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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bdcd166350c586b5c00a0f258f76f13a47a5b5db | 17,540,646,490,752 | bd3b0425de931235d3f5570453db5f15d9cf1df9 | /app/src/main/java/com/woongjin/sendemailtest/WebConnect/InterfaceAsyncResponseMap.java | cc7e2b2fd1a8e7e4c3770936235ad91136d50877 | [] | no_license | tarpboy/sendemailtest | https://github.com/tarpboy/sendemailtest | 8da09cd57c10fd09b609db1d4a0cb7e93553f69b | de71a5a05aa8acb5f9c8fbeb5e22d6b2969a2c97 | refs/heads/master | 2023-02-13T15:03:36.029000 | 2021-01-12T14:12:45 | 2021-01-12T14:12:45 | 290,968,232 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.woongjin.sendemailtest.WebConnect;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Jonathan on 2016. 8. 19..
*/
public interface InterfaceAsyncResponseMap {
public void processFinish(ArrayList<HashMap<String, String>> output);
}
| UTF-8 | Java | 274 | java | InterfaceAsyncResponseMap.java | Java | [
{
"context": "List;\nimport java.util.HashMap;\n\n/**\n * Created by Jonathan on 2016. 8. 19..\n */\npublic interface InterfaceAs",
"end": 129,
"score": 0.999415934085846,
"start": 121,
"tag": "NAME",
"value": "Jonathan"
}
] | null | [] | package com.woongjin.sendemailtest.WebConnect;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Jonathan on 2016. 8. 19..
*/
public interface InterfaceAsyncResponseMap {
public void processFinish(ArrayList<HashMap<String, String>> output);
}
| 274 | 0.759124 | 0.733577 | 13 | 20.076923 | 23.262587 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 12 |
b2fd3059aad017d8ab6954ac262fc4f1a8d4d5c7 | 34,823,594,842,042 | 4cfda4f1b4d7703e1b460359012082c158103476 | /miliconvert/xsmt/trunk/plugins/org.miliconvert.xsmt.mpgt/src/mpia/schema/TypeDictionaryDicoCapaciteFeuxCategorie.java | 01ce8b2743ea7afde5da183a56139e86b712fcad | [] | no_license | opensourcejavadeveloper/military_xml_project_miliconvert | https://github.com/opensourcejavadeveloper/military_xml_project_miliconvert | e62dee54499fdb8abaa76a9d44ed97ace19dc887 | bb0276970c243ec3acc07fd4b255673d6d7dd080 | refs/heads/master | 2022-01-10T18:11:39.021000 | 2018-08-20T12:45:02 | 2018-08-20T12:45:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package mpia.schema;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
* @see mpia.schema.SchemaPackage#getTypeDictionaryDicoCapaciteFeuxCategorie()
* @model extendedMetaData="name='type_Dictionary_Dico_CapaciteFeuxCategorie'"
* @generated
*/
public enum TypeDictionaryDicoCapaciteFeuxCategorie implements Enumerator {
/**
* The '<em><b>AIRAIR</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AIRAIR_VALUE
* @generated
* @ordered
*/
AIRAIR(0, "AIRAIR", "AIRAIR"),
/**
* The '<em><b>AIRGRD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AIRGRD_VALUE
* @generated
* @ordered
*/
AIRGRD(1, "AIRGRD", "AIRGRD"),
/**
* The '<em><b>AIRSEA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AIRSEA_VALUE
* @generated
* @ordered
*/
AIRSEA(2, "AIRSEA", "AIRSEA"),
/**
* The '<em><b>GRDAIR</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #GRDAIR_VALUE
* @generated
* @ordered
*/
GRDAIR(3, "GRDAIR", "GRDAIR"),
/**
* The '<em><b>GRDGRD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #GRDGRD_VALUE
* @generated
* @ordered
*/
GRDGRD(4, "GRDGRD", "GRDGRD"),
/**
* The '<em><b>GRDSEA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #GRDSEA_VALUE
* @generated
* @ordered
*/
GRDSEA(5, "GRDSEA", "GRDSEA"),
/**
* The '<em><b>SEAAIR</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEAAIR_VALUE
* @generated
* @ordered
*/
SEAAIR(6, "SEAAIR", "SEAAIR"),
/**
* The '<em><b>SEAGRD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEAGRD_VALUE
* @generated
* @ordered
*/
SEAGRD(7, "SEAGRD", "SEAGRD"),
/**
* The '<em><b>SEASEA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEASEA_VALUE
* @generated
* @ordered
*/
SEASEA(8, "SEASEA", "SEASEA");
/**
* The '<em><b>AIRAIR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>AIRAIR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #AIRAIR
* @model
* @generated
* @ordered
*/
public static final int AIRAIR_VALUE = 0;
/**
* The '<em><b>AIRGRD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>AIRGRD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #AIRGRD
* @model
* @generated
* @ordered
*/
public static final int AIRGRD_VALUE = 1;
/**
* The '<em><b>AIRSEA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>AIRSEA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #AIRSEA
* @model
* @generated
* @ordered
*/
public static final int AIRSEA_VALUE = 2;
/**
* The '<em><b>GRDAIR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>GRDAIR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #GRDAIR
* @model
* @generated
* @ordered
*/
public static final int GRDAIR_VALUE = 3;
/**
* The '<em><b>GRDGRD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>GRDGRD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #GRDGRD
* @model
* @generated
* @ordered
*/
public static final int GRDGRD_VALUE = 4;
/**
* The '<em><b>GRDSEA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>GRDSEA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #GRDSEA
* @model
* @generated
* @ordered
*/
public static final int GRDSEA_VALUE = 5;
/**
* The '<em><b>SEAAIR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SEAAIR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SEAAIR
* @model
* @generated
* @ordered
*/
public static final int SEAAIR_VALUE = 6;
/**
* The '<em><b>SEAGRD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SEAGRD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SEAGRD
* @model
* @generated
* @ordered
*/
public static final int SEAGRD_VALUE = 7;
/**
* The '<em><b>SEASEA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SEASEA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SEASEA
* @model
* @generated
* @ordered
*/
public static final int SEASEA_VALUE = 8;
/**
* An array of all the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final TypeDictionaryDicoCapaciteFeuxCategorie[] VALUES_ARRAY =
new TypeDictionaryDicoCapaciteFeuxCategorie[] {
AIRAIR,
AIRGRD,
AIRSEA,
GRDAIR,
GRDGRD,
GRDSEA,
SEAAIR,
SEAGRD,
SEASEA,
};
/**
* A public read-only list of all the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<TypeDictionaryDicoCapaciteFeuxCategorie> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
* Returns the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoCapaciteFeuxCategorie get(String literal) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
TypeDictionaryDicoCapaciteFeuxCategorie result = VALUES_ARRAY[i];
if (result.toString().equals(literal)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoCapaciteFeuxCategorie getByName(String name) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
TypeDictionaryDicoCapaciteFeuxCategorie result = VALUES_ARRAY[i];
if (result.getName().equals(name)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoCapaciteFeuxCategorie get(int value) {
switch (value) {
case AIRAIR_VALUE: return AIRAIR;
case AIRGRD_VALUE: return AIRGRD;
case AIRSEA_VALUE: return AIRSEA;
case GRDAIR_VALUE: return GRDAIR;
case GRDGRD_VALUE: return GRDGRD;
case GRDSEA_VALUE: return GRDSEA;
case SEAAIR_VALUE: return SEAAIR;
case SEAGRD_VALUE: return SEAGRD;
case SEASEA_VALUE: return SEASEA;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final int value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String name;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String literal;
/**
* Only this class can construct instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private TypeDictionaryDicoCapaciteFeuxCategorie(int value, String name, String literal) {
this.value = value;
this.name = name;
this.literal = literal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLiteral() {
return literal;
}
/**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return literal;
}
} //TypeDictionaryDicoCapaciteFeuxCategorie
| UTF-8 | Java | 9,313 | java | TypeDictionaryDicoCapaciteFeuxCategorie.java | Java | [] | null | [] | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package mpia.schema;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
* @see mpia.schema.SchemaPackage#getTypeDictionaryDicoCapaciteFeuxCategorie()
* @model extendedMetaData="name='type_Dictionary_Dico_CapaciteFeuxCategorie'"
* @generated
*/
public enum TypeDictionaryDicoCapaciteFeuxCategorie implements Enumerator {
/**
* The '<em><b>AIRAIR</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AIRAIR_VALUE
* @generated
* @ordered
*/
AIRAIR(0, "AIRAIR", "AIRAIR"),
/**
* The '<em><b>AIRGRD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AIRGRD_VALUE
* @generated
* @ordered
*/
AIRGRD(1, "AIRGRD", "AIRGRD"),
/**
* The '<em><b>AIRSEA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AIRSEA_VALUE
* @generated
* @ordered
*/
AIRSEA(2, "AIRSEA", "AIRSEA"),
/**
* The '<em><b>GRDAIR</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #GRDAIR_VALUE
* @generated
* @ordered
*/
GRDAIR(3, "GRDAIR", "GRDAIR"),
/**
* The '<em><b>GRDGRD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #GRDGRD_VALUE
* @generated
* @ordered
*/
GRDGRD(4, "GRDGRD", "GRDGRD"),
/**
* The '<em><b>GRDSEA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #GRDSEA_VALUE
* @generated
* @ordered
*/
GRDSEA(5, "GRDSEA", "GRDSEA"),
/**
* The '<em><b>SEAAIR</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEAAIR_VALUE
* @generated
* @ordered
*/
SEAAIR(6, "SEAAIR", "SEAAIR"),
/**
* The '<em><b>SEAGRD</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEAGRD_VALUE
* @generated
* @ordered
*/
SEAGRD(7, "SEAGRD", "SEAGRD"),
/**
* The '<em><b>SEASEA</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEASEA_VALUE
* @generated
* @ordered
*/
SEASEA(8, "SEASEA", "SEASEA");
/**
* The '<em><b>AIRAIR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>AIRAIR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #AIRAIR
* @model
* @generated
* @ordered
*/
public static final int AIRAIR_VALUE = 0;
/**
* The '<em><b>AIRGRD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>AIRGRD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #AIRGRD
* @model
* @generated
* @ordered
*/
public static final int AIRGRD_VALUE = 1;
/**
* The '<em><b>AIRSEA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>AIRSEA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #AIRSEA
* @model
* @generated
* @ordered
*/
public static final int AIRSEA_VALUE = 2;
/**
* The '<em><b>GRDAIR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>GRDAIR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #GRDAIR
* @model
* @generated
* @ordered
*/
public static final int GRDAIR_VALUE = 3;
/**
* The '<em><b>GRDGRD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>GRDGRD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #GRDGRD
* @model
* @generated
* @ordered
*/
public static final int GRDGRD_VALUE = 4;
/**
* The '<em><b>GRDSEA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>GRDSEA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #GRDSEA
* @model
* @generated
* @ordered
*/
public static final int GRDSEA_VALUE = 5;
/**
* The '<em><b>SEAAIR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SEAAIR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SEAAIR
* @model
* @generated
* @ordered
*/
public static final int SEAAIR_VALUE = 6;
/**
* The '<em><b>SEAGRD</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SEAGRD</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SEAGRD
* @model
* @generated
* @ordered
*/
public static final int SEAGRD_VALUE = 7;
/**
* The '<em><b>SEASEA</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SEASEA</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SEASEA
* @model
* @generated
* @ordered
*/
public static final int SEASEA_VALUE = 8;
/**
* An array of all the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final TypeDictionaryDicoCapaciteFeuxCategorie[] VALUES_ARRAY =
new TypeDictionaryDicoCapaciteFeuxCategorie[] {
AIRAIR,
AIRGRD,
AIRSEA,
GRDAIR,
GRDGRD,
GRDSEA,
SEAAIR,
SEAGRD,
SEASEA,
};
/**
* A public read-only list of all the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<TypeDictionaryDicoCapaciteFeuxCategorie> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
* Returns the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoCapaciteFeuxCategorie get(String literal) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
TypeDictionaryDicoCapaciteFeuxCategorie result = VALUES_ARRAY[i];
if (result.toString().equals(literal)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoCapaciteFeuxCategorie getByName(String name) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
TypeDictionaryDicoCapaciteFeuxCategorie result = VALUES_ARRAY[i];
if (result.getName().equals(name)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Type Dictionary Dico Capacite Feux Categorie</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static TypeDictionaryDicoCapaciteFeuxCategorie get(int value) {
switch (value) {
case AIRAIR_VALUE: return AIRAIR;
case AIRGRD_VALUE: return AIRGRD;
case AIRSEA_VALUE: return AIRSEA;
case GRDAIR_VALUE: return GRDAIR;
case GRDGRD_VALUE: return GRDGRD;
case GRDSEA_VALUE: return GRDSEA;
case SEAAIR_VALUE: return SEAAIR;
case SEAGRD_VALUE: return SEAGRD;
case SEASEA_VALUE: return SEASEA;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final int value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String name;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String literal;
/**
* Only this class can construct instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private TypeDictionaryDicoCapaciteFeuxCategorie(int value, String name, String literal) {
this.value = value;
this.name = name;
this.literal = literal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLiteral() {
return literal;
}
/**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return literal;
}
} //TypeDictionaryDicoCapaciteFeuxCategorie
| 9,313 | 0.589821 | 0.587673 | 401 | 22.22444 | 22.916622 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.27182 | false | false | 12 |
0167ce9a6602c3ad6ccb93575b86074b497908aa | 1,314,260,046,445 | 79e48d3a42a93dc67e406278cfa55ba23b78b68c | /src/com/javahttprequest/vpnadapter/bean/VpnUserResult.java | 7eea0101efa1c65daca35c35cac92ea4fcdbf438 | [] | no_license | iosdouble/ThinkingofJava | https://github.com/iosdouble/ThinkingofJava | 71e58e006a4559a6fcbfa00adbca089142d84833 | 30d7d9ca8e427d578c78c119fdc53551bb723dd3 | refs/heads/master | 2020-05-15T14:59:40.777000 | 2019-08-10T06:29:56 | 2019-08-10T06:29:56 | 182,354,784 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.javahttprequest.vpnadapter.bean;
/**
* @Classname VPNUserResult
* @Description TODO
* @Date 2019/8/9 3:32 PM
* @Created by nihui
*/
public class VpnUserResult {
private String website_name;
private String group_name;
private String account;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getWebsite_name() {
return website_name;
}
public void setWebsite_name(String website_name) {
this.website_name = website_name;
}
public String getGroup_name() {
return group_name;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
}
| UTF-8 | Java | 767 | java | VpnUserResult.java | Java | [
{
"context": "tion TODO\n * @Date 2019/8/9 3:32 PM\n * @Created by nihui\n */\npublic class VpnUserResult {\n\n private Str",
"end": 145,
"score": 0.9971969127655029,
"start": 140,
"tag": "USERNAME",
"value": "nihui"
}
] | null | [] | package com.javahttprequest.vpnadapter.bean;
/**
* @Classname VPNUserResult
* @Description TODO
* @Date 2019/8/9 3:32 PM
* @Created by nihui
*/
public class VpnUserResult {
private String website_name;
private String group_name;
private String account;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getWebsite_name() {
return website_name;
}
public void setWebsite_name(String website_name) {
this.website_name = website_name;
}
public String getGroup_name() {
return group_name;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
}
| 767 | 0.637549 | 0.625815 | 39 | 18.666666 | 16.852806 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25641 | false | false | 12 |
e86d5fd0d43e6051227433733be085bebb45ee5c | 36,429,912,623,062 | b0d07df10f5286d026f429787b5231d91f841f23 | /modules/api/src/main/java/org/sapia/corus/interop/api/InteropLink.java | a64190aac70213c4044524964750341b5f8d1d53 | [
"Apache-2.0"
] | permissive | sapia-oss/corus_iop | https://github.com/sapia-oss/corus_iop | 3f735c3175d65da43874c8a8ab58c3fa283d18b3 | ef7e23b4f050cf3011537e79ffe6b59af3af1324 | refs/heads/master | 2021-01-20T06:57:23.277000 | 2016-02-06T18:51:26 | 2016-02-06T18:51:26 | 26,384,473 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* IopLink.java
*
* Created on October 26, 2005, 9:54 AM
*/
package org.sapia.corus.interop.api;
/**
*
* @author yduchesne
*/
public class InteropLink {
private static Implementation _impl;
/** Creates a new instance of IopLink */
public InteropLink() {
}
/**
* Sets this instance's implementation, if it hasn't been already set.
*
* @param impl an <code>Implementation</code>.
*/
public static void setImpl(Implementation impl){
if(_impl == null)
_impl = impl;
}
/**
* @return this instance's <code>Implementation</code>.
*/
public static Implementation getImpl(){
return _impl == null ? new NullImplementation() : _impl;
}
}
| UTF-8 | Java | 705 | java | InteropLink.java | Java | [
{
"context": "ge org.sapia.corus.interop.api;\n\n/**\n *\n * @author yduchesne\n */\npublic class InteropLink {\n \n private stati",
"end": 132,
"score": 0.999427318572998,
"start": 123,
"tag": "USERNAME",
"value": "yduchesne"
}
] | null | [] | /*
* IopLink.java
*
* Created on October 26, 2005, 9:54 AM
*/
package org.sapia.corus.interop.api;
/**
*
* @author yduchesne
*/
public class InteropLink {
private static Implementation _impl;
/** Creates a new instance of IopLink */
public InteropLink() {
}
/**
* Sets this instance's implementation, if it hasn't been already set.
*
* @param impl an <code>Implementation</code>.
*/
public static void setImpl(Implementation impl){
if(_impl == null)
_impl = impl;
}
/**
* @return this instance's <code>Implementation</code>.
*/
public static Implementation getImpl(){
return _impl == null ? new NullImplementation() : _impl;
}
}
| 705 | 0.624114 | 0.611347 | 38 | 17.552631 | 20.337543 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.184211 | false | false | 12 |
b50274a22ecb90ec3152e6770020d9300f9db2f0 | 26,087,631,407,018 | 7c0b6d214654735a629d3bed771800631f013c53 | /app/src/main/java/com/example/jokesapp/view/FavJokeViewHolder.java | 90cbe227d2c7eaae3d1821e2fa20c53fcfae90ef | [] | no_license | Siddhi-singhh/JokesApp | https://github.com/Siddhi-singhh/JokesApp | 104ee8a042fd7b2280148054e6a8b544b4dd26df | bfdf384ffe4a4d51309ec6ef7d6e918fabdc57a2 | refs/heads/master | 2023-07-16T23:08:58.700000 | 2021-09-04T09:35:15 | 2021-09-04T09:35:15 | 403,016,886 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.jokesapp.view;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.jokesapp.R;
public class FavJokeViewHolder extends RecyclerView.ViewHolder {
private TextView txtFavJoke;
private ImageButton imgShareButttom;
public FavJokeViewHolder(@NonNull View itemView) {
super(itemView);
txtFavJoke=itemView.findViewById(R.id.txtFavJoke);
imgShareButttom=itemView.findViewById(R.id.shareButtonFavListItem);
}
public TextView getTxtFavJoke() {
return txtFavJoke;
}
public ImageButton getImgShareButttom() {
return imgShareButttom;
}
}
| UTF-8 | Java | 769 | java | FavJokeViewHolder.java | Java | [] | null | [] | package com.example.jokesapp.view;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.jokesapp.R;
public class FavJokeViewHolder extends RecyclerView.ViewHolder {
private TextView txtFavJoke;
private ImageButton imgShareButttom;
public FavJokeViewHolder(@NonNull View itemView) {
super(itemView);
txtFavJoke=itemView.findViewById(R.id.txtFavJoke);
imgShareButttom=itemView.findViewById(R.id.shareButtonFavListItem);
}
public TextView getTxtFavJoke() {
return txtFavJoke;
}
public ImageButton getImgShareButttom() {
return imgShareButttom;
}
}
| 769 | 0.752926 | 0.752926 | 29 | 25.517241 | 21.853148 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482759 | false | false | 12 |
2b56f34ada1dee8bf4dace5134880171021e12e6 | 30,889,404,826,998 | 71094a240ed488a82ddcd4f856fe091bb915bf63 | /app/src/main/java/cn/sghen/android/sghenmorge/test/datastructure/LinkList2Test.java | baf5c634a9486c72373c5ca4e7fd44a4abe04cca | [] | no_license | luoguibin/SghenMorge | https://github.com/luoguibin/SghenMorge | bd8349e6137bb6d29041130bcbfc229c26bd0a6d | e73cc6f287f389dbb7fde937889563cf1c4e0e22 | refs/heads/master | 2018-04-02T04:44:41.873000 | 2018-03-24T13:51:52 | 2018-03-24T13:51:52 | 88,493,019 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.sghen.android.sghenmorge.test.datastructure;
/**
* Created by luoguibin on 3/6/18.
*/
public class LinkList2Test {
Node head, tail;
class NodeData {
int id;
int age;
String name;
public NodeData(int id, int age, String name) {
this.id = id;
this.age = age;
this.name = name;
}
@Override
public String toString() {
return "NodeData{" +
"id=" + id +
", age=" + age +
", name='" + name + '\'' +
'}';
}
}
class Node {
Node pre;
Node next;
NodeData nodeData;
public Node() {
this.pre = null;
this.next = null;
}
}
public void addNode() {
Node newNode = new Node();
int length = length();
newNode.nodeData = new NodeData(length + 1, length + 1, "name" + (length + 1));
if (head == null) {
head = tail = newNode;
return;
}
Node tailNode = tail;
tailNode.next = newNode;
tail = newNode;
tail.pre = tailNode;
}
/**
* 删除双向链表的第index个节点
* @param index
* @return boolean
*/
public boolean deleteNode(int index) {
int length = length();
if (index < 1 || index > length){
// throw new IllegalArgumentException("deleteNode(): param index is invalid");
return false;
}
if (index == 1) {
head = head.next;
head.pre = null;
return true;
}else if (index == length) {
tail = tail.pre;
tail.next = null;
}
int i = 1;
boolean isPreHalf = index < length / 2; // 通过判断前后段位置,从而进行不同方向遍历链表
if (isPreHalf) {
Node preNode = head;
Node curNode = head;
while (curNode != null) {
if (index == i) {
preNode.next = curNode.next;
if (curNode.next != null)
curNode.next.pre = preNode;
return true;
}
i++;
preNode = curNode;
curNode = curNode.next;
}
} else {
index = length - index;
Node preNode = tail;
Node curNode = tail;
while (curNode != null) {
if (index == i) {
preNode.pre = curNode.pre;
if (curNode.pre != null)
curNode.pre.next = preNode;
return true;
}
i++;
preNode = curNode;
curNode = curNode.pre;
}
}
return false;
}
public Node searchNode(int index) {
int length = length();
if (index < 1 || index > length){
// throw new IllegalArgumentException("deleteNode(): param index is invalid");
return null;
}
int i = 0;
boolean isPreHalf = index < length / 2; // 通过判断前后段位置,从而进行不同方向遍历链表
if (isPreHalf) {
Node curNode = head;
while (curNode != null) {
i++;
if (index == i) {
return curNode;
}
curNode = curNode.next;
}
} else {
index = length - index + 1;
Node curNode = tail;
while (curNode != null) {
i++;
if (index == i) {
return curNode;
}
curNode = curNode.pre;
}
}
return null;
}
public Node searchMiddle() {
Node curNode = head;
Node curNode2 = tail;
while (curNode != null && curNode != curNode2 && curNode.next != curNode2) {
curNode = curNode.next;
curNode2 = curNode2.pre;
}
return curNode;
}
public int length() {
Node curNode = head;
int count = 0;
while (curNode != null) {
count++;
curNode = curNode.next;
}
return count;
}
public void print(boolean inversion) {
Node curNode = inversion ? tail : head;
while (curNode != null) {
System.out.println(curNode.nodeData.toString());
curNode = inversion? curNode.pre : curNode.next;
}
System.out.println();
}
public static void main(String[] args) {
LinkList2Test linkList2Test = new LinkList2Test();
for (int i = 0; i < 9; i++) {
linkList2Test.addNode();
}
linkList2Test.deleteNode(0);
System.out.println(linkList2Test.deleteNode(2));
linkList2Test.print(false);
linkList2Test.print(true);
System.out.println(linkList2Test.searchNode(7).nodeData.toString());
System.out.println(linkList2Test.searchMiddle().nodeData.toString());
}
}
| UTF-8 | Java | 5,190 | java | LinkList2Test.java | Java | [
{
"context": ".sghenmorge.test.datastructure;\n\n/**\n * Created by luoguibin on 3/6/18.\n */\n\npublic class LinkList2Test {\n\n ",
"end": 84,
"score": 0.9995738863945007,
"start": 75,
"tag": "USERNAME",
"value": "luoguibin"
}
] | null | [] | package cn.sghen.android.sghenmorge.test.datastructure;
/**
* Created by luoguibin on 3/6/18.
*/
public class LinkList2Test {
Node head, tail;
class NodeData {
int id;
int age;
String name;
public NodeData(int id, int age, String name) {
this.id = id;
this.age = age;
this.name = name;
}
@Override
public String toString() {
return "NodeData{" +
"id=" + id +
", age=" + age +
", name='" + name + '\'' +
'}';
}
}
class Node {
Node pre;
Node next;
NodeData nodeData;
public Node() {
this.pre = null;
this.next = null;
}
}
public void addNode() {
Node newNode = new Node();
int length = length();
newNode.nodeData = new NodeData(length + 1, length + 1, "name" + (length + 1));
if (head == null) {
head = tail = newNode;
return;
}
Node tailNode = tail;
tailNode.next = newNode;
tail = newNode;
tail.pre = tailNode;
}
/**
* 删除双向链表的第index个节点
* @param index
* @return boolean
*/
public boolean deleteNode(int index) {
int length = length();
if (index < 1 || index > length){
// throw new IllegalArgumentException("deleteNode(): param index is invalid");
return false;
}
if (index == 1) {
head = head.next;
head.pre = null;
return true;
}else if (index == length) {
tail = tail.pre;
tail.next = null;
}
int i = 1;
boolean isPreHalf = index < length / 2; // 通过判断前后段位置,从而进行不同方向遍历链表
if (isPreHalf) {
Node preNode = head;
Node curNode = head;
while (curNode != null) {
if (index == i) {
preNode.next = curNode.next;
if (curNode.next != null)
curNode.next.pre = preNode;
return true;
}
i++;
preNode = curNode;
curNode = curNode.next;
}
} else {
index = length - index;
Node preNode = tail;
Node curNode = tail;
while (curNode != null) {
if (index == i) {
preNode.pre = curNode.pre;
if (curNode.pre != null)
curNode.pre.next = preNode;
return true;
}
i++;
preNode = curNode;
curNode = curNode.pre;
}
}
return false;
}
public Node searchNode(int index) {
int length = length();
if (index < 1 || index > length){
// throw new IllegalArgumentException("deleteNode(): param index is invalid");
return null;
}
int i = 0;
boolean isPreHalf = index < length / 2; // 通过判断前后段位置,从而进行不同方向遍历链表
if (isPreHalf) {
Node curNode = head;
while (curNode != null) {
i++;
if (index == i) {
return curNode;
}
curNode = curNode.next;
}
} else {
index = length - index + 1;
Node curNode = tail;
while (curNode != null) {
i++;
if (index == i) {
return curNode;
}
curNode = curNode.pre;
}
}
return null;
}
public Node searchMiddle() {
Node curNode = head;
Node curNode2 = tail;
while (curNode != null && curNode != curNode2 && curNode.next != curNode2) {
curNode = curNode.next;
curNode2 = curNode2.pre;
}
return curNode;
}
public int length() {
Node curNode = head;
int count = 0;
while (curNode != null) {
count++;
curNode = curNode.next;
}
return count;
}
public void print(boolean inversion) {
Node curNode = inversion ? tail : head;
while (curNode != null) {
System.out.println(curNode.nodeData.toString());
curNode = inversion? curNode.pre : curNode.next;
}
System.out.println();
}
public static void main(String[] args) {
LinkList2Test linkList2Test = new LinkList2Test();
for (int i = 0; i < 9; i++) {
linkList2Test.addNode();
}
linkList2Test.deleteNode(0);
System.out.println(linkList2Test.deleteNode(2));
linkList2Test.print(false);
linkList2Test.print(true);
System.out.println(linkList2Test.searchNode(7).nodeData.toString());
System.out.println(linkList2Test.searchMiddle().nodeData.toString());
}
}
| 5,190 | 0.4524 | 0.445122 | 187 | 26.187166 | 18.710924 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.550802 | false | false | 12 |
c9d3717f1f55c2a9448276a8ecf72d24e02d32da | 19,971,597,982,034 | 3dd260795020cc452cbffa694db408da74459f0f | /app/src/main/java/com/aspsine/irecyclerview/demo/model/Image.java | 06bc5fa27657b94bb69fccc3f3474c102e350d48 | [
"Apache-2.0"
] | permissive | hehonghui/IRecyclerView | https://github.com/hehonghui/IRecyclerView | ecf19c14bd95b7477988d16293fc0324d2ae086a | b2cd67f156f83e2c0c4f2c906bde3ea5d12e812a | refs/heads/master | 2021-01-22T22:35:49.790000 | 2017-03-20T10:06:37 | 2017-03-20T10:06:37 | 85,561,243 | 2 | 0 | null | true | 2017-03-20T10:00:43 | 2017-03-20T10:00:43 | 2017-03-19T17:28:50 | 2016-09-04T11:28:09 | 31,664 | 0 | 0 | 0 | null | null | null | package com.aspsine.irecyclerview.demo.model;
/**
* Created by aspsine on 16/4/5.
*/
public class Image {
public String image;
public String title;
public Image(String image, String title) {
this.image = image;
this.title = title;
}
@Override
public String toString() {
return "Image{" +
"image='" + image + '\'' +
", title='" + title + '\'' +
'}';
}
}
| UTF-8 | Java | 458 | java | Image.java | Java | [
{
"context": "psine.irecyclerview.demo.model;\n\n/**\n * Created by aspsine on 16/4/5.\n */\npublic class Image {\n public St",
"end": 72,
"score": 0.999671995639801,
"start": 65,
"tag": "USERNAME",
"value": "aspsine"
}
] | null | [] | package com.aspsine.irecyclerview.demo.model;
/**
* Created by aspsine on 16/4/5.
*/
public class Image {
public String image;
public String title;
public Image(String image, String title) {
this.image = image;
this.title = title;
}
@Override
public String toString() {
return "Image{" +
"image='" + image + '\'' +
", title='" + title + '\'' +
'}';
}
}
| 458 | 0.504367 | 0.495633 | 22 | 19.818182 | 15.663033 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 12 |
86c7ab10ffadfad77bcf87fabe07529809f5fea1 | 8,615,704,450,273 | 6458b6cdab45589454d47d9afa33be66efab7433 | /netty-http-client/src/test/java/org/xbib/netty/http/client/test/pool/PoolTest.java | 86377421b6634b117dbb366be548ad1c8ee4872c | [
"Apache-2.0"
] | permissive | jprante/netty-http | https://github.com/jprante/netty-http | 43ffa068ec42c61578397987c1df1d0ddc52499f | ae1240822f522ce10c70692a44f5077e46b32a5a | refs/heads/main | 2023-08-14T18:41:35.120000 | 2023-03-11T08:06:26 | 2023-03-11T08:06:26 | 89,969,764 | 10 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.xbib.netty.http.client.test.pool;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.util.AttributeKey;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.xbib.netty.http.common.HttpAddress;
import org.xbib.netty.http.client.pool.BoundedChannelPool;
import org.xbib.netty.http.client.api.Pool;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class PoolTest {
private static final Logger logger = Logger.getLogger(PoolTest.class.getName());
private static final long TEST_STEP_TIME_SECONDS = 60L;
private static final int BATCH_SIZE = 100;
@ParameterizedTest
@ValueSource(ints = {1,10,25})
void testPool(int concurrencyLevel) throws InterruptedException {
ConcurrentMap<HttpAddress, LongAdder> nodeFreq = new ConcurrentHashMap<>();
int nodecount = 2;
ServerBootstrap serverBootstrap = new ServerBootstrap()
.group(new NioEventLoopGroup())
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<>() {
@Override
protected void initChannel(Channel ch) {
}
});
Channel serverChannel = serverBootstrap.bind("localhost", 8008).sync().channel();
List<HttpAddress> nodes = new ArrayList<>();
for (int i = 0; i < nodecount; i ++) {
nodes.add(HttpAddress.http1("localhost", 8008));
}
try (Pool<Channel> pool = new BoundedChannelPool<>(new Semaphore(concurrencyLevel), HttpVersion.HTTP_1_1,
nodes, new Bootstrap().group(new NioEventLoopGroup()).channel(NioSocketChannel.class),
null, 0, BoundedChannelPool.PoolKeySelectorType.ROUNDROBIN)) {
int n = Runtime.getRuntime().availableProcessors();
ExecutorService executorService = Executors.newFixedThreadPool(n);
for(int i = 0; i < n; i ++) {
executorService.submit(() -> {
Thread currThread = Thread.currentThread();
List<Channel> channels = new ArrayList<>(BATCH_SIZE);
int j;
int k;
Channel channel;
try {
while (!currThread.isInterrupted()) {
for (j = 0; j < BATCH_SIZE; j ++) {
channel = pool.acquire();
if (channel == null) {
break;
}
AttributeKey<HttpAddress> attributeKey = AttributeKey.valueOf("poolKey");
nodeFreq.computeIfAbsent(channel.attr(attributeKey).get(), node -> new LongAdder()).increment();
channels.add(channel);
}
for (k = 0; k < j; k ++) {
pool.release(channels.get(k), false);
}
channels.clear();
}
} catch (Exception ignored) {
//
}
});
}
executorService.shutdown();
try {
executorService.awaitTermination(TEST_STEP_TIME_SECONDS, TimeUnit.SECONDS);
} catch (InterruptedException e) {
logger.log(Level.WARNING, e.getMessage(), e);
}
executorService.shutdownNow();
} catch (Throwable t) {
logger.log(Level.WARNING, t.getMessage(), t);
} finally {
serverChannel.close();
long connCountSum = nodeFreq.values().stream().mapToLong(LongAdder::sum).sum();
logger.log(Level.INFO, "concurrency = " + concurrencyLevel + ", nodes = " + nodecount + " -> rate: " +
connCountSum / TEST_STEP_TIME_SECONDS);
long avgConnCountPerNode = connCountSum / 2;
for (HttpAddress nodeAddr: nodeFreq.keySet()) {
assertTrue(nodeFreq.get(nodeAddr).sum() > 0);
assertEquals(avgConnCountPerNode, nodeFreq.get(nodeAddr).sum(), 1.5 * avgConnCountPerNode);
}
}
}
}
| UTF-8 | Java | 5,145 | java | PoolTest.java | Java | [] | null | [] | package org.xbib.netty.http.client.test.pool;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.util.AttributeKey;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.xbib.netty.http.common.HttpAddress;
import org.xbib.netty.http.client.pool.BoundedChannelPool;
import org.xbib.netty.http.client.api.Pool;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
class PoolTest {
private static final Logger logger = Logger.getLogger(PoolTest.class.getName());
private static final long TEST_STEP_TIME_SECONDS = 60L;
private static final int BATCH_SIZE = 100;
@ParameterizedTest
@ValueSource(ints = {1,10,25})
void testPool(int concurrencyLevel) throws InterruptedException {
ConcurrentMap<HttpAddress, LongAdder> nodeFreq = new ConcurrentHashMap<>();
int nodecount = 2;
ServerBootstrap serverBootstrap = new ServerBootstrap()
.group(new NioEventLoopGroup())
.channel(NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<>() {
@Override
protected void initChannel(Channel ch) {
}
});
Channel serverChannel = serverBootstrap.bind("localhost", 8008).sync().channel();
List<HttpAddress> nodes = new ArrayList<>();
for (int i = 0; i < nodecount; i ++) {
nodes.add(HttpAddress.http1("localhost", 8008));
}
try (Pool<Channel> pool = new BoundedChannelPool<>(new Semaphore(concurrencyLevel), HttpVersion.HTTP_1_1,
nodes, new Bootstrap().group(new NioEventLoopGroup()).channel(NioSocketChannel.class),
null, 0, BoundedChannelPool.PoolKeySelectorType.ROUNDROBIN)) {
int n = Runtime.getRuntime().availableProcessors();
ExecutorService executorService = Executors.newFixedThreadPool(n);
for(int i = 0; i < n; i ++) {
executorService.submit(() -> {
Thread currThread = Thread.currentThread();
List<Channel> channels = new ArrayList<>(BATCH_SIZE);
int j;
int k;
Channel channel;
try {
while (!currThread.isInterrupted()) {
for (j = 0; j < BATCH_SIZE; j ++) {
channel = pool.acquire();
if (channel == null) {
break;
}
AttributeKey<HttpAddress> attributeKey = AttributeKey.valueOf("poolKey");
nodeFreq.computeIfAbsent(channel.attr(attributeKey).get(), node -> new LongAdder()).increment();
channels.add(channel);
}
for (k = 0; k < j; k ++) {
pool.release(channels.get(k), false);
}
channels.clear();
}
} catch (Exception ignored) {
//
}
});
}
executorService.shutdown();
try {
executorService.awaitTermination(TEST_STEP_TIME_SECONDS, TimeUnit.SECONDS);
} catch (InterruptedException e) {
logger.log(Level.WARNING, e.getMessage(), e);
}
executorService.shutdownNow();
} catch (Throwable t) {
logger.log(Level.WARNING, t.getMessage(), t);
} finally {
serverChannel.close();
long connCountSum = nodeFreq.values().stream().mapToLong(LongAdder::sum).sum();
logger.log(Level.INFO, "concurrency = " + concurrencyLevel + ", nodes = " + nodecount + " -> rate: " +
connCountSum / TEST_STEP_TIME_SECONDS);
long avgConnCountPerNode = connCountSum / 2;
for (HttpAddress nodeAddr: nodeFreq.keySet()) {
assertTrue(nodeFreq.get(nodeAddr).sum() > 0);
assertEquals(avgConnCountPerNode, nodeFreq.get(nodeAddr).sum(), 1.5 * avgConnCountPerNode);
}
}
}
}
| 5,145 | 0.586006 | 0.579981 | 115 | 43.739132 | 27.279579 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.808696 | false | false | 12 |
404b64e7a748ee5d86df99dc310deccd0dfc718c | 18,116,172,102,934 | b5e7b38a278bc4d98c544e92130ffcf077bd6a96 | /java/src/task6_heapsort/Program.java | f48ae4b745f2ff0b7079f85b1c44292c0fa7a5e9 | [] | no_license | vladimir-chagin/otus-algo | https://github.com/vladimir-chagin/otus-algo | abd0319d0f3142cf30b684515544d2dd242cb731 | 1a34e4bebd9ce6454c39b30bcc0aba38331aaf69 | refs/heads/master | 2020-09-04T17:11:21.515000 | 2020-01-23T21:51:06 | 2020-01-23T21:51:06 | 219,827,248 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package task6_heapsort;
import task5.impl.Sort;
import task6_heapsort.impl.HeapSort;
import util.Performance;
import util.U;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Program {
/*
* Напишите, какие пункты вы сделали, сколько на это ушло времени,
приложите ссылку на ваш код и на заполненную таблицу.
Как сравнивать производительность.
1. Выбрать подходящий размер массива, чтобы алгоритм работал 5-20 секунд.
2. Создать два массива выбранного размера:
а. случайный;
в. отсортированный, в котором перемешано 5% элементов.
3. Замерять время работы алгоритмов HeapSort и ShellSort для каждого массива, заполняя табличку. Таблицу приложить к коду.
4. Сделать вывод, какой алгоритм соритровки лучше.
Критерии оценки: +4 байта за реализацию алгоритма HeapSort
+4 байтов за создание и публикацию таблицы.
+2 байта за вывод, какой алгоритм сортировки лучше.
* */
private static final double[] shuffles = new double[] { 0, 0.05, 1 };
private static final int count = 50_000_000;
private static Integer[] createArray(int len, double mix) {
Integer[] array = new Integer[len];
U.fillArrayWithRandomIntegers(array);
U.shuffleArray(array, mix);
return array;
}
public static void main(String[] args) {
testSort();
// Integer[] array = createArray(10, 1);
// System.out.println(U.arrayToString(array));
// HeapSort.sort(array);
// System.out.println(U.arrayToString(array));
}
private static void testSort() {
StringBuilder report = new StringBuilder();
report.append("array size: " + count).append("\r\n\r\n");
report.append("Shuffle %|ShellSort|HeapSort").append("\r\n");
report.append("---|---|---").append("\r\n");
for (int i = 0; i < shuffles.length; i += 1) {
final Integer[] array = createArray(count, shuffles[i]);
final Integer[] arrayShell = new Integer[array.length];
System.arraycopy(array, 0, arrayShell, 0, array.length);
final Integer[] arrayHeap = new Integer[array.length];
System.arraycopy(array, 0, arrayHeap, 0, array.length);
final long durationShell = Performance.measure(() -> {
Sort.shell(arrayShell, Sort.Knuth);
});
final long durationHeap = Performance.measure(() -> {
HeapSort.sort(arrayHeap);
});
report.append(shuffles[i]).append("|");
report.append(durationShell + "ms").append("|");
report.append(durationHeap + "ms").append("\r\n");
}
final String output = report.toString();
System.out.println(output);
try {
Files.write(Paths.get("java", "src", "task6_heapsort", "report_generated.md"), output.getBytes());
} catch(Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 3,430 | java | Program.java | Java | [] | null | [] | package task6_heapsort;
import task5.impl.Sort;
import task6_heapsort.impl.HeapSort;
import util.Performance;
import util.U;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Program {
/*
* Напишите, какие пункты вы сделали, сколько на это ушло времени,
приложите ссылку на ваш код и на заполненную таблицу.
Как сравнивать производительность.
1. Выбрать подходящий размер массива, чтобы алгоритм работал 5-20 секунд.
2. Создать два массива выбранного размера:
а. случайный;
в. отсортированный, в котором перемешано 5% элементов.
3. Замерять время работы алгоритмов HeapSort и ShellSort для каждого массива, заполняя табличку. Таблицу приложить к коду.
4. Сделать вывод, какой алгоритм соритровки лучше.
Критерии оценки: +4 байта за реализацию алгоритма HeapSort
+4 байтов за создание и публикацию таблицы.
+2 байта за вывод, какой алгоритм сортировки лучше.
* */
private static final double[] shuffles = new double[] { 0, 0.05, 1 };
private static final int count = 50_000_000;
private static Integer[] createArray(int len, double mix) {
Integer[] array = new Integer[len];
U.fillArrayWithRandomIntegers(array);
U.shuffleArray(array, mix);
return array;
}
public static void main(String[] args) {
testSort();
// Integer[] array = createArray(10, 1);
// System.out.println(U.arrayToString(array));
// HeapSort.sort(array);
// System.out.println(U.arrayToString(array));
}
private static void testSort() {
StringBuilder report = new StringBuilder();
report.append("array size: " + count).append("\r\n\r\n");
report.append("Shuffle %|ShellSort|HeapSort").append("\r\n");
report.append("---|---|---").append("\r\n");
for (int i = 0; i < shuffles.length; i += 1) {
final Integer[] array = createArray(count, shuffles[i]);
final Integer[] arrayShell = new Integer[array.length];
System.arraycopy(array, 0, arrayShell, 0, array.length);
final Integer[] arrayHeap = new Integer[array.length];
System.arraycopy(array, 0, arrayHeap, 0, array.length);
final long durationShell = Performance.measure(() -> {
Sort.shell(arrayShell, Sort.Knuth);
});
final long durationHeap = Performance.measure(() -> {
HeapSort.sort(arrayHeap);
});
report.append(shuffles[i]).append("|");
report.append(durationShell + "ms").append("|");
report.append(durationHeap + "ms").append("\r\n");
}
final String output = report.toString();
System.out.println(output);
try {
Files.write(Paths.get("java", "src", "task6_heapsort", "report_generated.md"), output.getBytes());
} catch(Exception e) {
e.printStackTrace();
}
}
}
| 3,430 | 0.632569 | 0.619911 | 85 | 33.388237 | 27.683969 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.870588 | false | false | 12 |
3056921f2dde11fc983622cf7175e83a2a6e9314 | 25,907,242,777,722 | 8e36ba4103d0275f96cc18837285f67a876d2644 | /RetroFit/app/src/main/java/com/koolenwijkstra/siree/retrofit/RetroFitRepository.java | ac9f548397708beceb1c4e0093e27a9a7a458357 | [] | no_license | SireeKoolenWijkstra/MAD | https://github.com/SireeKoolenWijkstra/MAD | 5467e51ee5035c11a9f55dddc52e748fc5eb72d9 | a5e91ec8d5b500a7926c47898c2bdca7fc5ed79c | refs/heads/master | 2020-04-04T17:20:48.729000 | 2019-01-07T15:45:00 | 2019-01-07T15:45:00 | 156,117,169 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.koolenwijkstra.siree.retrofit;
import android.app.Application;
import android.arch.lifecycle.LiveData;
import android.os.AsyncTask;
public class RetroFitRepository {
private UserDao userDao;
private LiveData<User> mUser;
public RetroFitRepository(Application application) {
RetroFitRoomDatabase db = RetroFitRoomDatabase.getsInstance(application);
userDao = db.userDao();
mUser = userDao.getUser();
}
public LiveData<User> getUser() {
return mUser;
}
public void update(User user) {
new updateAsyncTask(userDao).execute(user);
}
private class updateAsyncTask extends AsyncTask<User, Void, Void> {
private UserDao mAsyncTaskDao;
public updateAsyncTask(UserDao dao) {
mAsyncTaskDao = dao;
}
@Override
protected Void doInBackground(final User... params) {
mAsyncTaskDao.updateUser(params[0]);
return null;
}
}
}
| UTF-8 | Java | 996 | java | RetroFitRepository.java | Java | [] | null | [] | package com.koolenwijkstra.siree.retrofit;
import android.app.Application;
import android.arch.lifecycle.LiveData;
import android.os.AsyncTask;
public class RetroFitRepository {
private UserDao userDao;
private LiveData<User> mUser;
public RetroFitRepository(Application application) {
RetroFitRoomDatabase db = RetroFitRoomDatabase.getsInstance(application);
userDao = db.userDao();
mUser = userDao.getUser();
}
public LiveData<User> getUser() {
return mUser;
}
public void update(User user) {
new updateAsyncTask(userDao).execute(user);
}
private class updateAsyncTask extends AsyncTask<User, Void, Void> {
private UserDao mAsyncTaskDao;
public updateAsyncTask(UserDao dao) {
mAsyncTaskDao = dao;
}
@Override
protected Void doInBackground(final User... params) {
mAsyncTaskDao.updateUser(params[0]);
return null;
}
}
}
| 996 | 0.659639 | 0.658635 | 40 | 23.875 | 21.982023 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425 | false | false | 12 |
b13af5c6f9b3c529b3534d6196fb8792261b654b | 16,587,163,699,310 | b99ab65ff6fd057a3c045c3eb7d8a357731ddccb | /MapExamples/src/main/java/MapExamples1.java | 7a10abbba730c4567f095557beefa1781d611594 | [] | no_license | ragonba3/my-promise-land | https://github.com/ragonba3/my-promise-land | cdd8069d5d41acc9d53be7c6b7a0131a15fb9ce1 | 79d1b371fdf87ce3829753d889454079463560a9 | refs/heads/main | 2023-07-19T17:58:41.857000 | 2021-08-15T08:33:33 | 2021-08-15T08:33:33 | 377,263,364 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.HashMap;
import java.util.Map;
/*
* 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.
*/
/**
*
* @author ragonba3
*/
public class MapExamples1 {
public static void main(String[] args) {
Map<String, Integer> populations = new HashMap<>();
populations.put("USA", 200000000);
populations.put("Canada", 34000000);
populations.put("United Kingdom", 63000000);
populations.put("Japan", 127000000);
System.out.println("Map size is: "+ populations.size());
Integer usaPopulation = populations.get("USA");
System.out.println(usaPopulation);
populations.put("USA", 313000000);
usaPopulation = populations.get("USA");
System.out.println(usaPopulation);
}
}
| UTF-8 | Java | 996 | java | MapExamples1.java | Java | [
{
"context": "the template in the editor.\n */\n\n/**\n *\n * @author ragonba3\n */\npublic class MapExamples1 {\n \n public st",
"end": 262,
"score": 0.9429967999458313,
"start": 254,
"tag": "USERNAME",
"value": "ragonba3"
}
] | null | [] |
import java.util.HashMap;
import java.util.Map;
/*
* 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.
*/
/**
*
* @author ragonba3
*/
public class MapExamples1 {
public static void main(String[] args) {
Map<String, Integer> populations = new HashMap<>();
populations.put("USA", 200000000);
populations.put("Canada", 34000000);
populations.put("United Kingdom", 63000000);
populations.put("Japan", 127000000);
System.out.println("Map size is: "+ populations.size());
Integer usaPopulation = populations.get("USA");
System.out.println(usaPopulation);
populations.put("USA", 313000000);
usaPopulation = populations.get("USA");
System.out.println(usaPopulation);
}
}
| 996 | 0.589357 | 0.544177 | 40 | 23.875 | 22.112427 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55 | false | false | 12 |
28e5b3ecd419c65bd013ec52433761264c43f3a7 | 32,719,060,914,029 | 297ea13785493e1d49098cc639d0c35f297f04f5 | /TSWP/src/com/mv2studio/tswp/ui/SettingsActivity.java | 1ddb9fee6f902291ffdac9032c28ad0ae5b50894 | [] | no_license | MatejVancik/tswp | https://github.com/MatejVancik/tswp | 648997566ee7e87dfc64e708c4b0462a06e2b1ba | d8ee9a67041074da18da06a2e967301a39228dc1 | refs/heads/master | 2021-01-01T19:35:01.838000 | 2014-05-05T06:40:32 | 2014-05-05T06:40:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mv2studio.tswp.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import com.mv2studio.mynsa.R;
import com.mv2studio.tswp.core.NotificationService;
import com.mv2studio.tswp.core.Prefs;
public class SettingsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager()
.beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
}
private class SettingsFragment extends PreferenceFragment implements OnSharedPreferenceChangeListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.student_prefs);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
System.out.println("something changed: "+key);
if(key.equals(Prefs.TIME_TAG)) {
String time = sharedPreferences.getString(key, "60");
try {
int timeInt = Integer.valueOf(time);
Prefs.storeIntValue(Prefs.TIME_TAG_INT, timeInt, getApplicationContext());
} catch(NumberFormatException e) {
Prefs.storeIntValue(Prefs.TIME_TAG_INT, 60, getApplicationContext());
}
System.out.println("chaingint gime");
Intent i = new Intent(getApplicationContext(), NotificationService.class);
startService(i);
} else if (key.equals(Prefs.VIB_TAG)) {
Prefs.storeBoolValue(key, sharedPreferences.getBoolean(key, true), getApplicationContext());
} else if (key.equals(Prefs.SOUND_TAG)) {
Prefs.storeBoolValue(Prefs.SOUND_TAG, sharedPreferences.getBoolean(key, true), getApplicationContext());
}
}
@Override
public void onResume() {
super.onResume();
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
}
}
| UTF-8 | Java | 2,268 | java | SettingsActivity.java | Java | [] | null | [] | package com.mv2studio.tswp.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import com.mv2studio.mynsa.R;
import com.mv2studio.tswp.core.NotificationService;
import com.mv2studio.tswp.core.Prefs;
public class SettingsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager()
.beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
}
private class SettingsFragment extends PreferenceFragment implements OnSharedPreferenceChangeListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.student_prefs);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
System.out.println("something changed: "+key);
if(key.equals(Prefs.TIME_TAG)) {
String time = sharedPreferences.getString(key, "60");
try {
int timeInt = Integer.valueOf(time);
Prefs.storeIntValue(Prefs.TIME_TAG_INT, timeInt, getApplicationContext());
} catch(NumberFormatException e) {
Prefs.storeIntValue(Prefs.TIME_TAG_INT, 60, getApplicationContext());
}
System.out.println("chaingint gime");
Intent i = new Intent(getApplicationContext(), NotificationService.class);
startService(i);
} else if (key.equals(Prefs.VIB_TAG)) {
Prefs.storeBoolValue(key, sharedPreferences.getBoolean(key, true), getApplicationContext());
} else if (key.equals(Prefs.SOUND_TAG)) {
Prefs.storeBoolValue(Prefs.SOUND_TAG, sharedPreferences.getBoolean(key, true), getApplicationContext());
}
}
@Override
public void onResume() {
super.onResume();
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onPause() {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
}
}
| 2,268 | 0.748236 | 0.744709 | 74 | 29.648649 | 30.190132 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.310811 | false | false | 12 |
e313b17b183a6915858981c20f3c5e80a865d55c | 33,595,234,249,994 | 3480d29662bd32655c5ec41de6a59bbaf02edc74 | /CollectionFramworkTest/src/CollectionsClassTest.java | 21a7ccf116692c631f5c4c5e765b2690cd9de91e | [] | no_license | HyerimRyu/workspace_teacher | https://github.com/HyerimRyu/workspace_teacher | 3e77243862b8004158aee3cfad7fa45106a0283d | 98d0bc96d483e60eae28f5e187e87ca834354080 | refs/heads/master | 2020-05-26T09:12:44.516000 | 2019-05-23T07:06:35 | 2019-05-23T07:06:35 | 188,179,834 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
import java.util.Collections;
import java.util.Queue;
import java.util.Stack;
public class CollectionsClassTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Collections클래스의 static메소드
//1) Collections.sort();
//2) Collections.shuffle();
//3) Coolections.binarySearch();
ArrayList<String> datas= new ArrayList<String>();
datas.add("asdfasd");
datas.add("Nice");
datas.add("World");
datas.add("Hello");
datas.add("hello");
datas.add("World");
System.out.println( datas.toString() );
Collections.sort(datas);
System.out.println( datas.toString() );
Collections.shuffle(datas);
System.out.println( datas.toString() );
//Stack과 Queue자료구조에서의 용어와 메소드명 소개
//1. Stack : push(요소추가), pop(요소 꺼내기) - FILO
//2. Queue : offer(요소추가), poll(요소 꺼내기) - FIFO
Stack<String> stack= null;
stack.push("aaa");
String s= stack.pop();
Queue<String> queue= null;
queue.offer("aaa");
String s2= queue.poll();
}
}
| UHC | Java | 1,131 | java | CollectionsClassTest.java | Java | [] | null | [] | import java.util.ArrayList;
import java.util.Collections;
import java.util.Queue;
import java.util.Stack;
public class CollectionsClassTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Collections클래스의 static메소드
//1) Collections.sort();
//2) Collections.shuffle();
//3) Coolections.binarySearch();
ArrayList<String> datas= new ArrayList<String>();
datas.add("asdfasd");
datas.add("Nice");
datas.add("World");
datas.add("Hello");
datas.add("hello");
datas.add("World");
System.out.println( datas.toString() );
Collections.sort(datas);
System.out.println( datas.toString() );
Collections.shuffle(datas);
System.out.println( datas.toString() );
//Stack과 Queue자료구조에서의 용어와 메소드명 소개
//1. Stack : push(요소추가), pop(요소 꺼내기) - FILO
//2. Queue : offer(요소추가), poll(요소 꺼내기) - FIFO
Stack<String> stack= null;
stack.push("aaa");
String s= stack.pop();
Queue<String> queue= null;
queue.offer("aaa");
String s2= queue.poll();
}
}
| 1,131 | 0.651385 | 0.645654 | 48 | 20.645834 | 15.203466 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.229167 | false | false | 12 |
025dd96ea55c193451e1952c4b7cdb3f605237cb | 3,126,736,238,763 | c08746e5c27f1ca0a80244a936e31f1bc96b6378 | /src/main/java/com/github/amusingimpala75/lotr/mixin/SignTypeRegisterInvoker.java | 1c00764f2204d2241c2db3a94b744cca36151d5a | [
"MIT"
] | permissive | amusingimpala75/lordoftherings | https://github.com/amusingimpala75/lordoftherings | e5c07ff5a4dd7a0ee12c3e652f268f25465a818a | 65d798fca956aac8fdc8dad3bee9e17005245a12 | refs/heads/master | 2023-02-14T02:17:48.430000 | 2021-01-13T00:16:55 | 2021-01-13T00:16:55 | 297,843,072 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.github.amusingimpala75.lotr.mixin;
import net.minecraft.util.SignType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
/*
attempt to fix non vanilla signs
TODO: actually work
*/
@Mixin(SignType.class)
public interface SignTypeRegisterInvoker {
@Invoker
static SignType invokeRegister(SignType type) {
throw new AssertionError();
}
}
| UTF-8 | Java | 409 | java | SignTypeRegisterInvoker.java | Java | [
{
"context": "package com.github.amusingimpala75.lotr.mixin;\n\nimport net.minecraft.util.SignType;\n",
"end": 34,
"score": 0.999275267124176,
"start": 19,
"tag": "USERNAME",
"value": "amusingimpala75"
}
] | null | [] | package com.github.amusingimpala75.lotr.mixin;
import net.minecraft.util.SignType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
/*
attempt to fix non vanilla signs
TODO: actually work
*/
@Mixin(SignType.class)
public interface SignTypeRegisterInvoker {
@Invoker
static SignType invokeRegister(SignType type) {
throw new AssertionError();
}
}
| 409 | 0.765281 | 0.760391 | 16 | 24.5625 | 18.062284 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 12 |
590109d9564f7fed6edd97a09a5657d6a4271577 | 1,125,281,485,028 | f70c42e8c86a4eb75060bce8b96f99d85ebb348a | /sci-model/src/main/java/br/com/ds/sci/entity/ValorIndice.java | 93baafa924ae10acce4e3df50285e3cca8669edb | [] | no_license | dlcarvalho/sci | https://github.com/dlcarvalho/sci | 46ae4f9fe15906df52105b4602bee27138c10e5f | 1e3b2a4f1b0565ed988586b30de6eea10a9d712b | refs/heads/master | 2018-12-28T02:08:31.349000 | 2014-02-06T01:38:57 | 2014-02-06T01:38:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.ds.sci.entity;
import java.io.Serializable;
import javax.persistence.*;
@Entity
@Table(name="valores_x_indice")
public class ValorIndice implements Serializable {
private static final long serialVersionUID = -3598984914245209172L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="valor_x_indice_id", unique=true, nullable=false)
private int id;
@Column(name="data_valor", length=45)
private String dataValor;
private double valor;
@ManyToOne
@JoinColumn(name="indice_id")
private Indice indice;
public int getid() {
return this.id;
}
public void setid(int id) {
this.id = id;
}
public String getDataValor() {
return this.dataValor;
}
public void setDataValor(String dataValor) {
this.dataValor = dataValor;
}
public double getValor() {
return this.valor;
}
public void setValor(double valor) {
this.valor = valor;
}
public Indice getIndice() {
return this.indice;
}
public void setIndice(Indice indice) {
this.indice = indice;
}
} | UTF-8 | Java | 1,023 | java | ValorIndice.java | Java | [] | null | [] | package br.com.ds.sci.entity;
import java.io.Serializable;
import javax.persistence.*;
@Entity
@Table(name="valores_x_indice")
public class ValorIndice implements Serializable {
private static final long serialVersionUID = -3598984914245209172L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="valor_x_indice_id", unique=true, nullable=false)
private int id;
@Column(name="data_valor", length=45)
private String dataValor;
private double valor;
@ManyToOne
@JoinColumn(name="indice_id")
private Indice indice;
public int getid() {
return this.id;
}
public void setid(int id) {
this.id = id;
}
public String getDataValor() {
return this.dataValor;
}
public void setDataValor(String dataValor) {
this.dataValor = dataValor;
}
public double getValor() {
return this.valor;
}
public void setValor(double valor) {
this.valor = valor;
}
public Indice getIndice() {
return this.indice;
}
public void setIndice(Indice indice) {
this.indice = indice;
}
} | 1,023 | 0.719453 | 0.698925 | 58 | 16.655172 | 17.308113 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.068966 | false | false | 12 |
5ac3671e71405e597d98766b432aebb99c6deacc | 13,365,938,234,834 | 0346f55b06ee24580b82e0a6780d0acb8fc20fb0 | /android/app/src/main/java/org/tensorflow/lite/examples/detection/Requests.java | 594a2904063438a0b0b6f655800c956172573112 | [] | no_license | abdullah-jaffer/ReecycleIt-Mobile-App | https://github.com/abdullah-jaffer/ReecycleIt-Mobile-App | 45d512972c854bd3708e150edbcbca2743fa0178 | 3cc9c0737d7944c067c59cff14c0eaf0b97a1743 | refs/heads/master | 2022-12-01T00:14:33.577000 | 2020-08-10T20:21:37 | 2020-08-10T20:21:37 | 265,153,628 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.tensorflow.lite.examples.detection;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class Requests extends AppCompatActivity implements AlertConfirmationAdapter.OnItemClickListener{
private FloatingActionButton floatingButton;
private RecyclerView alertList;
private RecycleItApi recycleItApi;
SharedPreferences sharedpreferences;
private ProgressBar loadProgress;
ArrayList<AlertConfirmation> list;
private View.OnClickListener buttonOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), DetectorActivity.class));
overridePendingTransition(0,0);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_requests);
floatingButton = findViewById(R.id.floatingActionButton);
floatingButton.setOnClickListener(buttonOnClickListener);
recycleItApi = RecycleItApi.retrofit.create(RecycleItApi.class);
alertList = findViewById(R.id.alertlist);
alertList.setLayoutManager(new LinearLayoutManager(this));
sharedpreferences = getSharedPreferences("MyPref", Context.MODE_PRIVATE);
loadProgress = findViewById(R.id.progressBar);
list = new ArrayList<>();
getAlertConfirmations();
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
bottomNavigationView.setSelectedItemId(R.id.navigation_requests);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch(menuItem.getItemId()){
case R.id.navigation_cam:
startActivity(new Intent(getApplicationContext(), Profile.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_goal:
startActivity(new Intent(getApplicationContext(), Goals.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_stats:
startActivity(new Intent(getApplicationContext(), Stats.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_history:
startActivity(new Intent(getApplicationContext(), History.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_requests:
startActivity(new Intent(getApplicationContext(), Requests.class));
overridePendingTransition(0,0);
return true;
}
return false;
}
});
}
public void getAlertConfirmations(){
Call<ArrayList<AlertConfirmation>> call = recycleItApi.getAlertConfirmations(sharedpreferences.getString("email",""));
call.enqueue(new Callback<ArrayList<AlertConfirmation>>() {
@Override
public void onResponse(Call<ArrayList<AlertConfirmation>> call, Response<ArrayList<AlertConfirmation>> response) {
loadProgress.setVisibility(View.GONE);
list = response.body();
if(list == null){
list = new ArrayList<>();
}
alertList.setAdapter(new AlertConfirmationAdapter(list, Requests.this));
}
@Override
public void onFailure(Call<ArrayList<AlertConfirmation>> call, Throwable t) {
Toast.makeText(getApplicationContext(), "Failed to load",Toast.LENGTH_LONG).show();
}
});
}
public void sendResponse(int id, String response){
Call<ResponseBody> call = recycleItApi.response(id, response);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Toast.makeText(getApplicationContext(), "Response sent",Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Toast.makeText(getApplicationContext(), "Failed to load",Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onItemClick(int position) {
LayoutInflater inflater = LayoutInflater.from(Requests.this);
View view1 = inflater.inflate(R.layout.query_dialog, null);
TextView explanation = view1.findViewById(R.id.textView3);
explanation.setText("An organization claimed to handle the following alert issued by you on "+list.get(position).getDate()+" which included the following");
TextView item1 = view1.findViewById(R.id.textview_name);
TextView item2 = view1.findViewById(R.id.textview_name1);
TextView item3 = view1.findViewById(R.id.textview_name2);
TextView[] textviews = new TextView[3];
textviews[0] = item1;
textviews[1] = item2;
textviews[2] = item3;
String[] items = list.get(position).getItemList().split(",");
HashMap<String, Integer> map = count(items);
int size = Math.min(3, map.size());
Iterator hmIterator = map.entrySet().iterator();
int i = 0;
while (i < size) {
Map.Entry mapElement = (Map.Entry)hmIterator.next();
int count = ((int)mapElement.getValue());
textviews[i].setText(count + " " + mapElement.getKey());
i++;
}
if(i < 3){
textviews[i].setVisibility(View.INVISIBLE);
i++;
}
if(i < 3){
textviews[i].setVisibility(View.INVISIBLE);
i++;
}
Button okButton = view1.findViewById(R.id.button5);
Button noButton = view1.findViewById(R.id.button6);
Button unsureButton = view1.findViewById(R.id.button7);
AlertDialog alertDialog = new AlertDialog.Builder(Requests.this)
.setView(view1)
.create();
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendResponse(list.get(position).getId(), "H");
alertDialog.dismiss();
}
});
noButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendResponse(list.get(position).getId(), "UH");
alertDialog.dismiss();
}
});
unsureButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendResponse(list.get(position).getId(), "IN");
alertDialog.dismiss();
}
});
alertDialog.show();
}
public HashMap<String, Integer> count(String[] items){
HashMap<String, Integer> map = new HashMap<>();
for(int i = 0; i < items.length; i++){
String key = items[i].split("\\(")[1].substring(0,items[i].split("\\(")[1].length()-1);
if(map.containsKey(key)){
map.put(key, map.get(key) + 1);
}else{
map.put(key, 1);
}
}
return map;
}
}
| UTF-8 | Java | 8,660 | java | Requests.java | Java | [] | null | [] | package org.tensorflow.lite.examples.detection;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class Requests extends AppCompatActivity implements AlertConfirmationAdapter.OnItemClickListener{
private FloatingActionButton floatingButton;
private RecyclerView alertList;
private RecycleItApi recycleItApi;
SharedPreferences sharedpreferences;
private ProgressBar loadProgress;
ArrayList<AlertConfirmation> list;
private View.OnClickListener buttonOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(), DetectorActivity.class));
overridePendingTransition(0,0);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_requests);
floatingButton = findViewById(R.id.floatingActionButton);
floatingButton.setOnClickListener(buttonOnClickListener);
recycleItApi = RecycleItApi.retrofit.create(RecycleItApi.class);
alertList = findViewById(R.id.alertlist);
alertList.setLayoutManager(new LinearLayoutManager(this));
sharedpreferences = getSharedPreferences("MyPref", Context.MODE_PRIVATE);
loadProgress = findViewById(R.id.progressBar);
list = new ArrayList<>();
getAlertConfirmations();
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
bottomNavigationView.setSelectedItemId(R.id.navigation_requests);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch(menuItem.getItemId()){
case R.id.navigation_cam:
startActivity(new Intent(getApplicationContext(), Profile.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_goal:
startActivity(new Intent(getApplicationContext(), Goals.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_stats:
startActivity(new Intent(getApplicationContext(), Stats.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_history:
startActivity(new Intent(getApplicationContext(), History.class));
overridePendingTransition(0,0);
return true;
case R.id.navigation_requests:
startActivity(new Intent(getApplicationContext(), Requests.class));
overridePendingTransition(0,0);
return true;
}
return false;
}
});
}
public void getAlertConfirmations(){
Call<ArrayList<AlertConfirmation>> call = recycleItApi.getAlertConfirmations(sharedpreferences.getString("email",""));
call.enqueue(new Callback<ArrayList<AlertConfirmation>>() {
@Override
public void onResponse(Call<ArrayList<AlertConfirmation>> call, Response<ArrayList<AlertConfirmation>> response) {
loadProgress.setVisibility(View.GONE);
list = response.body();
if(list == null){
list = new ArrayList<>();
}
alertList.setAdapter(new AlertConfirmationAdapter(list, Requests.this));
}
@Override
public void onFailure(Call<ArrayList<AlertConfirmation>> call, Throwable t) {
Toast.makeText(getApplicationContext(), "Failed to load",Toast.LENGTH_LONG).show();
}
});
}
public void sendResponse(int id, String response){
Call<ResponseBody> call = recycleItApi.response(id, response);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Toast.makeText(getApplicationContext(), "Response sent",Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Toast.makeText(getApplicationContext(), "Failed to load",Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onItemClick(int position) {
LayoutInflater inflater = LayoutInflater.from(Requests.this);
View view1 = inflater.inflate(R.layout.query_dialog, null);
TextView explanation = view1.findViewById(R.id.textView3);
explanation.setText("An organization claimed to handle the following alert issued by you on "+list.get(position).getDate()+" which included the following");
TextView item1 = view1.findViewById(R.id.textview_name);
TextView item2 = view1.findViewById(R.id.textview_name1);
TextView item3 = view1.findViewById(R.id.textview_name2);
TextView[] textviews = new TextView[3];
textviews[0] = item1;
textviews[1] = item2;
textviews[2] = item3;
String[] items = list.get(position).getItemList().split(",");
HashMap<String, Integer> map = count(items);
int size = Math.min(3, map.size());
Iterator hmIterator = map.entrySet().iterator();
int i = 0;
while (i < size) {
Map.Entry mapElement = (Map.Entry)hmIterator.next();
int count = ((int)mapElement.getValue());
textviews[i].setText(count + " " + mapElement.getKey());
i++;
}
if(i < 3){
textviews[i].setVisibility(View.INVISIBLE);
i++;
}
if(i < 3){
textviews[i].setVisibility(View.INVISIBLE);
i++;
}
Button okButton = view1.findViewById(R.id.button5);
Button noButton = view1.findViewById(R.id.button6);
Button unsureButton = view1.findViewById(R.id.button7);
AlertDialog alertDialog = new AlertDialog.Builder(Requests.this)
.setView(view1)
.create();
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendResponse(list.get(position).getId(), "H");
alertDialog.dismiss();
}
});
noButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendResponse(list.get(position).getId(), "UH");
alertDialog.dismiss();
}
});
unsureButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendResponse(list.get(position).getId(), "IN");
alertDialog.dismiss();
}
});
alertDialog.show();
}
public HashMap<String, Integer> count(String[] items){
HashMap<String, Integer> map = new HashMap<>();
for(int i = 0; i < items.length; i++){
String key = items[i].split("\\(")[1].substring(0,items[i].split("\\(")[1].length()-1);
if(map.containsKey(key)){
map.put(key, map.get(key) + 1);
}else{
map.put(key, 1);
}
}
return map;
}
}
| 8,660 | 0.621709 | 0.615704 | 222 | 38.00901 | 30.019361 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.72973 | false | false | 12 |
2368e17415151e131f1b8cbac9f61e5b438ca85c | 17,386,027,647,675 | c750b959188a87a8ac4a4340931442fa609b7f66 | /randomstuff.java | 856bfbc6ab51e1071e98d368cdb92206808fe667 | [] | no_license | NathanCKuo/java_learn | https://github.com/NathanCKuo/java_learn | ff42eeb06bdb5fe387b36386b40edb3301e61a96 | 56eaad9f0d6fdb9e7a90bc1aa843ec3eef3318f8 | refs/heads/master | 2021-09-04T09:15:32.338000 | 2018-01-17T16:31:30 | 2018-01-17T16:31:30 | 108,895,638 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class randomstuff {
public static void main(String args[]) {
System.out.println("Hi, this is your Java program speaking. Due to limited connectivity, we are unable to load the program...ALERT SYSTEM OVERHEAT SELF-DESTRUCT INITIATING IN 10,9,8,7,6,5,4,3,2,1.<BOOM>");
}
} | UTF-8 | Java | 279 | java | randomstuff.java | Java | [] | null | [] | class randomstuff {
public static void main(String args[]) {
System.out.println("Hi, this is your Java program speaking. Due to limited connectivity, we are unable to load the program...ALERT SYSTEM OVERHEAT SELF-DESTRUCT INITIATING IN 10,9,8,7,6,5,4,3,2,1.<BOOM>");
}
} | 279 | 0.724014 | 0.684588 | 6 | 45.666668 | 73.945175 | 208 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.666667 | false | false | 12 |
25df125eceb96c4ffaa420d224f5bed71aad1882 | 12,051,678,254,572 | f74f210982d0aca9c33e0336c37e8aa668e9f5bd | /src/Selenium/SelectorDemo.java | f06b8a51bf10458113f18ec5c7d4dc62d2619927 | [] | no_license | RajeshKumarMahto/SeleniumBasic | https://github.com/RajeshKumarMahto/SeleniumBasic | 59ba98176e7e84c55a3d251aa4e17a8ea4ac2466 | 6d786beed08b488c226987fb19f05dc795946415 | refs/heads/master | 2023-06-20T20:55:21.781000 | 2021-07-16T06:02:14 | 2021-07-16T06:02:14 | 386,389,453 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Selenium;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.text.DateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ntp.TimeStamp;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class SelectorDemo {
public static void main(String[] args) throws WebDriverException, IOException {
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"//Drivers//chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.manage().window().fullscreen();
driver.manage().deleteAllCookies();
//By Link Text
WebElement ele = driver.findElement(By.linkText("A/B Testing"));
System.out.println("---->"+ele.getText());
//Take Screenshot
// TakesScreenshot screenshot = (TakesScreenshot)driver;
// File srcFile = screenshot.getScreenshotAs(OutputType.FILE);
// File destFile = new File("G:\\Eclipse-workspace\\SeleniumBasic\\Screenshot"+ LocalDateTime.now());
// FileUtils.copyDirectory(srcFile, destFile);
ele.click();
System.out.println("---->"+driver.findElement(By.xpath("//p")).getText());
//Add/Remove Element
driver.navigate().back();
WebElement addAndRemoveElement = driver.findElement(By.xpath("//a[text()= 'Add/Remove Elements']"));
// addAndRemoveElement.click();
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click()", addAndRemoveElement);
String str = driver.findElement(By.xpath("//button[text()= 'Add Element']")).getText();
System.out.println("---->"+str);
driver.findElement(By.xpath("//button")).click();
boolean deleteBtn = driver.findElement(By.xpath("//button[@class='added-manually']")).isDisplayed();
if(deleteBtn) {
System.out.println("Delete button is added");
}
else {
System.out.println("Delete button is not added");
}
driver.quit();
}
}
| UTF-8 | Java | 2,470 | java | SelectorDemo.java | Java | [] | null | [] | package Selenium;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.text.DateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ntp.TimeStamp;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class SelectorDemo {
public static void main(String[] args) throws WebDriverException, IOException {
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"//Drivers//chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.manage().window().fullscreen();
driver.manage().deleteAllCookies();
//By Link Text
WebElement ele = driver.findElement(By.linkText("A/B Testing"));
System.out.println("---->"+ele.getText());
//Take Screenshot
// TakesScreenshot screenshot = (TakesScreenshot)driver;
// File srcFile = screenshot.getScreenshotAs(OutputType.FILE);
// File destFile = new File("G:\\Eclipse-workspace\\SeleniumBasic\\Screenshot"+ LocalDateTime.now());
// FileUtils.copyDirectory(srcFile, destFile);
ele.click();
System.out.println("---->"+driver.findElement(By.xpath("//p")).getText());
//Add/Remove Element
driver.navigate().back();
WebElement addAndRemoveElement = driver.findElement(By.xpath("//a[text()= 'Add/Remove Elements']"));
// addAndRemoveElement.click();
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click()", addAndRemoveElement);
String str = driver.findElement(By.xpath("//button[text()= 'Add Element']")).getText();
System.out.println("---->"+str);
driver.findElement(By.xpath("//button")).click();
boolean deleteBtn = driver.findElement(By.xpath("//button[@class='added-manually']")).isDisplayed();
if(deleteBtn) {
System.out.println("Delete button is added");
}
else {
System.out.println("Delete button is not added");
}
driver.quit();
}
}
| 2,470 | 0.744939 | 0.742915 | 66 | 36.424244 | 27.790918 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.954545 | false | false | 12 |
01b3d59f7083941991fc75e1f53e422a1462cfb4 | 300,647,730,848 | bbb7a4e071af78df52ff8ebca2b574d5a20922b8 | /code/spartacus_datafactory/src/main/java/spartacus_controlls/App.java | 0f2315985b1c46d38760e5591f9ff445bcfd6b9a | [] | no_license | sjctt/spartacus | https://github.com/sjctt/spartacus | 6b9ee53e91b04369e2fd042b5a0c43683e7e349d | de936212a52ab0270219efa10146a46ca8b65e0b | refs/heads/master | 2023-07-21T12:24:39.935000 | 2023-07-18T07:40:45 | 2023-07-18T07:40:45 | 291,909,708 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package spartacus_controlls;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import spartacus_public.entity.config.config;
import spartacus_public.entity.config.esconf;
import spartacus_public.entity.config.redisconf;
import spartacus_public.entity.config.sysconf;
import spartacus_public.method.spartacus_debug;
import spartacus_services.datafactory_service.datafactory_service;
@SpringBootApplication
@EnableConfigurationProperties({sysconf.class,redisconf.class,esconf.class})//加载系统配置文件
public class App
{
public static void main(String[] args)
{
config.content = SpringApplication.run(App.class, args);
spartacus_debug debug = new spartacus_debug();
debug.init();//初始化debug状态
datafactory_service service = new datafactory_service();
service.start();
}
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer()
{
return new EmbeddedServletContainerCustomizer()
{
@Override
public void customize(ConfigurableEmbeddedServletContainer container)
{
container.setPort(8004);//修改tomcat端口
}
};
}
}
| UTF-8 | Java | 1,524 | java | App.java | Java | [] | null | [] | package spartacus_controlls;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import spartacus_public.entity.config.config;
import spartacus_public.entity.config.esconf;
import spartacus_public.entity.config.redisconf;
import spartacus_public.entity.config.sysconf;
import spartacus_public.method.spartacus_debug;
import spartacus_services.datafactory_service.datafactory_service;
@SpringBootApplication
@EnableConfigurationProperties({sysconf.class,redisconf.class,esconf.class})//加载系统配置文件
public class App
{
public static void main(String[] args)
{
config.content = SpringApplication.run(App.class, args);
spartacus_debug debug = new spartacus_debug();
debug.init();//初始化debug状态
datafactory_service service = new datafactory_service();
service.start();
}
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer()
{
return new EmbeddedServletContainerCustomizer()
{
@Override
public void customize(ConfigurableEmbeddedServletContainer container)
{
container.setPort(8004);//修改tomcat端口
}
};
}
}
| 1,524 | 0.786577 | 0.783893 | 44 | 31.863636 | 28.535139 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.727273 | false | false | 12 |
6741c906d7a6d147ddb9ed19ccd3d58ee970ee03 | 28,939,489,671,606 | 9c28e363377a66722c0f3b3a8019f0dbf9b0154c | /src/main/java/ru/dz/traffic_rest_service/services/VisitService.java | 1e789b9b396e3c8d3b188cc4e2940c8ac9a6c09f | [] | no_license | Regiva/traffic-rest-service | https://github.com/Regiva/traffic-rest-service | 3205b123c914054c759332026cc4f8ebdbd86df5 | 79da65059d4f0a34d2d72cd0f0cd72f315228f94 | refs/heads/master | 2020-03-25T06:03:53.677000 | 2018-08-04T00:26:53 | 2018-08-04T00:26:53 | 143,481,246 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.dz.traffic_rest_service.services;
import ru.dz.traffic_rest_service.model.Response;
import ru.dz.traffic_rest_service.model.Visit;
import java.sql.Date;
public interface VisitService {
void createVisit(Visit visit);
Response countTodayVisits();
Response countTodayUniqueVisits();
Response countPeriodVisits(Date from, Date to);
Response countPeriodUniqueVisits(Date from, Date to);
Response countPeriodRegularUsers(Date from, Date to);
}
| UTF-8 | Java | 482 | java | VisitService.java | Java | [] | null | [] | package ru.dz.traffic_rest_service.services;
import ru.dz.traffic_rest_service.model.Response;
import ru.dz.traffic_rest_service.model.Visit;
import java.sql.Date;
public interface VisitService {
void createVisit(Visit visit);
Response countTodayVisits();
Response countTodayUniqueVisits();
Response countPeriodVisits(Date from, Date to);
Response countPeriodUniqueVisits(Date from, Date to);
Response countPeriodRegularUsers(Date from, Date to);
}
| 482 | 0.763485 | 0.763485 | 21 | 21.952381 | 22.316929 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.619048 | false | false | 12 |
ed471d81c7dcc206d5ede9f6d1103025396e846a | 24,180,665,914,199 | 98f3140eba0c5749ae8c6edf72175d2d1eed8eaf | /com/lcass/entity/Bullet.java | 39ce456eb3c98daf7cc135ff029a9c7de3ec1c9b | [] | no_license | lcass/SOLIS-src | https://github.com/lcass/SOLIS-src | ac75fc265ac46fed202d255a0bc43332b9365294 | a9e4857cd38d27e0c0aa491ca2a0278b12da5361 | refs/heads/master | 2020-05-17T14:41:04.448000 | 2015-08-14T11:03:55 | 2015-08-14T11:03:55 | 30,429,532 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lcass.entity;
import com.lcass.core.Core;
public class Bullet extends Projectile{
public Bullet(Core core){
super(core);
}
}
| UTF-8 | Java | 144 | java | Bullet.java | Java | [] | null | [] | package com.lcass.entity;
import com.lcass.core.Core;
public class Bullet extends Projectile{
public Bullet(Core core){
super(core);
}
}
| 144 | 0.736111 | 0.736111 | 10 | 13.4 | 13.987137 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false | 12 |
98f0276492e332f47568a23d7a91f65af1a3e156 | 22,952,305,266,962 | 0b79930040540b1197e5dcc4d99e77c907e3a5e8 | /src/main/java/br/com/thehero/domain/model/Files.java | 5039d98a4931b7fe6640f9d5a9a47566ab7641db | [
"Apache-2.0"
] | permissive | Danielgeb/thehero-backend | https://github.com/Danielgeb/thehero-backend | efc0920f2a036c4bb1fb144702497069142d4c04 | a64f1929b45fb80bbd843ef86a63b96f61d0fa42 | refs/heads/master | 2023-03-25T02:49:07.218000 | 2021-03-08T14:07:19 | 2021-03-08T14:07:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.thehero.domain.model;
import java.time.LocalDateTime;
import java.util.UUID;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Builder(builderMethodName = "newBuilder")
@Getter
@Setter
@Entity
@Table(name = "files")
public class Files {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private UUID uuid;
@Column(name = "created_at")
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
protected LocalDateTime createdAt;
@Column(name = "updated_at")
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
protected LocalDateTime updatedAt;
private String filename;
private byte[] data;
private String type;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
@JoinColumn(
name = "incidents_uuid",
referencedColumnName = "uuid",
foreignKey = @ForeignKey(name = "uuid"))
private Incidents incidents;
}
| UTF-8 | Java | 1,526 | java | Files.java | Java | [] | null | [] | package br.com.thehero.domain.model;
import java.time.LocalDateTime;
import java.util.UUID;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Builder(builderMethodName = "newBuilder")
@Getter
@Setter
@Entity
@Table(name = "files")
public class Files {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private UUID uuid;
@Column(name = "created_at")
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
protected LocalDateTime createdAt;
@Column(name = "updated_at")
@JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss")
protected LocalDateTime updatedAt;
private String filename;
private byte[] data;
private String type;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
@JoinColumn(
name = "incidents_uuid",
referencedColumnName = "uuid",
foreignKey = @ForeignKey(name = "uuid"))
private Incidents incidents;
}
| 1,526 | 0.777195 | 0.777195 | 57 | 25.771931 | 16.400703 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54386 | false | false | 12 |
e945b5ae658c08167764ec866e4a54c30a25e38e | 29,188,597,753,976 | 46a165ea953868088528043549ee9e9e8e27f479 | /src/main/java/jQuary/pages/HomePage.java | 08a3aecec8b969d5ea4ef45ac4713018b791439f | [] | no_license | dibashsaha1993/Selenium_Weekdays_December2019 | https://github.com/dibashsaha1993/Selenium_Weekdays_December2019 | 8ca289e16a3a5459ffe73335d51d2e856aa48fe5 | 6a5feeebba0a5ec606141dc045ddb85d81ec68b7 | refs/heads/master | 2022-06-21T21:49:50.847000 | 2020-03-03T04:50:09 | 2020-03-03T04:50:09 | 243,375,034 | 0 | 0 | null | false | 2022-06-21T02:52:24 | 2020-02-26T22:00:22 | 2020-03-03T04:50:22 | 2022-06-21T02:52:24 | 6,867 | 0 | 0 | 2 | Java | false | false | package jQuary.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class HomePage {
WebDriver driver;
public HomePage(WebDriver driver){
this.driver=driver;
PageFactory.initElements(driver, this);
}
@FindBy(linkText="jQuery UI")
WebElement logo;
@FindBy(xpath="//p[@class='intro']")
WebElement introText;
@FindBy(linkText="Demos")
WebElement demoLink;
@FindBy(linkText="Download")
WebElement downloadLink;
@FindBy(linkText="API Documentation")
WebElement apiLink;
@FindBy(linkText="Themes")
WebElement themeLink;
@FindBy(linkText="Development")
WebElement devLink;
@FindBy(xpath="(//a[text()='Support'])[2]")
WebElement supportLink;
@FindBy(linkText="Blog")
WebElement blogLink;
@FindBy(linkText="About")
WebElement aboutLink;
@FindBy(name="s")
WebElement searchTextBox;
@FindBy(xpath="//button[@type='submit']")
WebElement searchButton;
@FindBy(xpath="//h1")
WebElement searchText;
@FindBy(xpath="//img[@alt='Support the JS Foundation']")
WebElement supportProjectButton;
@FindBy(linkText="QUnit")
WebElement qunit;
@FindBy(linkText="Plugins")
WebElement pluginsLink;
public void clickPlugin(){
pluginsLink.click();
}
public String getIntroText(){
return introText.getText();
}
public String getSearchText(){
return searchText.getText();
}
public void typeSearchBox(String value){
searchTextBox.clear();
searchTextBox.sendKeys(value);
}
public void clickSuportProjectButton(){
supportProjectButton.click();
}
public void clickSearchButton(){
searchButton.click();
}
public void clickDemoLink(){
demoLink.click();
}
public void clickThemeLink(){
themeLink.click();
}
public void clickApiLink(){
apiLink.click();
}
public void clickDownloadLink(){
downloadLink.click();
}
public void clickDevLink(){
devLink.click();
}
public void clickSupportLink(){
supportLink.click();
}
public void clickBlogLink(){
blogLink.click();
}
public void clickAboutLink(){
aboutLink.click();
}
public void clickLogoLink(){
logo.click();
}
public void clickQUnitLink(){
qunit.click();
}
}
| UTF-8 | Java | 2,322 | java | HomePage.java | Java | [] | null | [] | package jQuary.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class HomePage {
WebDriver driver;
public HomePage(WebDriver driver){
this.driver=driver;
PageFactory.initElements(driver, this);
}
@FindBy(linkText="jQuery UI")
WebElement logo;
@FindBy(xpath="//p[@class='intro']")
WebElement introText;
@FindBy(linkText="Demos")
WebElement demoLink;
@FindBy(linkText="Download")
WebElement downloadLink;
@FindBy(linkText="API Documentation")
WebElement apiLink;
@FindBy(linkText="Themes")
WebElement themeLink;
@FindBy(linkText="Development")
WebElement devLink;
@FindBy(xpath="(//a[text()='Support'])[2]")
WebElement supportLink;
@FindBy(linkText="Blog")
WebElement blogLink;
@FindBy(linkText="About")
WebElement aboutLink;
@FindBy(name="s")
WebElement searchTextBox;
@FindBy(xpath="//button[@type='submit']")
WebElement searchButton;
@FindBy(xpath="//h1")
WebElement searchText;
@FindBy(xpath="//img[@alt='Support the JS Foundation']")
WebElement supportProjectButton;
@FindBy(linkText="QUnit")
WebElement qunit;
@FindBy(linkText="Plugins")
WebElement pluginsLink;
public void clickPlugin(){
pluginsLink.click();
}
public String getIntroText(){
return introText.getText();
}
public String getSearchText(){
return searchText.getText();
}
public void typeSearchBox(String value){
searchTextBox.clear();
searchTextBox.sendKeys(value);
}
public void clickSuportProjectButton(){
supportProjectButton.click();
}
public void clickSearchButton(){
searchButton.click();
}
public void clickDemoLink(){
demoLink.click();
}
public void clickThemeLink(){
themeLink.click();
}
public void clickApiLink(){
apiLink.click();
}
public void clickDownloadLink(){
downloadLink.click();
}
public void clickDevLink(){
devLink.click();
}
public void clickSupportLink(){
supportLink.click();
}
public void clickBlogLink(){
blogLink.click();
}
public void clickAboutLink(){
aboutLink.click();
}
public void clickLogoLink(){
logo.click();
}
public void clickQUnitLink(){
qunit.click();
}
}
| 2,322 | 0.696813 | 0.695952 | 134 | 16.328358 | 14.699364 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.201493 | false | false | 12 |
2b050a8e96f02e3494033845a9bf21e98b08131f | 29,386,166,265,027 | d19bb66aa81341fca790445d81d44c77a09843b2 | /com.suppresswarnings.osgi/c.s.c.common/src/main/java/com/suppresswarnings/corpus/common/SendMail.java | 2a7747920b4dd0595c0e5c2f809d4069d7317f3d | [] | no_license | outermanjiaming/suppresswarnings | https://github.com/outermanjiaming/suppresswarnings | 46e63673b7e742cd5360934be087a7c091c89977 | 252dae3dacab054c932f28793c06bf75641f26ca | refs/heads/master | 2022-05-30T01:09:53.492000 | 2020-09-11T10:31:41 | 2020-09-11T10:31:41 | 114,127,904 | 7 | 6 | null | false | 2022-05-20T20:51:05 | 2017-12-13T14:02:31 | 2020-09-11T10:32:04 | 2022-05-20T20:51:05 | 51,858 | 7 | 5 | 11 | Java | false | false | /**
*
* # # $
* # #
* # # #
*
* SuppressWarnings
*
*/
package com.suppresswarnings.corpus.common;
import java.io.File;
import java.util.Properties;
import java.util.Random;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import org.slf4j.LoggerFactory;
public class SendMail {
private static final String host = "smtp.163.com";
private static final String user = "outerman_mail";
private static final String pwd = System.getProperty("mail.passcode");
private static final String from = "outerman_mail@163.com";
private String to = null;
private static final byte[] identify = {111, 117, 116, 101, 114, 109, 97, 110, 106, 105, 97, 109, 105, 110, 103, 64, 49, 54, 51, 46, 99, 111, 109};
private static String smtp = "smtp";
private String subject = "SuppressWarnings";
private static org.slf4j.Logger logger = LoggerFactory.getLogger("SYSTEM");
public SendMail(){}
public SendMail(String sendTo) {
this.to = sendTo;
}
public void title(String subject, String content) {
logger.info("to send mail");
try {
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "true");
Session session = Session.getInstance(props);
session.setDebug(false);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
if(to != null) {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
}
message.addRecipient(Message.RecipientType.TO, new InternetAddress(new String(identify, "UTF-8")));
message.setSubject(subject);
message.setText(content);
Transport transport = session.getTransport(smtp);
transport.connect(host, user, pwd);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (Error e) {
logger.info("Exception: " + e.getMessage());
e.printStackTrace();
} catch (Exception e) {
logger.info("Exception: " + e.getMessage());
e.printStackTrace();
}
}
public void multipart(String content, String attachment) {
try {
if(to == null) return;
if(attachment == null) return;
File affix = new File(attachment);
if (!affix.exists()) return;
Properties props = new Properties();
Session session = Session.getDefaultInstance(props);
session.setDebug(false);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
Multipart multipart = new MimeMultipart();
BodyPart contentPart = new MimeBodyPart();
contentPart.setText(content);
multipart.addBodyPart(contentPart);
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(affix);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(MimeUtility.encodeText(affix.getName()));
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
message.saveChanges();
Transport transport = session.getTransport(smtp);
transport.connect(host, user, pwd);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SendMail cn = new SendMail();
Random rand = new Random();
for(int i : new int[]{1,2,3}) {
cn.title(cn.subject, "content:" + Long.toHexString(i + rand.nextLong()));
}
}
} | UTF-8 | Java | 3,918 | java | SendMail.java | Java | [
{
"context": "tp.163.com\";\n\tprivate static final String user = \"outerman_mail\";\n\tprivate static final String pwd = System.getPr",
"end": 827,
"score": 0.999656081199646,
"start": 814,
"tag": "USERNAME",
"value": "outerman_mail"
},
{
"context": ".passcode\");\n\tprivate static ... | null | [] | /**
*
* # # $
* # #
* # # #
*
* SuppressWarnings
*
*/
package com.suppresswarnings.corpus.common;
import java.io.File;
import java.util.Properties;
import java.util.Random;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import org.slf4j.LoggerFactory;
public class SendMail {
private static final String host = "smtp.163.com";
private static final String user = "outerman_mail";
private static final String pwd = System.getProperty("mail.passcode");
private static final String from = "<EMAIL>";
private String to = null;
private static final byte[] identify = {111, 117, 116, 101, 114, 109, 97, 110, 106, 105, 97, 109, 105, 110, 103, 64, 49, 54, 51, 46, 99, 111, 109};
private static String smtp = "smtp";
private String subject = "SuppressWarnings";
private static org.slf4j.Logger logger = LoggerFactory.getLogger("SYSTEM");
public SendMail(){}
public SendMail(String sendTo) {
this.to = sendTo;
}
public void title(String subject, String content) {
logger.info("to send mail");
try {
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "true");
Session session = Session.getInstance(props);
session.setDebug(false);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
if(to != null) {
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
}
message.addRecipient(Message.RecipientType.TO, new InternetAddress(new String(identify, "UTF-8")));
message.setSubject(subject);
message.setText(content);
Transport transport = session.getTransport(smtp);
transport.connect(host, user, pwd);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (Error e) {
logger.info("Exception: " + e.getMessage());
e.printStackTrace();
} catch (Exception e) {
logger.info("Exception: " + e.getMessage());
e.printStackTrace();
}
}
public void multipart(String content, String attachment) {
try {
if(to == null) return;
if(attachment == null) return;
File affix = new File(attachment);
if (!affix.exists()) return;
Properties props = new Properties();
Session session = Session.getDefaultInstance(props);
session.setDebug(false);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
Multipart multipart = new MimeMultipart();
BodyPart contentPart = new MimeBodyPart();
contentPart.setText(content);
multipart.addBodyPart(contentPart);
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(affix);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(MimeUtility.encodeText(affix.getName()));
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
message.saveChanges();
Transport transport = session.getTransport(smtp);
transport.connect(host, user, pwd);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
SendMail cn = new SendMail();
Random rand = new Random();
for(int i : new int[]{1,2,3}) {
cn.title(cn.subject, "content:" + Long.toHexString(i + rand.nextLong()));
}
}
} | 3,904 | 0.715416 | 0.696784 | 119 | 31.932774 | 23.518892 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.647059 | false | false | 12 |
f1c73f56345a11d23aefade2f8a85d195aeca03f | 6,519,760,384,652 | a858379b34eef51c6420227ed084e772e0b82f55 | /aucma/AucmaMdmParent/core/src/main/java/hmdm/core/masterdata/encode/service/IMasterDataEncodeSequenceService.java | 961a5ebd26dc0985b97e00703973b56e668dec3f | [] | no_license | lxtx793115/aucmaMdm | https://github.com/lxtx793115/aucmaMdm | 97fb55fdd49449faae8b8b3e16994ab815951b01 | 90e5e6d1d1aecf290b131731315e5072984e7f30 | refs/heads/master | 2017-12-04T19:03:11.968000 | 2017-03-28T09:33:11 | 2017-03-28T09:33:11 | 86,440,916 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hmdm.core.masterdata.encode.service;
import hmdm.core.masterdata.encode.dto.MasterDataEncodeSequence;
import com.hand.hap.core.ProxySelf;
import com.hand.hap.system.service.IBaseService;
/**
* Created by zyb on 2016/9/17.
*/
public interface IMasterDataEncodeSequenceService extends IBaseService<MasterDataEncodeSequence>, ProxySelf<IMasterDataCateEncodeService> {
}
| UTF-8 | Java | 380 | java | IMasterDataEncodeSequenceService.java | Java | [
{
"context": "ap.system.service.IBaseService;\n\n/**\n * Created by zyb on 2016/9/17.\n */\npublic interface IMasterDataEnc",
"end": 219,
"score": 0.9995095729827881,
"start": 216,
"tag": "USERNAME",
"value": "zyb"
}
] | null | [] | package hmdm.core.masterdata.encode.service;
import hmdm.core.masterdata.encode.dto.MasterDataEncodeSequence;
import com.hand.hap.core.ProxySelf;
import com.hand.hap.system.service.IBaseService;
/**
* Created by zyb on 2016/9/17.
*/
public interface IMasterDataEncodeSequenceService extends IBaseService<MasterDataEncodeSequence>, ProxySelf<IMasterDataCateEncodeService> {
}
| 380 | 0.823684 | 0.805263 | 12 | 30.666666 | 39.345337 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 12 |
fba1994bdf4dc956534a5bab915e15e9d3360d15 | 24,438,363,918,789 | f7fcb8479be9984b7ffcd7530c0df6096ec793f3 | /algorithms/src/stack/KthSmallestElementInASortedMatrix.java | 1f755d0e851851c7fb637fc2d0b5c7db9ec6f5cc | [] | no_license | zhaoyou/leetcode.com | https://github.com/zhaoyou/leetcode.com | a6ce2cee39da6578770b70ea7260a5f4716a4107 | ba8ca753d77cbf56b832973359c0b673c863d7d9 | refs/heads/master | 2022-11-28T11:05:12.345000 | 2022-11-23T02:41:24 | 2022-11-23T02:41:24 | 54,604,203 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package stack;
import org.junit.Test;
import java.util.Comparator;
import java.util.PriorityQueue;
/**
* reference:
* https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/discuss/85173/Share-my-thoughts-and-Clean-Java-Code
* http://www.cnblogs.com/grandyang/p/5727892.html#commentform
*/
public class KthSmallestElementInASortedMatrix {
@Test
public void test() {
int [][] matrix = {
{1, 5, 9},
{10,11,13},
{12,13,15}
};
// int [][] matrix = {
// {1,2},
// {1,3}
// };
int k = 8;
System.out.println(kthSmallest2(matrix, k));
}
public int kthSmallest(int[][] matrix, int k) {
PriorityQueue<Integer> queue = new PriorityQueue<>(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2 - o1;
}
});
int rows = matrix.length, cols = matrix[0].length;
for(int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
queue.offer(matrix[i][j]);
if (queue.size() > k) queue.poll();
}
}
return queue.peek();
}
public int kthSmallest2(int[][] matrix, int k) {
int rows = matrix.length, cols = matrix[0].length;
int left = matrix[0][0], right = matrix[rows-1][cols-1];
while(left < right) {
int mid = left + (right - left) / 2;
//System.out.println("left: " + left + " right: " + right + " mid: " + mid);
int count = findLessThanTarget(matrix, mid);
if (count < k) left = mid + 1;
else {
right = mid ;
}
}
return left;
}
/**
* 找到不大于某个target的个数
* @param matrix
* @param target
* @return
*/
public int findLessThanTarget(int[][] matrix, int target) {
int res = 0;
int rows = matrix.length, cols = matrix[0].length;
int i = rows - 1, j = 0;
while(i >= 0 && j < cols) {
if (matrix[i][j] <= target) {
res += i + 1;
j++;
} else {
i--;
}
}
return res;
}
}
| UTF-8 | Java | 2,340 | java | KthSmallestElementInASortedMatrix.java | Java | [
{
"context": "hts-and-Clean-Java-Code\n * http://www.cnblogs.com/grandyang/p/5727892.html#commentform\n */\npublic class KthSm",
"end": 280,
"score": 0.9996721744537354,
"start": 271,
"tag": "USERNAME",
"value": "grandyang"
}
] | null | [] | package stack;
import org.junit.Test;
import java.util.Comparator;
import java.util.PriorityQueue;
/**
* reference:
* https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix/discuss/85173/Share-my-thoughts-and-Clean-Java-Code
* http://www.cnblogs.com/grandyang/p/5727892.html#commentform
*/
public class KthSmallestElementInASortedMatrix {
@Test
public void test() {
int [][] matrix = {
{1, 5, 9},
{10,11,13},
{12,13,15}
};
// int [][] matrix = {
// {1,2},
// {1,3}
// };
int k = 8;
System.out.println(kthSmallest2(matrix, k));
}
public int kthSmallest(int[][] matrix, int k) {
PriorityQueue<Integer> queue = new PriorityQueue<>(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o2 - o1;
}
});
int rows = matrix.length, cols = matrix[0].length;
for(int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
queue.offer(matrix[i][j]);
if (queue.size() > k) queue.poll();
}
}
return queue.peek();
}
public int kthSmallest2(int[][] matrix, int k) {
int rows = matrix.length, cols = matrix[0].length;
int left = matrix[0][0], right = matrix[rows-1][cols-1];
while(left < right) {
int mid = left + (right - left) / 2;
//System.out.println("left: " + left + " right: " + right + " mid: " + mid);
int count = findLessThanTarget(matrix, mid);
if (count < k) left = mid + 1;
else {
right = mid ;
}
}
return left;
}
/**
* 找到不大于某个target的个数
* @param matrix
* @param target
* @return
*/
public int findLessThanTarget(int[][] matrix, int target) {
int res = 0;
int rows = matrix.length, cols = matrix[0].length;
int i = rows - 1, j = 0;
while(i >= 0 && j < cols) {
if (matrix[i][j] <= target) {
res += i + 1;
j++;
} else {
i--;
}
}
return res;
}
}
| 2,340 | 0.468103 | 0.444828 | 94 | 23.680851 | 23.307022 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585106 | false | false | 12 |
ebf643947e13ca882394360f9824eb72d56140d2 | 25,744,033,987,318 | 25c3fd6e093421f4493c6a3e602255783d01cdd2 | /src/ECS/System/RewardSystem.java | 7f0282f0e209e47cf4a9852d93db5f997cb7bc33 | [] | no_license | irmle/GOC_JavaServer | https://github.com/irmle/GOC_JavaServer | e5888ec06857141fe586336eeef397dfbfc085a7 | a4be6d4662a893a07b07d95ec563a64c533dff4b | refs/heads/master | 2023-09-05T11:52:17.442000 | 2021-11-25T17:34:51 | 2021-11-25T17:34:51 | 431,925,753 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ECS.System;
import ECS.Classes.Reward;
import ECS.Classes.StoreUpgradeInfoPerLevel;
import ECS.Classes.Type.RewardType;
import ECS.Classes.Type.Upgrade.StoreUpgradeType;
import ECS.Components.ConditionComponent;
import ECS.Components.RewardHistoryComponent;
import ECS.Entity.CharacterEntity;
import ECS.Game.GameDataManager;
import ECS.Game.Store;
import ECS.Game.WorldMap;
import java.util.HashMap;
import java.util.List;
/**
* 작 성 자 : 권령희
* 작성날짜 : 2019 12 16 월
* 업뎃날짜 : 2020 02 28 금
* 목 적 :
* 캐릭터에게 주어지는 각종 보상 처리를 한다. (추후 확장될지 모르겠지만, 우선은 보상받는 객체는 캐릭터 앤티티만으로. )
* 보상 처리는 여러가지가 있을 수 있다. 예)) 몹 사냥, 접속유지, 특정상태 유지 등등.. .
* 현재는 몹 사냥에 대한 보상만 존재.
* 각 캐릭터가 가지고 있는 보상 컴포넌트의 보상 리스트를 하나씩 읽으면서, 보상 타입에 맞는 처리를 수행한다.
* 현재 몹 사냥 보상의 경우, 골드 획득과 경험치 획득이 있음.
* 골드와 경험치는 캐릭터 앤티티의 캐릭터 컴포넌트가 가지고 있음. <<- 여기에 골드와 경험치를 조작하는 매서드를 만들 것.
* 보상 시스템이 종료된 후, 캐릭터의 경험치를 가지고 레벨 시스템이 돌게된다.
*
*/
public class RewardSystem {
WorldMap worldMap;
float coolTime;
float remainCoolTime;
HashMap<Integer, HashMap<Integer, StoreUpgradeInfoPerLevel>> storeUpgradeInfoList;
public RewardSystem(WorldMap worldMap, float coolTime) {
this.worldMap = worldMap;
storeUpgradeInfoList = GameDataManager.storeUpgradeInfoPerLevelList;
this.coolTime = coolTime;
this.remainCoolTime = this.coolTime;
}
public void onUpdate(float deltaTime){
// 시스템 도는 주기 조절용 코드
/*remainCoolTime -= worldMap.tickRate;
if(remainCoolTime <= 0){
remainCoolTime = coolTime;
}
else{
return;
}*/
/** 상점 업그레이드에 따른 보상 비율을 결정한다 */
/* 경험치 */
int expUpgradeLevel = Store.findUpgradeSlotByType(StoreUpgradeType.EXP_UPGRADE, worldMap).upgradeLevel;
StoreUpgradeInfoPerLevel expUpgradeInfo
= storeUpgradeInfoList.get(StoreUpgradeType.EXP_UPGRADE).get(expUpgradeLevel);
/* 골드 */
int goldUpgradeLevel = Store.findUpgradeSlotByType(StoreUpgradeType.GOLD_UPGRADE, worldMap).upgradeLevel;
StoreUpgradeInfoPerLevel goldUpgradeInfo
= storeUpgradeInfoList.get(StoreUpgradeType.GOLD_UPGRADE).get(goldUpgradeLevel);
/** 모든 캐릭터에 대해 반복 */
for (HashMap.Entry<Integer, CharacterEntity> characterEntity : worldMap.characterEntity.entrySet()) {
CharacterEntity character = characterEntity.getValue();
List<Reward> rewardList = character.rewardHistoryComponent.rewardHistory;
ConditionComponent charCondition = character.conditionComponent;
/* 경험치 보상 비율 결정 */
/**
* 아 고민되는게
* 이.. 상점 업그레이드로 인한 겸치량 증가 효과를
* 여기서 계산해서 적용해주는게 적절한지,
* 아니면 이번 턴의 캐릭터의 최종 상태를 결정하는 'BuffActionSystem'에서 적용해주는 게 좋은지..
* 최종상태 결정 시점에 들어가야 할 것도 같긴 한데, 문제는 버프시스템은 최종상태 결정 처리가 메인이라기보다는
* 현재 받고 있는 버프들을 캐릭의 상태에 반영해주는 게 목적인시스템이라..
* 한번에 두 가지 일을 맡기는 꼴이 될수도 있고.
* 또, 현재는 상점 업그레이드를 제외하고는, 캐릭터의 겸치/골드 획득 보상 비율에 영향을 미치는 요인이 전혀 없는 상태이지만,
* 만약 추가된다고 할 경우, 버프를 받아 추가된 '최종 직전 상태'에 대해, 상점업글 효과를 어떤 식으로 적용 해 줄 것이냐?? 가
* 최소한 나한테는 명확하지 않기 때문임. 나중에 바뀔 수도 있고.
* 최종 상태에 대해 곱연산 퍼센테이지로 적용할 수도 있고,
* '추가'되는 개념으로 적용될 수도 있고 그래서 말임
* 일단은, '최종 상태' 비율에 대해 상점 업그레이드 효과 퍼센테이지를 적용하는 걸로 생각하겠음.
* ㄴ 이 결과 구해진 '진짜 최종 비율'을, 현재 처리하려는 보상에 적용하는 식.
*
*/
//float expRate = 1 + (expUpgradeLevel * 0.1f);
float expRate = charCondition.expGainRate;
if(expUpgradeLevel >= 1){
expRate *= ( 1 + expUpgradeInfo.effectValue * 0.01f );
}
//System.out.println("경험치 보상 비율 : " + expRate + ", 경험치 업글 레벨 : " + expUpgradeLevel);
float goldRate = charCondition.goldGainRate;
if(goldUpgradeLevel >= 1){
goldRate *= ( 1 + goldUpgradeInfo.effectValue * 0.01f );
}
//System.out.println("골드 보상 비율 : " + goldRate + ", 골드 업글 레벨 : " + goldUpgradeLevel);
/** 현 캐릭터의 보상 목록을 처리한다 */
Reward currentReward = null;
// 중계를 위한.. 이번 틱 누적 보상
float expSum = 0f;
int goldSum = 0;
for (int i = 0; i < rewardList.size(); i++) {
currentReward = rewardList.get(i);
double finalRewardExp;
double finalRewardGold;
/* 보상 타입에 따라 처리한다 */
switch (currentReward.rewardType){
case RewardType.KILL_MONSTER :
// 몬스터를 죽이고 얻는 보상의 경우, 경험치와 골드를 둘 다 얻는다.
// 경험치
finalRewardExp = currentReward.rewardExp * expRate;
character.characterComponent.getExpReward((float)finalRewardExp); // 경험치
// 골드
finalRewardGold = currentReward.rewardGold * goldRate;
character.characterComponent.getGoldReward((int)finalRewardGold); // 골드
// 누적
expSum += (float)finalRewardExp;
goldSum += (int)finalRewardGold;
break;
case RewardType.KILL_MONSTER_BY_TURRET :
/**
* [ 오전 1:13 2020-04-04 권령희 ]
* 터렛에 의한 몹 KIll 보상을 처리하는 방식에 대해서는,
* 나중에 확실해지면 수정하거나 할 것.
* 보상 적용 비율을 파일로부터 읽어 처리하도록 하거나, 아니면 아예 주지 않거나.
* 현재는, 터렛을 건축한 캐릭터에게 그 보상을 주도록 하고 있음.
* ㄴ 아 또 이런경우에는.. 상점 보상 비율을 적용해야 하는가??
* 이게. 게임 월드 전체에 걸쳐 적용되는 개념으로 봐야할지,아니면 캐릭터에만 한정해야 할지..
*/
// 경험치
finalRewardExp = currentReward.rewardExp * expRate * 0.5f;
character.characterComponent.getExpReward((float)finalRewardExp); // 경험치
// 골드
finalRewardGold = currentReward.rewardGold * goldRate * 0.5f;
character.characterComponent.getGoldReward((int)finalRewardGold); // 골드
// 누적
expSum += (float)finalRewardExp;
goldSum += (int)finalRewardGold;
break;
case RewardType.KILL_MONSTER_JUNGLE_MONSTER :
// 경험치
finalRewardExp = currentReward.rewardExp * expRate;
character.characterComponent.getExpReward((float)finalRewardExp); // 경험치
// 골드
finalRewardGold = currentReward.rewardGold * goldRate;
character.characterComponent.getGoldReward((int)finalRewardGold); // 골드
// 누적
expSum += (float)finalRewardExp;
goldSum += (int)finalRewardGold;
/** 2020 02 28 */
//character.buffActionHistoryComponent.conditionHistory.add(currentReward.rewardBuff);
/** 2020 04 03 */
for (int j=0; j<currentReward.rewardBuff.size(); j++){
character.buffActionHistoryComponent.conditionHistory.add(
currentReward.rewardBuff.get(j));
}
break;
default:
break;
}
}
/** 2020 02 13 목 */
/* 스코어에 반영 */
worldMap.playerGameScoreList.get(character.entityID).earnedGold += goldSum;
/* 중계처리 (필요하다면. 혹은, 월드맵 메인 게임 루프에서 보상에 대한 중계도 하게끔 하던지 */
// 개인별로 보상내역을 중계할 경우 여기에 중계 코드를 작성..
/* 보상 목록을 초기화한다 */
rewardList.clear();
}
}
/*******************************************************************************************************************/
/**
* 2020 04 18 새벽 작성
* 필요 데이터를 GDM으로부터 클론하여 사용하게끔, 초반에 미리 복사해두는 처리
*/
/**
* 기 능 : 월드맵에서 필요로 하는 데이터를, GDM에서 복사해온다.
* 처 리 :
* WorldMap에서 필요로 하는 GDM 데이터는 다음과 같다
* -- 정글몹정보 목록
* -- 웨이브별 등장 몹 목록
*
*/
public void getNeedDataFromGDM(){
/* 초기화 처리 */
/* 정글몹 정보 목록을 복사한다 */
}
public void bringStoreUpgradeInfoListFromGDM(){
HashMap<Integer, HashMap<Integer, StoreUpgradeInfoPerLevel>> storeUpgradeInfoPerLevelList = new HashMap<>();
for( HashMap.Entry<Integer, HashMap<Integer, StoreUpgradeInfoPerLevel>> storeUpgradeInfo
: GameDataManager.storeUpgradeInfoPerLevelList.entrySet()){
int storeUpgradeKey = storeUpgradeInfo.getKey();
HashMap<Integer, StoreUpgradeInfoPerLevel> storeUpgradeValue = new HashMap<>();
for( HashMap.Entry<Integer, StoreUpgradeInfoPerLevel> upgradeInfoPerLevel : storeUpgradeInfo.getValue().entrySet()){
int upgradeKey = upgradeInfoPerLevel.getKey();
StoreUpgradeInfoPerLevel upgradeValue = upgradeInfoPerLevel.getValue();
storeUpgradeValue.put(upgradeKey, upgradeValue.clone());
}
storeUpgradeInfoPerLevelList.put(storeUpgradeKey, storeUpgradeValue);
}
}
}
| UTF-8 | Java | 11,831 | java | RewardSystem.java | Java | [] | null | [] | package ECS.System;
import ECS.Classes.Reward;
import ECS.Classes.StoreUpgradeInfoPerLevel;
import ECS.Classes.Type.RewardType;
import ECS.Classes.Type.Upgrade.StoreUpgradeType;
import ECS.Components.ConditionComponent;
import ECS.Components.RewardHistoryComponent;
import ECS.Entity.CharacterEntity;
import ECS.Game.GameDataManager;
import ECS.Game.Store;
import ECS.Game.WorldMap;
import java.util.HashMap;
import java.util.List;
/**
* 작 성 자 : 권령희
* 작성날짜 : 2019 12 16 월
* 업뎃날짜 : 2020 02 28 금
* 목 적 :
* 캐릭터에게 주어지는 각종 보상 처리를 한다. (추후 확장될지 모르겠지만, 우선은 보상받는 객체는 캐릭터 앤티티만으로. )
* 보상 처리는 여러가지가 있을 수 있다. 예)) 몹 사냥, 접속유지, 특정상태 유지 등등.. .
* 현재는 몹 사냥에 대한 보상만 존재.
* 각 캐릭터가 가지고 있는 보상 컴포넌트의 보상 리스트를 하나씩 읽으면서, 보상 타입에 맞는 처리를 수행한다.
* 현재 몹 사냥 보상의 경우, 골드 획득과 경험치 획득이 있음.
* 골드와 경험치는 캐릭터 앤티티의 캐릭터 컴포넌트가 가지고 있음. <<- 여기에 골드와 경험치를 조작하는 매서드를 만들 것.
* 보상 시스템이 종료된 후, 캐릭터의 경험치를 가지고 레벨 시스템이 돌게된다.
*
*/
public class RewardSystem {
WorldMap worldMap;
float coolTime;
float remainCoolTime;
HashMap<Integer, HashMap<Integer, StoreUpgradeInfoPerLevel>> storeUpgradeInfoList;
public RewardSystem(WorldMap worldMap, float coolTime) {
this.worldMap = worldMap;
storeUpgradeInfoList = GameDataManager.storeUpgradeInfoPerLevelList;
this.coolTime = coolTime;
this.remainCoolTime = this.coolTime;
}
public void onUpdate(float deltaTime){
// 시스템 도는 주기 조절용 코드
/*remainCoolTime -= worldMap.tickRate;
if(remainCoolTime <= 0){
remainCoolTime = coolTime;
}
else{
return;
}*/
/** 상점 업그레이드에 따른 보상 비율을 결정한다 */
/* 경험치 */
int expUpgradeLevel = Store.findUpgradeSlotByType(StoreUpgradeType.EXP_UPGRADE, worldMap).upgradeLevel;
StoreUpgradeInfoPerLevel expUpgradeInfo
= storeUpgradeInfoList.get(StoreUpgradeType.EXP_UPGRADE).get(expUpgradeLevel);
/* 골드 */
int goldUpgradeLevel = Store.findUpgradeSlotByType(StoreUpgradeType.GOLD_UPGRADE, worldMap).upgradeLevel;
StoreUpgradeInfoPerLevel goldUpgradeInfo
= storeUpgradeInfoList.get(StoreUpgradeType.GOLD_UPGRADE).get(goldUpgradeLevel);
/** 모든 캐릭터에 대해 반복 */
for (HashMap.Entry<Integer, CharacterEntity> characterEntity : worldMap.characterEntity.entrySet()) {
CharacterEntity character = characterEntity.getValue();
List<Reward> rewardList = character.rewardHistoryComponent.rewardHistory;
ConditionComponent charCondition = character.conditionComponent;
/* 경험치 보상 비율 결정 */
/**
* 아 고민되는게
* 이.. 상점 업그레이드로 인한 겸치량 증가 효과를
* 여기서 계산해서 적용해주는게 적절한지,
* 아니면 이번 턴의 캐릭터의 최종 상태를 결정하는 'BuffActionSystem'에서 적용해주는 게 좋은지..
* 최종상태 결정 시점에 들어가야 할 것도 같긴 한데, 문제는 버프시스템은 최종상태 결정 처리가 메인이라기보다는
* 현재 받고 있는 버프들을 캐릭의 상태에 반영해주는 게 목적인시스템이라..
* 한번에 두 가지 일을 맡기는 꼴이 될수도 있고.
* 또, 현재는 상점 업그레이드를 제외하고는, 캐릭터의 겸치/골드 획득 보상 비율에 영향을 미치는 요인이 전혀 없는 상태이지만,
* 만약 추가된다고 할 경우, 버프를 받아 추가된 '최종 직전 상태'에 대해, 상점업글 효과를 어떤 식으로 적용 해 줄 것이냐?? 가
* 최소한 나한테는 명확하지 않기 때문임. 나중에 바뀔 수도 있고.
* 최종 상태에 대해 곱연산 퍼센테이지로 적용할 수도 있고,
* '추가'되는 개념으로 적용될 수도 있고 그래서 말임
* 일단은, '최종 상태' 비율에 대해 상점 업그레이드 효과 퍼센테이지를 적용하는 걸로 생각하겠음.
* ㄴ 이 결과 구해진 '진짜 최종 비율'을, 현재 처리하려는 보상에 적용하는 식.
*
*/
//float expRate = 1 + (expUpgradeLevel * 0.1f);
float expRate = charCondition.expGainRate;
if(expUpgradeLevel >= 1){
expRate *= ( 1 + expUpgradeInfo.effectValue * 0.01f );
}
//System.out.println("경험치 보상 비율 : " + expRate + ", 경험치 업글 레벨 : " + expUpgradeLevel);
float goldRate = charCondition.goldGainRate;
if(goldUpgradeLevel >= 1){
goldRate *= ( 1 + goldUpgradeInfo.effectValue * 0.01f );
}
//System.out.println("골드 보상 비율 : " + goldRate + ", 골드 업글 레벨 : " + goldUpgradeLevel);
/** 현 캐릭터의 보상 목록을 처리한다 */
Reward currentReward = null;
// 중계를 위한.. 이번 틱 누적 보상
float expSum = 0f;
int goldSum = 0;
for (int i = 0; i < rewardList.size(); i++) {
currentReward = rewardList.get(i);
double finalRewardExp;
double finalRewardGold;
/* 보상 타입에 따라 처리한다 */
switch (currentReward.rewardType){
case RewardType.KILL_MONSTER :
// 몬스터를 죽이고 얻는 보상의 경우, 경험치와 골드를 둘 다 얻는다.
// 경험치
finalRewardExp = currentReward.rewardExp * expRate;
character.characterComponent.getExpReward((float)finalRewardExp); // 경험치
// 골드
finalRewardGold = currentReward.rewardGold * goldRate;
character.characterComponent.getGoldReward((int)finalRewardGold); // 골드
// 누적
expSum += (float)finalRewardExp;
goldSum += (int)finalRewardGold;
break;
case RewardType.KILL_MONSTER_BY_TURRET :
/**
* [ 오전 1:13 2020-04-04 권령희 ]
* 터렛에 의한 몹 KIll 보상을 처리하는 방식에 대해서는,
* 나중에 확실해지면 수정하거나 할 것.
* 보상 적용 비율을 파일로부터 읽어 처리하도록 하거나, 아니면 아예 주지 않거나.
* 현재는, 터렛을 건축한 캐릭터에게 그 보상을 주도록 하고 있음.
* ㄴ 아 또 이런경우에는.. 상점 보상 비율을 적용해야 하는가??
* 이게. 게임 월드 전체에 걸쳐 적용되는 개념으로 봐야할지,아니면 캐릭터에만 한정해야 할지..
*/
// 경험치
finalRewardExp = currentReward.rewardExp * expRate * 0.5f;
character.characterComponent.getExpReward((float)finalRewardExp); // 경험치
// 골드
finalRewardGold = currentReward.rewardGold * goldRate * 0.5f;
character.characterComponent.getGoldReward((int)finalRewardGold); // 골드
// 누적
expSum += (float)finalRewardExp;
goldSum += (int)finalRewardGold;
break;
case RewardType.KILL_MONSTER_JUNGLE_MONSTER :
// 경험치
finalRewardExp = currentReward.rewardExp * expRate;
character.characterComponent.getExpReward((float)finalRewardExp); // 경험치
// 골드
finalRewardGold = currentReward.rewardGold * goldRate;
character.characterComponent.getGoldReward((int)finalRewardGold); // 골드
// 누적
expSum += (float)finalRewardExp;
goldSum += (int)finalRewardGold;
/** 2020 02 28 */
//character.buffActionHistoryComponent.conditionHistory.add(currentReward.rewardBuff);
/** 2020 04 03 */
for (int j=0; j<currentReward.rewardBuff.size(); j++){
character.buffActionHistoryComponent.conditionHistory.add(
currentReward.rewardBuff.get(j));
}
break;
default:
break;
}
}
/** 2020 02 13 목 */
/* 스코어에 반영 */
worldMap.playerGameScoreList.get(character.entityID).earnedGold += goldSum;
/* 중계처리 (필요하다면. 혹은, 월드맵 메인 게임 루프에서 보상에 대한 중계도 하게끔 하던지 */
// 개인별로 보상내역을 중계할 경우 여기에 중계 코드를 작성..
/* 보상 목록을 초기화한다 */
rewardList.clear();
}
}
/*******************************************************************************************************************/
/**
* 2020 04 18 새벽 작성
* 필요 데이터를 GDM으로부터 클론하여 사용하게끔, 초반에 미리 복사해두는 처리
*/
/**
* 기 능 : 월드맵에서 필요로 하는 데이터를, GDM에서 복사해온다.
* 처 리 :
* WorldMap에서 필요로 하는 GDM 데이터는 다음과 같다
* -- 정글몹정보 목록
* -- 웨이브별 등장 몹 목록
*
*/
public void getNeedDataFromGDM(){
/* 초기화 처리 */
/* 정글몹 정보 목록을 복사한다 */
}
public void bringStoreUpgradeInfoListFromGDM(){
HashMap<Integer, HashMap<Integer, StoreUpgradeInfoPerLevel>> storeUpgradeInfoPerLevelList = new HashMap<>();
for( HashMap.Entry<Integer, HashMap<Integer, StoreUpgradeInfoPerLevel>> storeUpgradeInfo
: GameDataManager.storeUpgradeInfoPerLevelList.entrySet()){
int storeUpgradeKey = storeUpgradeInfo.getKey();
HashMap<Integer, StoreUpgradeInfoPerLevel> storeUpgradeValue = new HashMap<>();
for( HashMap.Entry<Integer, StoreUpgradeInfoPerLevel> upgradeInfoPerLevel : storeUpgradeInfo.getValue().entrySet()){
int upgradeKey = upgradeInfoPerLevel.getKey();
StoreUpgradeInfoPerLevel upgradeValue = upgradeInfoPerLevel.getValue();
storeUpgradeValue.put(upgradeKey, upgradeValue.clone());
}
storeUpgradeInfoPerLevelList.put(storeUpgradeKey, storeUpgradeValue);
}
}
}
| 11,831 | 0.533411 | 0.52486 | 271 | 33.955719 | 32.196323 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446494 | false | false | 12 |
61300e19803e24f3c3fa45be01034dc63da96a93 | 30,331,059,071,085 | af0b94f03c896cdfe972a85dd37280e9243da8b5 | /src/main/java/cn/lefer/tomu/song/exception/SongCannotReachableException.java | b430722345a42569e84d508cdc11696ce92f4551 | [] | no_license | frontc/tomuServer | https://github.com/frontc/tomuServer | 5a2f1b419f29170a2ad11dec5df4f30520620db1 | a80214622489164886c5ffacc1f3e1e4e761ef81 | refs/heads/master | 2022-12-07T10:09:53.808000 | 2020-08-17T07:03:33 | 2020-08-17T07:03:33 | 283,965,408 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.lefer.tomu.song.exception;
import cn.lefer.tomu.base.exception.BaseException;
/**
* @author : lefer
* @version : V1.0
* @date : 2020/8/2
* @Description : 频道不存在
*/
public class SongCannotReachableException extends BaseException {
/**
*
*/
private static final long serialVersionUID = 1L;
public SongCannotReachableException() {
super(SongErrorCode.SONG_CANNOT_REACHABLE);
}
}
| UTF-8 | Java | 440 | java | SongCannotReachableException.java | Java | [
{
"context": "mu.base.exception.BaseException;\n\n/**\n * @author : lefer\n * @version : V1.0\n * @date : 2020/8/2\n * @Desc",
"end": 113,
"score": 0.9995667934417725,
"start": 108,
"tag": "USERNAME",
"value": "lefer"
}
] | null | [] | package cn.lefer.tomu.song.exception;
import cn.lefer.tomu.base.exception.BaseException;
/**
* @author : lefer
* @version : V1.0
* @date : 2020/8/2
* @Description : 频道不存在
*/
public class SongCannotReachableException extends BaseException {
/**
*
*/
private static final long serialVersionUID = 1L;
public SongCannotReachableException() {
super(SongErrorCode.SONG_CANNOT_REACHABLE);
}
}
| 440 | 0.676744 | 0.655814 | 20 | 20.5 | 20.783407 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 12 |
8b5a07d610f6133f577a0e8eefec1967704eaf2e | 24,292,335,035,899 | db18284b9a0f5ec6bf6262f7121cda2bd99c4a8b | /JDBCEXAMPLE/src/main/java/com/ibm/InserFile.java | eb1fae1829e0a69ede6db0014f74f938f6df3b5e | [] | no_license | zain7shk/Eclipsefile | https://github.com/zain7shk/Eclipsefile | 46c1dcf94a5919e04da1522243f416a9b998ed20 | 08aeb964a5d77a9f9991a1d15dce19d05a312ab4 | refs/heads/master | 2023-06-04T19:44:27.976000 | 2021-06-18T10:37:45 | 2021-06-18T10:37:45 | 378,107,240 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ibm;
import java.sql.*;
import java.io.*;
public class InserFile {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
try {
String driver="com.mysql.cj.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/jdbc_example";
String username="root";
String password="1234";
Class.forName(driver);
Connection con=DriverManager.getConnection(url,username,password);
PreparedStatement pst=con.prepareStatement("insert into filedb values(?,?)");
File f=new File("C:\\Users\\zain\\eclipse-workspace\\JDBCEXAMPLE\\src\\main\\resources\\textfile.txt"); //yaha pe (\\) ayyaega
FileReader fr=new FileReader(f);
pst.setInt(1, 103);
pst.setCharacterStream(2,fr,(int)f.length());
int i=pst.executeUpdate();
System.out.println(i+ " records updated");
//for retrieve table
//PreparedStatement ps=con.prepareStatement("select * from filedb");
// ResultSet rs=ps.executeQuery();
// rs.next();
// Clob c=rs.getClob(2);//gegt 2 charcter
// Reader r=c.getCharacterStream();
//
// FileWriter fw=new FileWriter("C:\\Users\\zain\\eclipse-workspace\\JDBCEXAMPLE\\src\\main\\resources\\retrieve2.txt");
// int i;
// while((i=r.read())!=-1)
// fw.write((char)i);
// fw.close();
System.out.println("Succeess");
con.close();
}catch(Exception e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 1,446 | java | InserFile.java | Java | [
{
"context": "\";\n\t\t\tString username=\"root\";\n\t\t\tString password=\"1234\";\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tClass.forName(driver);\n\t\t\tConnec",
"end": 340,
"score": 0.9992564916610718,
"start": 336,
"tag": "PASSWORD",
"value": "1234"
}
] | null | [] | package com.ibm;
import java.sql.*;
import java.io.*;
public class InserFile {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
try {
String driver="com.mysql.cj.jdbc.Driver";
String url="jdbc:mysql://localhost:3306/jdbc_example";
String username="root";
String password="<PASSWORD>";
Class.forName(driver);
Connection con=DriverManager.getConnection(url,username,password);
PreparedStatement pst=con.prepareStatement("insert into filedb values(?,?)");
File f=new File("C:\\Users\\zain\\eclipse-workspace\\JDBCEXAMPLE\\src\\main\\resources\\textfile.txt"); //yaha pe (\\) ayyaega
FileReader fr=new FileReader(f);
pst.setInt(1, 103);
pst.setCharacterStream(2,fr,(int)f.length());
int i=pst.executeUpdate();
System.out.println(i+ " records updated");
//for retrieve table
//PreparedStatement ps=con.prepareStatement("select * from filedb");
// ResultSet rs=ps.executeQuery();
// rs.next();
// Clob c=rs.getClob(2);//gegt 2 charcter
// Reader r=c.getCharacterStream();
//
// FileWriter fw=new FileWriter("C:\\Users\\zain\\eclipse-workspace\\JDBCEXAMPLE\\src\\main\\resources\\retrieve2.txt");
// int i;
// while((i=r.read())!=-1)
// fw.write((char)i);
// fw.close();
System.out.println("Succeess");
con.close();
}catch(Exception e) {
e.printStackTrace();
}
}
}
| 1,452 | 0.647303 | 0.635546 | 58 | 23.931034 | 27.623617 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.982759 | false | false | 12 |
eb6465200564bb0677edafe47b7292bd29b7154f | 26,070,451,504,646 | 20103c076f8731b7d1f801be82c5b2763eb99522 | /src/main/java/saper/field/BaseField.java | c2c96de9f37d9127ee496936bc0ce4946a4a45f7 | [] | no_license | dzakarov/mesh | https://github.com/dzakarov/mesh | 2007358deb1954eeefe5c12d0280255de1a33679 | cd8f38df4a27ef8a46f9cad611ee82cba9fd6272 | refs/heads/master | 2021-01-10T19:50:18.075000 | 2011-10-18T09:37:28 | 2011-10-18T09:37:28 | 1,902,908 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Represents a base minesweeper field. Each cell can contain a mine or be
* empty. Correspondingly, state of the cell is either constant
* <code>MINE</code> or the number of mines in adjacent cells. Two cells are
* adjacent if they share an edge.
*
* @author Pestov Oleg
* @version 1.0
*/
package saper.field;
import java.util.Random;
public class BaseField extends Field
{
/**
* Mine.
*/
public static int MINE = -1;
/**
* Random numbers generator.
*/
private Random random;
/**
* Default number of rows.
*/
private static int ROWS = 16;
/**
* Default number of cols.
*/
private static int COLS = 16;
/**
* Default number of mines.
*/
private static int MINES = 16;
/**
* Minefield.
*/
private int[][] field;
/**
* Creates a new random minefield with default number of rows, columns and
* mines. Random generator seed is initialized to a value based on the
* current time.
*/
public BaseField()
{
this(0);
}
/**
* Creates a new random minefield with default number of rows, columns,
* mines and given seed for the random generator.
*
* @param seed
* initial seed.
*/
public BaseField(long seed)
{
this(seed, ROWS, COLS, MINES);
}
/**
* Creates a new random minefield with given number of rows, columns and
* mines. Random generator seed is initialized to a value based on the
* current time
*
* @param rows
* number of rows in the field.
* @param cols
* number of columns in the field.
* @param mines
* number of mines in the field.
*/
public BaseField(int rows, int cols, int mines)
{
this(0, rows, cols, mines);
}
/**
* Creates a new random minefield with given number of rows, columns, mines
* and given seed for the random generator.
*
* @param seed
* initial seed.
* @param rows
* number of rows in the field.
* @param cols
* number of columns in the field.
* @param mines
* number of mines in the field.
*/
public BaseField(long seed, int rows, int cols, int mines)
{
random = seed == 0 ? new Random() : new Random(seed);
boolean[][] bombs = new boolean[rows][cols];
boolean inverse = false;
if (2 * minesCount > rows * cols)
{
mines = rows * cols - mines;
inverse = true;
}
while (mines > 0)
{
int r, c;
do
{
r = random.nextInt(rows);
c = random.nextInt(cols);
} while (bombs[r][c]);
bombs[r][c] = true;
mines--;
}
if (inverse)
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
bombs[i][j] = !bombs[i][j];
setup(bombs);
}
/**
* Creates a new minefield based on given two dimensional array.
*
* @param a
* boolean minefield representation where <code>TRUE</code>
* values indicate mines.
*/
public BaseField(boolean[][] a)
{
setup(a);
}
/**
* Creates a new minefield based on given two dimensional array.
*
* @param a
* boolean minefield representation where <code>TRUE</code>
* values indicate mines.
*/
private void setup(boolean[][] a)
{
rowsCount = a.length;
colsCount = rowsCount > 0 ? a[0].length : 0;
minesCount = 0;
for (int r = 0; r < rowsCount; r++)
for (int c = 0; c < colsCount; c++)
if (a[r][c])
minesCount++;
field = new int[rowsCount][colsCount];
for (int r = 0; r < rowsCount; r++)
for (int c = 0; c < colsCount; c++)
{
field[r][c] = 0;
for (int dr = -1; dr <= 1; dr++)
for (int dc = -1; dc <= 1; dc++)
if (r + dr >= 0 && r + dr < rowsCount && c + dc >= 0 && c + dc < colsCount)
if (a[r + dr][c + dc])
field[r][c]++;
if (a[r][c])
field[r][c] = MINE;
}
}
/**
* Returns the number of mines in the adjacent cells or constant
* <code>MINE</code>.
*
* @param row
* row index.
* @param col
* column index.
* @return the number of mines in the adjacent cells or constant
* <code>MINE</code>.
*/
public int getCellState(int row, int col)
{
return field[row][col];
}
} | UTF-8 | Java | 5,091 | java | BaseField.java | Java | [
{
"context": "* adjacent if they share an edge.\r\n * \r\n * @author Pestov Oleg\r\n * @version 1.0\r\n */\r\n\r\npackage saper.field;\r\n\r\n",
"end": 287,
"score": 0.9998476505279541,
"start": 276,
"tag": "NAME",
"value": "Pestov Oleg"
}
] | null | [] | /**
* Represents a base minesweeper field. Each cell can contain a mine or be
* empty. Correspondingly, state of the cell is either constant
* <code>MINE</code> or the number of mines in adjacent cells. Two cells are
* adjacent if they share an edge.
*
* @author <NAME>
* @version 1.0
*/
package saper.field;
import java.util.Random;
public class BaseField extends Field
{
/**
* Mine.
*/
public static int MINE = -1;
/**
* Random numbers generator.
*/
private Random random;
/**
* Default number of rows.
*/
private static int ROWS = 16;
/**
* Default number of cols.
*/
private static int COLS = 16;
/**
* Default number of mines.
*/
private static int MINES = 16;
/**
* Minefield.
*/
private int[][] field;
/**
* Creates a new random minefield with default number of rows, columns and
* mines. Random generator seed is initialized to a value based on the
* current time.
*/
public BaseField()
{
this(0);
}
/**
* Creates a new random minefield with default number of rows, columns,
* mines and given seed for the random generator.
*
* @param seed
* initial seed.
*/
public BaseField(long seed)
{
this(seed, ROWS, COLS, MINES);
}
/**
* Creates a new random minefield with given number of rows, columns and
* mines. Random generator seed is initialized to a value based on the
* current time
*
* @param rows
* number of rows in the field.
* @param cols
* number of columns in the field.
* @param mines
* number of mines in the field.
*/
public BaseField(int rows, int cols, int mines)
{
this(0, rows, cols, mines);
}
/**
* Creates a new random minefield with given number of rows, columns, mines
* and given seed for the random generator.
*
* @param seed
* initial seed.
* @param rows
* number of rows in the field.
* @param cols
* number of columns in the field.
* @param mines
* number of mines in the field.
*/
public BaseField(long seed, int rows, int cols, int mines)
{
random = seed == 0 ? new Random() : new Random(seed);
boolean[][] bombs = new boolean[rows][cols];
boolean inverse = false;
if (2 * minesCount > rows * cols)
{
mines = rows * cols - mines;
inverse = true;
}
while (mines > 0)
{
int r, c;
do
{
r = random.nextInt(rows);
c = random.nextInt(cols);
} while (bombs[r][c]);
bombs[r][c] = true;
mines--;
}
if (inverse)
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
bombs[i][j] = !bombs[i][j];
setup(bombs);
}
/**
* Creates a new minefield based on given two dimensional array.
*
* @param a
* boolean minefield representation where <code>TRUE</code>
* values indicate mines.
*/
public BaseField(boolean[][] a)
{
setup(a);
}
/**
* Creates a new minefield based on given two dimensional array.
*
* @param a
* boolean minefield representation where <code>TRUE</code>
* values indicate mines.
*/
private void setup(boolean[][] a)
{
rowsCount = a.length;
colsCount = rowsCount > 0 ? a[0].length : 0;
minesCount = 0;
for (int r = 0; r < rowsCount; r++)
for (int c = 0; c < colsCount; c++)
if (a[r][c])
minesCount++;
field = new int[rowsCount][colsCount];
for (int r = 0; r < rowsCount; r++)
for (int c = 0; c < colsCount; c++)
{
field[r][c] = 0;
for (int dr = -1; dr <= 1; dr++)
for (int dc = -1; dc <= 1; dc++)
if (r + dr >= 0 && r + dr < rowsCount && c + dc >= 0 && c + dc < colsCount)
if (a[r + dr][c + dc])
field[r][c]++;
if (a[r][c])
field[r][c] = MINE;
}
}
/**
* Returns the number of mines in the adjacent cells or constant
* <code>MINE</code>.
*
* @param row
* row index.
* @param col
* column index.
* @return the number of mines in the adjacent cells or constant
* <code>MINE</code>.
*/
public int getCellState(int row, int col)
{
return field[row][col];
}
} | 5,086 | 0.469849 | 0.46376 | 192 | 24.526041 | 22.049881 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.364583 | false | false | 12 |
89ed7f2ad8eb539012a9cd4e7ad4e8b775b49157 | 28,853,590,325,751 | 5735236d2316e4dd06d9f157ea21c8873606b669 | /backend/src/main/java/com/psut/data/engineering/backend/services/SubmitService.java | afc7851f81725a39accb71008b97cabdd6ba68a9 | [
"MIT"
] | permissive | AbdAyyad/data-engineering-project | https://github.com/AbdAyyad/data-engineering-project | 562a7d2f14f7793a76b7e50ef62e3efe9aa0b02c | 648c02156612d59ab19e10167477a8bd3b046a85 | refs/heads/master | 2023-05-31T11:39:51.598000 | 2021-05-31T12:52:06 | 2021-05-31T12:52:06 | 353,988,435 | 1 | 0 | MIT | false | 2021-04-30T13:02:25 | 2021-04-02T10:41:23 | 2021-04-05T18:15:06 | 2021-04-25T14:49:52 | 4 | 0 | 0 | 0 | Shell | false | false | package com.psut.data.engineering.backend.services;
import org.springframework.lang.NonNull;
import java.io.InputStream;
public interface SubmitService {
void submit(@NonNull InputStream stream);
}
| UTF-8 | Java | 206 | java | SubmitService.java | Java | [] | null | [] | package com.psut.data.engineering.backend.services;
import org.springframework.lang.NonNull;
import java.io.InputStream;
public interface SubmitService {
void submit(@NonNull InputStream stream);
}
| 206 | 0.796117 | 0.796117 | 10 | 19.6 | 20.343058 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 12 |
b7459591e2e92ffc2d0b6cce299cb5581be8c1d3 | 4,681,514,368,469 | e52f93a900940f976068cff6ce7a3fb8a2a45d87 | /Mapas2/src/ucsg/gmaps/control/CategoriaControl.java | 83d3b99fda8a331b8313ad6c223818c2aff4c176 | [] | no_license | mhidalgop89/maps | https://github.com/mhidalgop89/maps | f6547d53466e8f56fa22b5e805e4676aa427d997 | fbb1e3789ed0508760f50f624fbdb434a4ea264b | refs/heads/master | 2021-07-25T11:25:52.805000 | 2017-11-21T23:59:02 | 2017-11-21T23:59:02 | 96,666,767 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ucsg.gmaps.control;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.gmaps.Gmarker;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zkex.zul.Fisheye;
import org.zkoss.zkplus.databind.AnnotateDataBinder;
import org.zkoss.zul.Image;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
import ucsg.gmaps.dao.DatosDao;
import ucsg.gmaps.dao.PerfilesDao;
import ucsg.gmaps.dao.RelPerfilPermisoDAO;
import ConexionUtil.ConexionUtil;
import Util.CategoriaVehiculo;
import Util.MapUsuarioSistema;
import Util.Marks;
import Util.Perfiles;
import Util.ReadPropertiesUtil;
import Util.Vehiculos;
public class CategoriaControl extends GenericForwardComposer{
private List<CategoriaVehiculo> catVeh= new ArrayList<CategoriaVehiculo>();
private List<CategoriaVehiculo> catVehModel= new ArrayList<CategoriaVehiculo>();
Listbox listuser;
String _user=null;
private CategoriaVehiculo objCategoria;//= new CategoriaVehiculo();
MapUsuarioSistema objUsuarioSistema = null;
List<Vehiculos> veh= new ArrayList<Vehiculos>();
List<Vehiculos> vehModel= new ArrayList<Vehiculos>();
AnnotateDataBinder binder;
///componentes
Textbox txtFilDes;
Textbox txtFilIden;
Textbox txtFilEstado;
private Listheader lshAcciones;
private Listheader lshDescripcion;
private Listheader lshIdentificador;
private Listheader lshEstado;
private Image imgEliminar;
private Image imgEditar;
private Image imgVerVehiculo;
private Fisheye febCategoria;
public void doAfterCompose(Component cmp){
try
{
super.doAfterCompose(cmp);
cmp.setAttribute("winuser",this,true);
//System.out.println("doAfterCompose cmpasfasfasfasfasfasfsafasasfsafasas");
//Ejecución de Ajax
binder = new AnnotateDataBinder(cmp);
getUserFromIndex();
if (objUsuarioSistema==null)
{
desconectar();
return;
}
cargarComponentes();
getCategoria();
txtFilEstado.setText("A");
filtraCategoria();
//mymark2.setOpen(true);
//binder.loadComponent(ComAmb);
//binder.loadComponent(cmbTramite);
binder.loadComponent(listuser);
//binder.loadAll();
}
catch(Exception e){
System.out.println("doAfterCompose Exception");
e.printStackTrace();
}
}
public void cargarComponentes()
{
txtFilDes.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.FiltroDescripcion", objUsuarioSistema.getIdioma()));
txtFilIden.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.FiltroIdentificador", objUsuarioSistema.getIdioma()));
txtFilEstado.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.FiltroEstado", objUsuarioSistema.getIdioma()));
lshAcciones.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Acciones", objUsuarioSistema.getIdioma()));
lshDescripcion.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Descripcion", objUsuarioSistema.getIdioma()));
lshIdentificador.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Identificador", objUsuarioSistema.getIdioma()));
lshEstado.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Estado", objUsuarioSistema.getIdioma()));
imgEliminar.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Eliminar", objUsuarioSistema.getIdioma()));
imgEditar.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Editar", objUsuarioSistema.getIdioma()));
imgVerVehiculo.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.VerVehiculo", objUsuarioSistema.getIdioma()));
febCategoria.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.AgregarCategoria", objUsuarioSistema.getIdioma()));
}
public void desconectar()
{
Executions.getCurrent().getSession().removeAttribute("usuario");
Executions.sendRedirect("index.zul");
}
public void filtraCategoria()
{
if(!txtFilDes.equals("")|| !txtFilIden.equals("")||!txtFilEstado.equals(""))
{System.out.println("txtFilDes: "+ txtFilDes.getText()+" txtFilIden: "+txtFilIden.getText());
catVeh = new ArrayList<CategoriaVehiculo>();
for(int i=0; i< catVehModel.size();i++)
{
if(
catVehModel.get(i).getDescripcion().toLowerCase().contains(txtFilDes.getText().toLowerCase()) &&
catVehModel.get(i).getIdentificador().toLowerCase().contains(txtFilIden.getText().toLowerCase())&&
catVehModel.get(i).getEstado().toLowerCase().contains(txtFilEstado.getText().toLowerCase())
)
catVeh.add(catVehModel.get(i));
}
binder.loadComponent(listuser);
}
}
public void getUserFromIndex()
{
objUsuarioSistema =(MapUsuarioSistema)Executions.getCurrent().getSession().getAttribute("usuario");
}
public void eliminarCategoria()
{
int respuesta=Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.EliminaCategoria", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.YES|Messagebox.NO,Messagebox.INFORMATION);
if(respuesta ==16)
{
boolean vehExist=false;
DatosDao dat = new DatosDao();
if ( objCategoria.getIdentificador() != null )
{
/*rsInsert=st.executeQuery("select * from vehiculos where ve_categoria = "+ objCategoria.getId_categoria() +";");
while(rsInsert.next())
{
vehExist=true;
}*/
veh= new ArrayList<Vehiculos>();
vehModel= new ArrayList<Vehiculos>();
vehModel = dat.obtieneVehiculoDao(objUsuarioSistema.getUsu_id());
veh = vehModel;
for(int i=0;i<veh.size()&&!vehExist;i++)
{
if(veh.get(i).getCatVeh()==objCategoria.getId_categoria())
vehExist=true;
}
if(!vehExist)
{
System.out.println("objCategoria.getId_categoria(): "+objCategoria.getId_categoria());
dat.eliminarCategoriaDao(objCategoria);
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.RegistroEliminado", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
getCategoria();
binder.loadComponent(listuser);
}
else
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.ErrorRegistroEliminado", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
}
else
{
//valida si user existe
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.NoSeleccionCategoria", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
}
}
}
public void cargarDataModal(){
try{
Perfiles perfil = new Perfiles();
PerfilesDao per= new PerfilesDao();
perfil = per.buscarPerfPorUsuario(_user);
RelPerfilPermisoDAO rpp= new RelPerfilPermisoDAO();
if( (rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.1")&& objCategoria==null)||
(rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.2")&& objCategoria!=null ))
{
int id_usuario=0;
String user=null;
/*Statement st=null;
ResultSet rs=null;
Connection conn= ConexionUtil.getConnection();
st=conn.createStatement();
//rs=st.executeQuery("select id_categoria_vehiculo, descripcion, identificador from categoria_vehiculo ;");
rs=st.executeQuery(" select usu_id,user from usuarios where User = '"+_user+"'");
while(rs.next())
{
id_usuario = rs.getInt(1);
user=rs.getString(2);
}
objCategoria.setIdUser(objUsuarioSistema.getUsu_id());
objCategoria.setUser(objUsuarioSistema.getUser());
System.out.println("objCategoria->>viaja: "+objCategoria.getIdUser()+"-"+objCategoria.getUser());*/
//lista doblemente enlazada
Map<String,CategoriaVehiculo> maCategoria = new HashMap<String,CategoriaVehiculo>();
maCategoria.put("pUsuario", objCategoria);
final Window registro = (Window) Executions.createComponents(
"RegistroCategoria.zul",null, maCategoria);
registro.doModal();
//objCategoria=null;
objCategoria=null;// new CategoriaVehiculo();
getCategoria();
txtFilDes.setText("");
txtFilIden.setText("");
filtraCategoria();
binder.loadComponent(listuser);
}
else
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.NoPermisoOpcion", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
/*
//lista doblemente enlazada
Map<String,FrUsuarios> maUsuario = new HashMap<String,FrUsuarios>();
maUsuario.put("pUsuario", objUsuario);
final Window registro = (Window) Executions.createComponents(
"registra_usuario.zul",null, maUsuario);
registro.doModal();
objUsuario = null;
HibernateSessionFactory.getSession().clear();
Session sess = HibernateSessionFactory.getSession();
UsuarioBo bo = new UsuarioBo();
us = bo.obtenerUsuario(sess);
binder.loadComponent(listuser);
//Poner para que no salga mensaje al cerrar ventana
//System.out.println(objUsuario.getApellido());
registro.setClosable(true);*/
}catch(Exception e){
e.printStackTrace();
}
}
public void cargarDataModal3(){
try{
Perfiles perfil = new Perfiles();
PerfilesDao per= new PerfilesDao();
perfil = per.buscarPerfPorUsuario(_user);
RelPerfilPermisoDAO rpp= new RelPerfilPermisoDAO();
if( (rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.1")&& objCategoria==null)||
(rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.2")&& objCategoria!=null ))
{
int id_usuario=0;
String user=null;
objCategoria=null;
//lista doblemente enlazada
Map<String,CategoriaVehiculo> maCategoria = new HashMap<String,CategoriaVehiculo>();
maCategoria.put("pUsuario", objCategoria);
final Window registro = (Window) Executions.createComponents(
"RegistroCategoria.zul",null, maCategoria);
registro.doModal();
//objCategoria=null;
objCategoria=null;// new CategoriaVehiculo();
getCategoria();
txtFilDes.setText("");
txtFilIden.setText("");
filtraCategoria();
binder.loadComponent(listuser);
}
else
Messagebox.show("No tiene permisos sobre la opcion","Atención!!!",Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
}catch(Exception e){
e.printStackTrace();
}
}
public void cargarDataModal2(){
try{
int id_usuario=0;
String user=null;
objCategoria.setIdUser(objUsuarioSistema.getUsu_id());
objCategoria.setUser(objUsuarioSistema.getUser());
System.out.println("objCategoria->>viaja: "+objCategoria.getIdUser()+"-"+objCategoria.getUser());
//lista doblemente enlazada
Map<String,CategoriaVehiculo> maCategoria = new HashMap<String,CategoriaVehiculo>();
maCategoria.put("pUsuario", objCategoria);
final Window registro = (Window) Executions.createComponents(
"VehiculoCategoria.zul",null, maCategoria);
registro.doModal();
//objCategoria=null;
objCategoria= new CategoriaVehiculo();
getCategoria();
txtFilDes.setText("");
txtFilIden.setText("");
binder.loadComponent(listuser);
}catch(Exception e){
e.printStackTrace();
}
}
public void getCategoria()
{
DatosDao dat = new DatosDao();
int per_id=0;
int usu_id=0;
catVeh= new ArrayList<CategoriaVehiculo>();
catVehModel= new ArrayList<CategoriaVehiculo>();
try{
per_id = objUsuarioSistema.getPer_id();
usu_id = objUsuarioSistema.getUsu_id();
catVehModel = dat.obtenerCatVehDao(objUsuarioSistema);
catVeh = catVehModel;
binder.loadComponent(listuser);
}
catch(Exception e){e.printStackTrace();}
}
public Textbox getTxtFilEstado() {
return txtFilEstado;
}
public void setTxtFilEstado(Textbox txtFilEstado) {
this.txtFilEstado = txtFilEstado;
}
public List<Vehiculos> getVeh() {
return veh;
}
public void setVeh(List<Vehiculos> veh) {
this.veh = veh;
}
public List<Vehiculos> getVehModel() {
return vehModel;
}
public void setVehModel(List<Vehiculos> vehModel) {
this.vehModel = vehModel;
}
public MapUsuarioSistema getObjUsuarioSistema() {
return objUsuarioSistema;
}
public void setObjUsuarioSistema(MapUsuarioSistema objUsuarioSistema) {
this.objUsuarioSistema = objUsuarioSistema;
}
public Textbox getTxtFilDes() {
return txtFilDes;
}
public void setTxtFilDes(Textbox txtFilDes) {
this.txtFilDes = txtFilDes;
}
public Textbox getTxtFilIden() {
return txtFilIden;
}
public void setTxtFilIden(Textbox txtFilIden) {
this.txtFilIden = txtFilIden;
}
public List<CategoriaVehiculo> getCatVehModel() {
return catVehModel;
}
public void setCatVehModel(List<CategoriaVehiculo> catVehModel) {
this.catVehModel = catVehModel;
}
public String get_user() {
return _user;
}
public void set_user(String _user) {
this._user = _user;
}
public CategoriaVehiculo getObjCategoria() {
return objCategoria;
}
public void setObjCategoria(CategoriaVehiculo objCategoria) {
this.objCategoria = objCategoria;
}
public Listbox getListuser() {
return listuser;
}
public void setListuser(Listbox listuser) {
this.listuser = listuser;
}
public AnnotateDataBinder getBinder() {
return binder;
}
public void setBinder(AnnotateDataBinder binder) {
this.binder = binder;
}
public List<CategoriaVehiculo> getCatVeh() {
return catVeh;
}
public void setCatVeh(List<CategoriaVehiculo> catVeh) {
this.catVeh = catVeh;
}
public Listheader getLshAcciones() {
return lshAcciones;
}
public void setLshAcciones(Listheader lshAcciones) {
this.lshAcciones = lshAcciones;
}
public Listheader getLshDescripcion() {
return lshDescripcion;
}
public void setLshDescripcion(Listheader lshDescripcion) {
this.lshDescripcion = lshDescripcion;
}
public Listheader getLshIdentificador() {
return lshIdentificador;
}
public void setLshIdentificador(Listheader lshIdentificador) {
this.lshIdentificador = lshIdentificador;
}
public Listheader getLshEstado() {
return lshEstado;
}
public void setLshEstado(Listheader lshEstado) {
this.lshEstado = lshEstado;
}
public Image getImgEliminar() {
return imgEliminar;
}
public void setImgEliminar(Image imgEliminar) {
this.imgEliminar = imgEliminar;
}
public Image getImgEditar() {
return imgEditar;
}
public void setImgEditar(Image imgEditar) {
this.imgEditar = imgEditar;
}
public Image getImgVerVehiculo() {
return imgVerVehiculo;
}
public void setImgVerVehiculo(Image imgVerVehiculo) {
this.imgVerVehiculo = imgVerVehiculo;
}
}
| WINDOWS-1250 | Java | 16,505 | java | CategoriaControl.java | Java | [] | null | [] | package ucsg.gmaps.control;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.gmaps.Gmarker;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zkex.zul.Fisheye;
import org.zkoss.zkplus.databind.AnnotateDataBinder;
import org.zkoss.zul.Image;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
import ucsg.gmaps.dao.DatosDao;
import ucsg.gmaps.dao.PerfilesDao;
import ucsg.gmaps.dao.RelPerfilPermisoDAO;
import ConexionUtil.ConexionUtil;
import Util.CategoriaVehiculo;
import Util.MapUsuarioSistema;
import Util.Marks;
import Util.Perfiles;
import Util.ReadPropertiesUtil;
import Util.Vehiculos;
public class CategoriaControl extends GenericForwardComposer{
private List<CategoriaVehiculo> catVeh= new ArrayList<CategoriaVehiculo>();
private List<CategoriaVehiculo> catVehModel= new ArrayList<CategoriaVehiculo>();
Listbox listuser;
String _user=null;
private CategoriaVehiculo objCategoria;//= new CategoriaVehiculo();
MapUsuarioSistema objUsuarioSistema = null;
List<Vehiculos> veh= new ArrayList<Vehiculos>();
List<Vehiculos> vehModel= new ArrayList<Vehiculos>();
AnnotateDataBinder binder;
///componentes
Textbox txtFilDes;
Textbox txtFilIden;
Textbox txtFilEstado;
private Listheader lshAcciones;
private Listheader lshDescripcion;
private Listheader lshIdentificador;
private Listheader lshEstado;
private Image imgEliminar;
private Image imgEditar;
private Image imgVerVehiculo;
private Fisheye febCategoria;
public void doAfterCompose(Component cmp){
try
{
super.doAfterCompose(cmp);
cmp.setAttribute("winuser",this,true);
//System.out.println("doAfterCompose cmpasfasfasfasfasfasfsafasasfsafasas");
//Ejecución de Ajax
binder = new AnnotateDataBinder(cmp);
getUserFromIndex();
if (objUsuarioSistema==null)
{
desconectar();
return;
}
cargarComponentes();
getCategoria();
txtFilEstado.setText("A");
filtraCategoria();
//mymark2.setOpen(true);
//binder.loadComponent(ComAmb);
//binder.loadComponent(cmbTramite);
binder.loadComponent(listuser);
//binder.loadAll();
}
catch(Exception e){
System.out.println("doAfterCompose Exception");
e.printStackTrace();
}
}
public void cargarComponentes()
{
txtFilDes.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.FiltroDescripcion", objUsuarioSistema.getIdioma()));
txtFilIden.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.FiltroIdentificador", objUsuarioSistema.getIdioma()));
txtFilEstado.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.FiltroEstado", objUsuarioSistema.getIdioma()));
lshAcciones.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Acciones", objUsuarioSistema.getIdioma()));
lshDescripcion.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Descripcion", objUsuarioSistema.getIdioma()));
lshIdentificador.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Identificador", objUsuarioSistema.getIdioma()));
lshEstado.setLabel(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Estado", objUsuarioSistema.getIdioma()));
imgEliminar.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Eliminar", objUsuarioSistema.getIdioma()));
imgEditar.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Editar", objUsuarioSistema.getIdioma()));
imgVerVehiculo.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.VerVehiculo", objUsuarioSistema.getIdioma()));
febCategoria.setTooltiptext(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.AgregarCategoria", objUsuarioSistema.getIdioma()));
}
public void desconectar()
{
Executions.getCurrent().getSession().removeAttribute("usuario");
Executions.sendRedirect("index.zul");
}
public void filtraCategoria()
{
if(!txtFilDes.equals("")|| !txtFilIden.equals("")||!txtFilEstado.equals(""))
{System.out.println("txtFilDes: "+ txtFilDes.getText()+" txtFilIden: "+txtFilIden.getText());
catVeh = new ArrayList<CategoriaVehiculo>();
for(int i=0; i< catVehModel.size();i++)
{
if(
catVehModel.get(i).getDescripcion().toLowerCase().contains(txtFilDes.getText().toLowerCase()) &&
catVehModel.get(i).getIdentificador().toLowerCase().contains(txtFilIden.getText().toLowerCase())&&
catVehModel.get(i).getEstado().toLowerCase().contains(txtFilEstado.getText().toLowerCase())
)
catVeh.add(catVehModel.get(i));
}
binder.loadComponent(listuser);
}
}
public void getUserFromIndex()
{
objUsuarioSistema =(MapUsuarioSistema)Executions.getCurrent().getSession().getAttribute("usuario");
}
public void eliminarCategoria()
{
int respuesta=Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.EliminaCategoria", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.YES|Messagebox.NO,Messagebox.INFORMATION);
if(respuesta ==16)
{
boolean vehExist=false;
DatosDao dat = new DatosDao();
if ( objCategoria.getIdentificador() != null )
{
/*rsInsert=st.executeQuery("select * from vehiculos where ve_categoria = "+ objCategoria.getId_categoria() +";");
while(rsInsert.next())
{
vehExist=true;
}*/
veh= new ArrayList<Vehiculos>();
vehModel= new ArrayList<Vehiculos>();
vehModel = dat.obtieneVehiculoDao(objUsuarioSistema.getUsu_id());
veh = vehModel;
for(int i=0;i<veh.size()&&!vehExist;i++)
{
if(veh.get(i).getCatVeh()==objCategoria.getId_categoria())
vehExist=true;
}
if(!vehExist)
{
System.out.println("objCategoria.getId_categoria(): "+objCategoria.getId_categoria());
dat.eliminarCategoriaDao(objCategoria);
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.RegistroEliminado", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
getCategoria();
binder.loadComponent(listuser);
}
else
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.ErrorRegistroEliminado", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
}
else
{
//valida si user existe
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.NoSeleccionCategoria", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
}
}
}
public void cargarDataModal(){
try{
Perfiles perfil = new Perfiles();
PerfilesDao per= new PerfilesDao();
perfil = per.buscarPerfPorUsuario(_user);
RelPerfilPermisoDAO rpp= new RelPerfilPermisoDAO();
if( (rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.1")&& objCategoria==null)||
(rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.2")&& objCategoria!=null ))
{
int id_usuario=0;
String user=null;
/*Statement st=null;
ResultSet rs=null;
Connection conn= ConexionUtil.getConnection();
st=conn.createStatement();
//rs=st.executeQuery("select id_categoria_vehiculo, descripcion, identificador from categoria_vehiculo ;");
rs=st.executeQuery(" select usu_id,user from usuarios where User = '"+_user+"'");
while(rs.next())
{
id_usuario = rs.getInt(1);
user=rs.getString(2);
}
objCategoria.setIdUser(objUsuarioSistema.getUsu_id());
objCategoria.setUser(objUsuarioSistema.getUser());
System.out.println("objCategoria->>viaja: "+objCategoria.getIdUser()+"-"+objCategoria.getUser());*/
//lista doblemente enlazada
Map<String,CategoriaVehiculo> maCategoria = new HashMap<String,CategoriaVehiculo>();
maCategoria.put("pUsuario", objCategoria);
final Window registro = (Window) Executions.createComponents(
"RegistroCategoria.zul",null, maCategoria);
registro.doModal();
//objCategoria=null;
objCategoria=null;// new CategoriaVehiculo();
getCategoria();
txtFilDes.setText("");
txtFilIden.setText("");
filtraCategoria();
binder.loadComponent(listuser);
}
else
Messagebox.show(ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.NoPermisoOpcion", objUsuarioSistema.getIdioma()),
ReadPropertiesUtil.obtenerProperty("control.CategoriaControl.Atencion", objUsuarioSistema.getIdioma()),
Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
/*
//lista doblemente enlazada
Map<String,FrUsuarios> maUsuario = new HashMap<String,FrUsuarios>();
maUsuario.put("pUsuario", objUsuario);
final Window registro = (Window) Executions.createComponents(
"registra_usuario.zul",null, maUsuario);
registro.doModal();
objUsuario = null;
HibernateSessionFactory.getSession().clear();
Session sess = HibernateSessionFactory.getSession();
UsuarioBo bo = new UsuarioBo();
us = bo.obtenerUsuario(sess);
binder.loadComponent(listuser);
//Poner para que no salga mensaje al cerrar ventana
//System.out.println(objUsuario.getApellido());
registro.setClosable(true);*/
}catch(Exception e){
e.printStackTrace();
}
}
public void cargarDataModal3(){
try{
Perfiles perfil = new Perfiles();
PerfilesDao per= new PerfilesDao();
perfil = per.buscarPerfPorUsuario(_user);
RelPerfilPermisoDAO rpp= new RelPerfilPermisoDAO();
if( (rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.1")&& objCategoria==null)||
(rpp.buscarPermisosDePerfilporIdPermiso(perfil, "2.2")&& objCategoria!=null ))
{
int id_usuario=0;
String user=null;
objCategoria=null;
//lista doblemente enlazada
Map<String,CategoriaVehiculo> maCategoria = new HashMap<String,CategoriaVehiculo>();
maCategoria.put("pUsuario", objCategoria);
final Window registro = (Window) Executions.createComponents(
"RegistroCategoria.zul",null, maCategoria);
registro.doModal();
//objCategoria=null;
objCategoria=null;// new CategoriaVehiculo();
getCategoria();
txtFilDes.setText("");
txtFilIden.setText("");
filtraCategoria();
binder.loadComponent(listuser);
}
else
Messagebox.show("No tiene permisos sobre la opcion","Atención!!!",Messagebox.OK|Messagebox.CANCEL,Messagebox.INFORMATION);
}catch(Exception e){
e.printStackTrace();
}
}
public void cargarDataModal2(){
try{
int id_usuario=0;
String user=null;
objCategoria.setIdUser(objUsuarioSistema.getUsu_id());
objCategoria.setUser(objUsuarioSistema.getUser());
System.out.println("objCategoria->>viaja: "+objCategoria.getIdUser()+"-"+objCategoria.getUser());
//lista doblemente enlazada
Map<String,CategoriaVehiculo> maCategoria = new HashMap<String,CategoriaVehiculo>();
maCategoria.put("pUsuario", objCategoria);
final Window registro = (Window) Executions.createComponents(
"VehiculoCategoria.zul",null, maCategoria);
registro.doModal();
//objCategoria=null;
objCategoria= new CategoriaVehiculo();
getCategoria();
txtFilDes.setText("");
txtFilIden.setText("");
binder.loadComponent(listuser);
}catch(Exception e){
e.printStackTrace();
}
}
public void getCategoria()
{
DatosDao dat = new DatosDao();
int per_id=0;
int usu_id=0;
catVeh= new ArrayList<CategoriaVehiculo>();
catVehModel= new ArrayList<CategoriaVehiculo>();
try{
per_id = objUsuarioSistema.getPer_id();
usu_id = objUsuarioSistema.getUsu_id();
catVehModel = dat.obtenerCatVehDao(objUsuarioSistema);
catVeh = catVehModel;
binder.loadComponent(listuser);
}
catch(Exception e){e.printStackTrace();}
}
public Textbox getTxtFilEstado() {
return txtFilEstado;
}
public void setTxtFilEstado(Textbox txtFilEstado) {
this.txtFilEstado = txtFilEstado;
}
public List<Vehiculos> getVeh() {
return veh;
}
public void setVeh(List<Vehiculos> veh) {
this.veh = veh;
}
public List<Vehiculos> getVehModel() {
return vehModel;
}
public void setVehModel(List<Vehiculos> vehModel) {
this.vehModel = vehModel;
}
public MapUsuarioSistema getObjUsuarioSistema() {
return objUsuarioSistema;
}
public void setObjUsuarioSistema(MapUsuarioSistema objUsuarioSistema) {
this.objUsuarioSistema = objUsuarioSistema;
}
public Textbox getTxtFilDes() {
return txtFilDes;
}
public void setTxtFilDes(Textbox txtFilDes) {
this.txtFilDes = txtFilDes;
}
public Textbox getTxtFilIden() {
return txtFilIden;
}
public void setTxtFilIden(Textbox txtFilIden) {
this.txtFilIden = txtFilIden;
}
public List<CategoriaVehiculo> getCatVehModel() {
return catVehModel;
}
public void setCatVehModel(List<CategoriaVehiculo> catVehModel) {
this.catVehModel = catVehModel;
}
public String get_user() {
return _user;
}
public void set_user(String _user) {
this._user = _user;
}
public CategoriaVehiculo getObjCategoria() {
return objCategoria;
}
public void setObjCategoria(CategoriaVehiculo objCategoria) {
this.objCategoria = objCategoria;
}
public Listbox getListuser() {
return listuser;
}
public void setListuser(Listbox listuser) {
this.listuser = listuser;
}
public AnnotateDataBinder getBinder() {
return binder;
}
public void setBinder(AnnotateDataBinder binder) {
this.binder = binder;
}
public List<CategoriaVehiculo> getCatVeh() {
return catVeh;
}
public void setCatVeh(List<CategoriaVehiculo> catVeh) {
this.catVeh = catVeh;
}
public Listheader getLshAcciones() {
return lshAcciones;
}
public void setLshAcciones(Listheader lshAcciones) {
this.lshAcciones = lshAcciones;
}
public Listheader getLshDescripcion() {
return lshDescripcion;
}
public void setLshDescripcion(Listheader lshDescripcion) {
this.lshDescripcion = lshDescripcion;
}
public Listheader getLshIdentificador() {
return lshIdentificador;
}
public void setLshIdentificador(Listheader lshIdentificador) {
this.lshIdentificador = lshIdentificador;
}
public Listheader getLshEstado() {
return lshEstado;
}
public void setLshEstado(Listheader lshEstado) {
this.lshEstado = lshEstado;
}
public Image getImgEliminar() {
return imgEliminar;
}
public void setImgEliminar(Image imgEliminar) {
this.imgEliminar = imgEliminar;
}
public Image getImgEditar() {
return imgEditar;
}
public void setImgEditar(Image imgEditar) {
this.imgEditar = imgEditar;
}
public Image getImgVerVehiculo() {
return imgVerVehiculo;
}
public void setImgVerVehiculo(Image imgVerVehiculo) {
this.imgVerVehiculo = imgVerVehiculo;
}
}
| 16,505 | 0.691511 | 0.690178 | 567 | 27.10582 | 30.995125 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.204586 | false | false | 12 |
ea0a0072c9f5c2ea2a2e47040694a5e773eebb0e | 9,216,999,873,020 | a927d8c0befc182bd1c5bbb383ba9f700b96e658 | /MaxPointsOnALine/src/MaxPointsOnALine.java | 2a2be631018be5e2390f7c5cbe25796a07953f81 | [] | no_license | yfliu87/LeetCode | https://github.com/yfliu87/LeetCode | f47e303e8c44b5ba0a5ba5412dcc861e48398336 | b3de7e39443e366469a3f394374700123a951251 | refs/heads/master | 2016-09-07T17:13:49.543000 | 2016-05-23T16:09:30 | 2016-05-23T16:09:30 | 35,405,664 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.HashMap;
import java.util.Map;
public class MaxPointsOnALine {
public int maxPoints(Point[] points) {
if (points == null || points.length == 0)
return 0;
Map<Double, Integer> slope = new HashMap<Double, Integer>();
int globalMaxPoints = 0;
for (int indexI = 0; indexI < points.length; indexI++){
Point p = points[indexI];
int duplicate = 1;
int localMaxPoints = 0;
slope.clear();
for (int indexJ = 0; indexJ < points.length; indexJ++){
if (indexJ == indexI)
continue;
Point q = points[indexJ];
if (p.x == q.x && p.y == q.y){
++duplicate;
continue;
}
double gradient = p.x == q.x? Double.MAX_VALUE : (double)(q.y - p.y)/(q.x - p.x);
int previous = slope.containsKey(gradient)? slope.get(gradient) : 0;
slope.put(gradient, previous + 1);
localMaxPoints = Math.max(slope.get(gradient), localMaxPoints);
}
globalMaxPoints = Math.max(globalMaxPoints, localMaxPoints + duplicate);
}
return globalMaxPoints;
}
}
| UTF-8 | Java | 1,266 | java | MaxPointsOnALine.java | Java | [] | null | [] | import java.util.HashMap;
import java.util.Map;
public class MaxPointsOnALine {
public int maxPoints(Point[] points) {
if (points == null || points.length == 0)
return 0;
Map<Double, Integer> slope = new HashMap<Double, Integer>();
int globalMaxPoints = 0;
for (int indexI = 0; indexI < points.length; indexI++){
Point p = points[indexI];
int duplicate = 1;
int localMaxPoints = 0;
slope.clear();
for (int indexJ = 0; indexJ < points.length; indexJ++){
if (indexJ == indexI)
continue;
Point q = points[indexJ];
if (p.x == q.x && p.y == q.y){
++duplicate;
continue;
}
double gradient = p.x == q.x? Double.MAX_VALUE : (double)(q.y - p.y)/(q.x - p.x);
int previous = slope.containsKey(gradient)? slope.get(gradient) : 0;
slope.put(gradient, previous + 1);
localMaxPoints = Math.max(slope.get(gradient), localMaxPoints);
}
globalMaxPoints = Math.max(globalMaxPoints, localMaxPoints + duplicate);
}
return globalMaxPoints;
}
}
| 1,266 | 0.508689 | 0.50158 | 42 | 29.142857 | 23.998583 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.880952 | false | false | 12 |
563d5a1428fe5449ea47a8a8e646493a7a42fab9 | 8,143,258,005,809 | 7ce8dc349e7b86e107f8c50d111bf340cc98798f | /src/main/java/top/atzlt/wordSeg/segmentation/Word.java | d8e78ae8800917e5cadf6eaed7d7b12b581dccb6 | [
"Apache-2.0"
] | permissive | axdii/TrademarkSearchAssistantServer | https://github.com/axdii/TrademarkSearchAssistantServer | 178b4e7dcc189ad3a04f38d0fa299f5751135cd2 | ad37458ffddcc709a4cbb8f4260c4b43e3bfde64 | refs/heads/master | 2022-12-20T07:34:22.053000 | 2019-05-16T13:06:09 | 2019-05-16T13:06:09 | 180,622,037 | 1 | 1 | Apache-2.0 | false | 2022-12-16T04:59:17 | 2019-04-10T16:32:58 | 2021-01-09T08:13:56 | 2022-12-16T04:59:15 | 5,669 | 1 | 1 | 10 | Java | false | false | package top.atzlt.wordSeg.segmentation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
//单词
public class Word implements Comparable{
private static final Logger logger = LoggerFactory.getLogger(Word.class);
private String text;//内容
private PartOfSpeech partOfSpeech = null;//词性
public Word(String text) {
this.text = text;
}
public Word(String text, PartOfSpeech partOfSpeech) {
this.text = text;
this.partOfSpeech = partOfSpeech;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public PartOfSpeech getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(PartOfSpeech partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public int hashCode() {
return Objects.hashCode(this.text);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Word other = (Word) obj;
return Objects.equals(this.text, other.text);
}
@Override
public String toString(){
StringBuilder str = new StringBuilder();
if(text!=null){
str.append(text);
}
if (partOfSpeech != null) {
str.append("(").append(partOfSpeech.getPos()).append(",").append(partOfSpeech.getDes()).append(")");
}
return str.toString();
}
@Override
public int compareTo(Object o) {
if(this == o){
return 0;
}
if(this.text == null){
return -1;
}
if(o == null){
return 1;
}
if(!(o instanceof Word)){
return 1;
}
String t = ((Word)o).getText();
if(t == null){
return 1;
}
return this.text.compareTo(t);
}
}
| UTF-8 | Java | 2,037 | java | Word.java | Java | [] | null | [] | package top.atzlt.wordSeg.segmentation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
//单词
public class Word implements Comparable{
private static final Logger logger = LoggerFactory.getLogger(Word.class);
private String text;//内容
private PartOfSpeech partOfSpeech = null;//词性
public Word(String text) {
this.text = text;
}
public Word(String text, PartOfSpeech partOfSpeech) {
this.text = text;
this.partOfSpeech = partOfSpeech;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public PartOfSpeech getPartOfSpeech() {
return partOfSpeech;
}
public void setPartOfSpeech(PartOfSpeech partOfSpeech) {
this.partOfSpeech = partOfSpeech;
}
@Override
public int hashCode() {
return Objects.hashCode(this.text);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Word other = (Word) obj;
return Objects.equals(this.text, other.text);
}
@Override
public String toString(){
StringBuilder str = new StringBuilder();
if(text!=null){
str.append(text);
}
if (partOfSpeech != null) {
str.append("(").append(partOfSpeech.getPos()).append(",").append(partOfSpeech.getDes()).append(")");
}
return str.toString();
}
@Override
public int compareTo(Object o) {
if(this == o){
return 0;
}
if(this.text == null){
return -1;
}
if(o == null){
return 1;
}
if(!(o instanceof Word)){
return 1;
}
String t = ((Word)o).getText();
if(t == null){
return 1;
}
return this.text.compareTo(t);
}
}
| 2,037 | 0.551605 | 0.548148 | 89 | 21.75281 | 19.407101 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.370787 | false | false | 12 |
07614446e8b1208768bc0e52da06143b3b43425f | 25,005,299,616,756 | 0eb7dcb0459de31871e2357cf5c713a53ea5f015 | /toolbus-ng-argus-viewer/src/argusviewer/view/listeners/IProcessInstanceBreakPointListener.java | e4c96d816833cfe79e25e96b9ef4c22977bbf462 | [] | no_license | cwi-swat/meta-environment | https://github.com/cwi-swat/meta-environment | a87055da2a6825c97c7744cdd84c08d39d9f3f66 | eea9a90fdb52415f43430a89adc7acddba2be0a4 | refs/heads/master | 2021-01-19T08:42:05.812000 | 2012-11-15T14:16:54 | 2012-11-15T14:16:54 | 5,178,544 | 8 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package argusviewer.view.listeners;
import toolbus.process.ProcessInstance;
/**
* Listener for breakpoint adds and removes on process instances.
*
* @author J. van den Bos
* @author T. van Laer
*/
public interface IProcessInstanceBreakPointListener{
/**
* A breakpoint is added in the t-script of the processInstance.
*
* @param processInstance
* The t-script of this process has a new breakpoint.
*/
void addBreakpoint(ProcessInstance processInstance);
/**
* A breakpoint is removed in the t-script of the processInstance.
*
* @param processInstance
* The t-script of this process has its breakpoint removed.
*/
void removeBreakpoint(ProcessInstance processInstance);
}
| UTF-8 | Java | 728 | java | IProcessInstanceBreakPointListener.java | Java | [
{
"context": "s and removes on process instances.\n * \n * @author J. van den Bos\n * @author T. van Laer\n */\npublic interface IProc",
"end": 177,
"score": 0.9998700022697449,
"start": 163,
"tag": "NAME",
"value": "J. van den Bos"
},
{
"context": "nstances.\n * \n * @author J. van ... | null | [] | package argusviewer.view.listeners;
import toolbus.process.ProcessInstance;
/**
* Listener for breakpoint adds and removes on process instances.
*
* @author <NAME>
* @author <NAME>
*/
public interface IProcessInstanceBreakPointListener{
/**
* A breakpoint is added in the t-script of the processInstance.
*
* @param processInstance
* The t-script of this process has a new breakpoint.
*/
void addBreakpoint(ProcessInstance processInstance);
/**
* A breakpoint is removed in the t-script of the processInstance.
*
* @param processInstance
* The t-script of this process has its breakpoint removed.
*/
void removeBreakpoint(ProcessInstance processInstance);
}
| 715 | 0.718407 | 0.718407 | 27 | 25.962963 | 25.809101 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 12 |
54cee8946f371e6147d1bac702ea7472cd6942ef | 13,666,585,954,644 | e108d65747c07078ae7be6dcd6369ac359d098d7 | /org/apache/poi/hssf/usermodel/helpers/HSSFRowShifter.java | fa55902b0a6663db1543a7ecbbc5d43c94047a7d | [
"MIT"
] | permissive | kelu124/pyS3 | https://github.com/kelu124/pyS3 | 50f30b51483bf8f9581427d2a424e239cfce5604 | 86eb139d971921418d6a62af79f2868f9c7704d5 | refs/heads/master | 2020-03-13T01:51:42.054000 | 2018-04-24T21:03:03 | 2018-04-24T21:03:03 | 130,913,008 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.apache.poi.hssf.usermodel.helpers;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.formula.FormulaShifter;
import org.apache.poi.ss.formula.eval.NotImplementedException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.helpers.RowShifter;
import org.apache.poi.util.Internal;
import org.apache.poi.util.NotImplemented;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
public final class HSSFRowShifter extends RowShifter {
private static final POILogger logger = POILogFactory.getLogger(HSSFRowShifter.class);
public HSSFRowShifter(HSSFSheet sh) {
super(sh);
}
@NotImplemented
public void updateNamedRanges(FormulaShifter shifter) {
throw new NotImplementedException("HSSFRowShifter.updateNamedRanges");
}
@NotImplemented
public void updateFormulas(FormulaShifter shifter) {
throw new NotImplementedException("updateFormulas");
}
@Internal
@NotImplemented
public void updateRowFormulas(Row row, FormulaShifter shifter) {
throw new NotImplementedException("updateRowFormulas");
}
@NotImplemented
public void updateConditionalFormatting(FormulaShifter shifter) {
throw new NotImplementedException("updateConditionalFormatting");
}
@NotImplemented
public void updateHyperlinks(FormulaShifter shifter) {
throw new NotImplementedException("updateHyperlinks");
}
}
| UTF-8 | Java | 1,485 | java | HSSFRowShifter.java | Java | [] | null | [] | package org.apache.poi.hssf.usermodel.helpers;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.formula.FormulaShifter;
import org.apache.poi.ss.formula.eval.NotImplementedException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.helpers.RowShifter;
import org.apache.poi.util.Internal;
import org.apache.poi.util.NotImplemented;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
public final class HSSFRowShifter extends RowShifter {
private static final POILogger logger = POILogFactory.getLogger(HSSFRowShifter.class);
public HSSFRowShifter(HSSFSheet sh) {
super(sh);
}
@NotImplemented
public void updateNamedRanges(FormulaShifter shifter) {
throw new NotImplementedException("HSSFRowShifter.updateNamedRanges");
}
@NotImplemented
public void updateFormulas(FormulaShifter shifter) {
throw new NotImplementedException("updateFormulas");
}
@Internal
@NotImplemented
public void updateRowFormulas(Row row, FormulaShifter shifter) {
throw new NotImplementedException("updateRowFormulas");
}
@NotImplemented
public void updateConditionalFormatting(FormulaShifter shifter) {
throw new NotImplementedException("updateConditionalFormatting");
}
@NotImplemented
public void updateHyperlinks(FormulaShifter shifter) {
throw new NotImplementedException("updateHyperlinks");
}
}
| 1,485 | 0.762963 | 0.762963 | 45 | 32 | 26.782249 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 12 |
bfb49d16b8e4b295eb1107d36d8ab47e9bb61018 | 32,521,492,375,339 | d68b23a8af66b07f6e443e1ad485fa16150b0dc0 | /csharp-psi-impl/src/main/java/consulo/csharp/lang/impl/psi/msil/MsilMethodAsCSharpConversionMethodDeclaration.java | 730857acef0b15d189d966f1b315a570d5c1ff8f | [
"Apache-2.0"
] | permissive | consulo/consulo-csharp | https://github.com/consulo/consulo-csharp | 34e1f591b31411cfa4ac6b96e82522e5ffbf80ad | ccb078d27b4ba37be9bb3f2c258aad9fb152a640 | refs/heads/master | 2023-08-31T16:12:36.841000 | 2023-08-17T10:56:13 | 2023-08-17T10:56:13 | 21,350,424 | 51 | 9 | Apache-2.0 | false | 2023-01-01T16:33:23 | 2014-06-30T12:35:16 | 2022-05-13T07:07:55 | 2023-01-01T16:33:22 | 12,676 | 51 | 5 | 52 | Java | false | false | /*
* Copyright 2013-2017 consulo.io
*
* 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 consulo.csharp.lang.impl.psi.msil;
import consulo.annotation.access.RequiredReadAction;
import consulo.application.util.NotNullLazyValue;
import consulo.csharp.lang.impl.psi.CSharpElementVisitor;
import consulo.csharp.lang.impl.psi.source.resolve.type.CSharpStaticTypeRef;
import consulo.csharp.lang.psi.CSharpConversionMethodDeclaration;
import consulo.dotnet.psi.DotNetType;
import consulo.dotnet.psi.resolve.DotNetTypeRef;
import consulo.language.psi.PsiElement;
import consulo.msil.lang.psi.MsilMethodEntry;
import consulo.util.lang.Comparing;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* @author VISTALL
* @since 13.06.14
*/
public class MsilMethodAsCSharpConversionMethodDeclaration extends MsilMethodAsCSharpLikeMethodDeclaration implements CSharpConversionMethodDeclaration
{
private final NotNullLazyValue<DotNetTypeRef> myReturnTypeRefValue;
public MsilMethodAsCSharpConversionMethodDeclaration(PsiElement parent, MsilMethodEntry methodEntry)
{
super(parent, methodEntry);
myReturnTypeRefValue = NotNullLazyValue.createValue(() -> MsilToCSharpUtil.extractToCSharp(myOriginal.getReturnTypeRef()));
}
@Override
public String getName()
{
return isImplicit() ? "<implicit>" : "<explicit>";
}
@Override
public void accept(@Nonnull CSharpElementVisitor visitor)
{
visitor.visitConversionMethodDeclaration(this);
}
@RequiredReadAction
@Nonnull
@Override
public DotNetTypeRef getReturnTypeRef()
{
return myReturnTypeRefValue.getValue();
}
@Override
public boolean isImplicit()
{
if(Comparing.equal(myOriginal.getName(), "op_Explicit"))
{
return false;
}
else if(Comparing.equal(myOriginal.getName(), "op_Implicit"))
{
return true;
}
else
{
throw new IllegalArgumentException(myOriginal.getName());
}
}
@Nonnull
@Override
public DotNetTypeRef getConversionTypeRef()
{
if(isImplicit())
{
return CSharpStaticTypeRef.IMPLICIT;
}
else
{
return CSharpStaticTypeRef.EXPLICIT;
}
}
@Nullable
@Override
public DotNetType getConversionType()
{
return null;
}
@Nullable
@Override
public PsiElement getOperatorElement()
{
return null;
}
@Nullable
@Override
protected Class<? extends PsiElement> getNavigationElementClass()
{
return CSharpConversionMethodDeclaration.class;
}
}
| UTF-8 | Java | 2,916 | java | MsilMethodAsCSharpConversionMethodDeclaration.java | Java | [
{
"context": "\nimport javax.annotation.Nullable;\n\n/**\n * @author VISTALL\n * @since 13.06.14\n */\npublic class MsilMethodAsC",
"end": 1244,
"score": 0.9970250725746155,
"start": 1237,
"tag": "NAME",
"value": "VISTALL"
}
] | null | [] | /*
* Copyright 2013-2017 consulo.io
*
* 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 consulo.csharp.lang.impl.psi.msil;
import consulo.annotation.access.RequiredReadAction;
import consulo.application.util.NotNullLazyValue;
import consulo.csharp.lang.impl.psi.CSharpElementVisitor;
import consulo.csharp.lang.impl.psi.source.resolve.type.CSharpStaticTypeRef;
import consulo.csharp.lang.psi.CSharpConversionMethodDeclaration;
import consulo.dotnet.psi.DotNetType;
import consulo.dotnet.psi.resolve.DotNetTypeRef;
import consulo.language.psi.PsiElement;
import consulo.msil.lang.psi.MsilMethodEntry;
import consulo.util.lang.Comparing;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* @author VISTALL
* @since 13.06.14
*/
public class MsilMethodAsCSharpConversionMethodDeclaration extends MsilMethodAsCSharpLikeMethodDeclaration implements CSharpConversionMethodDeclaration
{
private final NotNullLazyValue<DotNetTypeRef> myReturnTypeRefValue;
public MsilMethodAsCSharpConversionMethodDeclaration(PsiElement parent, MsilMethodEntry methodEntry)
{
super(parent, methodEntry);
myReturnTypeRefValue = NotNullLazyValue.createValue(() -> MsilToCSharpUtil.extractToCSharp(myOriginal.getReturnTypeRef()));
}
@Override
public String getName()
{
return isImplicit() ? "<implicit>" : "<explicit>";
}
@Override
public void accept(@Nonnull CSharpElementVisitor visitor)
{
visitor.visitConversionMethodDeclaration(this);
}
@RequiredReadAction
@Nonnull
@Override
public DotNetTypeRef getReturnTypeRef()
{
return myReturnTypeRefValue.getValue();
}
@Override
public boolean isImplicit()
{
if(Comparing.equal(myOriginal.getName(), "op_Explicit"))
{
return false;
}
else if(Comparing.equal(myOriginal.getName(), "op_Implicit"))
{
return true;
}
else
{
throw new IllegalArgumentException(myOriginal.getName());
}
}
@Nonnull
@Override
public DotNetTypeRef getConversionTypeRef()
{
if(isImplicit())
{
return CSharpStaticTypeRef.IMPLICIT;
}
else
{
return CSharpStaticTypeRef.EXPLICIT;
}
}
@Nullable
@Override
public DotNetType getConversionType()
{
return null;
}
@Nullable
@Override
public PsiElement getOperatorElement()
{
return null;
}
@Nullable
@Override
protected Class<? extends PsiElement> getNavigationElementClass()
{
return CSharpConversionMethodDeclaration.class;
}
}
| 2,916 | 0.772977 | 0.766804 | 118 | 23.711864 | 28.495049 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.177966 | false | false | 12 |
28e694dad0c479c3f776eb69300e9ccd7ba467b2 | 6,725,918,788,544 | e307fe02e31c0fe90e6547debec8c5a5d3486179 | /src/main/java/bank/Account.java | ade2d35e9b1a6a0958813b646e9b6d27f0816a45 | [
"MIT"
] | permissive | wojtekPi/TDD-training8 | https://github.com/wojtekPi/TDD-training8 | a9d2250fae5fe10f93d761931340ab3352f97a65 | 718b76711940fcc2fe5406e0c10eb0d5caba1575 | refs/heads/master | 2021-04-06T02:26:19.069000 | 2018-03-21T19:59:07 | 2018-03-21T19:59:07 | 125,282,925 | 0 | 1 | MIT | false | 2018-04-16T15:59:53 | 2018-03-14T22:42:41 | 2018-03-21T19:59:10 | 2018-03-25T17:14:08 | 40 | 0 | 1 | 8 | Java | false | null | package bank;
public class Account {
private String id;
private Instrument balance;
public Account(String id, int balance, Currency curr) {
this.id = id;
this.balance = new Instrument(curr, balance);
}
public Account(String id, Instrument balance) {
this.id = id;
this.balance = balance;
}
public Instrument getBalance() {
return balance;
}
public void setBalance(int amount) {
this.balance.setAmount( amount);
}
}
| UTF-8 | Java | 513 | java | Account.java | Java | [] | null | [] | package bank;
public class Account {
private String id;
private Instrument balance;
public Account(String id, int balance, Currency curr) {
this.id = id;
this.balance = new Instrument(curr, balance);
}
public Account(String id, Instrument balance) {
this.id = id;
this.balance = balance;
}
public Instrument getBalance() {
return balance;
}
public void setBalance(int amount) {
this.balance.setAmount( amount);
}
}
| 513 | 0.608187 | 0.608187 | 27 | 18 | 18.553226 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481481 | false | false | 12 |
88fb0ecece2e569e45b3db14e2a910bcea018384 | 29,695,403,884,602 | 239994fd79fdec7a4184db3e230828b8347dd997 | /FEX/Timer.java | 853cf3922f01380ae4a0bada8d416bbef9a50ced | [] | no_license | ClericX/Projects | https://github.com/ClericX/Projects | bd0944c6994658b539b61ae90580ee0db440f84c | 9c705315cb16d42a0116f88f156fb748ca46ccfc | refs/heads/master | 2021-01-01T19:42:21.981000 | 2013-03-16T15:49:00 | 2013-03-16T15:49:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package frostfe;
public class Timer
{
public static double LastTime = 0;
public static double CurrentTime = 0;
public static double ElapsedTime = 0;
public static double GetTimeMilliseconds()
{
return System.nanoTime() / 1000000.0;
}
public static double GetElapsedMilliseconds()
{
return ElapsedTime;
}
public static void Update()
{
CurrentTime = GetTimeMilliseconds();
ElapsedTime = (CurrentTime - LastTime);
LastTime = CurrentTime;
}
public static void Initialize()
{
Update();
ElapsedTime = 0;
}
}
| UTF-8 | Java | 640 | java | Timer.java | Java | [] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package frostfe;
public class Timer
{
public static double LastTime = 0;
public static double CurrentTime = 0;
public static double ElapsedTime = 0;
public static double GetTimeMilliseconds()
{
return System.nanoTime() / 1000000.0;
}
public static double GetElapsedMilliseconds()
{
return ElapsedTime;
}
public static void Update()
{
CurrentTime = GetTimeMilliseconds();
ElapsedTime = (CurrentTime - LastTime);
LastTime = CurrentTime;
}
public static void Initialize()
{
Update();
ElapsedTime = 0;
}
}
| 640 | 0.707812 | 0.689062 | 35 | 17.285715 | 17.271894 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.314286 | false | false | 12 |
ff07b8a66a0d6a78a50b00587f1f0f39a7349b4d | 26,104,811,292,149 | 43fe756ee076b3bd6cef33aaca9616203d616100 | /src/main/java/com/iheyday/service/nybank/util/CheckSignMessageUtil.java | aeb3265f1210beabf4254250aed37064b4e9f381 | [] | no_license | DongyeBaima/Finance-maven | https://github.com/DongyeBaima/Finance-maven | 0a0d7082f31ad271587f236461449167fb84b851 | ea8f3c04398b61f4c5830258f1146e9e80a6505e | refs/heads/master | 2018-09-19T06:09:38.440000 | 2017-06-08T00:28:26 | 2017-06-08T00:28:26 | 93,691,250 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iheyday.service.nybank.util;
import java.io.UnsupportedEncodingException;
import org.apache.mina.util.Base64;
import signatureAndVerification.MD5Utils;
import signatureAndVerification.RSAUtils;
/**@Description:验签
* @author: 20151020
* @version: 1.0
* @date: 2015年12月7日 下午6:41:25
*/
public class CheckSignMessageUtil {
public static boolean CheckSignMessage(String content) throws UnsupportedEncodingException, Exception{
String signmsg = SubStringCenter(content,"<SIGN_MSG>","</SIGN_MSG>");
content = content.replace("<SIGN_MSG>" + signmsg + "</SIGN_MSG>","<SIGN_MSG></SIGN_MSG>");
String publicKey = ReadFileConfigUtil.getNyBankpublicKey();
//解密验签方式
byte[] signBytes = Base64.decodeBase64(signmsg.getBytes());
String recMD5Msg = new String(RSAUtils.decryptByPublicKey(signBytes, publicKey), "UTF-8");
String md5Msg = MD5Utils.getMd5(content);
System.out.println("验签 valify:" + md5Msg.equals(recMD5Msg));
return md5Msg.equals(recMD5Msg);
}
public static String SubStringCenter(String reqMessage,String str1,String str2){
int indexbegin=reqMessage.indexOf(str1);
int indexend=reqMessage.indexOf(str2);
return reqMessage.substring(indexbegin+str1.length(), indexend);
}
public static void main(String[] args) throws UnsupportedEncodingException, Exception {
//String signmsg = "";
String content = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><SDOROOT>"
+ "<SYS_HEAD><CONSUMER_SEQ_NO>0101062015120761587600</CONSUMER_SEQ_NO><SERVICE_CODE>PTP1002</SERVICE_CODE>"
+ "<SERVICE_SCENE>01</SERVICE_SCENE><TRAN_DATE>20151207</TRAN_DATE><TRAN_TIMESTAMP>203955</TRAN_TIMESTAMP>"
+ "<SIGN_MSG>TU5ttfUURT2Vwr0kz3SCLZpLMRMYvNf0RtCx8nO68c22IvRJAGn0n7kI/Z7r/tx64ifr2zXSz3H/1ud7nK7a0Auq/ACBi6NRWzhOC3kJxZ51J+vX2WkSHf3qrabiofJ31n/Sc0Fh+DVFVzAzp7g6OVHyTvo9wmTxN3/z9Rw1KOM=</SIGN_MSG>"
+ "</SYS_HEAD><APP_HEAD><CHANNEL_CODE>PTP0000004</CHANNEL_CODE></APP_HEAD>"
+ "<BODY><ERROR_CODE>0000</ERROR_CODE><ERROR_MSG>交易成功</ERROR_MSG></BODY></SDOROOT>";
boolean result = CheckSignMessage(content);
System.out.println(result);
}
}
| GB18030 | Java | 2,160 | java | CheckSignMessageUtil.java | Java | [
{
"context": "ication.RSAUtils;\n\n/**@Description:验签\n * @author: 20151020\n * @version: 1.0\n * @date: 2015年12月7日 下午6:41:25\n ",
"end": 249,
"score": 0.9990500807762146,
"start": 241,
"tag": "USERNAME",
"value": "20151020"
}
] | null | [] | package com.iheyday.service.nybank.util;
import java.io.UnsupportedEncodingException;
import org.apache.mina.util.Base64;
import signatureAndVerification.MD5Utils;
import signatureAndVerification.RSAUtils;
/**@Description:验签
* @author: 20151020
* @version: 1.0
* @date: 2015年12月7日 下午6:41:25
*/
public class CheckSignMessageUtil {
public static boolean CheckSignMessage(String content) throws UnsupportedEncodingException, Exception{
String signmsg = SubStringCenter(content,"<SIGN_MSG>","</SIGN_MSG>");
content = content.replace("<SIGN_MSG>" + signmsg + "</SIGN_MSG>","<SIGN_MSG></SIGN_MSG>");
String publicKey = ReadFileConfigUtil.getNyBankpublicKey();
//解密验签方式
byte[] signBytes = Base64.decodeBase64(signmsg.getBytes());
String recMD5Msg = new String(RSAUtils.decryptByPublicKey(signBytes, publicKey), "UTF-8");
String md5Msg = MD5Utils.getMd5(content);
System.out.println("验签 valify:" + md5Msg.equals(recMD5Msg));
return md5Msg.equals(recMD5Msg);
}
public static String SubStringCenter(String reqMessage,String str1,String str2){
int indexbegin=reqMessage.indexOf(str1);
int indexend=reqMessage.indexOf(str2);
return reqMessage.substring(indexbegin+str1.length(), indexend);
}
public static void main(String[] args) throws UnsupportedEncodingException, Exception {
//String signmsg = "";
String content = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><SDOROOT>"
+ "<SYS_HEAD><CONSUMER_SEQ_NO>0101062015120761587600</CONSUMER_SEQ_NO><SERVICE_CODE>PTP1002</SERVICE_CODE>"
+ "<SERVICE_SCENE>01</SERVICE_SCENE><TRAN_DATE>20151207</TRAN_DATE><TRAN_TIMESTAMP>203955</TRAN_TIMESTAMP>"
+ "<SIGN_MSG>TU5ttfUURT2Vwr0kz3SCLZpLMRMYvNf0RtCx8nO68c22IvRJAGn0n7kI/Z7r/tx64ifr2zXSz3H/1ud7nK7a0Auq/ACBi6NRWzhOC3kJxZ51J+vX2WkSHf3qrabiofJ31n/Sc0Fh+DVFVzAzp7g6OVHyTvo9wmTxN3/z9Rw1KOM=</SIGN_MSG>"
+ "</SYS_HEAD><APP_HEAD><CHANNEL_CODE>PTP0000004</CHANNEL_CODE></APP_HEAD>"
+ "<BODY><ERROR_CODE>0000</ERROR_CODE><ERROR_MSG>交易成功</ERROR_MSG></BODY></SDOROOT>";
boolean result = CheckSignMessage(content);
System.out.println(result);
}
}
| 2,160 | 0.740811 | 0.677191 | 52 | 39.807693 | 41.037525 | 201 | false | false | 0 | 0 | 0 | 0 | 172 | 0.081056 | 1.846154 | false | false | 12 |
a5241d3f810350b33bcfa38be82d0d916af2f380 | 6,073,083,801,359 | a4c54cd34d829734b0c0220853fc52e44575aab8 | /src/main/java/com/financekeeper/web/controller/user/AdminController.java | b3a24eb5f608cf2b505be368681871ce8c8176ee | [] | no_license | OdysseusLaertiades/PersonalFinance | https://github.com/OdysseusLaertiades/PersonalFinance | b324063a868d98ea31fbf7e9b318c298e2ef4e62 | 128456f576160313addc2eb908f1b135b86c3b1b | refs/heads/master | 2018-02-08T14:21:30.426000 | 2017-09-21T13:09:13 | 2017-09-21T13:09:13 | 94,765,721 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.financekeeper.web.controller.user;
import com.financekeeper.model.User;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.support.SessionStatus;
import javax.validation.Valid;
import java.util.List;
/**
* Odysseus
* 16.08.2017
*/
@RestController
@RequestMapping("/admin/users")
public class AdminController extends UsersRootController {
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<User> getAll() {
return super.loadAllUsers();
}
@RequestMapping(value="/{id}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public User load(@PathVariable("id") int id){
return super.loadUser(id);
}
@RequestMapping(value="/save", method = RequestMethod.POST)
public void createOrUpdate(@Valid User user, BindingResult result, SessionStatus status) {
if (result.hasErrors()) {
throw LOGGER.getValidationException(result);
} else {
status.setComplete();
if (user.getId() == 0) {
super.createUser(user);
} else {
super.updateUser(user);
}
}
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void delete(@PathVariable("id") int id) {
super.deleteUser(id);
}
@RequestMapping(value="/{id}/enable", method = RequestMethod.POST)
public void enable(@PathVariable("id") int id, @RequestParam("enabled") boolean enabled){
super.activateUser(id,enabled);
}
}
| UTF-8 | Java | 1,958 | java | AdminController.java | Java | [
{
"context": "x.validation.Valid;\nimport java.util.List;\n\n/**\n * Odysseus\n * 16.08.2017\n */\n@RestController\n@RequestMapping",
"end": 621,
"score": 0.9892686605453491,
"start": 613,
"tag": "USERNAME",
"value": "Odysseus"
}
] | null | [] | package com.financekeeper.web.controller.user;
import com.financekeeper.model.User;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.support.SessionStatus;
import javax.validation.Valid;
import java.util.List;
/**
* Odysseus
* 16.08.2017
*/
@RestController
@RequestMapping("/admin/users")
public class AdminController extends UsersRootController {
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<User> getAll() {
return super.loadAllUsers();
}
@RequestMapping(value="/{id}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public User load(@PathVariable("id") int id){
return super.loadUser(id);
}
@RequestMapping(value="/save", method = RequestMethod.POST)
public void createOrUpdate(@Valid User user, BindingResult result, SessionStatus status) {
if (result.hasErrors()) {
throw LOGGER.getValidationException(result);
} else {
status.setComplete();
if (user.getId() == 0) {
super.createUser(user);
} else {
super.updateUser(user);
}
}
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public void delete(@PathVariable("id") int id) {
super.deleteUser(id);
}
@RequestMapping(value="/{id}/enable", method = RequestMethod.POST)
public void enable(@PathVariable("id") int id, @RequestParam("enabled") boolean enabled){
super.activateUser(id,enabled);
}
}
| 1,958 | 0.699694 | 0.695097 | 57 | 33.350876 | 28.055391 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 12 |
33125e85eebbc0b7e108eb81e880ac5bd119d729 | 22,548,578,337,882 | 95056bff1a9783686899955461975a5644c2c7d2 | /MJCompiler/src/rs/ac/bg/etf/pp1/CounterVisitor.java | 7989af16c83329bfa3f097965829486138aa798b | [] | no_license | zorana-jankovic/mj-compiler | https://github.com/zorana-jankovic/mj-compiler | 0f28939ae76f0d023bb1d23712cc7e31304d0a07 | 5da60daeda2cc5bb4f20c6d9722621d04ac5f39e | refs/heads/main | 2023-03-17T23:05:13.736000 | 2021-03-03T02:21:54 | 2021-03-03T02:21:54 | 343,973,890 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package rs.ac.bg.etf.pp1;
import rs.ac.bg.etf.pp1.ast.FormalParamDecl;
import rs.ac.bg.etf.pp1.ast.FormalParamDeclBraces;
import rs.ac.bg.etf.pp1.ast.FormalParamDeclNoBraces;
import rs.ac.bg.etf.pp1.ast.VarDecl;
import rs.ac.bg.etf.pp1.ast.VarDeclElem;
import rs.ac.bg.etf.pp1.ast.VarDeclElemBraces;
import rs.ac.bg.etf.pp1.ast.VarDeclElemNoBraces;
import rs.ac.bg.etf.pp1.ast.VisitorAdaptor;
public class CounterVisitor extends VisitorAdaptor {
protected int count;
public int getCount() {
return count;
}
public static class FormParamCounter extends CounterVisitor{
public void visit(FormalParamDeclBraces formalParamDecl) {
count++;
}
public void visit(FormalParamDeclNoBraces formalParamDecl) {
count++;
}
}
public static class VarCounter extends CounterVisitor{
public void visit(VarDeclElemBraces varDeclElem) {
count++;
}
public void visit(VarDeclElemNoBraces varDeclElem) {
count++;
}
}
}
| UTF-8 | Java | 1,001 | java | CounterVisitor.java | Java | [] | null | [] | package rs.ac.bg.etf.pp1;
import rs.ac.bg.etf.pp1.ast.FormalParamDecl;
import rs.ac.bg.etf.pp1.ast.FormalParamDeclBraces;
import rs.ac.bg.etf.pp1.ast.FormalParamDeclNoBraces;
import rs.ac.bg.etf.pp1.ast.VarDecl;
import rs.ac.bg.etf.pp1.ast.VarDeclElem;
import rs.ac.bg.etf.pp1.ast.VarDeclElemBraces;
import rs.ac.bg.etf.pp1.ast.VarDeclElemNoBraces;
import rs.ac.bg.etf.pp1.ast.VisitorAdaptor;
public class CounterVisitor extends VisitorAdaptor {
protected int count;
public int getCount() {
return count;
}
public static class FormParamCounter extends CounterVisitor{
public void visit(FormalParamDeclBraces formalParamDecl) {
count++;
}
public void visit(FormalParamDeclNoBraces formalParamDecl) {
count++;
}
}
public static class VarCounter extends CounterVisitor{
public void visit(VarDeclElemBraces varDeclElem) {
count++;
}
public void visit(VarDeclElemNoBraces varDeclElem) {
count++;
}
}
}
| 1,001 | 0.718282 | 0.709291 | 44 | 20.75 | 22.508711 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.409091 | false | false | 12 |
a21e71d50b1c26c1ca9dcc5943c0346783356cd5 | 9,758,165,712,802 | 6d40ffc505568fd4b34e87783e832cf78530d3de | /core/src/main/java/org/axonframework/queryhandling/SimpleQueryBus.java | 73386927dc0acc72ae64860584122bb4956a1dda | [
"Apache-2.0"
] | permissive | jenniferlawl/AxonFramework | https://github.com/jenniferlawl/AxonFramework | 0a6dbd5fd850190d5d8e5917404818f2119d0f87 | 8fdc4093bc99b6258299b2dbc7106e711f8c1779 | refs/heads/master | 2021-08-18T16:59:16.827000 | 2017-11-23T09:47:01 | 2017-11-23T09:47:01 | 111,807,786 | 1 | 0 | null | true | 2017-11-23T12:38:58 | 2017-11-23T12:38:58 | 2017-11-23T12:38:54 | 2017-11-23T10:55:03 | 21,761 | 0 | 0 | 0 | null | false | null | /*
* Copyright (c) 2010-2017. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.axonframework.queryhandling;
import org.axonframework.common.Registration;
import org.axonframework.common.transaction.TransactionManager;
import org.axonframework.messaging.DefaultInterceptorChain;
import org.axonframework.messaging.MessageDispatchInterceptor;
import org.axonframework.messaging.MessageHandler;
import org.axonframework.messaging.MessageHandlerInterceptor;
import org.axonframework.messaging.interceptors.TransactionManagingInterceptor;
import org.axonframework.messaging.unitofwork.DefaultUnitOfWork;
import org.axonframework.messaging.unitofwork.UnitOfWork;
import org.axonframework.monitoring.MessageMonitor;
import org.axonframework.monitoring.NoOpMessageMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Consumer;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static java.text.MessageFormat.format;
import static org.axonframework.common.ObjectUtils.getOrDefault;
/**
* Implementation of the QueryBus that dispatches queries to the handlers within the JVM. Any timeouts are ignored by
* this implementation, as handlers are considered to answer immediately.
* <p>
* In case multiple handlers are registered for the same query and response type, the {@link #query(QueryMessage)}
* method will invoke one of these handlers. Which one is unspecified.
*
* @author Marc Gathier
* @since 3.1
*/
public class SimpleQueryBus implements QueryBus {
private static final Logger logger = LoggerFactory.getLogger(SimpleQueryBus.class);
private final ConcurrentMap<QueryDefinition, Set<MessageHandler<? super QueryMessage<?, ?>>>> subscriptions = new ConcurrentHashMap<>();
private final MessageMonitor<? super QueryMessage<?, ?>> messageMonitor;
private final QueryInvocationErrorHandler errorHandler;
private final List<MessageHandlerInterceptor<? super QueryMessage<?, ?>>> handlerInterceptors = new CopyOnWriteArrayList<>();
private final List<MessageDispatchInterceptor<? super QueryMessage<?, ?>>> dispatchInterceptors = new CopyOnWriteArrayList<>();
/**
* Initialize the query bus without monitoring on messages and a {@link LoggingQueryInvocationErrorHandler}.
*/
public SimpleQueryBus() {
this(NoOpMessageMonitor.INSTANCE, null, null);
}
/**
* Initialize the query bus using given {@code transactionManager} to manage transactions around query execution
* with. No monitoring is applied to messages and a {@link LoggingQueryInvocationErrorHandler} is used
* to log errors on handlers during a scatter-gather query.
*
* @param transactionManager The transaction manager to manage transactions around query execution with
*/
public SimpleQueryBus(TransactionManager transactionManager) {
this(NoOpMessageMonitor.INSTANCE, transactionManager, null);
}
/**
* Initialize the query bus with the given {@code messageMonitor} and given {@code errorHandler}.
*
* @param messageMonitor The message monitor notified for incoming messages and their result
* @param transactionManager The transaction manager to manage transactions around query execution with
* @param errorHandler The error handler to invoke when query handler report an error
*/
public SimpleQueryBus(MessageMonitor<? super QueryMessage<?, ?>> messageMonitor,
TransactionManager transactionManager,
QueryInvocationErrorHandler errorHandler) {
this.messageMonitor = messageMonitor;
this.errorHandler = getOrDefault(errorHandler, () -> new LoggingQueryInvocationErrorHandler(logger));
if (transactionManager != null) {
registerHandlerInterceptor(new TransactionManagingInterceptor<>(transactionManager));
}
}
@SuppressWarnings("unchecked")
@Override
public <R> Registration subscribe(String queryName, Class<R> responseType, MessageHandler<? super QueryMessage<?, R>> handler) {
QueryDefinition registrationKey = new QueryDefinition(queryName, responseType);
subscriptions.computeIfAbsent(registrationKey, (k) -> new CopyOnWriteArraySet<>()).add((MessageHandler<? super QueryMessage<?, ?>>) handler);
return () -> unsubscribe(registrationKey, (MessageHandler<? super QueryMessage<?, ?>>) handler);
}
@Override
public <Q, R> CompletableFuture<R> query(QueryMessage<Q, R> query) {
MessageMonitor.MonitorCallback monitorCallback = messageMonitor.onMessageIngested(query);
QueryMessage<Q, R> interceptedQuery = intercept(query);
CompletableFuture<R> completableFuture = new CompletableFuture<>();
Set<MessageHandler<? super QueryMessage<?, ?>>> handlers = getHandlersForMessage(interceptedQuery);
try {
if (handlers.isEmpty()) {
throw new NoHandlerForQueryException(format("No handler found for %s with response name %s",
interceptedQuery.getQueryName(),
interceptedQuery.getResponseType()));
}
DefaultUnitOfWork<QueryMessage<Q, R>> uow = DefaultUnitOfWork.startAndGet(interceptedQuery);
completableFuture.complete(interceptAndInvoke(uow, handlers.iterator().next()));
monitorCallback.reportSuccess();
} catch (Exception e) {
completableFuture.completeExceptionally(e);
monitorCallback.reportFailure(e);
}
return completableFuture;
}
@Override
public <Q, R> Stream<R> queryAll(QueryMessage<Q, R> query, long timeout, TimeUnit unit) {
MessageMonitor.MonitorCallback monitorCallback = messageMonitor.onMessageIngested(query);
QueryMessage<Q, R> interceptedQuery = intercept(query);
Set<MessageHandler<? super QueryMessage<?, ?>>> handlers = getHandlersForMessage(interceptedQuery);
if (handlers.isEmpty()) {
monitorCallback.reportIgnored();
return Stream.empty();
}
return StreamSupport.stream(new Spliterators.AbstractSpliterator<R>(handlers.size(), Spliterator.SIZED) {
final Iterator<MessageHandler<? super QueryMessage<?, ?>>> handlerIterator = handlers.iterator();
@SuppressWarnings("unchecked")
public boolean tryAdvance(Consumer<? super R> action) {
while (handlerIterator.hasNext()) {
MessageHandler<? super QueryMessage<?, ?>> handler = handlerIterator.next();
try {
action.accept(interceptAndInvoke(DefaultUnitOfWork.startAndGet(interceptedQuery), handler));
monitorCallback.reportSuccess();
return true;
} catch (Exception e) {
monitorCallback.reportFailure(e);
errorHandler.onError(e, interceptedQuery, handler);
}
}
return false;
}
}, false);
}
@SuppressWarnings("unchecked")
private <Q, R> R interceptAndInvoke(UnitOfWork<QueryMessage<Q, R>> uow, MessageHandler<? super QueryMessage<?, ?>> handler) throws Exception {
return uow.executeWithResult(() -> (R) new DefaultInterceptorChain<>(uow, handlerInterceptors, handler).proceed());
}
@SuppressWarnings("unchecked")
private <Q, R> QueryMessage<Q, R> intercept(QueryMessage<Q, R> query) {
QueryMessage<Q, R> intercepted = query;
for (MessageDispatchInterceptor<? super QueryMessage<?, ?>> interceptor : dispatchInterceptors) {
intercepted = (QueryMessage<Q, R>) interceptor.handle(intercepted);
}
return intercepted;
}
private boolean unsubscribe(QueryDefinition registrationKey, MessageHandler<? super QueryMessage<?, ?>> handler) {
subscriptions.computeIfPresent(registrationKey, (key, handlers) -> {
handlers.remove(handler);
if (handlers.isEmpty()) {
return null;
}
return handlers;
});
return true;
}
/**
* Returns the subscriptions for this query bus. While the returned map is unmodifiable, it may or may not reflect
* changes made to the subscriptions after the call was made.
*
* @return the subscriptions for this query bus
*/
protected Map<QueryDefinition, Set<MessageHandler<? super QueryMessage<?, ?>>>> getSubscriptions() {
return Collections.unmodifiableMap(subscriptions);
}
/**
* Registers an interceptor that is used to intercept Queries before they are passed to their
* respective handlers. The interceptor is invoked separately for each handler instance (in a separate unit of work).
*
* @param interceptor the interceptor to invoke before passing a Query to the handler
*/
public void registerHandlerInterceptor(MessageHandlerInterceptor<QueryMessage<?, ?>> interceptor) {
this.handlerInterceptors.add(interceptor);
}
/**
* Registers an interceptor that intercepts Queries as they are sent. Each interceptor is called
* once, regardless of the type of query (point-to-point or scatter-gather) executed.
*
* @param interceptor the interceptor to invoke when sending a Query
*/
public void registerDispatchInterceptor(MessageDispatchInterceptor<QueryMessage<?, ?>> interceptor) {
this.dispatchInterceptors.add(interceptor);
}
private <Q, R> Set<MessageHandler<? super QueryMessage<?, ?>>> getHandlersForMessage(QueryMessage<Q, R> queryMessage) {
return subscriptions.getOrDefault(new QueryDefinition(queryMessage.getQueryName(), queryMessage.getResponseType()),
Collections.emptySet());
}
private static class QueryDefinition {
private final String queryName;
private final Class<?> responseType;
private QueryDefinition(String queryName, Class<?> responseType) {
this.queryName = queryName;
this.responseType = responseType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof QueryDefinition)) {
return false;
}
QueryDefinition that = (QueryDefinition) o;
return Objects.equals(queryName, that.queryName) &&
Objects.equals(responseType, that.responseType);
}
@Override
public int hashCode() {
return Objects.hash(queryName, responseType);
}
}
}
| UTF-8 | Java | 11,409 | java | SimpleQueryBus.java | Java | [
{
"context": " handlers. Which one is unspecified.\n *\n * @author Marc Gathier\n * @since 3.1\n */\npublic class SimpleQueryBus imp",
"end": 2051,
"score": 0.9998549222946167,
"start": 2039,
"tag": "NAME",
"value": "Marc Gathier"
}
] | null | [] | /*
* Copyright (c) 2010-2017. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.axonframework.queryhandling;
import org.axonframework.common.Registration;
import org.axonframework.common.transaction.TransactionManager;
import org.axonframework.messaging.DefaultInterceptorChain;
import org.axonframework.messaging.MessageDispatchInterceptor;
import org.axonframework.messaging.MessageHandler;
import org.axonframework.messaging.MessageHandlerInterceptor;
import org.axonframework.messaging.interceptors.TransactionManagingInterceptor;
import org.axonframework.messaging.unitofwork.DefaultUnitOfWork;
import org.axonframework.messaging.unitofwork.UnitOfWork;
import org.axonframework.monitoring.MessageMonitor;
import org.axonframework.monitoring.NoOpMessageMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Consumer;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static java.text.MessageFormat.format;
import static org.axonframework.common.ObjectUtils.getOrDefault;
/**
* Implementation of the QueryBus that dispatches queries to the handlers within the JVM. Any timeouts are ignored by
* this implementation, as handlers are considered to answer immediately.
* <p>
* In case multiple handlers are registered for the same query and response type, the {@link #query(QueryMessage)}
* method will invoke one of these handlers. Which one is unspecified.
*
* @author <NAME>
* @since 3.1
*/
public class SimpleQueryBus implements QueryBus {
private static final Logger logger = LoggerFactory.getLogger(SimpleQueryBus.class);
private final ConcurrentMap<QueryDefinition, Set<MessageHandler<? super QueryMessage<?, ?>>>> subscriptions = new ConcurrentHashMap<>();
private final MessageMonitor<? super QueryMessage<?, ?>> messageMonitor;
private final QueryInvocationErrorHandler errorHandler;
private final List<MessageHandlerInterceptor<? super QueryMessage<?, ?>>> handlerInterceptors = new CopyOnWriteArrayList<>();
private final List<MessageDispatchInterceptor<? super QueryMessage<?, ?>>> dispatchInterceptors = new CopyOnWriteArrayList<>();
/**
* Initialize the query bus without monitoring on messages and a {@link LoggingQueryInvocationErrorHandler}.
*/
public SimpleQueryBus() {
this(NoOpMessageMonitor.INSTANCE, null, null);
}
/**
* Initialize the query bus using given {@code transactionManager} to manage transactions around query execution
* with. No monitoring is applied to messages and a {@link LoggingQueryInvocationErrorHandler} is used
* to log errors on handlers during a scatter-gather query.
*
* @param transactionManager The transaction manager to manage transactions around query execution with
*/
public SimpleQueryBus(TransactionManager transactionManager) {
this(NoOpMessageMonitor.INSTANCE, transactionManager, null);
}
/**
* Initialize the query bus with the given {@code messageMonitor} and given {@code errorHandler}.
*
* @param messageMonitor The message monitor notified for incoming messages and their result
* @param transactionManager The transaction manager to manage transactions around query execution with
* @param errorHandler The error handler to invoke when query handler report an error
*/
public SimpleQueryBus(MessageMonitor<? super QueryMessage<?, ?>> messageMonitor,
TransactionManager transactionManager,
QueryInvocationErrorHandler errorHandler) {
this.messageMonitor = messageMonitor;
this.errorHandler = getOrDefault(errorHandler, () -> new LoggingQueryInvocationErrorHandler(logger));
if (transactionManager != null) {
registerHandlerInterceptor(new TransactionManagingInterceptor<>(transactionManager));
}
}
@SuppressWarnings("unchecked")
@Override
public <R> Registration subscribe(String queryName, Class<R> responseType, MessageHandler<? super QueryMessage<?, R>> handler) {
QueryDefinition registrationKey = new QueryDefinition(queryName, responseType);
subscriptions.computeIfAbsent(registrationKey, (k) -> new CopyOnWriteArraySet<>()).add((MessageHandler<? super QueryMessage<?, ?>>) handler);
return () -> unsubscribe(registrationKey, (MessageHandler<? super QueryMessage<?, ?>>) handler);
}
@Override
public <Q, R> CompletableFuture<R> query(QueryMessage<Q, R> query) {
MessageMonitor.MonitorCallback monitorCallback = messageMonitor.onMessageIngested(query);
QueryMessage<Q, R> interceptedQuery = intercept(query);
CompletableFuture<R> completableFuture = new CompletableFuture<>();
Set<MessageHandler<? super QueryMessage<?, ?>>> handlers = getHandlersForMessage(interceptedQuery);
try {
if (handlers.isEmpty()) {
throw new NoHandlerForQueryException(format("No handler found for %s with response name %s",
interceptedQuery.getQueryName(),
interceptedQuery.getResponseType()));
}
DefaultUnitOfWork<QueryMessage<Q, R>> uow = DefaultUnitOfWork.startAndGet(interceptedQuery);
completableFuture.complete(interceptAndInvoke(uow, handlers.iterator().next()));
monitorCallback.reportSuccess();
} catch (Exception e) {
completableFuture.completeExceptionally(e);
monitorCallback.reportFailure(e);
}
return completableFuture;
}
@Override
public <Q, R> Stream<R> queryAll(QueryMessage<Q, R> query, long timeout, TimeUnit unit) {
MessageMonitor.MonitorCallback monitorCallback = messageMonitor.onMessageIngested(query);
QueryMessage<Q, R> interceptedQuery = intercept(query);
Set<MessageHandler<? super QueryMessage<?, ?>>> handlers = getHandlersForMessage(interceptedQuery);
if (handlers.isEmpty()) {
monitorCallback.reportIgnored();
return Stream.empty();
}
return StreamSupport.stream(new Spliterators.AbstractSpliterator<R>(handlers.size(), Spliterator.SIZED) {
final Iterator<MessageHandler<? super QueryMessage<?, ?>>> handlerIterator = handlers.iterator();
@SuppressWarnings("unchecked")
public boolean tryAdvance(Consumer<? super R> action) {
while (handlerIterator.hasNext()) {
MessageHandler<? super QueryMessage<?, ?>> handler = handlerIterator.next();
try {
action.accept(interceptAndInvoke(DefaultUnitOfWork.startAndGet(interceptedQuery), handler));
monitorCallback.reportSuccess();
return true;
} catch (Exception e) {
monitorCallback.reportFailure(e);
errorHandler.onError(e, interceptedQuery, handler);
}
}
return false;
}
}, false);
}
@SuppressWarnings("unchecked")
private <Q, R> R interceptAndInvoke(UnitOfWork<QueryMessage<Q, R>> uow, MessageHandler<? super QueryMessage<?, ?>> handler) throws Exception {
return uow.executeWithResult(() -> (R) new DefaultInterceptorChain<>(uow, handlerInterceptors, handler).proceed());
}
@SuppressWarnings("unchecked")
private <Q, R> QueryMessage<Q, R> intercept(QueryMessage<Q, R> query) {
QueryMessage<Q, R> intercepted = query;
for (MessageDispatchInterceptor<? super QueryMessage<?, ?>> interceptor : dispatchInterceptors) {
intercepted = (QueryMessage<Q, R>) interceptor.handle(intercepted);
}
return intercepted;
}
private boolean unsubscribe(QueryDefinition registrationKey, MessageHandler<? super QueryMessage<?, ?>> handler) {
subscriptions.computeIfPresent(registrationKey, (key, handlers) -> {
handlers.remove(handler);
if (handlers.isEmpty()) {
return null;
}
return handlers;
});
return true;
}
/**
* Returns the subscriptions for this query bus. While the returned map is unmodifiable, it may or may not reflect
* changes made to the subscriptions after the call was made.
*
* @return the subscriptions for this query bus
*/
protected Map<QueryDefinition, Set<MessageHandler<? super QueryMessage<?, ?>>>> getSubscriptions() {
return Collections.unmodifiableMap(subscriptions);
}
/**
* Registers an interceptor that is used to intercept Queries before they are passed to their
* respective handlers. The interceptor is invoked separately for each handler instance (in a separate unit of work).
*
* @param interceptor the interceptor to invoke before passing a Query to the handler
*/
public void registerHandlerInterceptor(MessageHandlerInterceptor<QueryMessage<?, ?>> interceptor) {
this.handlerInterceptors.add(interceptor);
}
/**
* Registers an interceptor that intercepts Queries as they are sent. Each interceptor is called
* once, regardless of the type of query (point-to-point or scatter-gather) executed.
*
* @param interceptor the interceptor to invoke when sending a Query
*/
public void registerDispatchInterceptor(MessageDispatchInterceptor<QueryMessage<?, ?>> interceptor) {
this.dispatchInterceptors.add(interceptor);
}
private <Q, R> Set<MessageHandler<? super QueryMessage<?, ?>>> getHandlersForMessage(QueryMessage<Q, R> queryMessage) {
return subscriptions.getOrDefault(new QueryDefinition(queryMessage.getQueryName(), queryMessage.getResponseType()),
Collections.emptySet());
}
private static class QueryDefinition {
private final String queryName;
private final Class<?> responseType;
private QueryDefinition(String queryName, Class<?> responseType) {
this.queryName = queryName;
this.responseType = responseType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof QueryDefinition)) {
return false;
}
QueryDefinition that = (QueryDefinition) o;
return Objects.equals(queryName, that.queryName) &&
Objects.equals(responseType, that.responseType);
}
@Override
public int hashCode() {
return Objects.hash(queryName, responseType);
}
}
}
| 11,403 | 0.681918 | 0.680515 | 243 | 45.950619 | 39.517326 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 12 |
adb43b7a097d00955c3a0bb0aad312a7c7fd0dd3 | 31,086,973,305,574 | 35a2c6d86e721db547138852217aed90e925d2be | /src/sound/Player.java | bb9c12129b495a86ea5780cd848deb5a702971d5 | [] | no_license | zwisler-a/game-engine | https://github.com/zwisler-a/game-engine | ee9e4f116de3aa0859020153a43996858d9d7346 | dd92e313d9fa128d348d874d60f38ca60b20b6c1 | refs/heads/master | 2020-04-09T03:39:13.494000 | 2018-12-01T22:03:22 | 2018-12-01T22:03:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sound;
import common.Logger.Logger;
import javax.sound.sampled.*;
import java.io.File;
public class Player {
public static Clip load(String path) {
try {
File file = new File(path);
AudioInputStream stream;
AudioFormat format;
DataLine.Info info;
Clip clip;
stream = AudioSystem.getAudioInputStream(file);
format = stream.getFormat();
info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
clip.open(stream);
return clip;
} catch (Exception e) {
Logger.error(e.toString());
e.printStackTrace();
}
return null;
}
}
| UTF-8 | Java | 755 | java | Player.java | Java | [] | null | [] | package sound;
import common.Logger.Logger;
import javax.sound.sampled.*;
import java.io.File;
public class Player {
public static Clip load(String path) {
try {
File file = new File(path);
AudioInputStream stream;
AudioFormat format;
DataLine.Info info;
Clip clip;
stream = AudioSystem.getAudioInputStream(file);
format = stream.getFormat();
info = new DataLine.Info(Clip.class, format);
clip = (Clip) AudioSystem.getLine(info);
clip.open(stream);
return clip;
} catch (Exception e) {
Logger.error(e.toString());
e.printStackTrace();
}
return null;
}
}
| 755 | 0.552318 | 0.552318 | 30 | 24.166666 | 17.146589 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.633333 | false | false | 12 |
7236373ef82db0d8170f5c8e2600eeda73c6e37f | 13,202,729,494,082 | f1029872cc1b20a282fa396b2309a7868d2a3afd | /2D Physics Simulation/src/physicsengine/gui/Global.java | f3d43227ab0fd99485311c5c599d9891de28de9b | [] | no_license | jacobcohen76/2D-Physics-Engine | https://github.com/jacobcohen76/2D-Physics-Engine | 896e3f474b0a89cc1c0290adcea2a243804512c6 | af83ec6df592085c59b6d50f210d7e435c5d35e6 | refs/heads/master | 2021-01-05T13:21:39.383000 | 2020-06-25T06:56:23 | 2020-06-25T06:56:23 | 241,034,170 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package physicsengine.gui;
public class Global
{
public static int WIDTH = 0;
public static int HEIGHT = 300;
public static int getX(int x)
{
return x - WIDTH;
}
public static int getY(int y)
{
return HEIGHT - y;
}
}
| UTF-8 | Java | 251 | java | Global.java | Java | [] | null | [] | package physicsengine.gui;
public class Global
{
public static int WIDTH = 0;
public static int HEIGHT = 300;
public static int getX(int x)
{
return x - WIDTH;
}
public static int getY(int y)
{
return HEIGHT - y;
}
}
| 251 | 0.621514 | 0.605578 | 17 | 12.764706 | 12.63296 | 32 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.117647 | false | false | 12 |
d5fe0d52ac5a2d08aff72dff022e138e2b64b9dc | 17,901,423,745,538 | 2d0b065ff9ac6cf38f4fbc421fdcbaf4af085855 | /esxManagementService/src/main/java/com/mjolnir/datamodel/MoonHostProperty.java | 2b294faafe25dee58413199e8feb69ad85b831b7 | [
"Apache-2.0"
] | permissive | bevans88/Capuchin | https://github.com/bevans88/Capuchin | fe00dee3c78117c34ee92f844fc684960a03d007 | f783786d8fc448ff51ea7db4548aeb6afd88fd68 | refs/heads/master | 2021-01-23T00:20:32.931000 | 2017-06-04T15:16:31 | 2017-06-04T15:16:31 | 92,807,315 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mjolnir.datamodel;
public enum MoonHostProperty {
STATUS("Status"),
OWNER("Owner"),
RELEASE("Release");
private final String name;
MoonHostProperty(String name) {
this.name = name;
}
}
| UTF-8 | Java | 232 | java | MoonHostProperty.java | Java | [] | null | [] | package com.mjolnir.datamodel;
public enum MoonHostProperty {
STATUS("Status"),
OWNER("Owner"),
RELEASE("Release");
private final String name;
MoonHostProperty(String name) {
this.name = name;
}
}
| 232 | 0.637931 | 0.637931 | 13 | 16.846153 | 13.061076 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 12 |
cb892399f51d6cdeec7b4b2d6e058631c45a588a | 7,052,336,300,396 | edccc60db1a23323d2e2f875b5473b13d5831e4e | /src/test/java/com/airportManagement/test/TestBoundary.java | 1b991f93355f96438b51be82eff471eb5e1ba502 | [] | no_license | IIHT-ADP-Assignments-Organization/CTS-AirportManagementSystems-Java | https://github.com/IIHT-ADP-Assignments-Organization/CTS-AirportManagementSystems-Java | 435a05757c69844c84bd8f6035d4b641ded742e4 | bbec1a3229487f1cf2d83dbb62dd3914a1818efb | refs/heads/master | 2022-12-24T15:44:53.272000 | 2020-04-03T12:33:33 | 2020-04-03T12:33:33 | 252,726,896 | 0 | 0 | null | false | 2022-12-16T11:09:23 | 2020-04-03T12:31:07 | 2020-04-03T12:33:46 | 2022-12-16T11:09:20 | 18 | 0 | 0 | 4 | Java | false | false | package com.airportManagement.test;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.airportManagement.models.HangerDetails;
import com.airportManagement.models.PilotDetails;
import com.airportManagement.models.PlaneDetails;
public class TestBoundary {
@Test
public void testMobileNumberLength()
{
PilotDetails pilotDetails = new PilotDetails();
HangerDetails hangerDetails = new HangerDetails();
long mobileNumberLength=10;
assertEquals(mobileNumberLength,pilotDetails.getMobileNo());
assertEquals(mobileNumberLength,hangerDetails.getMobileNo());
}
@Test
public void testLicenseNoLength()
{
PilotDetails pilotDetails = new PilotDetails();
int minChar=10;
boolean licenseNoLength=(pilotDetails.getLicenseNo()==minChar);
assertEquals( licenseNoLength,pilotDetails.getLicenseNo());
}
@Test
public void testPilotAddressPinNoLength()
{
PlaneDetails planeDetails = new PlaneDetails();
PilotDetails pilotDetails = new PilotDetails();
HangerDetails hangerDetails = new HangerDetails();
int minChar=7;
boolean pinNoLength=(pilotDetails.getLicenseNo()==minChar);
assertEquals( pinNoLength,pilotDetails.getPinNo());
}
@Test
public void testOwnerPinNoLength()
{
PlaneDetails planeDetails = new PlaneDetails();
PilotDetails pilotDetails = new PilotDetails();
HangerDetails hangerDetails = new HangerDetails();
int minChar=7;
boolean pinNoLength=(planeDetails.getPinNo()==minChar);
assertEquals( pinNoLength,planeDetails.getPinNo());
}
@Test
public void testManagerPinNoLength()
{
HangerDetails hangerDetails = new HangerDetails();
int minChar=7;
boolean pinNoLength=(hangerDetails.getPinNo()==minChar);
assertEquals( pinNoLength,hangerDetails.getPinNo());
}
}
| UTF-8 | Java | 2,029 | java | TestBoundary.java | Java | [] | null | [] | package com.airportManagement.test;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.airportManagement.models.HangerDetails;
import com.airportManagement.models.PilotDetails;
import com.airportManagement.models.PlaneDetails;
public class TestBoundary {
@Test
public void testMobileNumberLength()
{
PilotDetails pilotDetails = new PilotDetails();
HangerDetails hangerDetails = new HangerDetails();
long mobileNumberLength=10;
assertEquals(mobileNumberLength,pilotDetails.getMobileNo());
assertEquals(mobileNumberLength,hangerDetails.getMobileNo());
}
@Test
public void testLicenseNoLength()
{
PilotDetails pilotDetails = new PilotDetails();
int minChar=10;
boolean licenseNoLength=(pilotDetails.getLicenseNo()==minChar);
assertEquals( licenseNoLength,pilotDetails.getLicenseNo());
}
@Test
public void testPilotAddressPinNoLength()
{
PlaneDetails planeDetails = new PlaneDetails();
PilotDetails pilotDetails = new PilotDetails();
HangerDetails hangerDetails = new HangerDetails();
int minChar=7;
boolean pinNoLength=(pilotDetails.getLicenseNo()==minChar);
assertEquals( pinNoLength,pilotDetails.getPinNo());
}
@Test
public void testOwnerPinNoLength()
{
PlaneDetails planeDetails = new PlaneDetails();
PilotDetails pilotDetails = new PilotDetails();
HangerDetails hangerDetails = new HangerDetails();
int minChar=7;
boolean pinNoLength=(planeDetails.getPinNo()==minChar);
assertEquals( pinNoLength,planeDetails.getPinNo());
}
@Test
public void testManagerPinNoLength()
{
HangerDetails hangerDetails = new HangerDetails();
int minChar=7;
boolean pinNoLength=(hangerDetails.getPinNo()==minChar);
assertEquals( pinNoLength,hangerDetails.getPinNo());
}
}
| 2,029 | 0.677674 | 0.674224 | 81 | 24.049383 | 23.842539 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.728395 | false | false | 12 |
449bc808e2126a2244c072a4dc93060d1ba344fe | 25,589,415,216,827 | 7370b21440610cb4f5e2b1d56129181fa8802933 | /week5/2-Annotations-Reflection/src/task1/Person.java | 5594467750f5c5d2202ecd26a354d6f57ab3433a | [] | no_license | stelllla/HackBulgaria | https://github.com/stelllla/HackBulgaria | cf780a3af28488543c6543842214f0ad26858eec | 4c3ea9b413ba29ccb88de9d7b836b582f24bcfcf | refs/heads/master | 2021-01-22T04:57:19.439000 | 2015-05-28T08:28:52 | 2015-05-28T08:28:52 | 30,965,512 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package task1;
import java.lang.annotation.Annotation;
@ClassInfo (
author = "Stella Gavrailova",
related = { Student.class }
)
public class Person {
private String name;
private int age;
Person(String name,int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public void setName(String name) {
this.name = name;
}
public void setAge (int age) {
this.age = age;
}
public static void main(String[] args) {
Person p = new Person ("Jenifer Lopez",20);
Annotation[] annotations = p.getClass().getAnnotations();
System.out.println("Annotations:" + annotations.length);
for ( Annotation a : annotations) {
System.out.println(a);
}
Person p2 = new Person ("alalal", 12);
ClassInfo ann = p2.getClass().getAnnotation(ClassInfo.class);
System.out.println(ann);
}
}
| UTF-8 | Java | 1,103 | java | Person.java | Java | [
{
"context": "notation.Annotation;\n\n@ClassInfo (\n author = \"Stella Gavrailova\",\n related = { Student.class }\n )\n\npublic",
"end": 102,
"score": 0.9998934864997864,
"start": 85,
"tag": "NAME",
"value": "Stella Gavrailova"
},
{
"context": "(String[] args) {\n ... | null | [] | package task1;
import java.lang.annotation.Annotation;
@ClassInfo (
author = "<NAME>",
related = { Student.class }
)
public class Person {
private String name;
private int age;
Person(String name,int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public void setName(String name) {
this.name = name;
}
public void setAge (int age) {
this.age = age;
}
public static void main(String[] args) {
Person p = new Person ("<NAME>",20);
Annotation[] annotations = p.getClass().getAnnotations();
System.out.println("Annotations:" + annotations.length);
for ( Annotation a : annotations) {
System.out.println(a);
}
Person p2 = new Person ("alalal", 12);
ClassInfo ann = p2.getClass().getAnnotation(ClassInfo.class);
System.out.println(ann);
}
}
| 1,085 | 0.538531 | 0.532185 | 49 | 21.510204 | 18.170532 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
45863059dbe3170d0f5a054f5b32f95a6e82b3e0 | 2,216,203,163,983 | 7fbcd88d33e94c64e77da44bb7ad10711ec8291b | /05.27_MultithreadingAndNetworking/mojeVjezbeNetworking/CircleAreaClientServer.java | b82ac246f4120f73f28d9a9597356d9cdc5a90ab | [] | no_license | Amel-Ali/AdvancedCasovi | https://github.com/Amel-Ali/AdvancedCasovi | 1cf3dcf58986a0c78910bb6c137a63917893f042 | 370d3115060fd963ac2d724235c5227efc93118e | refs/heads/master | 2020-04-09T05:28:26.003000 | 2016-08-07T19:50:37 | 2016-08-07T19:50:37 | 60,901,904 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package mojeVjezbeNetworking;
/*
* Ovo je isti zadatak kao one dvije posebne klase CircleAreaClient
* i CircleAreaServer, samo sto sada radim preko thread-ova
*/
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class CircleAreaClientServer {
public static void main(String[] args) {
CircleAreaServer server=new CircleAreaServer();
CircleAreaClient client=new CircleAreaClient();
Thread threadServer= new Thread(server);
Thread threadClient=new Thread(client);
threadServer.start();
threadClient.start();
}
//Server klasa
static class CircleAreaServer implements Runnable {
//Sve je isto kao kod public klase CircleAreaServer
@Override
public void run() {
System.out.println("\nSever class entered\n");
try {
ServerSocket serverSocket = new ServerSocket(7000);
System.out.println("Server started.");
Socket socket= serverSocket.accept();
DataInputStream fromClient=new DataInputStream(socket.getInputStream());
DataOutputStream toClient= new DataOutputStream(socket.getOutputStream());
double circleRadius=fromClient.readDouble();
double circleArea=circleRadius*circleRadius*Math.PI;
System.out.println("Server: Radius = "+circleRadius+", Area = "+circleArea);
toClient.writeDouble(circleArea);
System.out.println("Info sent to client");
serverSocket.close();
System.out.println("Server closed\n");
} catch (IOException e) {
e.printStackTrace();
}
}
}
static class CircleAreaClient implements Runnable{
//Sve je isto kao kod public klase CircleAreaClient
@Override
public void run() {
System.out.println("\nClient class entered\n");
try {
Socket socket = new Socket("localhost", 7000);
System.out.println("Socket started");
DataInputStream fromServer = new DataInputStream(socket.getInputStream());
DataOutputStream toServer = new DataOutputStream(socket.getOutputStream());
java.util.Scanner unos = new java.util.Scanner(System.in);
System.out.println("Unesite radius kruga:");
double radius = unos.nextDouble();
unos.nextLine();
unos.close();
toServer.writeDouble(radius);
toServer.flush();
System.out.println("Sent to server");
double circleArea = fromServer.readDouble();
System.out.println("Circle area = " + circleArea);
socket.close();
System.out.println("Socket closed");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| UTF-8 | Java | 2,604 | java | CircleAreaClientServer.java | Java | [] | null | [] | package mojeVjezbeNetworking;
/*
* Ovo je isti zadatak kao one dvije posebne klase CircleAreaClient
* i CircleAreaServer, samo sto sada radim preko thread-ova
*/
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
public class CircleAreaClientServer {
public static void main(String[] args) {
CircleAreaServer server=new CircleAreaServer();
CircleAreaClient client=new CircleAreaClient();
Thread threadServer= new Thread(server);
Thread threadClient=new Thread(client);
threadServer.start();
threadClient.start();
}
//Server klasa
static class CircleAreaServer implements Runnable {
//Sve je isto kao kod public klase CircleAreaServer
@Override
public void run() {
System.out.println("\nSever class entered\n");
try {
ServerSocket serverSocket = new ServerSocket(7000);
System.out.println("Server started.");
Socket socket= serverSocket.accept();
DataInputStream fromClient=new DataInputStream(socket.getInputStream());
DataOutputStream toClient= new DataOutputStream(socket.getOutputStream());
double circleRadius=fromClient.readDouble();
double circleArea=circleRadius*circleRadius*Math.PI;
System.out.println("Server: Radius = "+circleRadius+", Area = "+circleArea);
toClient.writeDouble(circleArea);
System.out.println("Info sent to client");
serverSocket.close();
System.out.println("Server closed\n");
} catch (IOException e) {
e.printStackTrace();
}
}
}
static class CircleAreaClient implements Runnable{
//Sve je isto kao kod public klase CircleAreaClient
@Override
public void run() {
System.out.println("\nClient class entered\n");
try {
Socket socket = new Socket("localhost", 7000);
System.out.println("Socket started");
DataInputStream fromServer = new DataInputStream(socket.getInputStream());
DataOutputStream toServer = new DataOutputStream(socket.getOutputStream());
java.util.Scanner unos = new java.util.Scanner(System.in);
System.out.println("Unesite radius kruga:");
double radius = unos.nextDouble();
unos.nextLine();
unos.close();
toServer.writeDouble(radius);
toServer.flush();
System.out.println("Sent to server");
double circleArea = fromServer.readDouble();
System.out.println("Circle area = " + circleArea);
socket.close();
System.out.println("Socket closed");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| 2,604 | 0.714286 | 0.711214 | 100 | 25.040001 | 23.022997 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.46 | false | false | 12 |
52949b5e01a1fd3f2f42a1621d2db917b43c849b | 32,581,621,965,455 | 59b1eb77d7b6cf74415baf9edbfdaa3b05e42a70 | /src/main/java/leetcode/graph_valid_tree/UnionFind.java | 28aecaca82b172d8ed20222d47a58327a5cee301 | [] | no_license | erictt/algorithms-practice | https://github.com/erictt/algorithms-practice | 81cb956a65be79b97e2416249d0273c49fbb1063 | 6f5028d57b6dc4a77b4579d1de93cdf0cd4ad1fb | refs/heads/master | 2023-07-08T04:03:33.314000 | 2023-06-28T02:51:18 | 2023-06-28T02:51:18 | 128,606,434 | 0 | 0 | null | false | 2021-03-07T06:50:43 | 2018-04-08T06:27:02 | 2021-01-12T22:09:11 | 2021-03-07T06:50:42 | 792 | 0 | 0 | 0 | Java | false | false | package leetcode.graph_valid_tree;
public class UnionFind {
public boolean validTree(int n, int[][] edges) {
if (n != edges.length + 1) return false;
int[] roots = new int[n];
int[] sizes = new int[n];
for (int i = 0; i < n; i++) {
roots[i] = i;
sizes[i] = 1;
}
for (int i = 0; i < edges.length; i++) {
if (connected(roots, edges[i][0], edges[i][1])) return false;
union(roots, sizes, edges[i][0], edges[i][1]);
}
return true;
}
private boolean connected(int[] roots, int i, int j) {
return root(roots, i) == root(roots, j);
}
private int root(int[] roots, int i) {
while (i != roots[i]) {
i = roots[roots[i]];
}
return i;
}
private void union(int[] roots, int[] sizes, int i, int j) {
int root1 = root(roots, i);
int root2 = root(roots, j);
if (sizes[root1] > sizes[root2]) {
roots[root2] = root1;
sizes[root1] += sizes[root2];
} else {
roots[root1] = root2;
sizes[root2] += sizes[root1];
}
}
} | UTF-8 | Java | 1,181 | java | UnionFind.java | Java | [] | null | [] | package leetcode.graph_valid_tree;
public class UnionFind {
public boolean validTree(int n, int[][] edges) {
if (n != edges.length + 1) return false;
int[] roots = new int[n];
int[] sizes = new int[n];
for (int i = 0; i < n; i++) {
roots[i] = i;
sizes[i] = 1;
}
for (int i = 0; i < edges.length; i++) {
if (connected(roots, edges[i][0], edges[i][1])) return false;
union(roots, sizes, edges[i][0], edges[i][1]);
}
return true;
}
private boolean connected(int[] roots, int i, int j) {
return root(roots, i) == root(roots, j);
}
private int root(int[] roots, int i) {
while (i != roots[i]) {
i = roots[roots[i]];
}
return i;
}
private void union(int[] roots, int[] sizes, int i, int j) {
int root1 = root(roots, i);
int root2 = root(roots, j);
if (sizes[root1] > sizes[root2]) {
roots[root2] = root1;
sizes[root1] += sizes[root2];
} else {
roots[root1] = root2;
sizes[root2] += sizes[root1];
}
}
} | 1,181 | 0.473328 | 0.456393 | 47 | 24.148935 | 20.505297 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.808511 | false | false | 12 |
a4e22f8b36400cda04cfaed88687300abd5c9b91 | 6,408,091,265,336 | 3e8b4f0487e18040592c5a04f6b9057c6f99c6a4 | /src/test/java/com/android/tools/build/bundletool/io/StandaloneApkSerializerTest.java | a7a34c97c86a2dd0fd9a19ee1521e00830751f2a | [
"Apache-2.0"
] | permissive | Ashok-Varma/bundletool | https://github.com/Ashok-Varma/bundletool | 31c38a249da3ca81af2f5aa3689c89361ca6c0b4 | 9a55fa0a89e315a1585890c34418d3bd345cf8eb | refs/heads/master | 2020-04-05T11:10:12.795000 | 2018-11-09T16:41:22 | 2018-11-09T16:41:22 | 156,825,465 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.android.tools.build.bundletool.io;
import static com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest;
import static com.android.tools.build.bundletool.testing.ManifestProtoUtils.withFusedModuleNames;
import static com.android.tools.build.bundletool.testing.TargetingUtils.apkMinSdkTargeting;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
import com.android.bundle.Commands.ApkDescription;
import com.android.bundle.Config.Compression;
import com.android.bundle.Targeting.ApkTargeting;
import com.android.bundle.Targeting.VariantTargeting;
import com.android.tools.build.bundletool.model.Aapt2Command;
import com.android.tools.build.bundletool.model.BundleModule;
import com.android.tools.build.bundletool.model.ModuleSplit;
import com.android.tools.build.bundletool.model.ModuleSplit.SplitType;
import com.android.tools.build.bundletool.model.ZipPath;
import com.android.tools.build.bundletool.testing.Aapt2Helper;
import com.android.tools.build.bundletool.testing.BundleModuleBuilder;
import java.io.File;
import java.nio.file.Path;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class StandaloneApkSerializerTest {
@Rule public final TemporaryFolder tempFolderRule = new TemporaryFolder();
private final Aapt2Command aapt2Command = Aapt2Helper.getAapt2Command();
private Path tempFolder;
@Before
public void setUp() throws Exception {
tempFolder = tempFolderRule.getRoot().toPath();
}
@Test
public void writeToDisk_basicApk() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
BundleModule module =
new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
ModuleSplit split = createStandaloneApkBuilder(module).build();
ApkDescription apkDescription = standaloneApkSerializer.writeToDisk(split, tempFolder);
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.getPath()).isEqualTo("standalones/standalone.apk");
assertThat(apkDescription.getTargeting()).isEqualToDefaultInstance();
assertThat(apkDescription.hasStandaloneApkMetadata()).isTrue();
}
@Test
public void writeToDiskAsUniversal_basicApk() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
BundleModule module =
new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
ModuleSplit split = createStandaloneApkBuilder(module).build();
ApkDescription apkDescription =
standaloneApkSerializer.writeToDiskAsUniversal(split, tempFolder);
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.getPath()).isEqualTo("universal.apk");
assertThat(apkDescription.getTargeting()).isEqualToDefaultInstance();
assertThat(apkDescription.hasStandaloneApkMetadata()).isTrue();
}
@Test
public void writeToDiskInternal_targetingPropagated() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
ApkTargeting customTargeting = apkMinSdkTargeting(5);
BundleModule module =
new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
ModuleSplit split = createStandaloneApkBuilder(module).setApkTargeting(customTargeting).build();
ApkDescription apkDescription =
standaloneApkSerializer.writeToDiskInternal(split, tempFolder, ZipPath.create("file.apk"));
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.getTargeting()).isEqualTo(customTargeting);
}
@Test
public void writeToDiskInternal_fusedModuleNamePropagated() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
BundleModule module =
new BundleModuleBuilder("testModule")
.setManifest(androidManifest("com.test.app", withFusedModuleNames("a,b,c")))
.build();
ModuleSplit split = createStandaloneApkBuilder(module).build();
ApkDescription apkDescription =
standaloneApkSerializer.writeToDiskInternal(split, tempFolder, ZipPath.create("file.apk"));
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.hasStandaloneApkMetadata()).isTrue();
assertThat(apkDescription.getStandaloneApkMetadata().getFusedModuleNameList())
.containsExactly("a", "b", "c");
}
private ModuleSplit.Builder createStandaloneApkBuilder(BundleModule module) {
return ModuleSplit.forModule(module)
.toBuilder()
.setVariantTargeting(VariantTargeting.getDefaultInstance())
.setSplitType(SplitType.STANDALONE);
}
}
| UTF-8 | Java | 6,351 | java | StandaloneApkSerializerTest.java | Java | [] | null | [] | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.android.tools.build.bundletool.io;
import static com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest;
import static com.android.tools.build.bundletool.testing.ManifestProtoUtils.withFusedModuleNames;
import static com.android.tools.build.bundletool.testing.TargetingUtils.apkMinSdkTargeting;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
import com.android.bundle.Commands.ApkDescription;
import com.android.bundle.Config.Compression;
import com.android.bundle.Targeting.ApkTargeting;
import com.android.bundle.Targeting.VariantTargeting;
import com.android.tools.build.bundletool.model.Aapt2Command;
import com.android.tools.build.bundletool.model.BundleModule;
import com.android.tools.build.bundletool.model.ModuleSplit;
import com.android.tools.build.bundletool.model.ModuleSplit.SplitType;
import com.android.tools.build.bundletool.model.ZipPath;
import com.android.tools.build.bundletool.testing.Aapt2Helper;
import com.android.tools.build.bundletool.testing.BundleModuleBuilder;
import java.io.File;
import java.nio.file.Path;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class StandaloneApkSerializerTest {
@Rule public final TemporaryFolder tempFolderRule = new TemporaryFolder();
private final Aapt2Command aapt2Command = Aapt2Helper.getAapt2Command();
private Path tempFolder;
@Before
public void setUp() throws Exception {
tempFolder = tempFolderRule.getRoot().toPath();
}
@Test
public void writeToDisk_basicApk() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
BundleModule module =
new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
ModuleSplit split = createStandaloneApkBuilder(module).build();
ApkDescription apkDescription = standaloneApkSerializer.writeToDisk(split, tempFolder);
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.getPath()).isEqualTo("standalones/standalone.apk");
assertThat(apkDescription.getTargeting()).isEqualToDefaultInstance();
assertThat(apkDescription.hasStandaloneApkMetadata()).isTrue();
}
@Test
public void writeToDiskAsUniversal_basicApk() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
BundleModule module =
new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
ModuleSplit split = createStandaloneApkBuilder(module).build();
ApkDescription apkDescription =
standaloneApkSerializer.writeToDiskAsUniversal(split, tempFolder);
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.getPath()).isEqualTo("universal.apk");
assertThat(apkDescription.getTargeting()).isEqualToDefaultInstance();
assertThat(apkDescription.hasStandaloneApkMetadata()).isTrue();
}
@Test
public void writeToDiskInternal_targetingPropagated() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
ApkTargeting customTargeting = apkMinSdkTargeting(5);
BundleModule module =
new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
ModuleSplit split = createStandaloneApkBuilder(module).setApkTargeting(customTargeting).build();
ApkDescription apkDescription =
standaloneApkSerializer.writeToDiskInternal(split, tempFolder, ZipPath.create("file.apk"));
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.getTargeting()).isEqualTo(customTargeting);
}
@Test
public void writeToDiskInternal_fusedModuleNamePropagated() throws Exception {
StandaloneApkSerializer standaloneApkSerializer =
new StandaloneApkSerializer(
new ApkPathManager(), aapt2Command, Optional.empty(), Compression.getDefaultInstance());
BundleModule module =
new BundleModuleBuilder("testModule")
.setManifest(androidManifest("com.test.app", withFusedModuleNames("a,b,c")))
.build();
ModuleSplit split = createStandaloneApkBuilder(module).build();
ApkDescription apkDescription =
standaloneApkSerializer.writeToDiskInternal(split, tempFolder, ZipPath.create("file.apk"));
File expectedApkFile = tempFolder.resolve(apkDescription.getPath()).toFile();
assertThat(expectedApkFile.exists()).isTrue();
assertThat(apkDescription.hasStandaloneApkMetadata()).isTrue();
assertThat(apkDescription.getStandaloneApkMetadata().getFusedModuleNameList())
.containsExactly("a", "b", "c");
}
private ModuleSplit.Builder createStandaloneApkBuilder(BundleModule module) {
return ModuleSplit.forModule(module)
.toBuilder()
.setVariantTargeting(VariantTargeting.getDefaultInstance())
.setSplitType(SplitType.STANDALONE);
}
}
| 6,351 | 0.771847 | 0.76854 | 149 | 41.624161 | 32.833824 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.624161 | false | false | 12 |
ccceb2c4cb9fcece70b0330479380602b35c0ca4 | 18,124,762,035,907 | 2f5d7184610ff9d4645657788ea39b7c83b05ceb | /de.prob2.kernel/src/main/java/de/prob/animator/command/ActivateUnitPluginCommand.java | 1da2caced25841f97e46e9726ebd59d62736739e | [] | no_license | miwer106/prob2 | https://github.com/miwer106/prob2 | 6b872835d2d340102aff9edbedbd5f7a86d23598 | a02a176096a6db5b23b02daa2280bc803a6fa8ad | HEAD | 2017-05-11T00:43:12.711000 | 2017-02-16T11:38:58 | 2017-02-16T11:38:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, Heinrich
* Heine Universitaet Duesseldorf This software is licenced under EPL 1.0
* (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.prob.animator.command;
import de.prob.parser.ISimplifiedROMap;
import de.prob.prolog.output.IPrologTermOutput;
import de.prob.prolog.term.PrologTerm;
public class ActivateUnitPluginCommand extends AbstractCommand {
private static final String PROLOG_COMMAND_NAME = "activate_plugin";
@Override
public void writeCommand(final IPrologTermOutput pto) {
pto.openTerm(PROLOG_COMMAND_NAME);
pto.printAtom("units");
pto.closeTerm();
}
@Override
public void processResult(
final ISimplifiedROMap<String, PrologTerm> bindings) {
// nothing to do here
}
}
| UTF-8 | Java | 800 | java | ActivateUnitPluginCommand.java | Java | [
{
"context": "tuhl fuer Softwaretechnik und Programmiersprachen, Heinrich\n * Heine Universitaet Duesseldorf This software i",
"end": 80,
"score": 0.9990251660346985,
"start": 72,
"tag": "NAME",
"value": "Heinrich"
},
{
"context": "ftwaretechnik und Programmiersprachen, Heinrich\n * ... | null | [] | /**
* (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, Heinrich
* <NAME> This software is licenced under EPL 1.0
* (http://www.eclipse.org/org/documents/epl-v10.html)
* */
package de.prob.animator.command;
import de.prob.parser.ISimplifiedROMap;
import de.prob.prolog.output.IPrologTermOutput;
import de.prob.prolog.term.PrologTerm;
public class ActivateUnitPluginCommand extends AbstractCommand {
private static final String PROLOG_COMMAND_NAME = "activate_plugin";
@Override
public void writeCommand(final IPrologTermOutput pto) {
pto.openTerm(PROLOG_COMMAND_NAME);
pto.printAtom("units");
pto.closeTerm();
}
@Override
public void processResult(
final ISimplifiedROMap<String, PrologTerm> bindings) {
// nothing to do here
}
}
| 776 | 0.76625 | 0.75625 | 31 | 24.806452 | 25.524712 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.935484 | false | false | 12 |
29dfce3bec1bb50a6817c7bf8d9a12184e8de9d7 | 22,943,715,297,163 | 2264daf76e31bc2e33df63ca290fb15f4eae9d55 | /NameSet/src/NameSet.java | ff1f2c75fd329dd5f03bf2b7a4106fbcf792e0fd | [] | no_license | jpezninjo/lectures-1 | https://github.com/jpezninjo/lectures-1 | 2dfd96ca2980127aaf77b32f6f3259995ac66fbb | 42eeb7f55d1084f09240e96055db4137750a9d27 | refs/heads/master | 2021-01-24T22:35:03.766000 | 2015-05-05T00:19:08 | 2015-05-05T00:19:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.TreeSet;
public class NameSet {
private TreeSet<Name> names;
public NameSet() {
this.names = new TreeSet<>();
}
public NameSet(TreeSet<Name> names) {
this.names = names;
}
public boolean addAndPrint(Name name) {
// boolean result = names.add(name);
// System.out.println("names.size = " + names.size());
// return result;
//Example: using try-finally instead of storing the temp result
try {
return names.add(name);
} finally {
System.out.println("names.size = " + names.size());
}
}
public void clear() {
/*
* For assertions to work correctly, make sure to use the
* -enableassertions flag. In Eclipse,
* Run As > Run Configurations > Arguments > VM Arguments
*/
assert (this.names.size() > 0): "Cannot clear empty NameSet";
this.names = new TreeSet<>();
}
public Name getFirst() {
//Do you really want an error that stops the program?
assert (this.names.size() > 0): "Cannot get first item of emtpy NameSet";
return this.names.first();
}
public NameSet clone() {
//return new NameSet(this.names);
//Alternate code for creating shallow copy
//return new NameSet((TreeSet<Name>)names.clone());
TreeSet<Name> newSet = new TreeSet<Name>();
for(Name name: this.names) {
newSet.add(name.clone());
}
return new NameSet(newSet);
}
public void display() {
for(Name name: this.names) {
System.out.println(name);
}
}
public static void main(String[] args) {
//Demonstrate assert
// nameSet.clear();
// System.out.println("NameSet cleared");
// nameSet.clear();
NameSet nameSet = new NameSet();
nameSet.addAndPrint(new Name("Bob", "Smith"));
nameSet.addAndPrint(new Name("Jane", "Doe"));
nameSet.addAndPrint(new Name("Herb", "Alexander"));
NameSet copy = nameSet.clone();
Name name = copy.getFirst();
name.setFirst("NEW");
name.setLast("GUY");
System.out.println("\n***Original***");
nameSet.display();
System.out.println("\n***Copy***");
copy.display();
}
}
| UTF-8 | Java | 2,067 | java | NameSet.java | Java | [
{
"context": " = new NameSet();\n\t\tnameSet.addAndPrint(new Name(\"Bob\", \"Smith\"));\n\t\tnameSet.addAndPrint(new Name(\"Jane",
"end": 1701,
"score": 0.9998710751533508,
"start": 1698,
"tag": "NAME",
"value": "Bob"
},
{
"context": "NameSet();\n\t\tnameSet.addAndPrint(new Name(\"Bo... | null | [] | import java.util.TreeSet;
public class NameSet {
private TreeSet<Name> names;
public NameSet() {
this.names = new TreeSet<>();
}
public NameSet(TreeSet<Name> names) {
this.names = names;
}
public boolean addAndPrint(Name name) {
// boolean result = names.add(name);
// System.out.println("names.size = " + names.size());
// return result;
//Example: using try-finally instead of storing the temp result
try {
return names.add(name);
} finally {
System.out.println("names.size = " + names.size());
}
}
public void clear() {
/*
* For assertions to work correctly, make sure to use the
* -enableassertions flag. In Eclipse,
* Run As > Run Configurations > Arguments > VM Arguments
*/
assert (this.names.size() > 0): "Cannot clear empty NameSet";
this.names = new TreeSet<>();
}
public Name getFirst() {
//Do you really want an error that stops the program?
assert (this.names.size() > 0): "Cannot get first item of emtpy NameSet";
return this.names.first();
}
public NameSet clone() {
//return new NameSet(this.names);
//Alternate code for creating shallow copy
//return new NameSet((TreeSet<Name>)names.clone());
TreeSet<Name> newSet = new TreeSet<Name>();
for(Name name: this.names) {
newSet.add(name.clone());
}
return new NameSet(newSet);
}
public void display() {
for(Name name: this.names) {
System.out.println(name);
}
}
public static void main(String[] args) {
//Demonstrate assert
// nameSet.clear();
// System.out.println("NameSet cleared");
// nameSet.clear();
NameSet nameSet = new NameSet();
nameSet.addAndPrint(new Name("Bob", "Smith"));
nameSet.addAndPrint(new Name("Jane", "Doe"));
nameSet.addAndPrint(new Name("Herb", "Alexander"));
NameSet copy = nameSet.clone();
Name name = copy.getFirst();
name.setFirst("NEW");
name.setLast("GUY");
System.out.println("\n***Original***");
nameSet.display();
System.out.println("\n***Copy***");
copy.display();
}
}
| 2,067 | 0.633769 | 0.632801 | 102 | 19.264706 | 19.772692 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.009804 | false | false | 12 |
cd8cb38693afd7c78a847e26a5bb0b2fc41c1c71 | 31,052,613,563,066 | 9d29ebd24ded7532aa179ac3095eb47f4fc33452 | /app/src/main/java/in/alertmeu/models/MyPlaceModeDAO.java | b7c87448bd89e7c0d3e1f8360300e658de6701ce | [] | no_license | ashokkumawat20/AlertMeU | https://github.com/ashokkumawat20/AlertMeU | 6e25d7231431d1264e27df22436be9502fa0052b | c87275571bda89cc5a166906d10f201eada68c66 | refs/heads/master | 2022-12-19T13:31:11.474000 | 2020-09-20T04:26:20 | 2020-09-20T04:26:20 | 268,855,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package in.alertmeu.models;
public class MyPlaceModeDAO {
private String id;
private String user_id;
private String latitude;
private String longitude;
private String full_address;
private String time_stamp;
public MyPlaceModeDAO() {
}
public MyPlaceModeDAO(String id, String user_id, String latitude, String longitude, String full_address, String time_stamp) {
this.id = id;
this.user_id = user_id;
this.latitude = latitude;
this.longitude = longitude;
this.full_address = full_address;
this.time_stamp = time_stamp;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getFull_address() {
return full_address;
}
public void setFull_address(String full_address) {
this.full_address = full_address;
}
public String getTime_stamp() {
return time_stamp;
}
public void setTime_stamp(String time_stamp) {
this.time_stamp = time_stamp;
}
} | UTF-8 | Java | 1,539 | java | MyPlaceModeDAO.java | Java | [] | null | [] | package in.alertmeu.models;
public class MyPlaceModeDAO {
private String id;
private String user_id;
private String latitude;
private String longitude;
private String full_address;
private String time_stamp;
public MyPlaceModeDAO() {
}
public MyPlaceModeDAO(String id, String user_id, String latitude, String longitude, String full_address, String time_stamp) {
this.id = id;
this.user_id = user_id;
this.latitude = latitude;
this.longitude = longitude;
this.full_address = full_address;
this.time_stamp = time_stamp;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getFull_address() {
return full_address;
}
public void setFull_address(String full_address) {
this.full_address = full_address;
}
public String getTime_stamp() {
return time_stamp;
}
public void setTime_stamp(String time_stamp) {
this.time_stamp = time_stamp;
}
} | 1,539 | 0.610786 | 0.610786 | 73 | 20.09589 | 20.690256 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.410959 | false | false | 12 |
f66babe355fdcf9a359c9efd1d139c3ecd41353c | 7,206,955,189,479 | cf798136766f4f0033f0989f358b36fd38a6cbb3 | /part06/执行中/ResultTask.java | a1fba6966e060d2f829f26f4ada88fd7645ee000 | [
"Apache-2.0"
] | permissive | MikeAcesse/2021-Java-ThreadPool-Tutorial | https://github.com/MikeAcesse/2021-Java-ThreadPool-Tutorial | 1b542d88581b1ad9f44176f843f96fc1750894a6 | c5fdfd643e4f33ee6b321dbc73b6b41fd0e35c9f | refs/heads/main | 2023-06-26T14:56:47.503000 | 2021-07-31T12:36:28 | 2021-07-31T12:36:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main;
import java.util.concurrent.Callable;
public class ResultTask implements Callable<Integer> {
@Override
public Integer call() throws Exception {
// 计数器
int i = 0;
// 当线程没被中断时
while (!Thread.interrupted()) {
// 递增i
i++;
}
// 输出i
System.out.println(i);
// 返回1+1的值
return 1 + 1;
}
} | UTF-8 | Java | 441 | java | ResultTask.java | Java | [] | null | [] | package main;
import java.util.concurrent.Callable;
public class ResultTask implements Callable<Integer> {
@Override
public Integer call() throws Exception {
// 计数器
int i = 0;
// 当线程没被中断时
while (!Thread.interrupted()) {
// 递增i
i++;
}
// 输出i
System.out.println(i);
// 返回1+1的值
return 1 + 1;
}
} | 441 | 0.508685 | 0.496278 | 21 | 18.238094 | 14.677176 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 12 |
1d539cb3dce2e75a73aadcb201ab5b19e07e452b | 18,365,280,205,908 | aff32e7776b4d2102d7fbc14562b2df75bc2fed2 | /src/main/java/edu/kyang/entity/EventBean.java | 02ea22eebd6935faaa273dad80abbcadefcf7d04 | [] | no_license | kiayang/indieProject | https://github.com/kiayang/indieProject | d56b83e4796792752449738a6168fdd788026efb | 374620bd0ab37270aeb057307cc58e6e10d97065 | refs/heads/master | 2020-03-28T15:09:24.754000 | 2018-12-19T22:08:00 | 2018-12-19T22:08:00 | 148,561,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.kyang.entity;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
/**
* The type Event bean.
*/
@Entity(name = "EventBean")
@Table(name = "event")
@Data
public class EventBean {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
@GenericGenerator(name = "native", strategy = "native")
@Column(name = "event_id")
private int eventId;
private String event_userid;
private String description;
private LocalDate event_date;
private BigDecimal event_fee;
/*
The bidirectional @OneToMany association also requires a @ManyToOne association on the child side.
Although the Domain Model exposes two sides to navigate this association, behind the scenes,
the relational database has only one foreign key for this relationship.
Every bidirectional association must have one owning side only (the child side),
the other one being referred to as the inverse (or the mappedBy) side.
*/
@OneToMany(mappedBy = "eventBean", orphanRemoval = true, fetch = FetchType.EAGER)
private Set<UserEventBean> userEventList = new HashSet<>();
/**
* Instantiates a new Event bean.
*/
public EventBean() {
}
/**
* Instantiates a new Event bean.
*
* @param event_userid the event userid
* @param description the description
* @param event_date the event date
* @param event_fee the event fee
*/
public EventBean(String event_userid, String description, LocalDate event_date, BigDecimal event_fee) {
this.event_userid = event_userid;
this.description = description;
this.event_date = event_date;
this.event_fee = event_fee;
}
@java.lang.Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
EventBean eventBean = (EventBean) object;
return eventId == eventBean.eventId &&
java.util.Objects.equals(event_userid, eventBean.event_userid) &&
java.util.Objects.equals(description, eventBean.description) &&
java.util.Objects.equals(event_date, eventBean.event_date) &&
java.util.Objects.equals(event_fee, eventBean.event_fee);
}
@java.lang.Override
public int hashCode() {
return java.util.Objects.hash(eventId, event_userid, description, event_date, event_fee);
}
@java.lang.Override
public java.lang.String toString() {
return "EventBean{" +
"eventId=" + eventId +
", event_userid='" + event_userid + '\'' +
", description='" + description + '\'' +
", event_date=" + event_date +
", event_fee=" + event_fee +
'}';
}
}
| UTF-8 | Java | 3,032 | java | EventBean.java | Java | [] | null | [] | package edu.kyang.entity;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
/**
* The type Event bean.
*/
@Entity(name = "EventBean")
@Table(name = "event")
@Data
public class EventBean {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
@GenericGenerator(name = "native", strategy = "native")
@Column(name = "event_id")
private int eventId;
private String event_userid;
private String description;
private LocalDate event_date;
private BigDecimal event_fee;
/*
The bidirectional @OneToMany association also requires a @ManyToOne association on the child side.
Although the Domain Model exposes two sides to navigate this association, behind the scenes,
the relational database has only one foreign key for this relationship.
Every bidirectional association must have one owning side only (the child side),
the other one being referred to as the inverse (or the mappedBy) side.
*/
@OneToMany(mappedBy = "eventBean", orphanRemoval = true, fetch = FetchType.EAGER)
private Set<UserEventBean> userEventList = new HashSet<>();
/**
* Instantiates a new Event bean.
*/
public EventBean() {
}
/**
* Instantiates a new Event bean.
*
* @param event_userid the event userid
* @param description the description
* @param event_date the event date
* @param event_fee the event fee
*/
public EventBean(String event_userid, String description, LocalDate event_date, BigDecimal event_fee) {
this.event_userid = event_userid;
this.description = description;
this.event_date = event_date;
this.event_fee = event_fee;
}
@java.lang.Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
EventBean eventBean = (EventBean) object;
return eventId == eventBean.eventId &&
java.util.Objects.equals(event_userid, eventBean.event_userid) &&
java.util.Objects.equals(description, eventBean.description) &&
java.util.Objects.equals(event_date, eventBean.event_date) &&
java.util.Objects.equals(event_fee, eventBean.event_fee);
}
@java.lang.Override
public int hashCode() {
return java.util.Objects.hash(eventId, event_userid, description, event_date, event_fee);
}
@java.lang.Override
public java.lang.String toString() {
return "EventBean{" +
"eventId=" + eventId +
", event_userid='" + event_userid + '\'' +
", description='" + description + '\'' +
", event_date=" + event_date +
", event_fee=" + event_fee +
'}';
}
}
| 3,032 | 0.641161 | 0.641161 | 89 | 33.067417 | 27.838539 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.550562 | false | false | 12 |
e9719d6b9c211b3b8d148742724d9ba0aaf09314 | 11,476,152,652,523 | 30b33bc5a3a5b0f8dd152ccd3d34f99356ba5185 | /src/de/fka/fmi4java/FMI2Component.java | e49f81b9a863a16751eaf5fc39a3231274bba644 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | JensKlimke/fmi4java | https://github.com/JensKlimke/fmi4java | c2618f8eda978f87e8cfbaa4b07722a752d7852b | a6fe2afd67ebf50927efa4ba5b744a9ed77d3ab1 | refs/heads/master | 2020-02-22T03:20:25.942000 | 2017-10-25T15:08:41 | 2017-10-25T15:08:41 | 99,930,618 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.fka.fmi4java;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import de.fka.fmi4java.FMI2ScalarVariable.CausalityType;
import de.fka.fmi4java.FMI2ScalarVariable.DataType;
public class FMI2Component
{
public static enum FMIStatus {OK, WARNING, DISCARD, ERROR, FATAL, PENDING};
private static class Variable
{
public FMI2ScalarVariable def;
public Pointer value;
public Pointer nominal;
public Pointer derivative;
}
private static class VariablesMemorySet
{
public int n = 0;
public Memory ref;
public Memory val;
}
private static final long D = Native.getNativeSize(Double.TYPE);
private static final long I = Native.getNativeSize(Integer.TYPE);
private static final long B = Native.BOOL_SIZE;
private static final long P = Native.POINTER_SIZE;
private FMI2FunctionalMockupUnit unit;
private Object modelPointer;
private String name;
private Map<Integer, Variable> variables = new HashMap<>();
private static final HashMap<DataType, Long> dataTypeSizes;
static
{
dataTypeSizes = new HashMap<>();
dataTypeSizes.put(DataType.INTEGER, I);
dataTypeSizes.put(DataType.REAL, D);
dataTypeSizes.put(DataType.BOOLEAN, B);
dataTypeSizes.put(DataType.STRING, P);
}
private HashMap<DataType, VariablesMemorySet> memIn;
private HashMap<DataType, VariablesMemorySet> memOut;
private VariablesMemorySet realsContSt;
private VariablesMemorySet realsNomContStr;
private Memory memEvents;
private ArrayList<Variable> outputs = new ArrayList<>();
private ArrayList<Variable> initialUnknowns = new ArrayList<>();
private FMIStatus status;
public FMI2Component(FMI2FunctionalMockupUnit unit, Object pointer, String name)
{
// set data
this.unit = unit;
this.modelPointer = pointer;
this.name = name;
// create variables
for(Entry<Integer, FMI2ScalarVariable> var : unit.createVariablesMap().entrySet())
{
// create variable
Variable tmp = new Variable();
tmp.def = var.getValue();
tmp.value = null;
// add to list
variables.put(var.getKey(), tmp);
}
// create outputs
for(Integer i : unit.getOutputs())
outputs.add(variables.get(i));
// create initial outputs
for(Integer i : unit.getInitialUnknowns())
initialUnknowns.add(variables.get(i));
// create event indicators
int en = unit.getNumberOfEventIndicators();
// create memory and quantity vector
if(en > 0)
memEvents = new Memory(D);
}
/**
* Returns the object (pointer) to the fmu model
* @return Object which represents the fmu
*/
public Object ptr()
{
return modelPointer;
}
/**
* Returns the name of the fmu model
* @return Name of the model
*/
public String getName()
{
// return name
return name;
}
/**
* Returns the status of the fmu model
* @return Status of the fmu model
*/
public FMIStatus getStatus()
{
// return status
return status;
}
/**
* Returns the pointer to the value
* @param name Name of the value
* @return Pointer to the memory
*/
public Pointer getValue(String name)
{
// get reference and from that the value
Integer ref = unit.getVariableRef(name);
return variables.get(ref).value;
}
/**
* Returns the pointer to the nominal of the value
* @param name Name of the value
* @return Pointer to the memory
*/
public Pointer getNominal(String name)
{
// get reference and from that the value
Integer ref = unit.getVariableRef(name);
return variables.get(ref).nominal;
}
/**
* Returns the pointer to the derivative of the value
* @param name Name of the value
* @return Pointer to the memory
*/
public Pointer getDerivative(String name)
{
// get reference and from that the value
Integer ref = unit.getVariableRef(name);
return variables.get(ref).derivative;
}
/**
* Allocates memory for the real type variables
* @throws Exception
*/
public void allocateRealMemory() throws Exception
{
// continuous states
realsContSt = new VariablesMemorySet();
realsNomContStr = new VariablesMemorySet();
// create hash maps
memIn = new HashMap<>();
memOut = new HashMap<>();
// do for ever data type
for(Entry<DataType, Long> en : dataTypeSizes.entrySet())
{
// get type and data type size
DataType t = en.getKey();
long s = en.getValue();
// create memory
memIn.put(t, new VariablesMemorySet());
memOut.put(t, new VariablesMemorySet());
// create lists
ArrayList<Integer> listOut = new ArrayList<>();
ArrayList<Integer> listIn = new ArrayList<>();
// iterate over variables
for(Variable variable : variables.values())
{
// get variable and causality
FMI2ScalarVariable var = variable.def;
CausalityType c = var.getCausality();
// type switch
if(var.getType() != t)
continue;
// check if variable is an output
if(c == CausalityType.OUTPUT)
listOut.add(var.getValueReference());
// check if variable is an input
if(c == CausalityType.INPUT)
listIn.add(var.getValueReference());
}
// create memory for outputs
linkVariables(listOut, memOut.get(t), s, "");
// create memory for outputs
linkVariables(listIn, memIn.get(t), s, "");
// TODO: continous states, nominals and derivatives
}
}
/**
* Instantiates the given real variable and sets the pointer to the memory.
* The variables are given by a ordered list of integers which represent their
* references. The memory is given by a pointer with the ordered locations for
* the values
* @param refs List of references
* @param mem Pointer to the memory
* @param size Size of the native data type
* @param mode Denotes which sub-value is set: value, nominal, derivative
* @throws Exception
*/
private void linkVariables(List<Integer> refs, VariablesMemorySet memSet, long varSize, String mode) throws Exception
{
// abort if size is zero
if(refs.size() == 0)
return;
// allocate memory for outputs
memSet.n = refs.size();
memSet.val = new Memory(memSet.n * varSize);
memSet.ref = new Memory(memSet.n * I);
// iterate over variables
int i = 0;
for(Integer ref : refs)
{
// get variable
Variable var = variables.get(ref);
// get pointer
Pointer ptr = memSet.val.share(i * varSize, varSize);
// switch
if(mode.equals("nominal"))
{
var.nominal = ptr;
}
else if(mode.equals("derivative"))
{
var.derivative = ptr;
}
else
{
var.value = ptr;
}
// save reference to memory
memSet.ref.setInt(i * I, ref);
// increase counter
++i;
}
}
public void close()
{
// free instance
unit.getLibrary().fncFreeInstance.invoke(new Object[] { ptr() });
}
/**
* Runs the initialization code for the fmu
* @param time Time at the initialization
*/
public void initialize(double time)
{
// set time and start values
setTime(time);
updateValues();
// setup experiment
checkState((Integer) unit.getLibrary().fncSetupExperiment.invoke(Integer.class,
new Object[] { ptr(), false, 0.0, time, false, 0.0 }));
// initialization
unit.getLibrary().fncEnterInitializationMode.invoke(new Object[] { ptr() } );
unit.getLibrary().fncExitInitializationMode.invoke(new Object[] { ptr() } );
// new discrete modes
getEventInfo();
// enter continuous time mode
unit.getLibrary().fncEnterContinuousTimeMode.invoke(new Object[] { ptr() } );
// receive initial states and nominal values
int nx = unit.getNumberOfContinousStates();
unit.getLibrary().fncGetContinuousStates.invoke(new Object[] { ptr(), realsContSt.val, nx } );
unit.getLibrary().fncGetNominalsOfContinuousStates.invoke(new Object[] { ptr(), realsNomContStr.val, nx } );
// receive values
receiveValues();
}
/**
* Set the simulation time to the fmu
* @param time Time to be set
*/
public void timeStep(double time)
{
// TODO: get derivatives, integrate, set continuous states
// probably in another method, thus a model can
// get the derivatives from the fmu, perform the integration in the stepAction() method
// and call the timeStep (this method) of the fmu with the continuous-time states
// calculated
// set time and update input values
setTime(time);
updateValues();
// get event indicator
unit.getLibrary().fncGetEventIndicators.invoke(new Object[] { ptr(), memEvents, unit.getNumberOfEventIndicators() });
// TODO: check state event
// complete integrator step
IntByReference enterEventMode = new IntByReference();
IntByReference terminateSim = new IntByReference();
unit.getLibrary().fncCompletedIntegratorStep.invoke(new Object[] { ptr(), true, enterEventMode, terminateSim });
// check if termination requested
if(terminateSim.getValue() == 1)
terminate(); // TODO: what happens in model
// enter event mode
unit.getLibrary().fncEnterEventMode.invoke(new Object[] { ptr() });
// get event info
FMI2EventInfo.ByReference eventInfo = getEventInfo();
// enter continuous mode
unit.getLibrary().fncEnterContinuousTimeMode.invoke(new Object[] { ptr() });
// get values
receiveValues();
// get number of continuous states
int nx = unit.getNumberOfContinousStates();
// receive continuous states if changed
if(eventInfo.valuesOfContinuousStatesChanged == 1)
unit.getLibrary().fncGetContinuousStates.invoke(new Object[] { ptr(), realsContSt.val, nx } );
// receive continuous states if changed
if(eventInfo.nominalsOfContinuousStatesChanged == 1)
unit.getLibrary().fncGetNominalsOfContinuousStates.invoke(new Object[] { ptr(), realsNomContStr.val, nx } );
// // set next time step
// double timeNext = Double.POSITIVE_INFINITY;
// if(eventInfo.nextEventTimeDefined == 1)
// timeNext = eventInfo.nextEventTime;
// else
// timeNext = Double.POSITIVE_INFINITY;
}
private FMI2EventInfo.ByReference getEventInfo()
{
// event iteration
FMI2EventInfo.ByReference eventInfo = new FMI2EventInfo.ByReference();
eventInfo.newDiscreteStatesNeeded = 1;
// run until no new discrete states needed
while(eventInfo.newDiscreteStatesNeeded == 1)
{
// check new discrete states
unit.getLibrary().fncNewDiscreteStates.invoke(new Object[] { ptr(), eventInfo } );
// terminate simulation
if(eventInfo.terminateSimulation == 1)
terminate();
}
return eventInfo;
}
/**
* Sets the values to the library
*/
private void updateValues()
{
// iterate over data types
for(Entry<DataType, Long> en : dataTypeSizes.entrySet())
{
// get type and memory set
DataType t = en.getKey();
VariablesMemorySet m = memIn.get(t);
// ignore empty container
if(m.n == 0)
continue;
// get outputs
int s = (Integer) unit.getLibrary().fncSetXXX.get(t).invoke(Integer.class,
new Object[] { ptr(), m.ref, m.n, m.val });
// check state
checkState(s);
}
}
/**
* Receives the values from the library
*/
private void receiveValues()
{
// iterate over data types
for(Entry<DataType, Long> en : dataTypeSizes.entrySet())
{
// get type and memory set
DataType t = en.getKey();
VariablesMemorySet m = memOut.get(t);
// ignore empty container
if(m.n == 0)
continue;
// get outputs
int s = (Integer) unit.getLibrary().fncGetXXX.get(t).invoke(Integer.class,
new Object[] { ptr(), m.ref, m.n, m.val });
// check state
checkState(s);
}
}
public void terminate()
{
// termination
unit.getLibrary().fncTerminate.invoke(new Object[] { ptr() } );
// receive final values
receiveValues();
// clean up
unit.getLibrary().fncFreeInstance.invoke(new Object[] { ptr() } );
}
public void reset()
{
// reset
unit.getLibrary().fncReset.invoke(new Object[] { ptr() } );
}
private void setTime(double time)
{
// call set time method
checkState((int) unit.getLibrary().fncSetTime.invoke(Integer.class,
new Object[] { ptr(), time }));
}
private void checkState(int s)
{
// check state
status = FMIStatus.values()[s];
if(status != FMIStatus.OK)
System.out.println(status);
}
/**
* Returns the step size of the fmu component
* @return Step size
*/
public double getStepSize()
{
return unit.getStepSize();
}
@Override
public String toString()
{
String str = "FMU Component \"" + getName() + "\": " + System.lineSeparator();
for(Variable var : variables.values())
str += var.def + "=" + var.value + System.lineSeparator();
return str;
}
}
| UTF-8 | Java | 13,480 | java | FMI2Component.java | Java | [] | null | [] | package de.fka.fmi4java;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import de.fka.fmi4java.FMI2ScalarVariable.CausalityType;
import de.fka.fmi4java.FMI2ScalarVariable.DataType;
public class FMI2Component
{
public static enum FMIStatus {OK, WARNING, DISCARD, ERROR, FATAL, PENDING};
private static class Variable
{
public FMI2ScalarVariable def;
public Pointer value;
public Pointer nominal;
public Pointer derivative;
}
private static class VariablesMemorySet
{
public int n = 0;
public Memory ref;
public Memory val;
}
private static final long D = Native.getNativeSize(Double.TYPE);
private static final long I = Native.getNativeSize(Integer.TYPE);
private static final long B = Native.BOOL_SIZE;
private static final long P = Native.POINTER_SIZE;
private FMI2FunctionalMockupUnit unit;
private Object modelPointer;
private String name;
private Map<Integer, Variable> variables = new HashMap<>();
private static final HashMap<DataType, Long> dataTypeSizes;
static
{
dataTypeSizes = new HashMap<>();
dataTypeSizes.put(DataType.INTEGER, I);
dataTypeSizes.put(DataType.REAL, D);
dataTypeSizes.put(DataType.BOOLEAN, B);
dataTypeSizes.put(DataType.STRING, P);
}
private HashMap<DataType, VariablesMemorySet> memIn;
private HashMap<DataType, VariablesMemorySet> memOut;
private VariablesMemorySet realsContSt;
private VariablesMemorySet realsNomContStr;
private Memory memEvents;
private ArrayList<Variable> outputs = new ArrayList<>();
private ArrayList<Variable> initialUnknowns = new ArrayList<>();
private FMIStatus status;
public FMI2Component(FMI2FunctionalMockupUnit unit, Object pointer, String name)
{
// set data
this.unit = unit;
this.modelPointer = pointer;
this.name = name;
// create variables
for(Entry<Integer, FMI2ScalarVariable> var : unit.createVariablesMap().entrySet())
{
// create variable
Variable tmp = new Variable();
tmp.def = var.getValue();
tmp.value = null;
// add to list
variables.put(var.getKey(), tmp);
}
// create outputs
for(Integer i : unit.getOutputs())
outputs.add(variables.get(i));
// create initial outputs
for(Integer i : unit.getInitialUnknowns())
initialUnknowns.add(variables.get(i));
// create event indicators
int en = unit.getNumberOfEventIndicators();
// create memory and quantity vector
if(en > 0)
memEvents = new Memory(D);
}
/**
* Returns the object (pointer) to the fmu model
* @return Object which represents the fmu
*/
public Object ptr()
{
return modelPointer;
}
/**
* Returns the name of the fmu model
* @return Name of the model
*/
public String getName()
{
// return name
return name;
}
/**
* Returns the status of the fmu model
* @return Status of the fmu model
*/
public FMIStatus getStatus()
{
// return status
return status;
}
/**
* Returns the pointer to the value
* @param name Name of the value
* @return Pointer to the memory
*/
public Pointer getValue(String name)
{
// get reference and from that the value
Integer ref = unit.getVariableRef(name);
return variables.get(ref).value;
}
/**
* Returns the pointer to the nominal of the value
* @param name Name of the value
* @return Pointer to the memory
*/
public Pointer getNominal(String name)
{
// get reference and from that the value
Integer ref = unit.getVariableRef(name);
return variables.get(ref).nominal;
}
/**
* Returns the pointer to the derivative of the value
* @param name Name of the value
* @return Pointer to the memory
*/
public Pointer getDerivative(String name)
{
// get reference and from that the value
Integer ref = unit.getVariableRef(name);
return variables.get(ref).derivative;
}
/**
* Allocates memory for the real type variables
* @throws Exception
*/
public void allocateRealMemory() throws Exception
{
// continuous states
realsContSt = new VariablesMemorySet();
realsNomContStr = new VariablesMemorySet();
// create hash maps
memIn = new HashMap<>();
memOut = new HashMap<>();
// do for ever data type
for(Entry<DataType, Long> en : dataTypeSizes.entrySet())
{
// get type and data type size
DataType t = en.getKey();
long s = en.getValue();
// create memory
memIn.put(t, new VariablesMemorySet());
memOut.put(t, new VariablesMemorySet());
// create lists
ArrayList<Integer> listOut = new ArrayList<>();
ArrayList<Integer> listIn = new ArrayList<>();
// iterate over variables
for(Variable variable : variables.values())
{
// get variable and causality
FMI2ScalarVariable var = variable.def;
CausalityType c = var.getCausality();
// type switch
if(var.getType() != t)
continue;
// check if variable is an output
if(c == CausalityType.OUTPUT)
listOut.add(var.getValueReference());
// check if variable is an input
if(c == CausalityType.INPUT)
listIn.add(var.getValueReference());
}
// create memory for outputs
linkVariables(listOut, memOut.get(t), s, "");
// create memory for outputs
linkVariables(listIn, memIn.get(t), s, "");
// TODO: continous states, nominals and derivatives
}
}
/**
* Instantiates the given real variable and sets the pointer to the memory.
* The variables are given by a ordered list of integers which represent their
* references. The memory is given by a pointer with the ordered locations for
* the values
* @param refs List of references
* @param mem Pointer to the memory
* @param size Size of the native data type
* @param mode Denotes which sub-value is set: value, nominal, derivative
* @throws Exception
*/
private void linkVariables(List<Integer> refs, VariablesMemorySet memSet, long varSize, String mode) throws Exception
{
// abort if size is zero
if(refs.size() == 0)
return;
// allocate memory for outputs
memSet.n = refs.size();
memSet.val = new Memory(memSet.n * varSize);
memSet.ref = new Memory(memSet.n * I);
// iterate over variables
int i = 0;
for(Integer ref : refs)
{
// get variable
Variable var = variables.get(ref);
// get pointer
Pointer ptr = memSet.val.share(i * varSize, varSize);
// switch
if(mode.equals("nominal"))
{
var.nominal = ptr;
}
else if(mode.equals("derivative"))
{
var.derivative = ptr;
}
else
{
var.value = ptr;
}
// save reference to memory
memSet.ref.setInt(i * I, ref);
// increase counter
++i;
}
}
public void close()
{
// free instance
unit.getLibrary().fncFreeInstance.invoke(new Object[] { ptr() });
}
/**
* Runs the initialization code for the fmu
* @param time Time at the initialization
*/
public void initialize(double time)
{
// set time and start values
setTime(time);
updateValues();
// setup experiment
checkState((Integer) unit.getLibrary().fncSetupExperiment.invoke(Integer.class,
new Object[] { ptr(), false, 0.0, time, false, 0.0 }));
// initialization
unit.getLibrary().fncEnterInitializationMode.invoke(new Object[] { ptr() } );
unit.getLibrary().fncExitInitializationMode.invoke(new Object[] { ptr() } );
// new discrete modes
getEventInfo();
// enter continuous time mode
unit.getLibrary().fncEnterContinuousTimeMode.invoke(new Object[] { ptr() } );
// receive initial states and nominal values
int nx = unit.getNumberOfContinousStates();
unit.getLibrary().fncGetContinuousStates.invoke(new Object[] { ptr(), realsContSt.val, nx } );
unit.getLibrary().fncGetNominalsOfContinuousStates.invoke(new Object[] { ptr(), realsNomContStr.val, nx } );
// receive values
receiveValues();
}
/**
* Set the simulation time to the fmu
* @param time Time to be set
*/
public void timeStep(double time)
{
// TODO: get derivatives, integrate, set continuous states
// probably in another method, thus a model can
// get the derivatives from the fmu, perform the integration in the stepAction() method
// and call the timeStep (this method) of the fmu with the continuous-time states
// calculated
// set time and update input values
setTime(time);
updateValues();
// get event indicator
unit.getLibrary().fncGetEventIndicators.invoke(new Object[] { ptr(), memEvents, unit.getNumberOfEventIndicators() });
// TODO: check state event
// complete integrator step
IntByReference enterEventMode = new IntByReference();
IntByReference terminateSim = new IntByReference();
unit.getLibrary().fncCompletedIntegratorStep.invoke(new Object[] { ptr(), true, enterEventMode, terminateSim });
// check if termination requested
if(terminateSim.getValue() == 1)
terminate(); // TODO: what happens in model
// enter event mode
unit.getLibrary().fncEnterEventMode.invoke(new Object[] { ptr() });
// get event info
FMI2EventInfo.ByReference eventInfo = getEventInfo();
// enter continuous mode
unit.getLibrary().fncEnterContinuousTimeMode.invoke(new Object[] { ptr() });
// get values
receiveValues();
// get number of continuous states
int nx = unit.getNumberOfContinousStates();
// receive continuous states if changed
if(eventInfo.valuesOfContinuousStatesChanged == 1)
unit.getLibrary().fncGetContinuousStates.invoke(new Object[] { ptr(), realsContSt.val, nx } );
// receive continuous states if changed
if(eventInfo.nominalsOfContinuousStatesChanged == 1)
unit.getLibrary().fncGetNominalsOfContinuousStates.invoke(new Object[] { ptr(), realsNomContStr.val, nx } );
// // set next time step
// double timeNext = Double.POSITIVE_INFINITY;
// if(eventInfo.nextEventTimeDefined == 1)
// timeNext = eventInfo.nextEventTime;
// else
// timeNext = Double.POSITIVE_INFINITY;
}
private FMI2EventInfo.ByReference getEventInfo()
{
// event iteration
FMI2EventInfo.ByReference eventInfo = new FMI2EventInfo.ByReference();
eventInfo.newDiscreteStatesNeeded = 1;
// run until no new discrete states needed
while(eventInfo.newDiscreteStatesNeeded == 1)
{
// check new discrete states
unit.getLibrary().fncNewDiscreteStates.invoke(new Object[] { ptr(), eventInfo } );
// terminate simulation
if(eventInfo.terminateSimulation == 1)
terminate();
}
return eventInfo;
}
/**
* Sets the values to the library
*/
private void updateValues()
{
// iterate over data types
for(Entry<DataType, Long> en : dataTypeSizes.entrySet())
{
// get type and memory set
DataType t = en.getKey();
VariablesMemorySet m = memIn.get(t);
// ignore empty container
if(m.n == 0)
continue;
// get outputs
int s = (Integer) unit.getLibrary().fncSetXXX.get(t).invoke(Integer.class,
new Object[] { ptr(), m.ref, m.n, m.val });
// check state
checkState(s);
}
}
/**
* Receives the values from the library
*/
private void receiveValues()
{
// iterate over data types
for(Entry<DataType, Long> en : dataTypeSizes.entrySet())
{
// get type and memory set
DataType t = en.getKey();
VariablesMemorySet m = memOut.get(t);
// ignore empty container
if(m.n == 0)
continue;
// get outputs
int s = (Integer) unit.getLibrary().fncGetXXX.get(t).invoke(Integer.class,
new Object[] { ptr(), m.ref, m.n, m.val });
// check state
checkState(s);
}
}
public void terminate()
{
// termination
unit.getLibrary().fncTerminate.invoke(new Object[] { ptr() } );
// receive final values
receiveValues();
// clean up
unit.getLibrary().fncFreeInstance.invoke(new Object[] { ptr() } );
}
public void reset()
{
// reset
unit.getLibrary().fncReset.invoke(new Object[] { ptr() } );
}
private void setTime(double time)
{
// call set time method
checkState((int) unit.getLibrary().fncSetTime.invoke(Integer.class,
new Object[] { ptr(), time }));
}
private void checkState(int s)
{
// check state
status = FMIStatus.values()[s];
if(status != FMIStatus.OK)
System.out.println(status);
}
/**
* Returns the step size of the fmu component
* @return Step size
*/
public double getStepSize()
{
return unit.getStepSize();
}
@Override
public String toString()
{
String str = "FMU Component \"" + getName() + "\": " + System.lineSeparator();
for(Variable var : variables.values())
str += var.def + "=" + var.value + System.lineSeparator();
return str;
}
}
| 13,480 | 0.644065 | 0.641617 | 549 | 22.553734 | 23.281584 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.233151 | false | false | 12 |
12226148c251b6630c6df006b78014589c643879 | 33,208,687,175,256 | 4694d5c647a4c309c3bcebe01cc9714a92e24562 | /netcore/src/main/java/com/charles/app/netcore/net/CMD.java | 716aec5d10a7503a3264000ddbf443bed32e515b | [] | no_license | chenshuide/Demo | https://github.com/chenshuide/Demo | c7a3b118ff8f5a40c635ed19d5677986709f6c85 | d02feda528aae4560f84f2eb01b416c74898a5c5 | refs/heads/master | 2018-03-20T20:12:46.390000 | 2017-07-12T08:24:24 | 2017-07-12T08:24:24 | 66,834,374 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.charles.app.netcore.net;
/**
* Created by charles on 22/12/16.
*/
public interface Cmd {
int PUSH = 1;
int SYNC = 2;
int NOTIFY = 3;
int RESPONSE = 4;
}
| UTF-8 | Java | 186 | java | CMD.java | Java | [
{
"context": "ge com.charles.app.netcore.net;\n\n/**\n * Created by charles on 22/12/16.\n */\n\npublic interface Cmd {\n\n int",
"end": 63,
"score": 0.9946185350418091,
"start": 56,
"tag": "USERNAME",
"value": "charles"
}
] | null | [] | package com.charles.app.netcore.net;
/**
* Created by charles on 22/12/16.
*/
public interface Cmd {
int PUSH = 1;
int SYNC = 2;
int NOTIFY = 3;
int RESPONSE = 4;
}
| 186 | 0.591398 | 0.537634 | 13 | 13.307693 | 12.504674 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 12 |
6c9513507b1c46c608ddc48b30c8c50c677db711 | 5,102,421,158,215 | 5fed25bcb32c09ca1e33f3dd76312d343e889ea3 | /src/Modell/CarTransportTruck.java | 3082608ee3cbf87f4deba25a53c591041f63308a | [] | no_license | Ralph-IT/TDA552 | https://github.com/Ralph-IT/TDA552 | cfe22962d69fe930e4691edaf861b669fc05b880 | ed43e33682f92d6f1a5dafa910133c588d96a810 | refs/heads/master | 2020-09-11T01:07:30.146000 | 2019-12-13T10:42:54 | 2019-12-13T10:42:54 | 221,889,190 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Modell;
import java.awt.*;
/**
* Class for a truck that transports cars
*/
public class CarTransportTruck extends Truck {
private VehicleStorage carStorage = new VehicleStorage(6, VehicleStorage.UnloadOrder.FirstInFirstOut);
private State rampState = State.HIGH;
/**
* Enum for the angular state of the flatbed
*/
private enum State{
HIGH,
LOW
}
public CarTransportTruck() {
super(2, 100, Color.blue, "Brunte", 5);
}
/**
* Method for raising the ramp
*/
public void raiseFlatbed(){
rampState = State.HIGH;
getFlatbed().setAngle(0);
}
/**
* Method for lowering the ramp
*/
public void lowerFlatbed(){ //Kanske göra till boolean? ger false om inte lyckas
if(getCurrentSpeed() < 0.001) {
rampState = State.LOW;
getFlatbed().setAngle(-70);
}
}
/**
* Method for loading a car onto the flatbed
* @param car the car that is being loaded onto the flatbed
*/
public void loadCar(Car car){
if(car.getSizeClass() < 4 && rampState == State.LOW && Math.abs(this.getX() - car.getX()) < 5 &&
Math.abs(this.getY() - car.getY()) < 5 && car.isStored() == false){
carStorage.load(car);
car.setStored(true);
}
}
/**
* Method for unloading cars from the flatbed
*/
public void unloadCar(){
if(rampState == State.LOW && getCurrentSpeed() < 0.001){
Vehicle car = carStorage.unload();
car.setY(getY() - 5);
}
}
/**
* Method that moves both the truck, and all the cars being transported on it
*/
@Override
public void move(){
super.move();
carStorage.updatePositions(getX(),getY());
}
/**
* Method for the truck's speed factor
* @return the truck's speed factor
*/
public double speedFactor(){
return getEnginePower() * 0.01;
}
public VehicleStorage getCarStorage() {
return carStorage;
}
}
| UTF-8 | Java | 2,089 | java | CarTransportTruck.java | Java | [] | null | [] | package Modell;
import java.awt.*;
/**
* Class for a truck that transports cars
*/
public class CarTransportTruck extends Truck {
private VehicleStorage carStorage = new VehicleStorage(6, VehicleStorage.UnloadOrder.FirstInFirstOut);
private State rampState = State.HIGH;
/**
* Enum for the angular state of the flatbed
*/
private enum State{
HIGH,
LOW
}
public CarTransportTruck() {
super(2, 100, Color.blue, "Brunte", 5);
}
/**
* Method for raising the ramp
*/
public void raiseFlatbed(){
rampState = State.HIGH;
getFlatbed().setAngle(0);
}
/**
* Method for lowering the ramp
*/
public void lowerFlatbed(){ //Kanske göra till boolean? ger false om inte lyckas
if(getCurrentSpeed() < 0.001) {
rampState = State.LOW;
getFlatbed().setAngle(-70);
}
}
/**
* Method for loading a car onto the flatbed
* @param car the car that is being loaded onto the flatbed
*/
public void loadCar(Car car){
if(car.getSizeClass() < 4 && rampState == State.LOW && Math.abs(this.getX() - car.getX()) < 5 &&
Math.abs(this.getY() - car.getY()) < 5 && car.isStored() == false){
carStorage.load(car);
car.setStored(true);
}
}
/**
* Method for unloading cars from the flatbed
*/
public void unloadCar(){
if(rampState == State.LOW && getCurrentSpeed() < 0.001){
Vehicle car = carStorage.unload();
car.setY(getY() - 5);
}
}
/**
* Method that moves both the truck, and all the cars being transported on it
*/
@Override
public void move(){
super.move();
carStorage.updatePositions(getX(),getY());
}
/**
* Method for the truck's speed factor
* @return the truck's speed factor
*/
public double speedFactor(){
return getEnginePower() * 0.01;
}
public VehicleStorage getCarStorage() {
return carStorage;
}
}
| 2,089 | 0.568008 | 0.556513 | 85 | 23.564707 | 24.364607 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false | 12 |
d358bae53eeed23a963fbafbd17b3369eca2e61c | 5,025,111,778,607 | 447520f40e82a060368a0802a391697bc00be96f | /apks/playstore_apps/com_idamob_tinkoff_android/source/io/reactivex/d/e/c/y.java | 13717f5a1051dac873baa59d384138adb1404527 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | https://github.com/iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689000 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | false | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | 2019-09-30T19:01:44 | 2023-07-16T07:41:38 | 1,616,319 | 0 | 0 | 1 | null | false | false | package io.reactivex.d.e.c;
import io.reactivex.b.b;
import io.reactivex.d.a.c;
import io.reactivex.d.a.f;
import io.reactivex.m;
import io.reactivex.o;
import io.reactivex.x;
import java.util.concurrent.atomic.AtomicReference;
public final class y<T>
extends a<T, T>
{
final x b;
public y(o<T> paramO, x paramX)
{
super(paramO);
this.b = paramX;
}
protected final void b(m<? super T> paramM)
{
a localA = new a(paramM);
paramM.a(localA);
c.c(localA.a, this.b.a(new b(localA, this.a)));
}
static final class a<T>
extends AtomicReference<b>
implements b, m<T>
{
private static final long serialVersionUID = 8571289934935992137L;
final f a;
final m<? super T> b;
a(m<? super T> paramM)
{
this.b = paramM;
this.a = new f();
}
public final void a()
{
this.b.a();
}
public final void a(b paramB)
{
c.b(this, paramB);
}
public final void a(Throwable paramThrowable)
{
this.b.a(paramThrowable);
}
public final void b()
{
c.a(this);
this.a.b();
}
public final boolean c()
{
return c.a((b)get());
}
public final void c_(T paramT)
{
this.b.c_(paramT);
}
}
static final class b<T>
implements Runnable
{
final m<? super T> a;
final o<T> b;
b(m<? super T> paramM, o<T> paramO)
{
this.a = paramM;
this.b = paramO;
}
public final void run()
{
this.b.a(this.a);
}
}
}
| UTF-8 | Java | 1,571 | java | y.java | Java | [] | null | [] | package io.reactivex.d.e.c;
import io.reactivex.b.b;
import io.reactivex.d.a.c;
import io.reactivex.d.a.f;
import io.reactivex.m;
import io.reactivex.o;
import io.reactivex.x;
import java.util.concurrent.atomic.AtomicReference;
public final class y<T>
extends a<T, T>
{
final x b;
public y(o<T> paramO, x paramX)
{
super(paramO);
this.b = paramX;
}
protected final void b(m<? super T> paramM)
{
a localA = new a(paramM);
paramM.a(localA);
c.c(localA.a, this.b.a(new b(localA, this.a)));
}
static final class a<T>
extends AtomicReference<b>
implements b, m<T>
{
private static final long serialVersionUID = 8571289934935992137L;
final f a;
final m<? super T> b;
a(m<? super T> paramM)
{
this.b = paramM;
this.a = new f();
}
public final void a()
{
this.b.a();
}
public final void a(b paramB)
{
c.b(this, paramB);
}
public final void a(Throwable paramThrowable)
{
this.b.a(paramThrowable);
}
public final void b()
{
c.a(this);
this.a.b();
}
public final boolean c()
{
return c.a((b)get());
}
public final void c_(T paramT)
{
this.b.c_(paramT);
}
}
static final class b<T>
implements Runnable
{
final m<? super T> a;
final o<T> b;
b(m<? super T> paramM, o<T> paramO)
{
this.a = paramM;
this.b = paramO;
}
public final void run()
{
this.b.a(this.a);
}
}
}
| 1,571 | 0.544876 | 0.532782 | 92 | 16.076086 | 13.944949 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413043 | false | false | 12 |
5401f4b8d2c2bd6d686472197874c483de1ecfd1 | 22,308,060,137,289 | 4691acca4e62da71a857385cffce2b6b4aef3bb3 | /akka-modules/spring-akka/src/main/java/com/baeldung/akka/AppConfiguration.java | 3568026d6daaf4bc1ad36e6926410a0c08aef800 | [
"MIT"
] | permissive | lor6/tutorials | https://github.com/lor6/tutorials | 800f2e48d7968c047407bbd8a61b47be7ec352f2 | e993db2c23d559d503b8bf8bc27aab0847224593 | refs/heads/master | 2023-05-29T06:17:47.980000 | 2023-05-19T08:37:45 | 2023-05-19T08:37:45 | 145,218,314 | 7 | 11 | MIT | true | 2018-08-18T12:29:20 | 2018-08-18T12:29:19 | 2018-08-18T12:01:20 | 2018-08-18T12:01:05 | 108,692 | 0 | 0 | 0 | null | false | null | package com.baeldung.akka;
import akka.actor.ActorSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
public class AppConfiguration {
@Autowired
private ApplicationContext applicationContext;
@Bean
public ActorSystem actorSystem() {
ActorSystem system = ActorSystem.create("akka-spring-demo");
SpringExtension.SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
return system;
}
}
| UTF-8 | Java | 726 | java | AppConfiguration.java | Java | [] | null | [] | package com.baeldung.akka;
import akka.actor.ActorSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
public class AppConfiguration {
@Autowired
private ApplicationContext applicationContext;
@Bean
public ActorSystem actorSystem() {
ActorSystem system = ActorSystem.create("akka-spring-demo");
SpringExtension.SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
return system;
}
}
| 726 | 0.794766 | 0.794766 | 24 | 29.25 | 26.583595 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false | 12 |
724bd8fae14c26b72b1c340ca5d3227d03771e28 | 9,869,834,897,256 | b335df9308aa2b0c668ecc74ed5b674de7d0d8e9 | /day5/Fun15.java | 079d96d550a5efbb7f44500d93d11440799620b0 | [] | no_license | Dhuvaraggn/java-training | https://github.com/Dhuvaraggn/java-training | 77a0e0c4c71b82975bb988866906b4d5b75988ef | 55c049e6de96c21a6c3b1d91ed1bfdbc23f9dabc | refs/heads/main | 2023-04-03T06:23:01.260000 | 2021-04-01T12:06:04 | 2021-04-01T12:09:37 | 346,287,631 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day5;
public class Fun15 {
int a=0;
public static void main(String [] arg) {
System.out.print(operation(1,2));
System.out.print(operation(1f,2f));
}
Fun15(){
}
Fun15(int a){
this.a=a;
}
static public int operation(int a,int b) {
return a+b;
}
static protected float operation(float a,float b) {
return a*b;
}
}
| UTF-8 | Java | 352 | java | Fun15.java | Java | [] | null | [] | package day5;
public class Fun15 {
int a=0;
public static void main(String [] arg) {
System.out.print(operation(1,2));
System.out.print(operation(1f,2f));
}
Fun15(){
}
Fun15(int a){
this.a=a;
}
static public int operation(int a,int b) {
return a+b;
}
static protected float operation(float a,float b) {
return a*b;
}
}
| 352 | 0.630682 | 0.596591 | 23 | 14.304348 | 15.727116 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.73913 | false | false | 12 |
cf31f12e405d33a8d28b0f20b3f567630bb7c99b | 34,213,709,522,655 | 2175d6a417843e151d54cda309bff47be0b97da3 | /src/test/java/dlineage/testMultpleSqlFiles.java | f797fb844e2533ba08de1fad61de7577fccc54cf | [] | no_license | sqlparser/gsp_demo_java | https://github.com/sqlparser/gsp_demo_java | 6cf93fdf567f40ca1da86e4d9da8d19d25452e55 | 6e377789c0b36f47013449a65ea293c9495b7dcc | refs/heads/master | 2023-08-18T02:02:34.857000 | 2023-06-08T02:32:26 | 2023-06-08T02:32:26 | 206,196,892 | 108 | 55 | null | false | 2023-04-14T18:30:08 | 2019-09-04T00:37:05 | 2023-04-09T07:14:54 | 2023-04-14T18:30:06 | 229,040 | 91 | 46 | 11 | Java | false | false | package dlineage;
import java.io.File;
import java.util.List;
import common.gspCommon;
import gudusoft.gsqlparser.EDbVendor;
import gudusoft.gsqlparser.dlineage.DataFlowAnalyzer;
import gudusoft.gsqlparser.dlineage.dataflow.model.DbObjectPosition;
import gudusoft.gsqlparser.dlineage.dataflow.model.json.Coordinate;
import gudusoft.gsqlparser.dlineage.dataflow.model.xml.dataflow;
import gudusoft.gsqlparser.dlineage.dataflow.model.xml.procedure;
import gudusoft.gsqlparser.dlineage.dataflow.model.xml.table;
import gudusoft.gsqlparser.dlineage.util.Pair;
import gudusoft.gsqlparser.dlineage.util.SqlInfoHelper;
import junit.framework.TestCase;
public class testMultpleSqlFiles extends TestCase {
public void test1() {
//File sqlfiles = new File("D:/develop/git/gsp_sqlfiles/TestCases/dlineage/mysql/547");
File sqlfiles = new File(common.gspCommon.BASE_SQL_DIR+"private/dlineage/mysql/547");
DataFlowAnalyzer analyzer = new DataFlowAnalyzer(sqlfiles, EDbVendor.dbvmysql, false);
analyzer.generateDataFlow();
dataflow dataflow = analyzer.getDataFlow();
String sqlInfoJson = SqlInfoHelper.getSqlInfoJson(analyzer);
SqlInfoHelper helper = new SqlInfoHelper(sqlInfoJson);
table basic_vw = dataflow.getViews().get(0);
Coordinate[][] viewCoordinates = SqlInfoHelper.parseCoordinateString(basic_vw.getCoordinate());
DbObjectPosition viewPosition = helper.getSelectedDbObjectInfo(viewCoordinates[0][0], viewCoordinates[0][1]);
String fileName = viewPosition.getFile();
List<Pair<Integer, Integer>> positions = viewPosition.getPositions();
assertEquals(fileName, "1.sql");
assertEquals(positions.get(0), new Pair<Integer, Integer>(1, 1));
assertEquals(positions.get(1), new Pair<Integer, Integer>(1, 90));
procedure Basic_Sal = dataflow.getProcedures().get(0);
Coordinate[][] procedureCoordinates = SqlInfoHelper.parseCoordinateString(Basic_Sal.getCoordinate());
DbObjectPosition procedurePosition = helper.getSelectedDbObjectInfo(procedureCoordinates[0][0],
procedureCoordinates[0][1]);
fileName = procedurePosition.getFile();
positions = procedurePosition.getPositions();
Pair<Integer, Integer> startPosition = positions.get(0);
Pair<Integer, Integer> endPosition = positions.get(1);
assertEquals(fileName, "2.sql");
assertEquals(startPosition, new Pair<Integer, Integer>(3, 1));
assertEquals(endPosition, new Pair<Integer, Integer>(5, 6));
DbObjectPosition procedureStatementPosition = helper.getSelectedDbObjectStatementInfo(EDbVendor.dbvmysql,
procedureCoordinates[0][0], procedureCoordinates[0][1]);
String sql = procedureStatementPosition.getSql();
String stmt = "CREATE PROCEDURE `Basic_Sal`()BEGIN\r\n"
+ " SELECT * FROM basic;\r\n"
+ "END;";
int index = procedureStatementPosition.getIndex();
positions = procedureStatementPosition.getPositions();
startPosition = positions.get(0);
endPosition = positions.get(1);
assertEquals(index, 1);
assertEquals(sql.trim(), stmt.trim());
assertEquals(startPosition, new Pair<Integer, Integer>(1, 1));
assertEquals(endPosition, new Pair<Integer, Integer>(3, 6));
}
} | UTF-8 | Java | 3,115 | java | testMultpleSqlFiles.java | Java | [] | null | [] | package dlineage;
import java.io.File;
import java.util.List;
import common.gspCommon;
import gudusoft.gsqlparser.EDbVendor;
import gudusoft.gsqlparser.dlineage.DataFlowAnalyzer;
import gudusoft.gsqlparser.dlineage.dataflow.model.DbObjectPosition;
import gudusoft.gsqlparser.dlineage.dataflow.model.json.Coordinate;
import gudusoft.gsqlparser.dlineage.dataflow.model.xml.dataflow;
import gudusoft.gsqlparser.dlineage.dataflow.model.xml.procedure;
import gudusoft.gsqlparser.dlineage.dataflow.model.xml.table;
import gudusoft.gsqlparser.dlineage.util.Pair;
import gudusoft.gsqlparser.dlineage.util.SqlInfoHelper;
import junit.framework.TestCase;
public class testMultpleSqlFiles extends TestCase {
public void test1() {
//File sqlfiles = new File("D:/develop/git/gsp_sqlfiles/TestCases/dlineage/mysql/547");
File sqlfiles = new File(common.gspCommon.BASE_SQL_DIR+"private/dlineage/mysql/547");
DataFlowAnalyzer analyzer = new DataFlowAnalyzer(sqlfiles, EDbVendor.dbvmysql, false);
analyzer.generateDataFlow();
dataflow dataflow = analyzer.getDataFlow();
String sqlInfoJson = SqlInfoHelper.getSqlInfoJson(analyzer);
SqlInfoHelper helper = new SqlInfoHelper(sqlInfoJson);
table basic_vw = dataflow.getViews().get(0);
Coordinate[][] viewCoordinates = SqlInfoHelper.parseCoordinateString(basic_vw.getCoordinate());
DbObjectPosition viewPosition = helper.getSelectedDbObjectInfo(viewCoordinates[0][0], viewCoordinates[0][1]);
String fileName = viewPosition.getFile();
List<Pair<Integer, Integer>> positions = viewPosition.getPositions();
assertEquals(fileName, "1.sql");
assertEquals(positions.get(0), new Pair<Integer, Integer>(1, 1));
assertEquals(positions.get(1), new Pair<Integer, Integer>(1, 90));
procedure Basic_Sal = dataflow.getProcedures().get(0);
Coordinate[][] procedureCoordinates = SqlInfoHelper.parseCoordinateString(Basic_Sal.getCoordinate());
DbObjectPosition procedurePosition = helper.getSelectedDbObjectInfo(procedureCoordinates[0][0],
procedureCoordinates[0][1]);
fileName = procedurePosition.getFile();
positions = procedurePosition.getPositions();
Pair<Integer, Integer> startPosition = positions.get(0);
Pair<Integer, Integer> endPosition = positions.get(1);
assertEquals(fileName, "2.sql");
assertEquals(startPosition, new Pair<Integer, Integer>(3, 1));
assertEquals(endPosition, new Pair<Integer, Integer>(5, 6));
DbObjectPosition procedureStatementPosition = helper.getSelectedDbObjectStatementInfo(EDbVendor.dbvmysql,
procedureCoordinates[0][0], procedureCoordinates[0][1]);
String sql = procedureStatementPosition.getSql();
String stmt = "CREATE PROCEDURE `Basic_Sal`()BEGIN\r\n"
+ " SELECT * FROM basic;\r\n"
+ "END;";
int index = procedureStatementPosition.getIndex();
positions = procedureStatementPosition.getPositions();
startPosition = positions.get(0);
endPosition = positions.get(1);
assertEquals(index, 1);
assertEquals(sql.trim(), stmt.trim());
assertEquals(startPosition, new Pair<Integer, Integer>(1, 1));
assertEquals(endPosition, new Pair<Integer, Integer>(3, 6));
}
} | 3,115 | 0.775281 | 0.761477 | 67 | 45.507462 | 29.103712 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.597015 | false | false | 12 |
0d7142a32a611872e7e1d2b40ff51aacfc1c148e | 16,681,653,024,550 | 66f7db37c5ab07e714cdd0bd38733c1c7cd2dbda | /ProgramLibrary/src/main/java/com/jack/POJO/Section.java | f76d4bd2caa3d519c17aab1499ee6327bf16eb74 | [] | no_license | JCochran92/ProgramLibrary | https://github.com/JCochran92/ProgramLibrary | aa5c07c8a93c950ded8e18bac227f98b9250da09 | 62cd0e8a64eb150176c0f0044b18c555b8c41e52 | refs/heads/main | 2023-07-16T08:01:15.487000 | 2021-08-23T07:19:10 | 2021-08-23T07:19:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jack.POJO;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import com.jack.DAO.*;
public class Section implements SectionDAO {
private String Name;
private String Description;
private String OverviewImageBase64;
private int OrderIndex;
private int SectionID;
private int ProgramID;
private List<Activity> Activities;
///////////////////////////// Constructors //////////////////////////////////////////////
public Section(String name, String description, String overviewImageBase64, int sectionID, int programID) {
Name = name;
Description = description;
OverviewImageBase64 = overviewImageBase64;
SectionID = sectionID;
ProgramID = programID;
Activities = pullAllSectionActivities(SectionID);
}
public Section(int sectionID) {
this.SectionID = sectionID;
Section tempSection = pullSection(sectionID);
this.Description = tempSection.getDescription();
this.Name = tempSection.getName();
this.OrderIndex = tempSection.getOrderIndex();
this.ProgramID = tempSection.getProgramID();
this.Activities = tempSection.getActivities();
this.OverviewImageBase64 = tempSection.getOverviewImageBase64();
tempSection = null;
}
public Section() {
}
///////////////////////////// Methods ///////////////////////////////////////////////////
/////////////////////////////// This pulls all available sections ///////////////////////////////
public static List<Section> pullAllSections() {
// Queries all sections
List<Section> listTempSection = new ArrayList();
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Sections\"";
PreparedStatement ps = con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Section tempSection = new Section();
tempSection.setName(rs.getString(1));
tempSection.setDescription(rs.getString(2));
tempSection.setOrderIndex(rs.getInt(4));
tempSection.setSectionID(rs.getInt(5));
tempSection.setProgramID(rs.getInt(5));
//transform to base64
if (rs.getBlob(3) != null) {
byte[] OverviewImageByte = rs.getBlob(3).getBytes(1, (int)rs.getBlob(3).length());
tempSection.setOverviewImageBase64(Base64.getEncoder().encodeToString(OverviewImageByte));
}
listTempSection.add(tempSection);
}
}catch (SQLException e) {
e.printStackTrace();
}
return listTempSection;
}
/////////////////////////////// Pulls a section by programmatic ID ///////////////////////////////
public static List<Section> pullSectionsByProgram(int P_ID){
List<Section> tempSectionList = new ArrayList();
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Sections\" WHERE \"Program_ID\" = ?";
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, P_ID);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Section tempSection = new Section();
tempSection.setName(rs.getString(1));
tempSection.setDescription(rs.getString(2));
tempSection.setOrderIndex(rs.getInt(4));
tempSection.setSectionID(rs.getInt(5));
tempSection.setProgramID(rs.getInt(5));
//transform to base 64
if (rs.getBlob(3) != null) {
byte[] OverviewImageByte = rs.getBlob(3).getBytes(1, (int)rs.getBlob(3).length());
tempSection.setOverviewImageBase64(Base64.getEncoder().encodeToString(OverviewImageByte));
}
tempSectionList.add(tempSection);
}
}catch (SQLException e) {
e.printStackTrace();
}
return tempSectionList;
}
/////////////////////////////// This pulls a section by section ID ///////////////////////////////
@Override
public Section pullSection(int S_ID) {
// Pull section from DB via S_ID
Section tempSection = new Section();
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Sections\" WHERE \"Section_ID\" = ?";
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, S_ID);
ResultSet rs = ps.executeQuery();
while(rs.next()){
tempSection.setName(rs.getString(1));
tempSection.setDescription(rs.getString(2));
tempSection.setOrderIndex(rs.getInt(4));
tempSection.setSectionID(rs.getInt(5));
tempSection.setProgramID(rs.getInt(5));
// transform blob into base64
if (rs.getBlob(3) != null) {
byte[] OverviewImageByte = rs.getBlob(3).getBytes(1, (int)rs.getBlob(3).length());
tempSection.setOverviewImageBase64(Base64.getEncoder().encodeToString(OverviewImageByte));
}
}
}catch (SQLException e) {
e.printStackTrace();
}
tempSection.setActivities(pullAllSectionActivities(S_ID));
return tempSection;
}
/////////////////////////////// Pulls all the activities ///////////////////////////////
@Override
public List<Activity> pullAllSectionActivities(int S_ID) {
// TODO Auto-generated method stub
//Pulls all activities with questions
List<Activity> tempActivityList = new ArrayList();
String tempContent = "";
String tempQuestion = "";
Integer tempAnswerID = 0;
String tempAnswerText = "";
Integer tempActID = 0;
Integer tempSecID = 0;
// Query of Activity and Answers
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Activity\" LEFT JOIN \"ProgramLibrary\".\"Answer\" ON \"ProgramLibrary\".\"Activity\".\"Activity_ID\"= \"ProgramLibrary\".\"Answer\".\"Activity_ID\" WHERE \"ProgramLibrary\".\"Activity\".\"Section_ID\"= ?";
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, S_ID);
ResultSet rs = ps.executeQuery();
while(rs.next()){
tempActID = rs.getInt(1);
tempSecID = rs.getInt(2);
tempContent = rs.getString(3);
tempQuestion = rs.getString(4);
tempAnswerID = rs.getInt(5);
tempAnswerText= rs.getString(6);
//If the Activity does not already exist then add to array list.
if (!Activity.containsActivityID(tempActivityList, tempActID) ) {
List<String> tempAnswers = new ArrayList();
tempAnswers.add(tempAnswerText);
tempActivityList.add(new Activity(tempActID,tempContent,tempQuestion,tempAnswers));
}
// If Activity already exists then add to activity.
else {
for (int i =0; i<tempActivityList.size(); i++) {
if (tempActID.equals(tempActivityList.get(i).getActivityID())) {
tempActivityList.get(i).addAnswerText(tempAnswerText);
}
}
}
}
}catch (SQLException e) {
e.printStackTrace();
}
return tempActivityList;
}
//////////////////////// Getters and Setters //////////////////////////////////
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public int getSectionID() {
return SectionID;
}
public void setSectionID(int sectionID) {
SectionID = sectionID;
}
public int getProgramID() {
return ProgramID;
}
public void setProgramID(int programID) {
ProgramID = programID;
}
public List<Activity> getActivities() {
return Activities;
}
public void setActivities(List<Activity> activities) {
Activities = activities;
}
public int getOrderIndex() {
return OrderIndex;
}
public void setOrderIndex(int orderIndex) {
OrderIndex = orderIndex;
}
public String getOverviewImageBase64() {
return OverviewImageBase64;
}
public void setOverviewImageBase64(String overviewImageBase64) {
OverviewImageBase64 = overviewImageBase64;
}
////////////////////To String /////////////////////////////////////////
@Override
public String toString() {
return "Section [Name=" + Name + ", Description=" + Description + ", OverviewImage=" + OverviewImageBase64
+ ", OrderIndex=" + OrderIndex + ", SectionID=" + SectionID + ", ProgramID=" + ProgramID
+ ", Activities=" + Activities + "]";
}
}
| UTF-8 | Java | 8,841 | java | Section.java | Java | [] | null | [] | package com.jack.POJO;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import com.jack.DAO.*;
public class Section implements SectionDAO {
private String Name;
private String Description;
private String OverviewImageBase64;
private int OrderIndex;
private int SectionID;
private int ProgramID;
private List<Activity> Activities;
///////////////////////////// Constructors //////////////////////////////////////////////
public Section(String name, String description, String overviewImageBase64, int sectionID, int programID) {
Name = name;
Description = description;
OverviewImageBase64 = overviewImageBase64;
SectionID = sectionID;
ProgramID = programID;
Activities = pullAllSectionActivities(SectionID);
}
public Section(int sectionID) {
this.SectionID = sectionID;
Section tempSection = pullSection(sectionID);
this.Description = tempSection.getDescription();
this.Name = tempSection.getName();
this.OrderIndex = tempSection.getOrderIndex();
this.ProgramID = tempSection.getProgramID();
this.Activities = tempSection.getActivities();
this.OverviewImageBase64 = tempSection.getOverviewImageBase64();
tempSection = null;
}
public Section() {
}
///////////////////////////// Methods ///////////////////////////////////////////////////
/////////////////////////////// This pulls all available sections ///////////////////////////////
public static List<Section> pullAllSections() {
// Queries all sections
List<Section> listTempSection = new ArrayList();
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Sections\"";
PreparedStatement ps = con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Section tempSection = new Section();
tempSection.setName(rs.getString(1));
tempSection.setDescription(rs.getString(2));
tempSection.setOrderIndex(rs.getInt(4));
tempSection.setSectionID(rs.getInt(5));
tempSection.setProgramID(rs.getInt(5));
//transform to base64
if (rs.getBlob(3) != null) {
byte[] OverviewImageByte = rs.getBlob(3).getBytes(1, (int)rs.getBlob(3).length());
tempSection.setOverviewImageBase64(Base64.getEncoder().encodeToString(OverviewImageByte));
}
listTempSection.add(tempSection);
}
}catch (SQLException e) {
e.printStackTrace();
}
return listTempSection;
}
/////////////////////////////// Pulls a section by programmatic ID ///////////////////////////////
public static List<Section> pullSectionsByProgram(int P_ID){
List<Section> tempSectionList = new ArrayList();
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Sections\" WHERE \"Program_ID\" = ?";
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, P_ID);
ResultSet rs = ps.executeQuery();
while(rs.next()){
Section tempSection = new Section();
tempSection.setName(rs.getString(1));
tempSection.setDescription(rs.getString(2));
tempSection.setOrderIndex(rs.getInt(4));
tempSection.setSectionID(rs.getInt(5));
tempSection.setProgramID(rs.getInt(5));
//transform to base 64
if (rs.getBlob(3) != null) {
byte[] OverviewImageByte = rs.getBlob(3).getBytes(1, (int)rs.getBlob(3).length());
tempSection.setOverviewImageBase64(Base64.getEncoder().encodeToString(OverviewImageByte));
}
tempSectionList.add(tempSection);
}
}catch (SQLException e) {
e.printStackTrace();
}
return tempSectionList;
}
/////////////////////////////// This pulls a section by section ID ///////////////////////////////
@Override
public Section pullSection(int S_ID) {
// Pull section from DB via S_ID
Section tempSection = new Section();
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Sections\" WHERE \"Section_ID\" = ?";
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, S_ID);
ResultSet rs = ps.executeQuery();
while(rs.next()){
tempSection.setName(rs.getString(1));
tempSection.setDescription(rs.getString(2));
tempSection.setOrderIndex(rs.getInt(4));
tempSection.setSectionID(rs.getInt(5));
tempSection.setProgramID(rs.getInt(5));
// transform blob into base64
if (rs.getBlob(3) != null) {
byte[] OverviewImageByte = rs.getBlob(3).getBytes(1, (int)rs.getBlob(3).length());
tempSection.setOverviewImageBase64(Base64.getEncoder().encodeToString(OverviewImageByte));
}
}
}catch (SQLException e) {
e.printStackTrace();
}
tempSection.setActivities(pullAllSectionActivities(S_ID));
return tempSection;
}
/////////////////////////////// Pulls all the activities ///////////////////////////////
@Override
public List<Activity> pullAllSectionActivities(int S_ID) {
// TODO Auto-generated method stub
//Pulls all activities with questions
List<Activity> tempActivityList = new ArrayList();
String tempContent = "";
String tempQuestion = "";
Integer tempAnswerID = 0;
String tempAnswerText = "";
Integer tempActID = 0;
Integer tempSecID = 0;
// Query of Activity and Answers
try (Connection con = DriverManager.getConnection(url,username,password);) {
String sql = "SELECT * FROM \"ProgramLibrary\".\"Activity\" LEFT JOIN \"ProgramLibrary\".\"Answer\" ON \"ProgramLibrary\".\"Activity\".\"Activity_ID\"= \"ProgramLibrary\".\"Answer\".\"Activity_ID\" WHERE \"ProgramLibrary\".\"Activity\".\"Section_ID\"= ?";
PreparedStatement ps = con.prepareStatement(sql);
ps.setInt(1, S_ID);
ResultSet rs = ps.executeQuery();
while(rs.next()){
tempActID = rs.getInt(1);
tempSecID = rs.getInt(2);
tempContent = rs.getString(3);
tempQuestion = rs.getString(4);
tempAnswerID = rs.getInt(5);
tempAnswerText= rs.getString(6);
//If the Activity does not already exist then add to array list.
if (!Activity.containsActivityID(tempActivityList, tempActID) ) {
List<String> tempAnswers = new ArrayList();
tempAnswers.add(tempAnswerText);
tempActivityList.add(new Activity(tempActID,tempContent,tempQuestion,tempAnswers));
}
// If Activity already exists then add to activity.
else {
for (int i =0; i<tempActivityList.size(); i++) {
if (tempActID.equals(tempActivityList.get(i).getActivityID())) {
tempActivityList.get(i).addAnswerText(tempAnswerText);
}
}
}
}
}catch (SQLException e) {
e.printStackTrace();
}
return tempActivityList;
}
//////////////////////// Getters and Setters //////////////////////////////////
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
public int getSectionID() {
return SectionID;
}
public void setSectionID(int sectionID) {
SectionID = sectionID;
}
public int getProgramID() {
return ProgramID;
}
public void setProgramID(int programID) {
ProgramID = programID;
}
public List<Activity> getActivities() {
return Activities;
}
public void setActivities(List<Activity> activities) {
Activities = activities;
}
public int getOrderIndex() {
return OrderIndex;
}
public void setOrderIndex(int orderIndex) {
OrderIndex = orderIndex;
}
public String getOverviewImageBase64() {
return OverviewImageBase64;
}
public void setOverviewImageBase64(String overviewImageBase64) {
OverviewImageBase64 = overviewImageBase64;
}
////////////////////To String /////////////////////////////////////////
@Override
public String toString() {
return "Section [Name=" + Name + ", Description=" + Description + ", OverviewImage=" + OverviewImageBase64
+ ", OrderIndex=" + OrderIndex + ", SectionID=" + SectionID + ", ProgramID=" + ProgramID
+ ", Activities=" + Activities + "]";
}
}
| 8,841 | 0.617125 | 0.607397 | 291 | 28.381443 | 29.259514 | 261 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.329897 | false | false | 12 |
a6f7c5ad4ae5f6cf23a06c84819bf9355be2557c | 38,543,036,525,045 | 6812f9993f700bbd06ca9e21c47d22d1b12462d5 | /fkh-scf/fkh-mservice-scf/fkh-scf-service/src/main/java/com/fkhwl/scf/service/AuthFunctionService.java | 2e81f5ca75486a5d59c35b227785589a86406ef8 | [] | no_license | moutainhigh/scf-1 | https://github.com/moutainhigh/scf-1 | b0b87e4ee536efa41b2f4e73692928e5472c2df3 | 7df78e5c003ae2aacc59f0ea104d78fc136ebe24 | refs/heads/master | 2022-06-23T23:14:28.628000 | 2020-05-07T01:56:45 | 2020-05-07T01:56:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fkhwl.scf.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fkhwl.scf.entity.dto.AuthFunctionDTO;
import java.util.List;
import java.util.Map;
/**
* <p>Company: 成都返空汇网络技术有限公司</p>
* <p>Description: 权限系统资源表 服务接口 </p>
*
* @author ASpiralMoon
* @email ASpiralMoon@fkhwl.com
* @since 2020-02-18
*/
public interface AuthFunctionService {
/**
* 分页查询权限系统资源
*
* @param page 分页信息
* @param params 查询参数
* @return 返回分页用户数据 page
*/
IPage<AuthFunctionDTO> listPage(IPage<AuthFunctionDTO> page, Map<String, Object> params);
/**
* 获取权限详情
*
* @param id 角色id
* @return 角色详情DTO optional
*/
AuthFunctionDTO getDetail(Long id);
/**
* 新增和更新权限系统资源
*
* @param authFunctionDTO 权限实体
*/
void saveOrUpdate(AuthFunctionDTO authFunctionDTO);
/**
* 删除权限系统资源表
*
* @param id 权限d
*/
void delete(Long id);
/**
* 查询权限名称
*
* @param roleId 角色id
* @return 返回权限名称数据
*/
List<String> listFuncKey(Long roleId);
}
| UTF-8 | Java | 1,291 | java | AuthFunctionService.java | Java | [
{
"context": " * <p>Description: 权限系统资源表 服务接口 </p>\n *\n * @author ASpiralMoon\n * @email ASpiralMoon@fkhwl.com\n * @since 2020-02",
"end": 280,
"score": 0.9996041655540466,
"start": 269,
"tag": "USERNAME",
"value": "ASpiralMoon"
},
{
"context": "统资源表 服务接口 </p>\n *\n * @author ASpira... | null | [] | package com.fkhwl.scf.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fkhwl.scf.entity.dto.AuthFunctionDTO;
import java.util.List;
import java.util.Map;
/**
* <p>Company: 成都返空汇网络技术有限公司</p>
* <p>Description: 权限系统资源表 服务接口 </p>
*
* @author ASpiralMoon
* @email <EMAIL>
* @since 2020-02-18
*/
public interface AuthFunctionService {
/**
* 分页查询权限系统资源
*
* @param page 分页信息
* @param params 查询参数
* @return 返回分页用户数据 page
*/
IPage<AuthFunctionDTO> listPage(IPage<AuthFunctionDTO> page, Map<String, Object> params);
/**
* 获取权限详情
*
* @param id 角色id
* @return 角色详情DTO optional
*/
AuthFunctionDTO getDetail(Long id);
/**
* 新增和更新权限系统资源
*
* @param authFunctionDTO 权限实体
*/
void saveOrUpdate(AuthFunctionDTO authFunctionDTO);
/**
* 删除权限系统资源表
*
* @param id 权限d
*/
void delete(Long id);
/**
* 查询权限名称
*
* @param roleId 角色id
* @return 返回权限名称数据
*/
List<String> listFuncKey(Long roleId);
}
| 1,277 | 0.608495 | 0.601108 | 56 | 18.321428 | 17.624159 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | false | false | 12 |
7abd51d9cbb574117de038eebe2e572fa6251f9a | 2,997,887,184,367 | 3bcce9b046dbd44dcad2dbd4ab14d783b40b443b | /BurstingBalloon.java | 103c0aba5558c686c0ef19fcd73e66d3ff141144 | [] | no_license | ayush-qubit/Algorithm | https://github.com/ayush-qubit/Algorithm | 06a97e7688e880dadbf4e8746cd5b0c4c01f70fe | 2e124af377f6a6a3a27eaee43c753286057e2e9c | refs/heads/master | 2022-11-25T21:26:51.804000 | 2020-07-31T15:42:57 | 2020-07-31T15:42:57 | 281,109,673 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class BurstingBalloon {
public static int MaxCost(int[] arr,int n) {
int[][] dp=new int[n][n];
for(int len=0;len<n;len++) {
for(int i=0,j=len;i<n-len && j<n;i++,j++) {
int l=i-1<0?1:arr[i-1];
int r=j+1>n-1?1:arr[j+1];
if(i==j) {
dp[i][j]=l*arr[i]*r;
}
else {
int q=Integer.MIN_VALUE;
int left,right;
for(int k=i;k<=j;k++) {
left=k-1<i?0:dp[i][k-1];
right=k+1>j?0:dp[k+1][j];
q=Math.max(q, left+right+l*arr[k]*r);
}
dp[i][j]=q;
}
}
}
return dp[0][n-1];
}
public static void main(String[] args) {
int n;
int[] arr;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
arr=new int[n];
for(int i=0;i<n;i++) {
arr[i]=sc.nextInt();
}
System.out.println(MaxCost(arr,n));
sc.close();
}
}
| UTF-8 | Java | 864 | java | BurstingBalloon.java | Java | [] | null | [] |
import java.util.Scanner;
public class BurstingBalloon {
public static int MaxCost(int[] arr,int n) {
int[][] dp=new int[n][n];
for(int len=0;len<n;len++) {
for(int i=0,j=len;i<n-len && j<n;i++,j++) {
int l=i-1<0?1:arr[i-1];
int r=j+1>n-1?1:arr[j+1];
if(i==j) {
dp[i][j]=l*arr[i]*r;
}
else {
int q=Integer.MIN_VALUE;
int left,right;
for(int k=i;k<=j;k++) {
left=k-1<i?0:dp[i][k-1];
right=k+1>j?0:dp[k+1][j];
q=Math.max(q, left+right+l*arr[k]*r);
}
dp[i][j]=q;
}
}
}
return dp[0][n-1];
}
public static void main(String[] args) {
int n;
int[] arr;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
arr=new int[n];
for(int i=0;i<n;i++) {
arr[i]=sc.nextInt();
}
System.out.println(MaxCost(arr,n));
sc.close();
}
}
| 864 | 0.496528 | 0.474537 | 39 | 20.102564 | 13.350876 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.717949 | false | false | 12 |
2d614f929fb44a55c63628d66731e69396c4d021 | 19,275,813,234,653 | ad500ce947c01fb25ad72993a0d95bfb41515f44 | /src/main/java/org/polytech/BookEndpoint.java | 9fa6aab52d884a86359444944986bc9b4bb2591c | [] | no_license | Dylanderv/soap-spring | https://github.com/Dylanderv/soap-spring | dbe2d72e1c127a43864d25b52f484fb4f042886f | 4b5092686acc91cf5515aa7995fa3dba687fc071 | refs/heads/master | 2020-08-27T08:57:37.144000 | 2019-10-24T13:47:42 | 2019-10-24T13:47:42 | 217,308,826 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.polytech;
import io.spring.guides.gs_producing_web_service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import java.util.Map;
@Endpoint
public class BookEndpoint {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";
private BookRepository bookRepository;
@Autowired
public BookEndpoint(BookRepository bookRepository) {
this.bookRepository = bookRepository;
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getBookRequest")
@ResponsePayload
public GetBookResponse getBook(@RequestPayload GetBookRequest request) {
GetBookResponse response = new GetBookResponse();
response.setBook(bookRepository.findBook(request.getId()));
return response;
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getBooksRequest")
@ResponsePayload
public GetBooksResponse getBooks(@RequestPayload GetBooksRequest request) {
GetBooksResponse response = new GetBooksResponse();
Map<Integer, Book> books = bookRepository.getBooks();
books.forEach((bookId, book) -> response.getBooks().add(book));
return response;
}
}
| UTF-8 | Java | 1,529 | java | BookEndpoint.java | Java | [] | null | [] | package org.polytech;
import io.spring.guides.gs_producing_web_service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import java.util.Map;
@Endpoint
public class BookEndpoint {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";
private BookRepository bookRepository;
@Autowired
public BookEndpoint(BookRepository bookRepository) {
this.bookRepository = bookRepository;
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getBookRequest")
@ResponsePayload
public GetBookResponse getBook(@RequestPayload GetBookRequest request) {
GetBookResponse response = new GetBookResponse();
response.setBook(bookRepository.findBook(request.getId()));
return response;
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getBooksRequest")
@ResponsePayload
public GetBooksResponse getBooks(@RequestPayload GetBooksRequest request) {
GetBooksResponse response = new GetBooksResponse();
Map<Integer, Book> books = bookRepository.getBooks();
books.forEach((bookId, book) -> response.getBooks().add(book));
return response;
}
}
| 1,529 | 0.735121 | 0.735121 | 39 | 37.205128 | 30.241066 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564103 | false | false | 12 |
ebc81f46d561e75555f68000305e49070030e7af | 2,010,044,713,026 | bee88e7305de366597cb7fb18deb17ca1841865c | /module-framework-monitor/src/main/java/com/lsxy/framework/monitor/FrameworkMonitorConfig.java | 366b3c49bad2a54a9955aa11ed91033fec7b2654 | [] | no_license | bellmit/lsxy-yunhuni-peer-internet | https://github.com/bellmit/lsxy-yunhuni-peer-internet | 70a92f366be4a40ad07a1211c44f446cfe0c3959 | b24380f581545c1838f222d7ab13a50aa9a89e13 | refs/heads/master | 2022-03-23T22:57:02.960000 | 2018-01-07T12:40:28 | 2018-01-07T12:40:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lsxy.framework.monitor;
import com.lsxy.framework.cache.FrameworkCacheConfig;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* Created by tandy on 16/9/29.
*/
@Configurable
@EnableScheduling
@ComponentScan
@Import(value={FrameworkCacheConfig.class})
public class FrameworkMonitorConfig {
}
| UTF-8 | Java | 512 | java | FrameworkMonitorConfig.java | Java | [
{
"context": "ng.annotation.EnableScheduling;\n\n/**\n * Created by tandy on 16/9/29.\n */\n@Configurable\n@EnableScheduling\n@",
"end": 363,
"score": 0.9993657469749451,
"start": 358,
"tag": "USERNAME",
"value": "tandy"
}
] | null | [] | package com.lsxy.framework.monitor;
import com.lsxy.framework.cache.FrameworkCacheConfig;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* Created by tandy on 16/9/29.
*/
@Configurable
@EnableScheduling
@ComponentScan
@Import(value={FrameworkCacheConfig.class})
public class FrameworkMonitorConfig {
}
| 512 | 0.833984 | 0.824219 | 18 | 27.444445 | 23.942575 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 12 |
4af9cdc485c2b531337b49aca35ec61f473c8929 | 18,932,215,851,574 | 67a95bce80277f047d26e07684070f9a4aff1f49 | /src/il/ac/mta/model/StockStatus.java | 06c552a49b8469b7993f6b56ca22c344bd29ead1 | [] | no_license | YaronCohen212/Test1 | https://github.com/YaronCohen212/Test1 | 72c608d59cbbbb2f66708f96884719f9a6f0d017 | 202b5ea39cc7763bfcc3143b343fc83db9e9b0e6 | refs/heads/master | 2021-01-10T22:13:31.482000 | 2015-02-01T09:48:36 | 2015-02-01T09:48:36 | 26,088,853 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package il.ac.mta.model;
import java.util.Date;
import il.ac.mta.model.Portfolio.ALGO_RECOMMENDATION;
/**
* this class extends for stock it add add members:<br>
* current quantity, algo last recommendation.
* @author Yaron_Cohen
* @since JDK 7
*/
public class StockStatus extends Stock{
//members
private ALGO_RECOMMENDATION recommendation;
private int stockQuantity;
//c'tor
public StockStatus(){
super();
this.recommendation = ALGO_RECOMMENDATION.DO_NOTHING;
stockQuantity = 0;
}
public StockStatus(String symbol, float ask, float bid, Date date){
super(symbol, ask, bid, date);
this.recommendation = ALGO_RECOMMENDATION.DO_NOTHING;
stockQuantity = 0;
}
public StockStatus(Stock stock){
super(stock);
this.recommendation = ALGO_RECOMMENDATION.DO_NOTHING;
stockQuantity = 0;
}
//copy c'tor
public StockStatus (StockStatus stockStatus){
super((Stock)stockStatus);
this.recommendation = stockStatus.recommendation;
this.stockQuantity = stockStatus.stockQuantity;
}
//getters & setters
public ALGO_RECOMMENDATION getRecommendation() {
return recommendation;
}
public void setRecommendation(ALGO_RECOMMENDATION recommendation) {
this.recommendation = recommendation;
}
public int getStockQuantity() {
return stockQuantity;
}
public void setStockQuantity(int stockQuantity) {
this.stockQuantity = stockQuantity;
}
/**
* return an HTML code string of stock Status.
* @example
* <b>Stock symbol:</b> PIH, <b>ask:</b> 12.4, <b>bid:</b> 13.1, <b>date:</b> Sat Nov 15 22:12:04 IST 2014 <b>quantity: </b>32 <br>
*/
public String getHtmlDescription(){
String res = super.getHtmlDescription();
res += " <b>quantity: </b>" + this.stockQuantity;
return res;
}
}
| UTF-8 | Java | 1,818 | java | StockStatus.java | Java | [
{
"context": "nt quantity, algo last recommendation.\r\n * @author Yaron_Cohen\r\n * @since JDK 7\r\n */\r\npublic class StockStatus e",
"end": 243,
"score": 0.9929516911506653,
"start": 232,
"tag": "NAME",
"value": "Yaron_Cohen"
}
] | null | [] | package il.ac.mta.model;
import java.util.Date;
import il.ac.mta.model.Portfolio.ALGO_RECOMMENDATION;
/**
* this class extends for stock it add add members:<br>
* current quantity, algo last recommendation.
* @author Yaron_Cohen
* @since JDK 7
*/
public class StockStatus extends Stock{
//members
private ALGO_RECOMMENDATION recommendation;
private int stockQuantity;
//c'tor
public StockStatus(){
super();
this.recommendation = ALGO_RECOMMENDATION.DO_NOTHING;
stockQuantity = 0;
}
public StockStatus(String symbol, float ask, float bid, Date date){
super(symbol, ask, bid, date);
this.recommendation = ALGO_RECOMMENDATION.DO_NOTHING;
stockQuantity = 0;
}
public StockStatus(Stock stock){
super(stock);
this.recommendation = ALGO_RECOMMENDATION.DO_NOTHING;
stockQuantity = 0;
}
//copy c'tor
public StockStatus (StockStatus stockStatus){
super((Stock)stockStatus);
this.recommendation = stockStatus.recommendation;
this.stockQuantity = stockStatus.stockQuantity;
}
//getters & setters
public ALGO_RECOMMENDATION getRecommendation() {
return recommendation;
}
public void setRecommendation(ALGO_RECOMMENDATION recommendation) {
this.recommendation = recommendation;
}
public int getStockQuantity() {
return stockQuantity;
}
public void setStockQuantity(int stockQuantity) {
this.stockQuantity = stockQuantity;
}
/**
* return an HTML code string of stock Status.
* @example
* <b>Stock symbol:</b> PIH, <b>ask:</b> 12.4, <b>bid:</b> 13.1, <b>date:</b> Sat Nov 15 22:12:04 IST 2014 <b>quantity: </b>32 <br>
*/
public String getHtmlDescription(){
String res = super.getHtmlDescription();
res += " <b>quantity: </b>" + this.stockQuantity;
return res;
}
}
| 1,818 | 0.688669 | 0.675468 | 72 | 23.25 | 24.096306 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 12 |
4dbd2c5969160abc757595eb1708164f6d89c39e | 32,573,031,983,913 | fa1ad2e2ac7e376fc7cb3b3a6e1bb88eed3e80be | /studio/micro-services/SREWorks/paas/action/src/main/java/com/alibaba/tesla/action/dao/ActionExample.java | 51dee938fb0ad856f00bf4794a659efc1c169631 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"EPL-1.0",
"LGPL-2.0-or-later",
"MPL-2.0",
"GPL-2.0-only",
"JSON",
"Python-2.0"
] | permissive | alldatacenter/alldata | https://github.com/alldatacenter/alldata | 7bc7713c9f1d56ad6b8e59ea03206d1073b7e047 | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | refs/heads/master | 2023-08-05T07:32:25.442000 | 2023-08-03T13:17:24 | 2023-08-03T13:17:24 | 213,321,771 | 774 | 250 | Apache-2.0 | false | 2023-09-06T17:35:32 | 2019-10-07T07:36:18 | 2023-09-06T07:35:48 | 2023-09-06T17:35:30 | 1,610,032 | 1,898 | 711 | 14 | null | false | false | package com.alibaba.tesla.action.dao;
import java.util.ArrayList;
import java.util.List;
/**
* This class was generated by Ali-Generator
* @author bang
*/
public class ActionExample {
/**
*
* @mbg.generated
*/
protected String orderByClause;
/**
*
* @mbg.generated
*/
@Deprecated
protected boolean distinct;
/**
*
* @mbg.generated
*/
protected boolean page;
/**
*
* @mbg.generated
*/
protected int pageIndex;
/**
*
* @mbg.generated
*/
protected int pageSize;
/**
*
* @mbg.generated
*/
protected int pageStart;
/**
*
* @mbg.generated
*/
protected String distinctSql;
/**
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
*
* @mbg.generated
*/
public ActionExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @param orderCondition
* @param sortType
* @return
*
* @mbg.generated
*/
public ActionExample appendOrderByClause(OrderCondition orderCondition, SortType sortType) {
if (null != orderByClause) {
orderByClause = orderByClause + ", " + orderCondition.getColumnName() + " " + sortType.getValue();
} else {
orderByClause = orderCondition.getColumnName() + " " + sortType.getValue();
}
return this;
}
/**
* @return
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @param distinct
*
* @mbg.generated
*/
@Deprecated
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @return
*
* @mbg.generated
*/
@Deprecated
public boolean isDistinct() {
return distinct;
}
/**
* @param page
* @return
*
* @mbg.generated
*/
public ActionExample setPage(boolean page) {
this.page = page;
return this;
}
/**
* @return
*
* @mbg.generated
*/
public boolean isPage() {
return page;
}
/**
* @return
*
* @mbg.generated
*/
public int getPageIndex() {
return pageIndex;
}
/**
* @param pageSize
* @return
*
* @mbg.generated
*/
public ActionExample setPageSize(int pageSize) {
this.pageSize = pageSize < 1 ? 10 : pageSize;
this.pageIndex = pageStart < 1 ? 0 : (pageStart - 1) * this.pageSize;
return this;
}
/**
* @return
*
* @mbg.generated
*/
public int getPageSize() {
return pageSize;
}
/**
* @param pageStart
* @return
*
* @mbg.generated
*/
public ActionExample setPageStart(int pageStart) {
this.pageStart = pageStart < 1 ? 1 : pageStart;
this.pageIndex = (this.pageStart - 1) * this.pageSize;
return this;
}
/**
* @return
*
* @mbg.generated
*/
public int getPageStart() {
return pageStart;
}
/**
* @param pageStart
* @param pageSize
*
* @mbg.generated
*/
public void setPagination(int pageStart, int pageSize) {
this.page = true;
this.pageSize = pageSize < 1 ? 10 : pageSize;
this.pageIndex = pageStart < 1 ? 0 : (pageStart - 1) * this.pageSize;
}
/**
* @param condition
* @return
*
* @mbg.generated
*/
public ActionExample appendDistinct(OrderCondition condition) {
if (null != distinctSql){
distinctSql = distinctSql + ", " + condition.getColumnName();
} else {
distinctSql = condition.getColumnName();
}
return this;
}
/**
* @return
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @param criteria
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @return
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @return
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @return
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
*
* @mbg.generated
*/
protected abstract static class AbstractGeneratedCriteria {
protected List<Criterion> criteria;
protected AbstractGeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andAppCodeIsNull() {
addCriterion("app_code is null");
return (Criteria) this;
}
public Criteria andAppCodeIsNotNull() {
addCriterion("app_code is not null");
return (Criteria) this;
}
public Criteria andAppCodeEqualTo(String value) {
addCriterion("app_code =", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotEqualTo(String value) {
addCriterion("app_code <>", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeGreaterThan(String value) {
addCriterion("app_code >", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeGreaterThanOrEqualTo(String value) {
addCriterion("app_code >=", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeLessThan(String value) {
addCriterion("app_code <", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeLessThanOrEqualTo(String value) {
addCriterion("app_code <=", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeLike(String value) {
addCriterion("app_code like", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotLike(String value) {
addCriterion("app_code not like", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeIn(List<String> values) {
addCriterion("app_code in", values, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotIn(List<String> values) {
addCriterion("app_code not in", values, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeBetween(String value1, String value2) {
addCriterion("app_code between", value1, value2, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotBetween(String value1, String value2) {
addCriterion("app_code not between", value1, value2, "appCode");
return (Criteria) this;
}
public Criteria andActionIdIsNull() {
addCriterion("action_id is null");
return (Criteria) this;
}
public Criteria andActionIdIsNotNull() {
addCriterion("action_id is not null");
return (Criteria) this;
}
public Criteria andActionIdEqualTo(Long value) {
addCriterion("action_id =", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdNotEqualTo(Long value) {
addCriterion("action_id <>", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdGreaterThan(Long value) {
addCriterion("action_id >", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdGreaterThanOrEqualTo(Long value) {
addCriterion("action_id >=", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdLessThan(Long value) {
addCriterion("action_id <", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdLessThanOrEqualTo(Long value) {
addCriterion("action_id <=", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdIn(List<Long> values) {
addCriterion("action_id in", values, "actionId");
return (Criteria) this;
}
public Criteria andActionIdNotIn(List<Long> values) {
addCriterion("action_id not in", values, "actionId");
return (Criteria) this;
}
public Criteria andActionIdBetween(Long value1, Long value2) {
addCriterion("action_id between", value1, value2, "actionId");
return (Criteria) this;
}
public Criteria andActionIdNotBetween(Long value1, Long value2) {
addCriterion("action_id not between", value1, value2, "actionId");
return (Criteria) this;
}
public Criteria andElementIdIsNull() {
addCriterion("element_id is null");
return (Criteria) this;
}
public Criteria andElementIdIsNotNull() {
addCriterion("element_id is not null");
return (Criteria) this;
}
public Criteria andElementIdEqualTo(String value) {
addCriterion("element_id =", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotEqualTo(String value) {
addCriterion("element_id <>", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdGreaterThan(String value) {
addCriterion("element_id >", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdGreaterThanOrEqualTo(String value) {
addCriterion("element_id >=", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdLessThan(String value) {
addCriterion("element_id <", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdLessThanOrEqualTo(String value) {
addCriterion("element_id <=", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdLike(String value) {
addCriterion("element_id like", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotLike(String value) {
addCriterion("element_id not like", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdIn(List<String> values) {
addCriterion("element_id in", values, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotIn(List<String> values) {
addCriterion("element_id not in", values, "elementId");
return (Criteria) this;
}
public Criteria andElementIdBetween(String value1, String value2) {
addCriterion("element_id between", value1, value2, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotBetween(String value1, String value2) {
addCriterion("element_id not between", value1, value2, "elementId");
return (Criteria) this;
}
public Criteria andActionTypeIsNull() {
addCriterion("action_type is null");
return (Criteria) this;
}
public Criteria andActionTypeIsNotNull() {
addCriterion("action_type is not null");
return (Criteria) this;
}
public Criteria andActionTypeEqualTo(String value) {
addCriterion("action_type =", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotEqualTo(String value) {
addCriterion("action_type <>", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeGreaterThan(String value) {
addCriterion("action_type >", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeGreaterThanOrEqualTo(String value) {
addCriterion("action_type >=", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeLessThan(String value) {
addCriterion("action_type <", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeLessThanOrEqualTo(String value) {
addCriterion("action_type <=", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeLike(String value) {
addCriterion("action_type like", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotLike(String value) {
addCriterion("action_type not like", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeIn(List<String> values) {
addCriterion("action_type in", values, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotIn(List<String> values) {
addCriterion("action_type not in", values, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeBetween(String value1, String value2) {
addCriterion("action_type between", value1, value2, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotBetween(String value1, String value2) {
addCriterion("action_type not between", value1, value2, "actionType");
return (Criteria) this;
}
public Criteria andActionNameIsNull() {
addCriterion("action_name is null");
return (Criteria) this;
}
public Criteria andActionNameIsNotNull() {
addCriterion("action_name is not null");
return (Criteria) this;
}
public Criteria andActionNameEqualTo(String value) {
addCriterion("action_name =", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotEqualTo(String value) {
addCriterion("action_name <>", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameGreaterThan(String value) {
addCriterion("action_name >", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameGreaterThanOrEqualTo(String value) {
addCriterion("action_name >=", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameLessThan(String value) {
addCriterion("action_name <", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameLessThanOrEqualTo(String value) {
addCriterion("action_name <=", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameLike(String value) {
addCriterion("action_name like", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotLike(String value) {
addCriterion("action_name not like", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameIn(List<String> values) {
addCriterion("action_name in", values, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotIn(List<String> values) {
addCriterion("action_name not in", values, "actionName");
return (Criteria) this;
}
public Criteria andActionNameBetween(String value1, String value2) {
addCriterion("action_name between", value1, value2, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotBetween(String value1, String value2) {
addCriterion("action_name not between", value1, value2, "actionName");
return (Criteria) this;
}
public Criteria andActionLabelIsNull() {
addCriterion("action_label is null");
return (Criteria) this;
}
public Criteria andActionLabelIsNotNull() {
addCriterion("action_label is not null");
return (Criteria) this;
}
public Criteria andActionLabelEqualTo(String value) {
addCriterion("action_label =", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotEqualTo(String value) {
addCriterion("action_label <>", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelGreaterThan(String value) {
addCriterion("action_label >", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelGreaterThanOrEqualTo(String value) {
addCriterion("action_label >=", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelLessThan(String value) {
addCriterion("action_label <", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelLessThanOrEqualTo(String value) {
addCriterion("action_label <=", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelLike(String value) {
addCriterion("action_label like", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotLike(String value) {
addCriterion("action_label not like", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelIn(List<String> values) {
addCriterion("action_label in", values, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotIn(List<String> values) {
addCriterion("action_label not in", values, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelBetween(String value1, String value2) {
addCriterion("action_label between", value1, value2, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotBetween(String value1, String value2) {
addCriterion("action_label not between", value1, value2, "actionLabel");
return (Criteria) this;
}
public Criteria andNodeIsNull() {
addCriterion("node is null");
return (Criteria) this;
}
public Criteria andNodeIsNotNull() {
addCriterion("node is not null");
return (Criteria) this;
}
public Criteria andNodeEqualTo(String value) {
addCriterion("node =", value, "node");
return (Criteria) this;
}
public Criteria andNodeNotEqualTo(String value) {
addCriterion("node <>", value, "node");
return (Criteria) this;
}
public Criteria andNodeGreaterThan(String value) {
addCriterion("node >", value, "node");
return (Criteria) this;
}
public Criteria andNodeGreaterThanOrEqualTo(String value) {
addCriterion("node >=", value, "node");
return (Criteria) this;
}
public Criteria andNodeLessThan(String value) {
addCriterion("node <", value, "node");
return (Criteria) this;
}
public Criteria andNodeLessThanOrEqualTo(String value) {
addCriterion("node <=", value, "node");
return (Criteria) this;
}
public Criteria andNodeLike(String value) {
addCriterion("node like", value, "node");
return (Criteria) this;
}
public Criteria andNodeNotLike(String value) {
addCriterion("node not like", value, "node");
return (Criteria) this;
}
public Criteria andNodeIn(List<String> values) {
addCriterion("node in", values, "node");
return (Criteria) this;
}
public Criteria andNodeNotIn(List<String> values) {
addCriterion("node not in", values, "node");
return (Criteria) this;
}
public Criteria andNodeBetween(String value1, String value2) {
addCriterion("node between", value1, value2, "node");
return (Criteria) this;
}
public Criteria andNodeNotBetween(String value1, String value2) {
addCriterion("node not between", value1, value2, "node");
return (Criteria) this;
}
public Criteria andEntityTypeIsNull() {
addCriterion("entity_type is null");
return (Criteria) this;
}
public Criteria andEntityTypeIsNotNull() {
addCriterion("entity_type is not null");
return (Criteria) this;
}
public Criteria andEntityTypeEqualTo(String value) {
addCriterion("entity_type =", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotEqualTo(String value) {
addCriterion("entity_type <>", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeGreaterThan(String value) {
addCriterion("entity_type >", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeGreaterThanOrEqualTo(String value) {
addCriterion("entity_type >=", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeLessThan(String value) {
addCriterion("entity_type <", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeLessThanOrEqualTo(String value) {
addCriterion("entity_type <=", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeLike(String value) {
addCriterion("entity_type like", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotLike(String value) {
addCriterion("entity_type not like", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeIn(List<String> values) {
addCriterion("entity_type in", values, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotIn(List<String> values) {
addCriterion("entity_type not in", values, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeBetween(String value1, String value2) {
addCriterion("entity_type between", value1, value2, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotBetween(String value1, String value2) {
addCriterion("entity_type not between", value1, value2, "entityType");
return (Criteria) this;
}
public Criteria andEntityValueIsNull() {
addCriterion("entity_value is null");
return (Criteria) this;
}
public Criteria andEntityValueIsNotNull() {
addCriterion("entity_value is not null");
return (Criteria) this;
}
public Criteria andEntityValueEqualTo(String value) {
addCriterion("entity_value =", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotEqualTo(String value) {
addCriterion("entity_value <>", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueGreaterThan(String value) {
addCriterion("entity_value >", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueGreaterThanOrEqualTo(String value) {
addCriterion("entity_value >=", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueLessThan(String value) {
addCriterion("entity_value <", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueLessThanOrEqualTo(String value) {
addCriterion("entity_value <=", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueLike(String value) {
addCriterion("entity_value like", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotLike(String value) {
addCriterion("entity_value not like", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueIn(List<String> values) {
addCriterion("entity_value in", values, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotIn(List<String> values) {
addCriterion("entity_value not in", values, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueBetween(String value1, String value2) {
addCriterion("entity_value between", value1, value2, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotBetween(String value1, String value2) {
addCriterion("entity_value not between", value1, value2, "entityValue");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;
}
public Criteria andStartTimeIsNotNull() {
addCriterion("start_time is not null");
return (Criteria) this;
}
public Criteria andStartTimeEqualTo(Long value) {
addCriterion("start_time =", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotEqualTo(Long value) {
addCriterion("start_time <>", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThan(Long value) {
addCriterion("start_time >", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThanOrEqualTo(Long value) {
addCriterion("start_time >=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThan(Long value) {
addCriterion("start_time <", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThanOrEqualTo(Long value) {
addCriterion("start_time <=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeIn(List<Long> values) {
addCriterion("start_time in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotIn(List<Long> values) {
addCriterion("start_time not in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeBetween(Long value1, Long value2) {
addCriterion("start_time between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotBetween(Long value1, Long value2) {
addCriterion("start_time not between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andEmpIdIsNull() {
addCriterion("emp_id is null");
return (Criteria) this;
}
public Criteria andEmpIdIsNotNull() {
addCriterion("emp_id is not null");
return (Criteria) this;
}
public Criteria andEmpIdEqualTo(String value) {
addCriterion("emp_id =", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotEqualTo(String value) {
addCriterion("emp_id <>", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdGreaterThan(String value) {
addCriterion("emp_id >", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdGreaterThanOrEqualTo(String value) {
addCriterion("emp_id >=", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdLessThan(String value) {
addCriterion("emp_id <", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdLessThanOrEqualTo(String value) {
addCriterion("emp_id <=", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdLike(String value) {
addCriterion("emp_id like", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotLike(String value) {
addCriterion("emp_id not like", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdIn(List<String> values) {
addCriterion("emp_id in", values, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotIn(List<String> values) {
addCriterion("emp_id not in", values, "empId");
return (Criteria) this;
}
public Criteria andEmpIdBetween(String value1, String value2) {
addCriterion("emp_id between", value1, value2, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotBetween(String value1, String value2) {
addCriterion("emp_id not between", value1, value2, "empId");
return (Criteria) this;
}
public Criteria andEndTimeIsNull() {
addCriterion("end_time is null");
return (Criteria) this;
}
public Criteria andEndTimeIsNotNull() {
addCriterion("end_time is not null");
return (Criteria) this;
}
public Criteria andEndTimeEqualTo(Long value) {
addCriterion("end_time =", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotEqualTo(Long value) {
addCriterion("end_time <>", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThan(Long value) {
addCriterion("end_time >", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("end_time >=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThan(Long value) {
addCriterion("end_time <", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
addCriterion("end_time <=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeIn(List<Long> values) {
addCriterion("end_time in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotIn(List<Long> values) {
addCriterion("end_time not in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeBetween(Long value1, Long value2) {
addCriterion("end_time between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
addCriterion("end_time not between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andOrderIdIsNull() {
addCriterion("order_id is null");
return (Criteria) this;
}
public Criteria andOrderIdIsNotNull() {
addCriterion("order_id is not null");
return (Criteria) this;
}
public Criteria andOrderIdEqualTo(String value) {
addCriterion("order_id =", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotEqualTo(String value) {
addCriterion("order_id <>", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThan(String value) {
addCriterion("order_id >", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThanOrEqualTo(String value) {
addCriterion("order_id >=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThan(String value) {
addCriterion("order_id <", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThanOrEqualTo(String value) {
addCriterion("order_id <=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLike(String value) {
addCriterion("order_id like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotLike(String value) {
addCriterion("order_id not like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdIn(List<String> values) {
addCriterion("order_id in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotIn(List<String> values) {
addCriterion("order_id not in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdBetween(String value1, String value2) {
addCriterion("order_id between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotBetween(String value1, String value2) {
addCriterion("order_id not between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andSyncResultIsNull() {
addCriterion("sync_result is null");
return (Criteria) this;
}
public Criteria andSyncResultIsNotNull() {
addCriterion("sync_result is not null");
return (Criteria) this;
}
public Criteria andSyncResultEqualTo(Byte value) {
addCriterion("sync_result =", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultNotEqualTo(Byte value) {
addCriterion("sync_result <>", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultGreaterThan(Byte value) {
addCriterion("sync_result >", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultGreaterThanOrEqualTo(Byte value) {
addCriterion("sync_result >=", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultLessThan(Byte value) {
addCriterion("sync_result <", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultLessThanOrEqualTo(Byte value) {
addCriterion("sync_result <=", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultIn(List<Byte> values) {
addCriterion("sync_result in", values, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultNotIn(List<Byte> values) {
addCriterion("sync_result not in", values, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultBetween(Byte value1, Byte value2) {
addCriterion("sync_result between", value1, value2, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultNotBetween(Byte value1, Byte value2) {
addCriterion("sync_result not between", value1, value2, "syncResult");
return (Criteria) this;
}
public Criteria andUuidIsNull() {
addCriterion("uuid is null");
return (Criteria) this;
}
public Criteria andUuidIsNotNull() {
addCriterion("uuid is not null");
return (Criteria) this;
}
public Criteria andUuidEqualTo(String value) {
addCriterion("uuid =", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotEqualTo(String value) {
addCriterion("uuid <>", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidGreaterThan(String value) {
addCriterion("uuid >", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidGreaterThanOrEqualTo(String value) {
addCriterion("uuid >=", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLessThan(String value) {
addCriterion("uuid <", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLessThanOrEqualTo(String value) {
addCriterion("uuid <=", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLike(String value) {
addCriterion("uuid like", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotLike(String value) {
addCriterion("uuid not like", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidIn(List<String> values) {
addCriterion("uuid in", values, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotIn(List<String> values) {
addCriterion("uuid not in", values, "uuid");
return (Criteria) this;
}
public Criteria andUuidBetween(String value1, String value2) {
addCriterion("uuid between", value1, value2, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotBetween(String value1, String value2) {
addCriterion("uuid not between", value1, value2, "uuid");
return (Criteria) this;
}
public Criteria andTeslaOrderIdIsNull() {
addCriterion("tesla_order_id is null");
return (Criteria) this;
}
public Criteria andTeslaOrderIdIsNotNull() {
addCriterion("tesla_order_id is not null");
return (Criteria) this;
}
public Criteria andTeslaOrderIdEqualTo(Long value) {
addCriterion("tesla_order_id =", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdNotEqualTo(Long value) {
addCriterion("tesla_order_id <>", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdGreaterThan(Long value) {
addCriterion("tesla_order_id >", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdGreaterThanOrEqualTo(Long value) {
addCriterion("tesla_order_id >=", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdLessThan(Long value) {
addCriterion("tesla_order_id <", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdLessThanOrEqualTo(Long value) {
addCriterion("tesla_order_id <=", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdIn(List<Long> values) {
addCriterion("tesla_order_id in", values, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdNotIn(List<Long> values) {
addCriterion("tesla_order_id not in", values, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdBetween(Long value1, Long value2) {
addCriterion("tesla_order_id between", value1, value2, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdNotBetween(Long value1, Long value2) {
addCriterion("tesla_order_id not between", value1, value2, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultIsNull() {
addCriterion("tesla_order_sync_result is null");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultIsNotNull() {
addCriterion("tesla_order_sync_result is not null");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultEqualTo(Byte value) {
addCriterion("tesla_order_sync_result =", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultNotEqualTo(Byte value) {
addCriterion("tesla_order_sync_result <>", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultGreaterThan(Byte value) {
addCriterion("tesla_order_sync_result >", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultGreaterThanOrEqualTo(Byte value) {
addCriterion("tesla_order_sync_result >=", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultLessThan(Byte value) {
addCriterion("tesla_order_sync_result <", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultLessThanOrEqualTo(Byte value) {
addCriterion("tesla_order_sync_result <=", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultIn(List<Byte> values) {
addCriterion("tesla_order_sync_result in", values, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultNotIn(List<Byte> values) {
addCriterion("tesla_order_sync_result not in", values, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultBetween(Byte value1, Byte value2) {
addCriterion("tesla_order_sync_result between", value1, value2, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultNotBetween(Byte value1, Byte value2) {
addCriterion("tesla_order_sync_result not between", value1, value2, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderIsNull() {
addCriterion("sync_tesla_order is null");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderIsNotNull() {
addCriterion("sync_tesla_order is not null");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderEqualTo(Byte value) {
addCriterion("sync_tesla_order =", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderNotEqualTo(Byte value) {
addCriterion("sync_tesla_order <>", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderGreaterThan(Byte value) {
addCriterion("sync_tesla_order >", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderGreaterThanOrEqualTo(Byte value) {
addCriterion("sync_tesla_order >=", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderLessThan(Byte value) {
addCriterion("sync_tesla_order <", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderLessThanOrEqualTo(Byte value) {
addCriterion("sync_tesla_order <=", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderIn(List<Byte> values) {
addCriterion("sync_tesla_order in", values, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderNotIn(List<Byte> values) {
addCriterion("sync_tesla_order not in", values, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderBetween(Byte value1, Byte value2) {
addCriterion("sync_tesla_order between", value1, value2, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderNotBetween(Byte value1, Byte value2) {
addCriterion("sync_tesla_order not between", value1, value2, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andOrderTypeIsNull() {
addCriterion("order_type is null");
return (Criteria) this;
}
public Criteria andOrderTypeIsNotNull() {
addCriterion("order_type is not null");
return (Criteria) this;
}
public Criteria andOrderTypeEqualTo(String value) {
addCriterion("order_type =", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotEqualTo(String value) {
addCriterion("order_type <>", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeGreaterThan(String value) {
addCriterion("order_type >", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeGreaterThanOrEqualTo(String value) {
addCriterion("order_type >=", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeLessThan(String value) {
addCriterion("order_type <", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeLessThanOrEqualTo(String value) {
addCriterion("order_type <=", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeLike(String value) {
addCriterion("order_type like", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotLike(String value) {
addCriterion("order_type not like", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeIn(List<String> values) {
addCriterion("order_type in", values, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotIn(List<String> values) {
addCriterion("order_type not in", values, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeBetween(String value1, String value2) {
addCriterion("order_type between", value1, value2, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotBetween(String value1, String value2) {
addCriterion("order_type not between", value1, value2, "orderType");
return (Criteria) this;
}
}
/**
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends AbstractGeneratedCriteria {
protected Criteria() {
super();
}
}
/**
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
/**
*
* @mbg.generated
*/
public enum OrderCondition {
/**
*主键
*/
ID("id"),
/**
*所属产品线
*/
APPCODE("app_code"),
/**
*操作唯一ID
*/
ACTIONID("action_id"),
/**
*操作elementId
*/
ELEMENTID("element_id"),
/**
*操作类型
*/
ACTIONTYPE("action_type"),
/**
*操作名称
*/
ACTIONNAME("action_name"),
/**
*操作label
*/
ACTIONLABEL("action_label"),
/**
*执行操作上层的node信息
*/
NODE("node"),
/**
*对象实体类型
*/
ENTITYTYPE("entity_type"),
/**
*对象实体值
*/
ENTITYVALUE("entity_value"),
/**
*执行状态
*/
STATUS("status"),
/**
*创建时间
*/
CREATETIME("create_time"),
/**
*开始时间
*/
STARTTIME("start_time"),
/**
*执行人工号
*/
EMPID("emp_id"),
/**
*结束时间
*/
ENDTIME("end_time"),
/**
*changfree orderId
*/
ORDERID("order_id"),
/**
*是否同步结束
*/
SYNCRESULT("sync_result"),
/**
*action uuid
*/
UUID("uuid"),
/**
*tesla工单ID
*/
TESLAORDERID("tesla_order_id"),
/**
*tesla工单是否同步结束
*/
TESLAORDERSYNCRESULT("tesla_order_sync_result"),
/**
*是否同步到tesla工单系统
*/
SYNCTESLAORDER("sync_tesla_order"),
/**
*同步工单类型
*/
ORDERTYPE("order_type");
private String columnName;
OrderCondition(String columnName) {
this.columnName = columnName;
}
public String getColumnName() {
return columnName;
}
public static OrderCondition getEnumByName(String name) {
OrderCondition[] orderConditions = OrderCondition.values();
for (OrderCondition orderCondition : orderConditions) {
if (orderCondition.name().equalsIgnoreCase(name)) {
return orderCondition;
}
}
throw new RuntimeException("OrderCondition of " + name + " enum not exist");
}
@Override
public String toString() {
return columnName;
}
}
/**
*
* @mbg.generated
*/
public enum SortType {
/**
* 升序
*/
ASC("asc"),
/**
* 降序
*/
DESC("desc");
private String value;
SortType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static SortType getEnumByName(String name) {
SortType[] sortTypes = SortType.values();
for (SortType sortType : sortTypes) {
if (sortType.name().equalsIgnoreCase(name)) {
return sortType;
}
}
throw new RuntimeException("SortType of " + name + " enum not exist");
}
@Override
public String toString() {
return value;
}
}
} | UTF-8 | Java | 64,662 | java | ActionExample.java | Java | [
{
"context": "s class was generated by Ali-Generator\r\n * @author bang\r\n */\r\npublic class ActionExample {\r\n /**\r\n ",
"end": 162,
"score": 0.9827909469604492,
"start": 158,
"tag": "USERNAME",
"value": "bang"
}
] | null | [] | package com.alibaba.tesla.action.dao;
import java.util.ArrayList;
import java.util.List;
/**
* This class was generated by Ali-Generator
* @author bang
*/
public class ActionExample {
/**
*
* @mbg.generated
*/
protected String orderByClause;
/**
*
* @mbg.generated
*/
@Deprecated
protected boolean distinct;
/**
*
* @mbg.generated
*/
protected boolean page;
/**
*
* @mbg.generated
*/
protected int pageIndex;
/**
*
* @mbg.generated
*/
protected int pageSize;
/**
*
* @mbg.generated
*/
protected int pageStart;
/**
*
* @mbg.generated
*/
protected String distinctSql;
/**
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
*
* @mbg.generated
*/
public ActionExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* @param orderCondition
* @param sortType
* @return
*
* @mbg.generated
*/
public ActionExample appendOrderByClause(OrderCondition orderCondition, SortType sortType) {
if (null != orderByClause) {
orderByClause = orderByClause + ", " + orderCondition.getColumnName() + " " + sortType.getValue();
} else {
orderByClause = orderCondition.getColumnName() + " " + sortType.getValue();
}
return this;
}
/**
* @return
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* @param distinct
*
* @mbg.generated
*/
@Deprecated
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* @return
*
* @mbg.generated
*/
@Deprecated
public boolean isDistinct() {
return distinct;
}
/**
* @param page
* @return
*
* @mbg.generated
*/
public ActionExample setPage(boolean page) {
this.page = page;
return this;
}
/**
* @return
*
* @mbg.generated
*/
public boolean isPage() {
return page;
}
/**
* @return
*
* @mbg.generated
*/
public int getPageIndex() {
return pageIndex;
}
/**
* @param pageSize
* @return
*
* @mbg.generated
*/
public ActionExample setPageSize(int pageSize) {
this.pageSize = pageSize < 1 ? 10 : pageSize;
this.pageIndex = pageStart < 1 ? 0 : (pageStart - 1) * this.pageSize;
return this;
}
/**
* @return
*
* @mbg.generated
*/
public int getPageSize() {
return pageSize;
}
/**
* @param pageStart
* @return
*
* @mbg.generated
*/
public ActionExample setPageStart(int pageStart) {
this.pageStart = pageStart < 1 ? 1 : pageStart;
this.pageIndex = (this.pageStart - 1) * this.pageSize;
return this;
}
/**
* @return
*
* @mbg.generated
*/
public int getPageStart() {
return pageStart;
}
/**
* @param pageStart
* @param pageSize
*
* @mbg.generated
*/
public void setPagination(int pageStart, int pageSize) {
this.page = true;
this.pageSize = pageSize < 1 ? 10 : pageSize;
this.pageIndex = pageStart < 1 ? 0 : (pageStart - 1) * this.pageSize;
}
/**
* @param condition
* @return
*
* @mbg.generated
*/
public ActionExample appendDistinct(OrderCondition condition) {
if (null != distinctSql){
distinctSql = distinctSql + ", " + condition.getColumnName();
} else {
distinctSql = condition.getColumnName();
}
return this;
}
/**
* @return
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* @param criteria
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* @return
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* @return
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* @return
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
*
* @mbg.generated
*/
protected abstract static class AbstractGeneratedCriteria {
protected List<Criterion> criteria;
protected AbstractGeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andAppCodeIsNull() {
addCriterion("app_code is null");
return (Criteria) this;
}
public Criteria andAppCodeIsNotNull() {
addCriterion("app_code is not null");
return (Criteria) this;
}
public Criteria andAppCodeEqualTo(String value) {
addCriterion("app_code =", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotEqualTo(String value) {
addCriterion("app_code <>", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeGreaterThan(String value) {
addCriterion("app_code >", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeGreaterThanOrEqualTo(String value) {
addCriterion("app_code >=", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeLessThan(String value) {
addCriterion("app_code <", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeLessThanOrEqualTo(String value) {
addCriterion("app_code <=", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeLike(String value) {
addCriterion("app_code like", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotLike(String value) {
addCriterion("app_code not like", value, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeIn(List<String> values) {
addCriterion("app_code in", values, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotIn(List<String> values) {
addCriterion("app_code not in", values, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeBetween(String value1, String value2) {
addCriterion("app_code between", value1, value2, "appCode");
return (Criteria) this;
}
public Criteria andAppCodeNotBetween(String value1, String value2) {
addCriterion("app_code not between", value1, value2, "appCode");
return (Criteria) this;
}
public Criteria andActionIdIsNull() {
addCriterion("action_id is null");
return (Criteria) this;
}
public Criteria andActionIdIsNotNull() {
addCriterion("action_id is not null");
return (Criteria) this;
}
public Criteria andActionIdEqualTo(Long value) {
addCriterion("action_id =", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdNotEqualTo(Long value) {
addCriterion("action_id <>", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdGreaterThan(Long value) {
addCriterion("action_id >", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdGreaterThanOrEqualTo(Long value) {
addCriterion("action_id >=", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdLessThan(Long value) {
addCriterion("action_id <", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdLessThanOrEqualTo(Long value) {
addCriterion("action_id <=", value, "actionId");
return (Criteria) this;
}
public Criteria andActionIdIn(List<Long> values) {
addCriterion("action_id in", values, "actionId");
return (Criteria) this;
}
public Criteria andActionIdNotIn(List<Long> values) {
addCriterion("action_id not in", values, "actionId");
return (Criteria) this;
}
public Criteria andActionIdBetween(Long value1, Long value2) {
addCriterion("action_id between", value1, value2, "actionId");
return (Criteria) this;
}
public Criteria andActionIdNotBetween(Long value1, Long value2) {
addCriterion("action_id not between", value1, value2, "actionId");
return (Criteria) this;
}
public Criteria andElementIdIsNull() {
addCriterion("element_id is null");
return (Criteria) this;
}
public Criteria andElementIdIsNotNull() {
addCriterion("element_id is not null");
return (Criteria) this;
}
public Criteria andElementIdEqualTo(String value) {
addCriterion("element_id =", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotEqualTo(String value) {
addCriterion("element_id <>", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdGreaterThan(String value) {
addCriterion("element_id >", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdGreaterThanOrEqualTo(String value) {
addCriterion("element_id >=", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdLessThan(String value) {
addCriterion("element_id <", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdLessThanOrEqualTo(String value) {
addCriterion("element_id <=", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdLike(String value) {
addCriterion("element_id like", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotLike(String value) {
addCriterion("element_id not like", value, "elementId");
return (Criteria) this;
}
public Criteria andElementIdIn(List<String> values) {
addCriterion("element_id in", values, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotIn(List<String> values) {
addCriterion("element_id not in", values, "elementId");
return (Criteria) this;
}
public Criteria andElementIdBetween(String value1, String value2) {
addCriterion("element_id between", value1, value2, "elementId");
return (Criteria) this;
}
public Criteria andElementIdNotBetween(String value1, String value2) {
addCriterion("element_id not between", value1, value2, "elementId");
return (Criteria) this;
}
public Criteria andActionTypeIsNull() {
addCriterion("action_type is null");
return (Criteria) this;
}
public Criteria andActionTypeIsNotNull() {
addCriterion("action_type is not null");
return (Criteria) this;
}
public Criteria andActionTypeEqualTo(String value) {
addCriterion("action_type =", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotEqualTo(String value) {
addCriterion("action_type <>", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeGreaterThan(String value) {
addCriterion("action_type >", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeGreaterThanOrEqualTo(String value) {
addCriterion("action_type >=", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeLessThan(String value) {
addCriterion("action_type <", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeLessThanOrEqualTo(String value) {
addCriterion("action_type <=", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeLike(String value) {
addCriterion("action_type like", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotLike(String value) {
addCriterion("action_type not like", value, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeIn(List<String> values) {
addCriterion("action_type in", values, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotIn(List<String> values) {
addCriterion("action_type not in", values, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeBetween(String value1, String value2) {
addCriterion("action_type between", value1, value2, "actionType");
return (Criteria) this;
}
public Criteria andActionTypeNotBetween(String value1, String value2) {
addCriterion("action_type not between", value1, value2, "actionType");
return (Criteria) this;
}
public Criteria andActionNameIsNull() {
addCriterion("action_name is null");
return (Criteria) this;
}
public Criteria andActionNameIsNotNull() {
addCriterion("action_name is not null");
return (Criteria) this;
}
public Criteria andActionNameEqualTo(String value) {
addCriterion("action_name =", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotEqualTo(String value) {
addCriterion("action_name <>", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameGreaterThan(String value) {
addCriterion("action_name >", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameGreaterThanOrEqualTo(String value) {
addCriterion("action_name >=", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameLessThan(String value) {
addCriterion("action_name <", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameLessThanOrEqualTo(String value) {
addCriterion("action_name <=", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameLike(String value) {
addCriterion("action_name like", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotLike(String value) {
addCriterion("action_name not like", value, "actionName");
return (Criteria) this;
}
public Criteria andActionNameIn(List<String> values) {
addCriterion("action_name in", values, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotIn(List<String> values) {
addCriterion("action_name not in", values, "actionName");
return (Criteria) this;
}
public Criteria andActionNameBetween(String value1, String value2) {
addCriterion("action_name between", value1, value2, "actionName");
return (Criteria) this;
}
public Criteria andActionNameNotBetween(String value1, String value2) {
addCriterion("action_name not between", value1, value2, "actionName");
return (Criteria) this;
}
public Criteria andActionLabelIsNull() {
addCriterion("action_label is null");
return (Criteria) this;
}
public Criteria andActionLabelIsNotNull() {
addCriterion("action_label is not null");
return (Criteria) this;
}
public Criteria andActionLabelEqualTo(String value) {
addCriterion("action_label =", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotEqualTo(String value) {
addCriterion("action_label <>", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelGreaterThan(String value) {
addCriterion("action_label >", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelGreaterThanOrEqualTo(String value) {
addCriterion("action_label >=", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelLessThan(String value) {
addCriterion("action_label <", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelLessThanOrEqualTo(String value) {
addCriterion("action_label <=", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelLike(String value) {
addCriterion("action_label like", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotLike(String value) {
addCriterion("action_label not like", value, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelIn(List<String> values) {
addCriterion("action_label in", values, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotIn(List<String> values) {
addCriterion("action_label not in", values, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelBetween(String value1, String value2) {
addCriterion("action_label between", value1, value2, "actionLabel");
return (Criteria) this;
}
public Criteria andActionLabelNotBetween(String value1, String value2) {
addCriterion("action_label not between", value1, value2, "actionLabel");
return (Criteria) this;
}
public Criteria andNodeIsNull() {
addCriterion("node is null");
return (Criteria) this;
}
public Criteria andNodeIsNotNull() {
addCriterion("node is not null");
return (Criteria) this;
}
public Criteria andNodeEqualTo(String value) {
addCriterion("node =", value, "node");
return (Criteria) this;
}
public Criteria andNodeNotEqualTo(String value) {
addCriterion("node <>", value, "node");
return (Criteria) this;
}
public Criteria andNodeGreaterThan(String value) {
addCriterion("node >", value, "node");
return (Criteria) this;
}
public Criteria andNodeGreaterThanOrEqualTo(String value) {
addCriterion("node >=", value, "node");
return (Criteria) this;
}
public Criteria andNodeLessThan(String value) {
addCriterion("node <", value, "node");
return (Criteria) this;
}
public Criteria andNodeLessThanOrEqualTo(String value) {
addCriterion("node <=", value, "node");
return (Criteria) this;
}
public Criteria andNodeLike(String value) {
addCriterion("node like", value, "node");
return (Criteria) this;
}
public Criteria andNodeNotLike(String value) {
addCriterion("node not like", value, "node");
return (Criteria) this;
}
public Criteria andNodeIn(List<String> values) {
addCriterion("node in", values, "node");
return (Criteria) this;
}
public Criteria andNodeNotIn(List<String> values) {
addCriterion("node not in", values, "node");
return (Criteria) this;
}
public Criteria andNodeBetween(String value1, String value2) {
addCriterion("node between", value1, value2, "node");
return (Criteria) this;
}
public Criteria andNodeNotBetween(String value1, String value2) {
addCriterion("node not between", value1, value2, "node");
return (Criteria) this;
}
public Criteria andEntityTypeIsNull() {
addCriterion("entity_type is null");
return (Criteria) this;
}
public Criteria andEntityTypeIsNotNull() {
addCriterion("entity_type is not null");
return (Criteria) this;
}
public Criteria andEntityTypeEqualTo(String value) {
addCriterion("entity_type =", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotEqualTo(String value) {
addCriterion("entity_type <>", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeGreaterThan(String value) {
addCriterion("entity_type >", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeGreaterThanOrEqualTo(String value) {
addCriterion("entity_type >=", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeLessThan(String value) {
addCriterion("entity_type <", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeLessThanOrEqualTo(String value) {
addCriterion("entity_type <=", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeLike(String value) {
addCriterion("entity_type like", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotLike(String value) {
addCriterion("entity_type not like", value, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeIn(List<String> values) {
addCriterion("entity_type in", values, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotIn(List<String> values) {
addCriterion("entity_type not in", values, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeBetween(String value1, String value2) {
addCriterion("entity_type between", value1, value2, "entityType");
return (Criteria) this;
}
public Criteria andEntityTypeNotBetween(String value1, String value2) {
addCriterion("entity_type not between", value1, value2, "entityType");
return (Criteria) this;
}
public Criteria andEntityValueIsNull() {
addCriterion("entity_value is null");
return (Criteria) this;
}
public Criteria andEntityValueIsNotNull() {
addCriterion("entity_value is not null");
return (Criteria) this;
}
public Criteria andEntityValueEqualTo(String value) {
addCriterion("entity_value =", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotEqualTo(String value) {
addCriterion("entity_value <>", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueGreaterThan(String value) {
addCriterion("entity_value >", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueGreaterThanOrEqualTo(String value) {
addCriterion("entity_value >=", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueLessThan(String value) {
addCriterion("entity_value <", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueLessThanOrEqualTo(String value) {
addCriterion("entity_value <=", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueLike(String value) {
addCriterion("entity_value like", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotLike(String value) {
addCriterion("entity_value not like", value, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueIn(List<String> values) {
addCriterion("entity_value in", values, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotIn(List<String> values) {
addCriterion("entity_value not in", values, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueBetween(String value1, String value2) {
addCriterion("entity_value between", value1, value2, "entityValue");
return (Criteria) this;
}
public Criteria andEntityValueNotBetween(String value1, String value2) {
addCriterion("entity_value not between", value1, value2, "entityValue");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;
}
public Criteria andStartTimeIsNotNull() {
addCriterion("start_time is not null");
return (Criteria) this;
}
public Criteria andStartTimeEqualTo(Long value) {
addCriterion("start_time =", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotEqualTo(Long value) {
addCriterion("start_time <>", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThan(Long value) {
addCriterion("start_time >", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThanOrEqualTo(Long value) {
addCriterion("start_time >=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThan(Long value) {
addCriterion("start_time <", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThanOrEqualTo(Long value) {
addCriterion("start_time <=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeIn(List<Long> values) {
addCriterion("start_time in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotIn(List<Long> values) {
addCriterion("start_time not in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeBetween(Long value1, Long value2) {
addCriterion("start_time between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotBetween(Long value1, Long value2) {
addCriterion("start_time not between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andEmpIdIsNull() {
addCriterion("emp_id is null");
return (Criteria) this;
}
public Criteria andEmpIdIsNotNull() {
addCriterion("emp_id is not null");
return (Criteria) this;
}
public Criteria andEmpIdEqualTo(String value) {
addCriterion("emp_id =", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotEqualTo(String value) {
addCriterion("emp_id <>", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdGreaterThan(String value) {
addCriterion("emp_id >", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdGreaterThanOrEqualTo(String value) {
addCriterion("emp_id >=", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdLessThan(String value) {
addCriterion("emp_id <", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdLessThanOrEqualTo(String value) {
addCriterion("emp_id <=", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdLike(String value) {
addCriterion("emp_id like", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotLike(String value) {
addCriterion("emp_id not like", value, "empId");
return (Criteria) this;
}
public Criteria andEmpIdIn(List<String> values) {
addCriterion("emp_id in", values, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotIn(List<String> values) {
addCriterion("emp_id not in", values, "empId");
return (Criteria) this;
}
public Criteria andEmpIdBetween(String value1, String value2) {
addCriterion("emp_id between", value1, value2, "empId");
return (Criteria) this;
}
public Criteria andEmpIdNotBetween(String value1, String value2) {
addCriterion("emp_id not between", value1, value2, "empId");
return (Criteria) this;
}
public Criteria andEndTimeIsNull() {
addCriterion("end_time is null");
return (Criteria) this;
}
public Criteria andEndTimeIsNotNull() {
addCriterion("end_time is not null");
return (Criteria) this;
}
public Criteria andEndTimeEqualTo(Long value) {
addCriterion("end_time =", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotEqualTo(Long value) {
addCriterion("end_time <>", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThan(Long value) {
addCriterion("end_time >", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("end_time >=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThan(Long value) {
addCriterion("end_time <", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
addCriterion("end_time <=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeIn(List<Long> values) {
addCriterion("end_time in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotIn(List<Long> values) {
addCriterion("end_time not in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeBetween(Long value1, Long value2) {
addCriterion("end_time between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
addCriterion("end_time not between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andOrderIdIsNull() {
addCriterion("order_id is null");
return (Criteria) this;
}
public Criteria andOrderIdIsNotNull() {
addCriterion("order_id is not null");
return (Criteria) this;
}
public Criteria andOrderIdEqualTo(String value) {
addCriterion("order_id =", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotEqualTo(String value) {
addCriterion("order_id <>", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThan(String value) {
addCriterion("order_id >", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThanOrEqualTo(String value) {
addCriterion("order_id >=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThan(String value) {
addCriterion("order_id <", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThanOrEqualTo(String value) {
addCriterion("order_id <=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLike(String value) {
addCriterion("order_id like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotLike(String value) {
addCriterion("order_id not like", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdIn(List<String> values) {
addCriterion("order_id in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotIn(List<String> values) {
addCriterion("order_id not in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdBetween(String value1, String value2) {
addCriterion("order_id between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotBetween(String value1, String value2) {
addCriterion("order_id not between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andSyncResultIsNull() {
addCriterion("sync_result is null");
return (Criteria) this;
}
public Criteria andSyncResultIsNotNull() {
addCriterion("sync_result is not null");
return (Criteria) this;
}
public Criteria andSyncResultEqualTo(Byte value) {
addCriterion("sync_result =", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultNotEqualTo(Byte value) {
addCriterion("sync_result <>", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultGreaterThan(Byte value) {
addCriterion("sync_result >", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultGreaterThanOrEqualTo(Byte value) {
addCriterion("sync_result >=", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultLessThan(Byte value) {
addCriterion("sync_result <", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultLessThanOrEqualTo(Byte value) {
addCriterion("sync_result <=", value, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultIn(List<Byte> values) {
addCriterion("sync_result in", values, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultNotIn(List<Byte> values) {
addCriterion("sync_result not in", values, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultBetween(Byte value1, Byte value2) {
addCriterion("sync_result between", value1, value2, "syncResult");
return (Criteria) this;
}
public Criteria andSyncResultNotBetween(Byte value1, Byte value2) {
addCriterion("sync_result not between", value1, value2, "syncResult");
return (Criteria) this;
}
public Criteria andUuidIsNull() {
addCriterion("uuid is null");
return (Criteria) this;
}
public Criteria andUuidIsNotNull() {
addCriterion("uuid is not null");
return (Criteria) this;
}
public Criteria andUuidEqualTo(String value) {
addCriterion("uuid =", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotEqualTo(String value) {
addCriterion("uuid <>", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidGreaterThan(String value) {
addCriterion("uuid >", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidGreaterThanOrEqualTo(String value) {
addCriterion("uuid >=", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLessThan(String value) {
addCriterion("uuid <", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLessThanOrEqualTo(String value) {
addCriterion("uuid <=", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidLike(String value) {
addCriterion("uuid like", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotLike(String value) {
addCriterion("uuid not like", value, "uuid");
return (Criteria) this;
}
public Criteria andUuidIn(List<String> values) {
addCriterion("uuid in", values, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotIn(List<String> values) {
addCriterion("uuid not in", values, "uuid");
return (Criteria) this;
}
public Criteria andUuidBetween(String value1, String value2) {
addCriterion("uuid between", value1, value2, "uuid");
return (Criteria) this;
}
public Criteria andUuidNotBetween(String value1, String value2) {
addCriterion("uuid not between", value1, value2, "uuid");
return (Criteria) this;
}
public Criteria andTeslaOrderIdIsNull() {
addCriterion("tesla_order_id is null");
return (Criteria) this;
}
public Criteria andTeslaOrderIdIsNotNull() {
addCriterion("tesla_order_id is not null");
return (Criteria) this;
}
public Criteria andTeslaOrderIdEqualTo(Long value) {
addCriterion("tesla_order_id =", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdNotEqualTo(Long value) {
addCriterion("tesla_order_id <>", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdGreaterThan(Long value) {
addCriterion("tesla_order_id >", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdGreaterThanOrEqualTo(Long value) {
addCriterion("tesla_order_id >=", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdLessThan(Long value) {
addCriterion("tesla_order_id <", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdLessThanOrEqualTo(Long value) {
addCriterion("tesla_order_id <=", value, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdIn(List<Long> values) {
addCriterion("tesla_order_id in", values, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdNotIn(List<Long> values) {
addCriterion("tesla_order_id not in", values, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdBetween(Long value1, Long value2) {
addCriterion("tesla_order_id between", value1, value2, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderIdNotBetween(Long value1, Long value2) {
addCriterion("tesla_order_id not between", value1, value2, "teslaOrderId");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultIsNull() {
addCriterion("tesla_order_sync_result is null");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultIsNotNull() {
addCriterion("tesla_order_sync_result is not null");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultEqualTo(Byte value) {
addCriterion("tesla_order_sync_result =", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultNotEqualTo(Byte value) {
addCriterion("tesla_order_sync_result <>", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultGreaterThan(Byte value) {
addCriterion("tesla_order_sync_result >", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultGreaterThanOrEqualTo(Byte value) {
addCriterion("tesla_order_sync_result >=", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultLessThan(Byte value) {
addCriterion("tesla_order_sync_result <", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultLessThanOrEqualTo(Byte value) {
addCriterion("tesla_order_sync_result <=", value, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultIn(List<Byte> values) {
addCriterion("tesla_order_sync_result in", values, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultNotIn(List<Byte> values) {
addCriterion("tesla_order_sync_result not in", values, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultBetween(Byte value1, Byte value2) {
addCriterion("tesla_order_sync_result between", value1, value2, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andTeslaOrderSyncResultNotBetween(Byte value1, Byte value2) {
addCriterion("tesla_order_sync_result not between", value1, value2, "teslaOrderSyncResult");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderIsNull() {
addCriterion("sync_tesla_order is null");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderIsNotNull() {
addCriterion("sync_tesla_order is not null");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderEqualTo(Byte value) {
addCriterion("sync_tesla_order =", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderNotEqualTo(Byte value) {
addCriterion("sync_tesla_order <>", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderGreaterThan(Byte value) {
addCriterion("sync_tesla_order >", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderGreaterThanOrEqualTo(Byte value) {
addCriterion("sync_tesla_order >=", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderLessThan(Byte value) {
addCriterion("sync_tesla_order <", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderLessThanOrEqualTo(Byte value) {
addCriterion("sync_tesla_order <=", value, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderIn(List<Byte> values) {
addCriterion("sync_tesla_order in", values, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderNotIn(List<Byte> values) {
addCriterion("sync_tesla_order not in", values, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderBetween(Byte value1, Byte value2) {
addCriterion("sync_tesla_order between", value1, value2, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andSyncTeslaOrderNotBetween(Byte value1, Byte value2) {
addCriterion("sync_tesla_order not between", value1, value2, "syncTeslaOrder");
return (Criteria) this;
}
public Criteria andOrderTypeIsNull() {
addCriterion("order_type is null");
return (Criteria) this;
}
public Criteria andOrderTypeIsNotNull() {
addCriterion("order_type is not null");
return (Criteria) this;
}
public Criteria andOrderTypeEqualTo(String value) {
addCriterion("order_type =", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotEqualTo(String value) {
addCriterion("order_type <>", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeGreaterThan(String value) {
addCriterion("order_type >", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeGreaterThanOrEqualTo(String value) {
addCriterion("order_type >=", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeLessThan(String value) {
addCriterion("order_type <", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeLessThanOrEqualTo(String value) {
addCriterion("order_type <=", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeLike(String value) {
addCriterion("order_type like", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotLike(String value) {
addCriterion("order_type not like", value, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeIn(List<String> values) {
addCriterion("order_type in", values, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotIn(List<String> values) {
addCriterion("order_type not in", values, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeBetween(String value1, String value2) {
addCriterion("order_type between", value1, value2, "orderType");
return (Criteria) this;
}
public Criteria andOrderTypeNotBetween(String value1, String value2) {
addCriterion("order_type not between", value1, value2, "orderType");
return (Criteria) this;
}
}
/**
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends AbstractGeneratedCriteria {
protected Criteria() {
super();
}
}
/**
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
/**
*
* @mbg.generated
*/
public enum OrderCondition {
/**
*主键
*/
ID("id"),
/**
*所属产品线
*/
APPCODE("app_code"),
/**
*操作唯一ID
*/
ACTIONID("action_id"),
/**
*操作elementId
*/
ELEMENTID("element_id"),
/**
*操作类型
*/
ACTIONTYPE("action_type"),
/**
*操作名称
*/
ACTIONNAME("action_name"),
/**
*操作label
*/
ACTIONLABEL("action_label"),
/**
*执行操作上层的node信息
*/
NODE("node"),
/**
*对象实体类型
*/
ENTITYTYPE("entity_type"),
/**
*对象实体值
*/
ENTITYVALUE("entity_value"),
/**
*执行状态
*/
STATUS("status"),
/**
*创建时间
*/
CREATETIME("create_time"),
/**
*开始时间
*/
STARTTIME("start_time"),
/**
*执行人工号
*/
EMPID("emp_id"),
/**
*结束时间
*/
ENDTIME("end_time"),
/**
*changfree orderId
*/
ORDERID("order_id"),
/**
*是否同步结束
*/
SYNCRESULT("sync_result"),
/**
*action uuid
*/
UUID("uuid"),
/**
*tesla工单ID
*/
TESLAORDERID("tesla_order_id"),
/**
*tesla工单是否同步结束
*/
TESLAORDERSYNCRESULT("tesla_order_sync_result"),
/**
*是否同步到tesla工单系统
*/
SYNCTESLAORDER("sync_tesla_order"),
/**
*同步工单类型
*/
ORDERTYPE("order_type");
private String columnName;
OrderCondition(String columnName) {
this.columnName = columnName;
}
public String getColumnName() {
return columnName;
}
public static OrderCondition getEnumByName(String name) {
OrderCondition[] orderConditions = OrderCondition.values();
for (OrderCondition orderCondition : orderConditions) {
if (orderCondition.name().equalsIgnoreCase(name)) {
return orderCondition;
}
}
throw new RuntimeException("OrderCondition of " + name + " enum not exist");
}
@Override
public String toString() {
return columnName;
}
}
/**
*
* @mbg.generated
*/
public enum SortType {
/**
* 升序
*/
ASC("asc"),
/**
* 降序
*/
DESC("desc");
private String value;
SortType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static SortType getEnumByName(String name) {
SortType[] sortTypes = SortType.values();
for (SortType sortType : sortTypes) {
if (sortType.name().equalsIgnoreCase(name)) {
return sortType;
}
}
throw new RuntimeException("SortType of " + name + " enum not exist");
}
@Override
public String toString() {
return value;
}
}
} | 64,662 | 0.548709 | 0.545622 | 2,029 | 29.772301 | 25.589808 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65106 | false | false | 12 |
db5b637a0435b506f464a6a1391a2a9ce2c8db8a | 23,115,514,000,683 | 46af45a1033bf8ddecb1a122a385b5a73f1e4eef | /app/src/main/java/com/example/life/fragments/LogIn.java | b15a7a8ca5a3ff64f5211b03873ff3827dc68d14 | [] | no_license | Digant-Parmar/Life | https://github.com/Digant-Parmar/Life | e346fb53495bbf3ce78a08ee9d2aab48182fdac9 | 9298ad5cd524b28c885a82fcf4a2fb78e43338a5 | refs/heads/master | 2022-11-20T06:41:45.348000 | 2020-07-16T10:35:25 | 2020-07-16T10:35:25 | 278,109,273 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.life.fragments;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import com.example.life.LoginSignIn.PhoneLoginActivity;
import com.example.life.chatActivities.ChatActivity;
import com.example.life.R;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
public class LogIn extends Fragment {
private static final int RC_SIGN_IN = 234;
private Button btnPhoneLoginButton;
//Tag for the logs optional
private static final String TAG = "simplifiedcoding";
//creating a GoogleSignInClient object
GoogleSignInClient mGoogleSignInClient;
//And also a Firebase Auth object
FirebaseAuth mAuth;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_log_in, container, false);
mAuth = FirebaseAuth.getInstance();
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(getActivity(), gso);
v.findViewById(R.id.btnGoogleLogin).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
signIn();
}
});
btnPhoneLoginButton = v.findViewById(R.id.btnPhoneLogin);
btnPhoneLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent phoneLoginIntent = new Intent(getContext(), PhoneLoginActivity.class);
startActivity(phoneLoginIntent);
}
});
// Inflate the layout for this fragment
return v;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//if the requestCode is the Google Sign In code that we defined at starting
if (requestCode == RC_SIGN_IN) {
//Getting the GoogleSignIn Task
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
//Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
//authenticating with firebase
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
//getting the auth credential
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
//Now using firebase we are signing in the user here
mAuth.signInWithCredential(credential)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
Toast.makeText(getActivity(), "User Signed In", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getActivity(), ChatActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
getActivity().finish();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(getActivity(), "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// ...
}
});
}
private void signIn() {
//getting the google signin intent
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
//starting the activity for result
startActivityForResult(signInIntent, RC_SIGN_IN);
}
} | UTF-8 | Java | 5,493 | java | LogIn.java | Java | [] | null | [] | package com.example.life.fragments;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import com.example.life.LoginSignIn.PhoneLoginActivity;
import com.example.life.chatActivities.ChatActivity;
import com.example.life.R;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
public class LogIn extends Fragment {
private static final int RC_SIGN_IN = 234;
private Button btnPhoneLoginButton;
//Tag for the logs optional
private static final String TAG = "simplifiedcoding";
//creating a GoogleSignInClient object
GoogleSignInClient mGoogleSignInClient;
//And also a Firebase Auth object
FirebaseAuth mAuth;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_log_in, container, false);
mAuth = FirebaseAuth.getInstance();
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(getActivity(), gso);
v.findViewById(R.id.btnGoogleLogin).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
signIn();
}
});
btnPhoneLoginButton = v.findViewById(R.id.btnPhoneLogin);
btnPhoneLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent phoneLoginIntent = new Intent(getContext(), PhoneLoginActivity.class);
startActivity(phoneLoginIntent);
}
});
// Inflate the layout for this fragment
return v;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//if the requestCode is the Google Sign In code that we defined at starting
if (requestCode == RC_SIGN_IN) {
//Getting the GoogleSignIn Task
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
//Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
//authenticating with firebase
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId());
//getting the auth credential
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
//Now using firebase we are signing in the user here
mAuth.signInWithCredential(credential)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
Toast.makeText(getActivity(), "User Signed In", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getActivity(), ChatActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
getActivity().finish();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithCredential:failure", task.getException());
Toast.makeText(getActivity(), "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// ...
}
});
}
private void signIn() {
//getting the google signin intent
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
//starting the activity for result
startActivityForResult(signInIntent, RC_SIGN_IN);
}
} | 5,493 | 0.638995 | 0.638449 | 145 | 36.889656 | 29.944344 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.606897 | false | false | 12 |
5bc91fa1ec560bc48775cfd6ff0f51040e138c0e | 21,852,793,617,910 | 797565f583ff4e9f396464c6a1470cf6f4d2da8e | /organization/src/main/java/com/springcloud/organization/param/UserQueryParam.java | b9de6b9265852a0a87d939e8ae286e06081497ef | [] | no_license | 583747346/SpringCloud | https://github.com/583747346/SpringCloud | c7cbb1511dd639d6c16b45f3e6f47bd4165a1788 | 912f5bb3cfa29cfa34210672477df7532af654fe | refs/heads/master | 2020-07-16T12:59:34.576000 | 2019-11-06T09:31:07 | 2019-11-06T09:31:07 | 205,762,463 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.springcloud.organization.param;
import com.springcloud.common.web.entity.param.BaseParam;
import com.springcloud.organization.entity.UserEntity;
import lombok.Data;
@Data
public class UserQueryParam extends BaseParam<UserEntity> {
private String name;
private String mobile;
private String username;
}
| UTF-8 | Java | 328 | java | UserQueryParam.java | Java | [] | null | [] | package com.springcloud.organization.param;
import com.springcloud.common.web.entity.param.BaseParam;
import com.springcloud.organization.entity.UserEntity;
import lombok.Data;
@Data
public class UserQueryParam extends BaseParam<UserEntity> {
private String name;
private String mobile;
private String username;
}
| 328 | 0.801829 | 0.801829 | 12 | 26.333334 | 21.596039 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false | 12 |
be20e1e77cc31cc443becb5bc680610cd1101e2d | 30,906,584,674,906 | 76cb2e3d60a0c22b81b625afdf3b7881583abaf5 | /src/main/java/org/crush/design/creator/factorymethod/Product.java | d2ce55816bef2d3f3860f11acb5c83ca20be127c | [] | no_license | 287122728/design-pattern | https://github.com/287122728/design-pattern | 69741509f0b96b8c6edc1e14165b73147967db6e | 14318b5a75f698cc9ae75304126e89e061761e70 | refs/heads/master | 2020-03-09T15:46:22.269000 | 2018-05-11T06:13:26 | 2018-05-11T06:13:26 | 123,391,183 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.crush.design.creator.factorymethod;
/**
* <p>
* Title: TODO
* </p>
* <p>
* Description: TODO
* </p>
* <p>
* Copyright: Copyright (c) 2017
* </p>
* <p>
* Company: 客如云
* </p>
*
* @author crush_lee
* @date 18/4/13
*/
public abstract class Product {
public abstract void show();
}
| UTF-8 | Java | 316 | java | Product.java | Java | [
{
"context": " </p>\n * <p>\n * Company: 客如云\n * </p>\n *\n * @author crush_lee\n * @date 18/4/13\n */\npublic abstract class Produc",
"end": 221,
"score": 0.9996357560157776,
"start": 212,
"tag": "USERNAME",
"value": "crush_lee"
}
] | null | [] | package org.crush.design.creator.factorymethod;
/**
* <p>
* Title: TODO
* </p>
* <p>
* Description: TODO
* </p>
* <p>
* Copyright: Copyright (c) 2017
* </p>
* <p>
* Company: 客如云
* </p>
*
* @author crush_lee
* @date 18/4/13
*/
public abstract class Product {
public abstract void show();
}
| 316 | 0.570968 | 0.541936 | 22 | 13.090909 | 12.224822 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | false | false | 12 |
e5d444b906278eb560186b490123cb2aa3deedd0 | 11,639,361,390,462 | 9330ead53b51a8bd2318409c29990c18266f0558 | /AndroidApp/app/src/main/java/md/ble/ui/dialogs/EnterValueDialog.java | 63353c9a9ce28f65fde3711535becc2f7aeac583 | [] | no_license | MinhDinhTran/eBike | https://github.com/MinhDinhTran/eBike | c6681436e704cad547a220ed35f108a202ab72d2 | 04eebe0f69b7de40c78e0571fcf48e7ec1d1cd29 | refs/heads/master | 2021-09-15T23:04:49.294000 | 2018-06-12T10:52:24 | 2018-06-12T10:52:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package md.ble.ui.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.InputType;
import android.widget.EditText;
import md.apk.R;
public class EnterValueDialog extends AppDialog<EnterValueDialog.ValueEnterDialogListener> {
public static final String TAG = EnterValueDialog.class.getSimpleName();
public interface ValueEnterDialogListener {
void ValueEntered(String value);
}
private EditText _input = null;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
_input = new EditText(getActivity());
_input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_CLASS_NUMBER);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.enter_value)
.setView(_input)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
getListener().ValueEntered(_input.getText().toString());
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
return builder.create();
}
@Override
public void onDestroy() {
_input = null;
super.onDestroy();
}
public void SetDefaultValue(String defValue)
{
if (_input != null)
_input.setText(defValue);
}
} | UTF-8 | Java | 1,710 | java | EnterValueDialog.java | Java | [] | null | [] | package md.ble.ui.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.InputType;
import android.widget.EditText;
import md.apk.R;
public class EnterValueDialog extends AppDialog<EnterValueDialog.ValueEnterDialogListener> {
public static final String TAG = EnterValueDialog.class.getSimpleName();
public interface ValueEnterDialogListener {
void ValueEntered(String value);
}
private EditText _input = null;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
_input = new EditText(getActivity());
_input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_CLASS_NUMBER);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.enter_value)
.setView(_input)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
getListener().ValueEntered(_input.getText().toString());
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
return builder.create();
}
@Override
public void onDestroy() {
_input = null;
super.onDestroy();
}
public void SetDefaultValue(String defValue)
{
if (_input != null)
_input.setText(defValue);
}
} | 1,710 | 0.628655 | 0.628655 | 55 | 30.109091 | 27.632441 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472727 | false | false | 12 |
24bd1f9d85e417eacf6cc69e023d655951499187 | 11,957,188,971,755 | 3a330ca91591859532b325f25a3b7762324ec27c | /Factors of a number/Main.java | 7189432f0bc93b1d581c15a9972bb8d3b250eff6 | [] | no_license | VaibhavFuke/Playground | https://github.com/VaibhavFuke/Playground | b38e3b3750fa65fe31d70c02e906b1a34ba67aac | d85e8b7cfae1763b8f128dca337d9445cb73e0a7 | refs/heads/master | 2020-04-14T17:43:36.821000 | 2019-02-16T18:06:17 | 2019-02-16T18:06:17 | 163,991,789 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
class Main{
public static void main (String[] args){
// Type your code here
int n=new Scanner(System.in).nextInt();
for(int i=1;i<n+1;i++)
if(n%i==0)
System.out.println(i);
}
} | UTF-8 | Java | 242 | java | Main.java | Java | [] | null | [] | import java.util.Scanner;
class Main{
public static void main (String[] args){
// Type your code here
int n=new Scanner(System.in).nextInt();
for(int i=1;i<n+1;i++)
if(n%i==0)
System.out.println(i);
}
} | 242 | 0.57438 | 0.561983 | 11 | 21.09091 | 14.859674 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false | 12 |
86f6d613539e4575d04855dbfdc5ed01ceb68264 | 31,765,578,142,656 | 96da0ca503e1b41fb70589f6c21b5f376cd7766e | /app/src/main/java/com/tarpost/bryanty/proj_t_post/sqlite/DbHelper.java | b0f46694ac3b21bb00bb36cb2cf4dd6f47c6a23c | [] | no_license | GamaX320/PROJ_T_POST | https://github.com/GamaX320/PROJ_T_POST | 38e016d0a9e93f354af41e7c99d039f1b9c3e298 | 88a448b2d1716846b1ef5df40419b4200727c1d4 | refs/heads/master | 2020-04-06T05:20:07.347000 | 2016-03-30T13:21:26 | 2016-03-30T13:21:26 | 37,376,935 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tarpost.bryanty.proj_t_post.sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.tarpost.bryanty.proj_t_post.common.DateUtil;
import com.tarpost.bryanty.proj_t_post.object.Event;
import com.tarpost.bryanty.proj_t_post.object.Post;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by BRYANTY on 29-Jan-16.
*/
public class DbHelper extends SQLiteOpenHelper {
//Db version
private static final int DATABASE_VERSION = 1;
//Db name
private static final String DATABASE_NAME = "tarpost_offline";
//Table name
private static final String TABLE_POST = "post";
private static final String TABLE_EVENT = "event";
//Post Table columns
private static final String COLUMN_POSTID = "postId";
private static final String COLUMN_CREATORID = "creatorId";
private static final String COLUMN_CREATORNAME = "creatorName";
private static final String COLUMN_TITLE = "title";
private static final String COLUMN_CONTENT = "content";
private static final String COLUMN_UPDATEDATETIME = "updateDateTime";
private static final String COLUMN_STATUS = "status";
private static final String COLUMN_TYPE = "type";
private static final String COLUMN_ADDEDDATE = "addedDate";
//Event Table columns
private static final String COLUMN_EVENTID = "postId";
private static final String COLUMN_EVENT_CREATORID = "creatorId";
private static final String COLUMN_EVENT_CREATORNAME = "creatorName";
private static final String COLUMN_EVENT_TITLE = "title";
private static final String COLUMN_EVENT_CONTENT = "content";
private static final String COLUMN_EVENT_IMAGE = "image";
private static final String COLUMN_EVENT_STARTDATETIME = "startDateTime";
private static final String COLUMN_EVENT_ENDDATETIME = "endDateTime";
private static final String COLUMN_EVENT_LATITUDE = "locationLat";
private static final String COLUMN_EVENT_LONGITUDU = "locationLng";
private static final String COLUMN_EVENT_CREATEDATETIME = "createDateTime";
private static final String COLUMN_EVENT_UPDATEDATETIME = "updateDateTime";
private static final String COLUMN_EVENT_STATUS = "status";
private static final String COLUMN_EVENT_TYPE = "type";
private static final String COLUMN_EVENT_ADDEDDATE = "addedDate";
public DbHelper(Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
//Create database
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_TABLE_POST = "CREATE TABLE "+TABLE_POST+" ("
+COLUMN_POSTID+" INTEGER PRIMARY KEY, "
+COLUMN_CREATORID+" TEXT, "
+COLUMN_CREATORNAME+" TEXT, "
+COLUMN_TITLE+" TEXT, "
+COLUMN_CONTENT+" TEXT, "
+COLUMN_UPDATEDATETIME+" TEXT, "
+COLUMN_STATUS+" TEXT, "
+COLUMN_TYPE+" TEXT, "
+COLUMN_ADDEDDATE+" TEXT "
+")";
String CREATE_TABLE_EVENT = "CREATE TABLE "+TABLE_EVENT+" ("
+COLUMN_EVENTID+" INTEGER PRIMARY KEY, "
+COLUMN_EVENT_CREATORID+" TEXT, "
+COLUMN_EVENT_CREATORNAME+" TEXT, "
+COLUMN_EVENT_TITLE+" TEXT, "
+COLUMN_EVENT_CONTENT+" TEXT, "
// +COLUMN_EVENT_IMAGE+" BLOB, "
+COLUMN_EVENT_STARTDATETIME+" TEXT, "
+COLUMN_EVENT_ENDDATETIME+" TEXT, "
+COLUMN_EVENT_LATITUDE+" DOUBLE, "
+COLUMN_EVENT_LONGITUDU+" DOUBLE, "
// +COLUMN_EVENT_CREATEDATETIME+" TEXT, "
+COLUMN_EVENT_UPDATEDATETIME+" TEXT, "
+COLUMN_EVENT_STATUS+" TEXT, "
+COLUMN_EVENT_TYPE+" TEXT, "
+COLUMN_EVENT_ADDEDDATE+" TEXT "
+")";
db.execSQL(CREATE_TABLE_POST);
db.execSQL(CREATE_TABLE_EVENT);
}
//Upgrade database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+TABLE_POST);
db.execSQL("DROP TABLE IF EXISTS "+TABLE_EVENT);
onCreate(db);
}
//Insert post record
public void addPost(Post post){
List<Post> postList = new ArrayList<Post>();
if(post.getType().equals("P")){
postList=getAllPost();
}else if(post.getType().equals("M")){
postList=getAllMyPost();
}else if(post.getType().equals("B")){
postList=getAllBookmarks();
}
if(postList != null && postList.size() > 0){
//Duplicate record found
for(Post object : postList){
if(object.getPostId().equals(post.getPostId())){
return;
}
}
}
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(COLUMN_POSTID, post.getPostId());
values.put(COLUMN_CREATORID, post.getCreatorId());
values.put(COLUMN_CREATORNAME, post.getCreatorName());
values.put(COLUMN_TITLE, post.getTitle());
values.put(COLUMN_CONTENT, post.getContent());
values.put(COLUMN_UPDATEDATETIME, post.getUpdateDateTime().toString());
values.put(COLUMN_STATUS, post.getStatus());
values.put(COLUMN_TYPE, post.getType());
values.put(COLUMN_ADDEDDATE, post.getAddedDate().toString());
db.insert(TABLE_POST, null, values);
db.close();
}
//Insert event record
public void addEvent(Event event){
SQLiteDatabase db = this.getWritableDatabase();
List<Event> eventList = new ArrayList<Event>();
if(event.getType().equals("E")){
eventList = getAllEvent();
}else if(event.getType().equals("J")){
eventList = getAllEventJoin();
}else if(event.getType().equals("C")) {
eventList = getAllEventCreate();
}
if(eventList != null && eventList.size() > 0){
//Duplicate record found
for(Event object : eventList){
if(object.getEventId().equals(event.getEventId())){
return;
}
}
}
ContentValues values = new ContentValues();
values.put(COLUMN_EVENTID, event.getEventId());
values.put(COLUMN_EVENT_CREATORID, event.getCreatorId());
values.put(COLUMN_EVENT_CREATORNAME, event.getCreatorName());
values.put(COLUMN_EVENT_TITLE, event.getTitle());
values.put(COLUMN_EVENT_CONTENT, event.getContent());
values.put(COLUMN_EVENT_STARTDATETIME, event.getStartDateTime().toString());
values.put(COLUMN_EVENT_ENDDATETIME, event.getEndDateTime().toString());
values.put(COLUMN_EVENT_LATITUDE, event.getLocationLat());
values.put(COLUMN_EVENT_LONGITUDU, event.getLocationLng());
values.put(COLUMN_EVENT_UPDATEDATETIME, event.getUpdateDateTime().toString());
values.put(COLUMN_EVENT_STATUS, event.getStatus());
values.put(COLUMN_EVENT_TYPE, event.getType());
values.put(COLUMN_EVENT_ADDEDDATE, event.getAddedDate().toString());
db.insert(TABLE_EVENT, null, values);
db.close();
}
//Get all posts record
public List<Post> getAllPost(){
List<Post> posts = new ArrayList<Post>();
// String query = "SELECT * FROM "+TABLE_POST; DESC
String query = "SELECT * FROM "+TABLE_POST+" WHERE "+COLUMN_TYPE+" == 'P' ORDER BY " +
// ""+COLUMN_UPDATEDATETIME+" DESC";
""+COLUMN_ADDEDDATE+" DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Post post = new Post();
post.setPostId(Integer.parseInt(cursor.getString(0)));
post.setCreatorId(cursor.getString(1));
post.setCreatorName(cursor.getString(2));
post.setTitle(cursor.getString(3));
post.setContent(cursor.getString(4));
post.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
post.setStatus(cursor.getString(6));
post.setType(cursor.getString(7));
post.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(8)));
posts.add(post);
}while(cursor.moveToNext());
}
cursor.close();
db.close();
return posts;
}
public List<Post> getAllBookmarks(){
List<Post> posts = new ArrayList<Post>();
String query = "SELECT * FROM "+TABLE_POST+" WHERE "+COLUMN_TYPE+" == 'B' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Post post = new Post();
post.setPostId(Integer.parseInt(cursor.getString(0)));
post.setCreatorId(cursor.getString(1));
post.setCreatorName(cursor.getString(2));
post.setTitle(cursor.getString(3));
post.setContent(cursor.getString(4));
post.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
post.setStatus(cursor.getString(6));
post.setType(cursor.getString(7));
post.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(8)));
posts.add(post);
}while(cursor.moveToNext());
}
cursor.close();
db.close();
return posts;
}
//Get all posts record
public List<Post> getAllMyPost(){
List<Post> posts = new ArrayList<Post>();
// String query = "SELECT * FROM "+TABLE_POST;
String query = "SELECT * FROM "+TABLE_POST+" WHERE "+COLUMN_TYPE+" == 'M' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Post post = new Post();
post.setPostId(Integer.parseInt(cursor.getString(0)));
post.setCreatorId(cursor.getString(1));
post.setCreatorName(cursor.getString(2));
post.setTitle(cursor.getString(3));
post.setContent(cursor.getString(4));
post.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
post.setStatus(cursor.getString(6));
post.setType(cursor.getString(7));
post.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(8)));
posts.add(post);
}while(cursor.moveToNext());
}
cursor.close();
db.close();
return posts;
}
//Get all events record
public List<Event> getAllEvent(){
List<Event> events = new ArrayList<Event>();
String query = "SELECT * FROM "+TABLE_EVENT+" WHERE "+COLUMN_EVENT_TYPE+" == 'E' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Event event = new Event();
event.setEventId(Integer.parseInt(cursor.getString(0)));
event.setCreatorId(cursor.getString(1));
event.setCreatorName(cursor.getString(2));
event.setTitle(cursor.getString(3));
event.setContent(cursor.getString(4));
//Convert byte[] to bitmap
//BitmapFactory.decodeByteArray(cursor.getBlob(4), 0, cursor.getBlob(4).length);
// event.setImage(cursor.getBlob(4));
event.setStartDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
event.setEndDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(6)));
event.setLocationLat(cursor.getDouble(7));
event.setLocationLng(cursor.getDouble(8));
// event.setCreateDateTime(DateUtil.convertStringToDate(cursor.getString(9)));
event.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(9)));
event.setStatus(cursor.getString(10));
event.setType(cursor.getString(11));
event.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(12)));
events.add(event);
}while(cursor.moveToNext());
}
return events;
}
public List<Event> getAllEventJoin(){
List<Event> events = new ArrayList<Event>();
String query = "SELECT * FROM "+TABLE_EVENT+" WHERE "+COLUMN_EVENT_TYPE+" == 'J' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Event event = new Event();
event.setEventId(Integer.parseInt(cursor.getString(0)));
event.setCreatorId(cursor.getString(1));
event.setCreatorName(cursor.getString(2));
event.setTitle(cursor.getString(3));
event.setContent(cursor.getString(4));
event.setStartDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
event.setEndDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(6)));
event.setLocationLat(cursor.getDouble(7));
event.setLocationLng(cursor.getDouble(8));
event.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(9)));
event.setStatus(cursor.getString(10));
event.setType(cursor.getString(11));
event.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(12)));
events.add(event);
}while(cursor.moveToNext());
}
return events;
}
public List<Event> getAllEventCreate(){
List<Event> events = new ArrayList<Event>();
String query = "SELECT * FROM "+TABLE_EVENT+" WHERE "+COLUMN_EVENT_TYPE+" == 'C' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Event event = new Event();
event.setEventId(Integer.parseInt(cursor.getString(0)));
event.setCreatorId(cursor.getString(1));
event.setCreatorName(cursor.getString(2));
event.setTitle(cursor.getString(3));
event.setContent(cursor.getString(4));
event.setStartDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
event.setEndDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(6)));
event.setLocationLat(cursor.getDouble(7));
event.setLocationLng(cursor.getDouble(8));
event.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(9)));
event.setStatus(cursor.getString(10));
event.setType(cursor.getString(11));
event.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(12)));
events.add(event);
}while(cursor.moveToNext());
}
return events;
}
//Get total posts count
public int getPostCount(){
String query = "SELECT * FROM "+TABLE_POST;
SQLiteDatabase db = this.getReadableDatabase();
int count = 0;
Cursor cursor = db.rawQuery(query, null);
cursor.close();
count = cursor.getCount();
return count;
}
//Get total events count
public int getEventCount(){
String query = "SELECT * FROM "+TABLE_EVENT;
SQLiteDatabase db = this.getReadableDatabase();
int count = 0;
Cursor cursor = db.rawQuery(query, null);
cursor.close();
count = cursor.getCount();
return count;
}
//Update post record
public int updatePost(Post post){
SQLiteDatabase db = this.getWritableDatabase();
int result =0;
ContentValues values = new ContentValues();
values.put(COLUMN_CREATORID, post.getCreatorId());
values.put(COLUMN_CREATORNAME, post.getCreatorName());
values.put(COLUMN_TITLE, post.getTitle());
values.put(COLUMN_CONTENT, post.getContent());
values.put(COLUMN_UPDATEDATETIME, post.getUpdateDateTime().toString());
values.put(COLUMN_STATUS, post.getStatus());
values.put(COLUMN_TYPE, post.getType());
result = db.update(TABLE_POST, values, COLUMN_POSTID + " = ?", new String[]{String
.valueOf(post.getPostId())});
return result;
}
//Update event record
public int updateEvent(Event event){
SQLiteDatabase db = this.getWritableDatabase();
int result =0;
ContentValues values = new ContentValues();
values.put(COLUMN_EVENT_CREATORID, event.getCreatorId());
values.put(COLUMN_EVENT_TITLE, event.getTitle());
values.put(COLUMN_EVENT_CONTENT, event.getContent());
// values.put(COLUMN_EVENT_IMAGE, event.getImage());
values.put(COLUMN_EVENT_STARTDATETIME, event.getStartDateTime().toString());
values.put(COLUMN_EVENT_ENDDATETIME, event.getEndDateTime().toString());
values.put(COLUMN_EVENT_LATITUDE, event.getLocationLat());
values.put(COLUMN_EVENT_LONGITUDU, event.getLocationLng());
// values.put(COLUMN_EVENT_CREATEDATETIME, event.getCreateDateTime().toString());
values.put(COLUMN_EVENT_UPDATEDATETIME, event.getUpdateDateTime().toString());
values.put(COLUMN_EVENT_STATUS, event.getStatus());
values.put(COLUMN_EVENT_TYPE, event.getType());
values.put(COLUMN_EVENT_ADDEDDATE, event.getAddedDate().toString());
result = db.update(TABLE_EVENT, values, COLUMN_EVENTID + " = ?", new String[]{String
.valueOf(event.getEventId())});
return result;
}
//Delete post record
public void deletePost(Post post){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_POST, COLUMN_POSTID + " = ?", new String[]{String
.valueOf(post.getPostId())});
db.close();
}
//Delete older post record
public void deleteOldPost() {
Log.v("SQLite Delete","Deleting old post records...");
String query = "DELETE FROM "+TABLE_POST+" WHERE "+COLUMN_ADDEDDATE+" <= date('now','-2 day')";
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL(query);
db.close();
}
//Delete event record
public void deleteEvent(Event event){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_EVENT, COLUMN_EVENTID + " = ?", new String[]{String
.valueOf(event.getEventId())});
db.close();
}
//Delete older post record
public void deleteOldEvent(){
Log.v("SQLite Delete","Deleting old event records...");
String query = "DELETE FROM "+TABLE_EVENT+" WHERE "+COLUMN_ADDEDDATE+" <=date('now', '-2 day')";
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL(query);
db.close();
}
}
| UTF-8 | Java | 19,698 | java | DbHelper.java | Java | [
{
"context": "il.Date;\nimport java.util.List;\n\n/**\n * Created by BRYANTY on 29-Jan-16.\n */\npublic class DbHelper extends S",
"end": 603,
"score": 0.9991189241409302,
"start": 596,
"tag": "USERNAME",
"value": "BRYANTY"
}
] | null | [] | package com.tarpost.bryanty.proj_t_post.sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.tarpost.bryanty.proj_t_post.common.DateUtil;
import com.tarpost.bryanty.proj_t_post.object.Event;
import com.tarpost.bryanty.proj_t_post.object.Post;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by BRYANTY on 29-Jan-16.
*/
public class DbHelper extends SQLiteOpenHelper {
//Db version
private static final int DATABASE_VERSION = 1;
//Db name
private static final String DATABASE_NAME = "tarpost_offline";
//Table name
private static final String TABLE_POST = "post";
private static final String TABLE_EVENT = "event";
//Post Table columns
private static final String COLUMN_POSTID = "postId";
private static final String COLUMN_CREATORID = "creatorId";
private static final String COLUMN_CREATORNAME = "creatorName";
private static final String COLUMN_TITLE = "title";
private static final String COLUMN_CONTENT = "content";
private static final String COLUMN_UPDATEDATETIME = "updateDateTime";
private static final String COLUMN_STATUS = "status";
private static final String COLUMN_TYPE = "type";
private static final String COLUMN_ADDEDDATE = "addedDate";
//Event Table columns
private static final String COLUMN_EVENTID = "postId";
private static final String COLUMN_EVENT_CREATORID = "creatorId";
private static final String COLUMN_EVENT_CREATORNAME = "creatorName";
private static final String COLUMN_EVENT_TITLE = "title";
private static final String COLUMN_EVENT_CONTENT = "content";
private static final String COLUMN_EVENT_IMAGE = "image";
private static final String COLUMN_EVENT_STARTDATETIME = "startDateTime";
private static final String COLUMN_EVENT_ENDDATETIME = "endDateTime";
private static final String COLUMN_EVENT_LATITUDE = "locationLat";
private static final String COLUMN_EVENT_LONGITUDU = "locationLng";
private static final String COLUMN_EVENT_CREATEDATETIME = "createDateTime";
private static final String COLUMN_EVENT_UPDATEDATETIME = "updateDateTime";
private static final String COLUMN_EVENT_STATUS = "status";
private static final String COLUMN_EVENT_TYPE = "type";
private static final String COLUMN_EVENT_ADDEDDATE = "addedDate";
public DbHelper(Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
//Create database
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_TABLE_POST = "CREATE TABLE "+TABLE_POST+" ("
+COLUMN_POSTID+" INTEGER PRIMARY KEY, "
+COLUMN_CREATORID+" TEXT, "
+COLUMN_CREATORNAME+" TEXT, "
+COLUMN_TITLE+" TEXT, "
+COLUMN_CONTENT+" TEXT, "
+COLUMN_UPDATEDATETIME+" TEXT, "
+COLUMN_STATUS+" TEXT, "
+COLUMN_TYPE+" TEXT, "
+COLUMN_ADDEDDATE+" TEXT "
+")";
String CREATE_TABLE_EVENT = "CREATE TABLE "+TABLE_EVENT+" ("
+COLUMN_EVENTID+" INTEGER PRIMARY KEY, "
+COLUMN_EVENT_CREATORID+" TEXT, "
+COLUMN_EVENT_CREATORNAME+" TEXT, "
+COLUMN_EVENT_TITLE+" TEXT, "
+COLUMN_EVENT_CONTENT+" TEXT, "
// +COLUMN_EVENT_IMAGE+" BLOB, "
+COLUMN_EVENT_STARTDATETIME+" TEXT, "
+COLUMN_EVENT_ENDDATETIME+" TEXT, "
+COLUMN_EVENT_LATITUDE+" DOUBLE, "
+COLUMN_EVENT_LONGITUDU+" DOUBLE, "
// +COLUMN_EVENT_CREATEDATETIME+" TEXT, "
+COLUMN_EVENT_UPDATEDATETIME+" TEXT, "
+COLUMN_EVENT_STATUS+" TEXT, "
+COLUMN_EVENT_TYPE+" TEXT, "
+COLUMN_EVENT_ADDEDDATE+" TEXT "
+")";
db.execSQL(CREATE_TABLE_POST);
db.execSQL(CREATE_TABLE_EVENT);
}
//Upgrade database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+TABLE_POST);
db.execSQL("DROP TABLE IF EXISTS "+TABLE_EVENT);
onCreate(db);
}
//Insert post record
public void addPost(Post post){
List<Post> postList = new ArrayList<Post>();
if(post.getType().equals("P")){
postList=getAllPost();
}else if(post.getType().equals("M")){
postList=getAllMyPost();
}else if(post.getType().equals("B")){
postList=getAllBookmarks();
}
if(postList != null && postList.size() > 0){
//Duplicate record found
for(Post object : postList){
if(object.getPostId().equals(post.getPostId())){
return;
}
}
}
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(COLUMN_POSTID, post.getPostId());
values.put(COLUMN_CREATORID, post.getCreatorId());
values.put(COLUMN_CREATORNAME, post.getCreatorName());
values.put(COLUMN_TITLE, post.getTitle());
values.put(COLUMN_CONTENT, post.getContent());
values.put(COLUMN_UPDATEDATETIME, post.getUpdateDateTime().toString());
values.put(COLUMN_STATUS, post.getStatus());
values.put(COLUMN_TYPE, post.getType());
values.put(COLUMN_ADDEDDATE, post.getAddedDate().toString());
db.insert(TABLE_POST, null, values);
db.close();
}
//Insert event record
public void addEvent(Event event){
SQLiteDatabase db = this.getWritableDatabase();
List<Event> eventList = new ArrayList<Event>();
if(event.getType().equals("E")){
eventList = getAllEvent();
}else if(event.getType().equals("J")){
eventList = getAllEventJoin();
}else if(event.getType().equals("C")) {
eventList = getAllEventCreate();
}
if(eventList != null && eventList.size() > 0){
//Duplicate record found
for(Event object : eventList){
if(object.getEventId().equals(event.getEventId())){
return;
}
}
}
ContentValues values = new ContentValues();
values.put(COLUMN_EVENTID, event.getEventId());
values.put(COLUMN_EVENT_CREATORID, event.getCreatorId());
values.put(COLUMN_EVENT_CREATORNAME, event.getCreatorName());
values.put(COLUMN_EVENT_TITLE, event.getTitle());
values.put(COLUMN_EVENT_CONTENT, event.getContent());
values.put(COLUMN_EVENT_STARTDATETIME, event.getStartDateTime().toString());
values.put(COLUMN_EVENT_ENDDATETIME, event.getEndDateTime().toString());
values.put(COLUMN_EVENT_LATITUDE, event.getLocationLat());
values.put(COLUMN_EVENT_LONGITUDU, event.getLocationLng());
values.put(COLUMN_EVENT_UPDATEDATETIME, event.getUpdateDateTime().toString());
values.put(COLUMN_EVENT_STATUS, event.getStatus());
values.put(COLUMN_EVENT_TYPE, event.getType());
values.put(COLUMN_EVENT_ADDEDDATE, event.getAddedDate().toString());
db.insert(TABLE_EVENT, null, values);
db.close();
}
//Get all posts record
public List<Post> getAllPost(){
List<Post> posts = new ArrayList<Post>();
// String query = "SELECT * FROM "+TABLE_POST; DESC
String query = "SELECT * FROM "+TABLE_POST+" WHERE "+COLUMN_TYPE+" == 'P' ORDER BY " +
// ""+COLUMN_UPDATEDATETIME+" DESC";
""+COLUMN_ADDEDDATE+" DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Post post = new Post();
post.setPostId(Integer.parseInt(cursor.getString(0)));
post.setCreatorId(cursor.getString(1));
post.setCreatorName(cursor.getString(2));
post.setTitle(cursor.getString(3));
post.setContent(cursor.getString(4));
post.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
post.setStatus(cursor.getString(6));
post.setType(cursor.getString(7));
post.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(8)));
posts.add(post);
}while(cursor.moveToNext());
}
cursor.close();
db.close();
return posts;
}
public List<Post> getAllBookmarks(){
List<Post> posts = new ArrayList<Post>();
String query = "SELECT * FROM "+TABLE_POST+" WHERE "+COLUMN_TYPE+" == 'B' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Post post = new Post();
post.setPostId(Integer.parseInt(cursor.getString(0)));
post.setCreatorId(cursor.getString(1));
post.setCreatorName(cursor.getString(2));
post.setTitle(cursor.getString(3));
post.setContent(cursor.getString(4));
post.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
post.setStatus(cursor.getString(6));
post.setType(cursor.getString(7));
post.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(8)));
posts.add(post);
}while(cursor.moveToNext());
}
cursor.close();
db.close();
return posts;
}
//Get all posts record
public List<Post> getAllMyPost(){
List<Post> posts = new ArrayList<Post>();
// String query = "SELECT * FROM "+TABLE_POST;
String query = "SELECT * FROM "+TABLE_POST+" WHERE "+COLUMN_TYPE+" == 'M' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Post post = new Post();
post.setPostId(Integer.parseInt(cursor.getString(0)));
post.setCreatorId(cursor.getString(1));
post.setCreatorName(cursor.getString(2));
post.setTitle(cursor.getString(3));
post.setContent(cursor.getString(4));
post.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
post.setStatus(cursor.getString(6));
post.setType(cursor.getString(7));
post.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(8)));
posts.add(post);
}while(cursor.moveToNext());
}
cursor.close();
db.close();
return posts;
}
//Get all events record
public List<Event> getAllEvent(){
List<Event> events = new ArrayList<Event>();
String query = "SELECT * FROM "+TABLE_EVENT+" WHERE "+COLUMN_EVENT_TYPE+" == 'E' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Event event = new Event();
event.setEventId(Integer.parseInt(cursor.getString(0)));
event.setCreatorId(cursor.getString(1));
event.setCreatorName(cursor.getString(2));
event.setTitle(cursor.getString(3));
event.setContent(cursor.getString(4));
//Convert byte[] to bitmap
//BitmapFactory.decodeByteArray(cursor.getBlob(4), 0, cursor.getBlob(4).length);
// event.setImage(cursor.getBlob(4));
event.setStartDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
event.setEndDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(6)));
event.setLocationLat(cursor.getDouble(7));
event.setLocationLng(cursor.getDouble(8));
// event.setCreateDateTime(DateUtil.convertStringToDate(cursor.getString(9)));
event.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(9)));
event.setStatus(cursor.getString(10));
event.setType(cursor.getString(11));
event.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(12)));
events.add(event);
}while(cursor.moveToNext());
}
return events;
}
public List<Event> getAllEventJoin(){
List<Event> events = new ArrayList<Event>();
String query = "SELECT * FROM "+TABLE_EVENT+" WHERE "+COLUMN_EVENT_TYPE+" == 'J' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Event event = new Event();
event.setEventId(Integer.parseInt(cursor.getString(0)));
event.setCreatorId(cursor.getString(1));
event.setCreatorName(cursor.getString(2));
event.setTitle(cursor.getString(3));
event.setContent(cursor.getString(4));
event.setStartDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
event.setEndDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(6)));
event.setLocationLat(cursor.getDouble(7));
event.setLocationLng(cursor.getDouble(8));
event.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(9)));
event.setStatus(cursor.getString(10));
event.setType(cursor.getString(11));
event.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(12)));
events.add(event);
}while(cursor.moveToNext());
}
return events;
}
public List<Event> getAllEventCreate(){
List<Event> events = new ArrayList<Event>();
String query = "SELECT * FROM "+TABLE_EVENT+" WHERE "+COLUMN_EVENT_TYPE+" == 'C' ";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if(cursor.moveToFirst()){
do{
Event event = new Event();
event.setEventId(Integer.parseInt(cursor.getString(0)));
event.setCreatorId(cursor.getString(1));
event.setCreatorName(cursor.getString(2));
event.setTitle(cursor.getString(3));
event.setContent(cursor.getString(4));
event.setStartDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(5)));
event.setEndDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(6)));
event.setLocationLat(cursor.getDouble(7));
event.setLocationLng(cursor.getDouble(8));
event.setUpdateDateTime(DateUtil.convertStringToDateSQLite(cursor.getString(9)));
event.setStatus(cursor.getString(10));
event.setType(cursor.getString(11));
event.setAddedDate(DateUtil.convertStringToDateSQLite(cursor.getString(12)));
events.add(event);
}while(cursor.moveToNext());
}
return events;
}
//Get total posts count
public int getPostCount(){
String query = "SELECT * FROM "+TABLE_POST;
SQLiteDatabase db = this.getReadableDatabase();
int count = 0;
Cursor cursor = db.rawQuery(query, null);
cursor.close();
count = cursor.getCount();
return count;
}
//Get total events count
public int getEventCount(){
String query = "SELECT * FROM "+TABLE_EVENT;
SQLiteDatabase db = this.getReadableDatabase();
int count = 0;
Cursor cursor = db.rawQuery(query, null);
cursor.close();
count = cursor.getCount();
return count;
}
//Update post record
public int updatePost(Post post){
SQLiteDatabase db = this.getWritableDatabase();
int result =0;
ContentValues values = new ContentValues();
values.put(COLUMN_CREATORID, post.getCreatorId());
values.put(COLUMN_CREATORNAME, post.getCreatorName());
values.put(COLUMN_TITLE, post.getTitle());
values.put(COLUMN_CONTENT, post.getContent());
values.put(COLUMN_UPDATEDATETIME, post.getUpdateDateTime().toString());
values.put(COLUMN_STATUS, post.getStatus());
values.put(COLUMN_TYPE, post.getType());
result = db.update(TABLE_POST, values, COLUMN_POSTID + " = ?", new String[]{String
.valueOf(post.getPostId())});
return result;
}
//Update event record
public int updateEvent(Event event){
SQLiteDatabase db = this.getWritableDatabase();
int result =0;
ContentValues values = new ContentValues();
values.put(COLUMN_EVENT_CREATORID, event.getCreatorId());
values.put(COLUMN_EVENT_TITLE, event.getTitle());
values.put(COLUMN_EVENT_CONTENT, event.getContent());
// values.put(COLUMN_EVENT_IMAGE, event.getImage());
values.put(COLUMN_EVENT_STARTDATETIME, event.getStartDateTime().toString());
values.put(COLUMN_EVENT_ENDDATETIME, event.getEndDateTime().toString());
values.put(COLUMN_EVENT_LATITUDE, event.getLocationLat());
values.put(COLUMN_EVENT_LONGITUDU, event.getLocationLng());
// values.put(COLUMN_EVENT_CREATEDATETIME, event.getCreateDateTime().toString());
values.put(COLUMN_EVENT_UPDATEDATETIME, event.getUpdateDateTime().toString());
values.put(COLUMN_EVENT_STATUS, event.getStatus());
values.put(COLUMN_EVENT_TYPE, event.getType());
values.put(COLUMN_EVENT_ADDEDDATE, event.getAddedDate().toString());
result = db.update(TABLE_EVENT, values, COLUMN_EVENTID + " = ?", new String[]{String
.valueOf(event.getEventId())});
return result;
}
//Delete post record
public void deletePost(Post post){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_POST, COLUMN_POSTID + " = ?", new String[]{String
.valueOf(post.getPostId())});
db.close();
}
//Delete older post record
public void deleteOldPost() {
Log.v("SQLite Delete","Deleting old post records...");
String query = "DELETE FROM "+TABLE_POST+" WHERE "+COLUMN_ADDEDDATE+" <= date('now','-2 day')";
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL(query);
db.close();
}
//Delete event record
public void deleteEvent(Event event){
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_EVENT, COLUMN_EVENTID + " = ?", new String[]{String
.valueOf(event.getEventId())});
db.close();
}
//Delete older post record
public void deleteOldEvent(){
Log.v("SQLite Delete","Deleting old event records...");
String query = "DELETE FROM "+TABLE_EVENT+" WHERE "+COLUMN_ADDEDDATE+" <=date('now', '-2 day')";
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL(query);
db.close();
}
}
| 19,698 | 0.609504 | 0.604782 | 486 | 39.530865 | 26.830708 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769547 | false | false | 12 |
f3267c8a74bbabd1f1a58cc7c96fa0a2bdfcb133 | 31,310,311,606,378 | e9b18b16e39d6c432062814318207d344f1f7001 | /domain/src/main/java/by/epam/domain/specialization/Specialization.java | b69bdf7e480b650b765aa6ced8536f19a63a8b41 | [] | no_license | okrupnik/allservicesinone | https://github.com/okrupnik/allservicesinone | f69c2c59ff1c2f49b13786cae2c8c1a278ec83c9 | 0d5c05277996cf2e4533ebc79dc8104c2ac2a780 | refs/heads/master | 2020-03-23T12:48:52.988000 | 2018-09-05T06:09:53 | 2018-09-05T06:09:53 | 141,583,552 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.epam.domain.specialization;
import java.util.List;
import by.epam.domain.subtypespecialization.BeautyAndHealth;
import by.epam.domain.subtypespecialization.CleaningAndHelp;
import by.epam.domain.subtypespecialization.ComputerHelp;
import by.epam.domain.subtypespecialization.CourierService;
import by.epam.domain.subtypespecialization.Design;
import by.epam.domain.subtypespecialization.Education;
import by.epam.domain.subtypespecialization.EventAndPromotion;
import by.epam.domain.subtypespecialization.InstallAndRepairEquipment;
import by.epam.domain.subtypespecialization.LegalAssistance;
import by.epam.domain.subtypespecialization.PhotoAndVideoService;
import by.epam.domain.subtypespecialization.RepairAndConstruction;
import by.epam.domain.subtypespecialization.RepairTransport;
import by.epam.domain.subtypespecialization.TruckingIndustry;
import by.epam.domain.subtypespecialization.WebDeveloping;
public class Specialization {
private final String activities;
private final String description;
private final List<String> subspecialization;
private final BeautyAndHealth beautyAndHealth;
private final CleaningAndHelp cleaningAndHelp;
private final ComputerHelp computerHelp;
private final CourierService courierService;
private final Design design;
private final Education education;
private final EventAndPromotion eventAndPromotion;
private final InstallAndRepairEquipment installAndRepairEquipment;
private final LegalAssistance legalAssistance;
private final PhotoAndVideoService photoAndVideoService;
private final RepairAndConstruction repairAndConstruction;
private final RepairTransport repairTransport;
private final TruckingIndustry truckingIndustry;
private final WebDeveloping webDeveloping;
public String getActivities() {
return activities;
}
public String getDescription() {
return description;
}
public List<String> getSubspecialization() {
return subspecialization;
}
public BeautyAndHealth getBeautyAndHealth() {
return beautyAndHealth;
}
public CleaningAndHelp getCleaningAndHelp() {
return cleaningAndHelp;
}
public ComputerHelp getComputerHelp() {
return computerHelp;
}
public CourierService getCourierService() {
return courierService;
}
public Design getDesign() {
return design;
}
public Education getEducation() {
return education;
}
public EventAndPromotion getEventAndPromotion() {
return eventAndPromotion;
}
public InstallAndRepairEquipment getInstallAndRepairEquipment() {
return installAndRepairEquipment;
}
public LegalAssistance getLegalAssistance() {
return legalAssistance;
}
public PhotoAndVideoService getPhotoAndVideoService() {
return photoAndVideoService;
}
public RepairAndConstruction getRepairAndConstruction() {
return repairAndConstruction;
}
public RepairTransport getRepairTransport() {
return repairTransport;
}
public TruckingIndustry getTruckingIndustry() {
return truckingIndustry;
}
public WebDeveloping getWebDeveloping() {
return webDeveloping;
}
private Specialization(Builder builder) {
this.activities = builder.activities;
this.description = builder.description;
this.subspecialization = builder.subspecialization;
this.beautyAndHealth = builder.beautyAndHealth;
this.cleaningAndHelp = builder.cleaningAndHelp;
this.computerHelp = builder.computerHelp;
this.courierService = builder.courierService;
this.design = builder.design;
this.education = builder.education;
this.eventAndPromotion = builder.eventAndPromotion;
this.installAndRepairEquipment = builder.installAndRepairEquipment;
this.legalAssistance = builder.legalAssistance;
this.photoAndVideoService = builder.photoAndVideoService;
this.repairAndConstruction = builder.repairAndConstruction;
this.repairTransport = builder.repairTransport;
this.truckingIndustry = builder.truckingIndustry;
this.webDeveloping = builder.webDeveloping;
}
public static class Builder {
private String activities;
private String description;
private List<String> subspecialization;
private BeautyAndHealth beautyAndHealth;
private CleaningAndHelp cleaningAndHelp;
private ComputerHelp computerHelp;
private CourierService courierService;
private Design design;
private Education education;
private EventAndPromotion eventAndPromotion;
private InstallAndRepairEquipment installAndRepairEquipment;
private LegalAssistance legalAssistance;
private PhotoAndVideoService photoAndVideoService;
private RepairAndConstruction repairAndConstruction;
private RepairTransport repairTransport;
private TruckingIndustry truckingIndustry;
private WebDeveloping webDeveloping;
public Builder setActivities(String activities) {
this.activities = activities;
return this;
}
public Builder setDescription(String description) {
this.description = description;
return this;
}
public Builder setSubspecialization(List<String> subspecialization) {
this.subspecialization = subspecialization;
return this;
}
public Builder setBeautyAndHealth(BeautyAndHealth beautyAndHealth) {
this.beautyAndHealth = beautyAndHealth;
return this;
}
public Builder setCleaningAndHelp(CleaningAndHelp cleaningAndHelp) {
this.cleaningAndHelp = cleaningAndHelp;
return this;
}
public Builder setComputerHelp(ComputerHelp computerHelp) {
this.computerHelp = computerHelp;
return this;
}
public Builder setCourierService(CourierService courierService) {
this.courierService = courierService;
return this;
}
public Builder setDesign(Design design) {
this.design = design;
return this;
}
public Builder setEducation(Education education) {
this.education = education;
return this;
}
public Builder setEventAndPromotion(EventAndPromotion eventAndPromotion) {
this.eventAndPromotion = eventAndPromotion;
return this;
}
public Builder setInstallAndRepairEquipment(InstallAndRepairEquipment installAndRepairEquipment) {
this.installAndRepairEquipment = installAndRepairEquipment;
return this;
}
public Builder setLegalAssistance(LegalAssistance legalAssistance) {
this.legalAssistance = legalAssistance;
return this;
}
public Builder setPhotoAndVideoService(PhotoAndVideoService photoAndVideoService) {
this.photoAndVideoService = photoAndVideoService;
return this;
}
public Builder setRepairAndConstruction(RepairAndConstruction repairAndConstruction) {
this.repairAndConstruction = repairAndConstruction;
return this;
}
public Builder setRepairTransport(RepairTransport repairTransport) {
this.repairTransport = repairTransport;
return this;
}
public Builder setTruckingIndustry(TruckingIndustry truckingIndustry) {
this.truckingIndustry = truckingIndustry;
return this;
}
public Builder setWebDeveloping(WebDeveloping webDeveloping) {
this.webDeveloping = webDeveloping;
return this;
}
public Specialization build() {
return new Specialization(this);
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((activities == null) ? 0 : activities.hashCode());
result = prime * result + ((beautyAndHealth == null) ? 0 : beautyAndHealth.hashCode());
result = prime * result + ((cleaningAndHelp == null) ? 0 : cleaningAndHelp.hashCode());
result = prime * result + ((computerHelp == null) ? 0 : computerHelp.hashCode());
result = prime * result + ((courierService == null) ? 0 : courierService.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((design == null) ? 0 : design.hashCode());
result = prime * result + ((education == null) ? 0 : education.hashCode());
result = prime * result + ((eventAndPromotion == null) ? 0 : eventAndPromotion.hashCode());
result = prime * result + ((installAndRepairEquipment == null) ? 0 : installAndRepairEquipment.hashCode());
result = prime * result + ((legalAssistance == null) ? 0 : legalAssistance.hashCode());
result = prime * result + ((photoAndVideoService == null) ? 0 : photoAndVideoService.hashCode());
result = prime * result + ((repairAndConstruction == null) ? 0 : repairAndConstruction.hashCode());
result = prime * result + ((repairTransport == null) ? 0 : repairTransport.hashCode());
result = prime * result + ((truckingIndustry == null) ? 0 : truckingIndustry.hashCode());
result = prime * result + ((webDeveloping == null) ? 0 : webDeveloping.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Specialization other = (Specialization) obj;
if (activities == null) {
if (other.activities != null)
return false;
} else if (!activities.equals(other.activities))
return false;
if (beautyAndHealth == null) {
if (other.beautyAndHealth != null)
return false;
} else if (!beautyAndHealth.equals(other.beautyAndHealth))
return false;
if (cleaningAndHelp == null) {
if (other.cleaningAndHelp != null)
return false;
} else if (!cleaningAndHelp.equals(other.cleaningAndHelp))
return false;
if (computerHelp == null) {
if (other.computerHelp != null)
return false;
} else if (!computerHelp.equals(other.computerHelp))
return false;
if (courierService == null) {
if (other.courierService != null)
return false;
} else if (!courierService.equals(other.courierService))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (design == null) {
if (other.design != null)
return false;
} else if (!design.equals(other.design))
return false;
if (education == null) {
if (other.education != null)
return false;
} else if (!education.equals(other.education))
return false;
if (eventAndPromotion == null) {
if (other.eventAndPromotion != null)
return false;
} else if (!eventAndPromotion.equals(other.eventAndPromotion))
return false;
if (installAndRepairEquipment == null) {
if (other.installAndRepairEquipment != null)
return false;
} else if (!installAndRepairEquipment.equals(other.installAndRepairEquipment))
return false;
if (legalAssistance == null) {
if (other.legalAssistance != null)
return false;
} else if (!legalAssistance.equals(other.legalAssistance))
return false;
if (photoAndVideoService == null) {
if (other.photoAndVideoService != null)
return false;
} else if (!photoAndVideoService.equals(other.photoAndVideoService))
return false;
if (repairAndConstruction == null) {
if (other.repairAndConstruction != null)
return false;
} else if (!repairAndConstruction.equals(other.repairAndConstruction))
return false;
if (repairTransport == null) {
if (other.repairTransport != null)
return false;
} else if (!repairTransport.equals(other.repairTransport))
return false;
if (truckingIndustry == null) {
if (other.truckingIndustry != null)
return false;
} else if (!truckingIndustry.equals(other.truckingIndustry))
return false;
if (webDeveloping == null) {
if (other.webDeveloping != null)
return false;
} else if (!webDeveloping.equals(other.webDeveloping))
return false;
return true;
}
}
| UTF-8 | Java | 11,411 | java | Specialization.java | Java | [] | null | [] | package by.epam.domain.specialization;
import java.util.List;
import by.epam.domain.subtypespecialization.BeautyAndHealth;
import by.epam.domain.subtypespecialization.CleaningAndHelp;
import by.epam.domain.subtypespecialization.ComputerHelp;
import by.epam.domain.subtypespecialization.CourierService;
import by.epam.domain.subtypespecialization.Design;
import by.epam.domain.subtypespecialization.Education;
import by.epam.domain.subtypespecialization.EventAndPromotion;
import by.epam.domain.subtypespecialization.InstallAndRepairEquipment;
import by.epam.domain.subtypespecialization.LegalAssistance;
import by.epam.domain.subtypespecialization.PhotoAndVideoService;
import by.epam.domain.subtypespecialization.RepairAndConstruction;
import by.epam.domain.subtypespecialization.RepairTransport;
import by.epam.domain.subtypespecialization.TruckingIndustry;
import by.epam.domain.subtypespecialization.WebDeveloping;
public class Specialization {
private final String activities;
private final String description;
private final List<String> subspecialization;
private final BeautyAndHealth beautyAndHealth;
private final CleaningAndHelp cleaningAndHelp;
private final ComputerHelp computerHelp;
private final CourierService courierService;
private final Design design;
private final Education education;
private final EventAndPromotion eventAndPromotion;
private final InstallAndRepairEquipment installAndRepairEquipment;
private final LegalAssistance legalAssistance;
private final PhotoAndVideoService photoAndVideoService;
private final RepairAndConstruction repairAndConstruction;
private final RepairTransport repairTransport;
private final TruckingIndustry truckingIndustry;
private final WebDeveloping webDeveloping;
public String getActivities() {
return activities;
}
public String getDescription() {
return description;
}
public List<String> getSubspecialization() {
return subspecialization;
}
public BeautyAndHealth getBeautyAndHealth() {
return beautyAndHealth;
}
public CleaningAndHelp getCleaningAndHelp() {
return cleaningAndHelp;
}
public ComputerHelp getComputerHelp() {
return computerHelp;
}
public CourierService getCourierService() {
return courierService;
}
public Design getDesign() {
return design;
}
public Education getEducation() {
return education;
}
public EventAndPromotion getEventAndPromotion() {
return eventAndPromotion;
}
public InstallAndRepairEquipment getInstallAndRepairEquipment() {
return installAndRepairEquipment;
}
public LegalAssistance getLegalAssistance() {
return legalAssistance;
}
public PhotoAndVideoService getPhotoAndVideoService() {
return photoAndVideoService;
}
public RepairAndConstruction getRepairAndConstruction() {
return repairAndConstruction;
}
public RepairTransport getRepairTransport() {
return repairTransport;
}
public TruckingIndustry getTruckingIndustry() {
return truckingIndustry;
}
public WebDeveloping getWebDeveloping() {
return webDeveloping;
}
private Specialization(Builder builder) {
this.activities = builder.activities;
this.description = builder.description;
this.subspecialization = builder.subspecialization;
this.beautyAndHealth = builder.beautyAndHealth;
this.cleaningAndHelp = builder.cleaningAndHelp;
this.computerHelp = builder.computerHelp;
this.courierService = builder.courierService;
this.design = builder.design;
this.education = builder.education;
this.eventAndPromotion = builder.eventAndPromotion;
this.installAndRepairEquipment = builder.installAndRepairEquipment;
this.legalAssistance = builder.legalAssistance;
this.photoAndVideoService = builder.photoAndVideoService;
this.repairAndConstruction = builder.repairAndConstruction;
this.repairTransport = builder.repairTransport;
this.truckingIndustry = builder.truckingIndustry;
this.webDeveloping = builder.webDeveloping;
}
public static class Builder {
private String activities;
private String description;
private List<String> subspecialization;
private BeautyAndHealth beautyAndHealth;
private CleaningAndHelp cleaningAndHelp;
private ComputerHelp computerHelp;
private CourierService courierService;
private Design design;
private Education education;
private EventAndPromotion eventAndPromotion;
private InstallAndRepairEquipment installAndRepairEquipment;
private LegalAssistance legalAssistance;
private PhotoAndVideoService photoAndVideoService;
private RepairAndConstruction repairAndConstruction;
private RepairTransport repairTransport;
private TruckingIndustry truckingIndustry;
private WebDeveloping webDeveloping;
public Builder setActivities(String activities) {
this.activities = activities;
return this;
}
public Builder setDescription(String description) {
this.description = description;
return this;
}
public Builder setSubspecialization(List<String> subspecialization) {
this.subspecialization = subspecialization;
return this;
}
public Builder setBeautyAndHealth(BeautyAndHealth beautyAndHealth) {
this.beautyAndHealth = beautyAndHealth;
return this;
}
public Builder setCleaningAndHelp(CleaningAndHelp cleaningAndHelp) {
this.cleaningAndHelp = cleaningAndHelp;
return this;
}
public Builder setComputerHelp(ComputerHelp computerHelp) {
this.computerHelp = computerHelp;
return this;
}
public Builder setCourierService(CourierService courierService) {
this.courierService = courierService;
return this;
}
public Builder setDesign(Design design) {
this.design = design;
return this;
}
public Builder setEducation(Education education) {
this.education = education;
return this;
}
public Builder setEventAndPromotion(EventAndPromotion eventAndPromotion) {
this.eventAndPromotion = eventAndPromotion;
return this;
}
public Builder setInstallAndRepairEquipment(InstallAndRepairEquipment installAndRepairEquipment) {
this.installAndRepairEquipment = installAndRepairEquipment;
return this;
}
public Builder setLegalAssistance(LegalAssistance legalAssistance) {
this.legalAssistance = legalAssistance;
return this;
}
public Builder setPhotoAndVideoService(PhotoAndVideoService photoAndVideoService) {
this.photoAndVideoService = photoAndVideoService;
return this;
}
public Builder setRepairAndConstruction(RepairAndConstruction repairAndConstruction) {
this.repairAndConstruction = repairAndConstruction;
return this;
}
public Builder setRepairTransport(RepairTransport repairTransport) {
this.repairTransport = repairTransport;
return this;
}
public Builder setTruckingIndustry(TruckingIndustry truckingIndustry) {
this.truckingIndustry = truckingIndustry;
return this;
}
public Builder setWebDeveloping(WebDeveloping webDeveloping) {
this.webDeveloping = webDeveloping;
return this;
}
public Specialization build() {
return new Specialization(this);
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((activities == null) ? 0 : activities.hashCode());
result = prime * result + ((beautyAndHealth == null) ? 0 : beautyAndHealth.hashCode());
result = prime * result + ((cleaningAndHelp == null) ? 0 : cleaningAndHelp.hashCode());
result = prime * result + ((computerHelp == null) ? 0 : computerHelp.hashCode());
result = prime * result + ((courierService == null) ? 0 : courierService.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((design == null) ? 0 : design.hashCode());
result = prime * result + ((education == null) ? 0 : education.hashCode());
result = prime * result + ((eventAndPromotion == null) ? 0 : eventAndPromotion.hashCode());
result = prime * result + ((installAndRepairEquipment == null) ? 0 : installAndRepairEquipment.hashCode());
result = prime * result + ((legalAssistance == null) ? 0 : legalAssistance.hashCode());
result = prime * result + ((photoAndVideoService == null) ? 0 : photoAndVideoService.hashCode());
result = prime * result + ((repairAndConstruction == null) ? 0 : repairAndConstruction.hashCode());
result = prime * result + ((repairTransport == null) ? 0 : repairTransport.hashCode());
result = prime * result + ((truckingIndustry == null) ? 0 : truckingIndustry.hashCode());
result = prime * result + ((webDeveloping == null) ? 0 : webDeveloping.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Specialization other = (Specialization) obj;
if (activities == null) {
if (other.activities != null)
return false;
} else if (!activities.equals(other.activities))
return false;
if (beautyAndHealth == null) {
if (other.beautyAndHealth != null)
return false;
} else if (!beautyAndHealth.equals(other.beautyAndHealth))
return false;
if (cleaningAndHelp == null) {
if (other.cleaningAndHelp != null)
return false;
} else if (!cleaningAndHelp.equals(other.cleaningAndHelp))
return false;
if (computerHelp == null) {
if (other.computerHelp != null)
return false;
} else if (!computerHelp.equals(other.computerHelp))
return false;
if (courierService == null) {
if (other.courierService != null)
return false;
} else if (!courierService.equals(other.courierService))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (design == null) {
if (other.design != null)
return false;
} else if (!design.equals(other.design))
return false;
if (education == null) {
if (other.education != null)
return false;
} else if (!education.equals(other.education))
return false;
if (eventAndPromotion == null) {
if (other.eventAndPromotion != null)
return false;
} else if (!eventAndPromotion.equals(other.eventAndPromotion))
return false;
if (installAndRepairEquipment == null) {
if (other.installAndRepairEquipment != null)
return false;
} else if (!installAndRepairEquipment.equals(other.installAndRepairEquipment))
return false;
if (legalAssistance == null) {
if (other.legalAssistance != null)
return false;
} else if (!legalAssistance.equals(other.legalAssistance))
return false;
if (photoAndVideoService == null) {
if (other.photoAndVideoService != null)
return false;
} else if (!photoAndVideoService.equals(other.photoAndVideoService))
return false;
if (repairAndConstruction == null) {
if (other.repairAndConstruction != null)
return false;
} else if (!repairAndConstruction.equals(other.repairAndConstruction))
return false;
if (repairTransport == null) {
if (other.repairTransport != null)
return false;
} else if (!repairTransport.equals(other.repairTransport))
return false;
if (truckingIndustry == null) {
if (other.truckingIndustry != null)
return false;
} else if (!truckingIndustry.equals(other.truckingIndustry))
return false;
if (webDeveloping == null) {
if (other.webDeveloping != null)
return false;
} else if (!webDeveloping.equals(other.webDeveloping))
return false;
return true;
}
}
| 11,411 | 0.759443 | 0.757778 | 339 | 32.660767 | 24.75425 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.374631 | false | false | 12 |
aa5a1fb7849c7f4c7734f4252ac6bb610b8556aa | 34,832,184,797,675 | e8665c1173d750ea10d8b45ab49a950db8047b71 | /zeus-java/zeus-client/src/main/java/io/github/zeus/client/ZeusClientBuilder.java | 96b1795aa8bde469cde01b9b7f102587bee266c7 | [] | no_license | liurenjie1024/zeus | https://github.com/liurenjie1024/zeus | cfed9342c9b23038145eaf4ec4e81614130d6198 | abbe8aa6f09693ca02deb0eab225eabcf304ebbc | refs/heads/master | 2021-05-09T04:19:14.918000 | 2018-08-13T11:08:23 | 2018-08-19T08:10:39 | 119,269,717 | 18 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.github.zeus.client;
import io.github.zeus.client.impl.ZeusClientImpl;
import io.github.zeus.rpc.ZeusCatalog;
import io.github.zeus.rpc.ZeusDataServiceGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import java.io.FileInputStream;
import java.io.IOException;
/**
* Created by liurenjie on 24/01/2018.
*/
public class ZeusClientBuilder {
private final String schemaPath;
private final String dataHost;
private final int dataPort;
private ZeusClientBuilder(String schemaPath, String dataHost, int dataPort) {
this.schemaPath = schemaPath;
this.dataHost = dataHost;
this.dataPort = dataPort;
}
public static ZeusClientBuilder newBuilder(String schemaPath, String dataHost, int dataPort) {
return new ZeusClientBuilder(schemaPath, dataHost, dataPort);
}
public ZeusClient build() throws IOException {
try (FileInputStream f = new FileInputStream(this.schemaPath)) {
ZeusCatalog catalog = ZeusCatalog.parseFrom(f);
ManagedChannel dataChannel = ManagedChannelBuilder.forAddress(dataHost, dataPort)
.usePlaintext(true)
.build();
return new ZeusClientImpl(catalog,
dataChannel,
ZeusDataServiceGrpc.newBlockingStub(dataChannel));
}
}
}
| UTF-8 | Java | 1,273 | java | ZeusClientBuilder.java | Java | [
{
"context": "am;\nimport java.io.IOException;\n\n/**\n * Created by liurenjie on 24/01/2018.\n */\npublic class ZeusClientBuilder",
"end": 326,
"score": 0.9995063543319702,
"start": 317,
"tag": "USERNAME",
"value": "liurenjie"
}
] | null | [] | package io.github.zeus.client;
import io.github.zeus.client.impl.ZeusClientImpl;
import io.github.zeus.rpc.ZeusCatalog;
import io.github.zeus.rpc.ZeusDataServiceGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import java.io.FileInputStream;
import java.io.IOException;
/**
* Created by liurenjie on 24/01/2018.
*/
public class ZeusClientBuilder {
private final String schemaPath;
private final String dataHost;
private final int dataPort;
private ZeusClientBuilder(String schemaPath, String dataHost, int dataPort) {
this.schemaPath = schemaPath;
this.dataHost = dataHost;
this.dataPort = dataPort;
}
public static ZeusClientBuilder newBuilder(String schemaPath, String dataHost, int dataPort) {
return new ZeusClientBuilder(schemaPath, dataHost, dataPort);
}
public ZeusClient build() throws IOException {
try (FileInputStream f = new FileInputStream(this.schemaPath)) {
ZeusCatalog catalog = ZeusCatalog.parseFrom(f);
ManagedChannel dataChannel = ManagedChannelBuilder.forAddress(dataHost, dataPort)
.usePlaintext(true)
.build();
return new ZeusClientImpl(catalog,
dataChannel,
ZeusDataServiceGrpc.newBlockingStub(dataChannel));
}
}
}
| 1,273 | 0.745483 | 0.739199 | 42 | 29.309525 | 25.328779 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 12 |
4e2aeb6791dd50810ca01b92ee5477b555a248cb | 16,612,933,519,668 | 5308b3167e6892890382d9a4e8fac8ad904aef1d | /stock/Main.java | cf5e9e62bd2335c8d56bf9074ee254d1b83c5b67 | [] | no_license | Mihai1902/Software-Development-Academy | https://github.com/Mihai1902/Software-Development-Academy | 0962e7cc606046a5ee957687fcddabbed0b40cb1 | bf4f1822c6a95b386c5097469ca240bd84e01fe6 | refs/heads/master | 2022-09-15T01:53:48.835000 | 2020-06-03T12:03:17 | 2020-06-03T12:03:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sda.stock;
public class Main {
public static void main(String[] args) {
Stock myStock = new Stock("A", "Apa", 42.2, 99.5);
System.out.printf("%.1f", myStock.getChangePercent());
System.out.print("%");
System.out.println();
myStock.setCurrentPrice(12.1);
System.out.printf("%.1f", myStock.getChangePercent());
System.out.print("%");
System.out.println();
myStock.setCurrentPrice(42.2);
System.out.printf("%.1f", myStock.getChangePercent());
System.out.print("%");
}
}
| UTF-8 | Java | 577 | java | Main.java | Java | [] | null | [] | package com.sda.stock;
public class Main {
public static void main(String[] args) {
Stock myStock = new Stock("A", "Apa", 42.2, 99.5);
System.out.printf("%.1f", myStock.getChangePercent());
System.out.print("%");
System.out.println();
myStock.setCurrentPrice(12.1);
System.out.printf("%.1f", myStock.getChangePercent());
System.out.print("%");
System.out.println();
myStock.setCurrentPrice(42.2);
System.out.printf("%.1f", myStock.getChangePercent());
System.out.print("%");
}
}
| 577 | 0.584055 | 0.558059 | 18 | 31.055555 | 20.565538 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 7 |
3920420178550d95e7c07ed17f56e98627d0a51c | 4,879,082,878,293 | 507fa63a81bfd067c378b2de3d4fee83a2fb3fbf | /src/com/web/controller/LoginManage.java | 481ae6305d31e1fd8576fb5c309c162c091eece9 | [] | no_license | 631068264/salary | https://github.com/631068264/salary | 1684fbc7416666779ad595aa6107edbfde02cb55 | 2fcf7941d7102069806ce225b468e3ba5997aaa0 | refs/heads/master | 2016-09-01T15:45:49.778000 | 2016-03-04T15:48:27 | 2016-03-04T15:48:27 | 53,144,492 | 13 | 6 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.web.controller;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.web.base.BaseAction;
import com.web.entity.User;
import com.web.utils.CodeUtils;
import com.web.utils.Md5Utils;
@Controller
@RequestMapping("/loginManage")
public class LoginManage extends BaseAction {
private String imageCode;
/**
* 验证码检验
*
* @return
*/
@RequestMapping(value = "/validCode")
@ResponseBody
public String code() {
return imageCode;
}
@RequestMapping(value = "/validUser")
@ResponseBody
public boolean validUser(String userID, String password) {
User user = userService.getAccount(userID);
if (user == null) {
return false;
} else if (!Md5Utils.md5(password, userID).equals(user.getPassword())) {
return false;
}
return true;
}
@RequestMapping(value = "/code")
public String code(HttpSession session, HttpServletResponse response) throws Exception {
CodeUtils.createImage();
imageCode = CodeUtils.code;
// 保存在Session
if (session.getAttribute("imageCode") != null) {
session.removeAttribute("imageCode");
}
session.setAttribute("imageCode", imageCode);
response.setContentType("image/jpeg");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", -1);
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(CodeUtils.imageStream);
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buffer = new byte[1024];
int len = 0;
while ((len = bis.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null) {
bis.close();
}
if (bos != null) {
bos.close();
}
}
return null;
}
}
| UTF-8 | Java | 2,106 | java | LoginManage.java | Java | [] | null | [] | package com.web.controller;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.web.base.BaseAction;
import com.web.entity.User;
import com.web.utils.CodeUtils;
import com.web.utils.Md5Utils;
@Controller
@RequestMapping("/loginManage")
public class LoginManage extends BaseAction {
private String imageCode;
/**
* 验证码检验
*
* @return
*/
@RequestMapping(value = "/validCode")
@ResponseBody
public String code() {
return imageCode;
}
@RequestMapping(value = "/validUser")
@ResponseBody
public boolean validUser(String userID, String password) {
User user = userService.getAccount(userID);
if (user == null) {
return false;
} else if (!Md5Utils.md5(password, userID).equals(user.getPassword())) {
return false;
}
return true;
}
@RequestMapping(value = "/code")
public String code(HttpSession session, HttpServletResponse response) throws Exception {
CodeUtils.createImage();
imageCode = CodeUtils.code;
// 保存在Session
if (session.getAttribute("imageCode") != null) {
session.removeAttribute("imageCode");
}
session.setAttribute("imageCode", imageCode);
response.setContentType("image/jpeg");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", -1);
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(CodeUtils.imageStream);
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buffer = new byte[1024];
int len = 0;
while ((len = bis.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (bis != null) {
bis.close();
}
if (bos != null) {
bos.close();
}
}
return null;
}
}
| 2,106 | 0.710526 | 0.705263 | 89 | 22.483147 | 20.269594 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.831461 | false | false | 7 |
6614c595998acf129e717b016a5ef7fd00ef1e88 | 7,164,005,472,521 | 435be7bf43fdcb3cefd1f7b36a7043a1469102f3 | /src/assignment2/Question10.java | 2d72026b8bda5458f2136774dd578bb6049850da | [] | no_license | ZaferKok/HelloWorld | https://github.com/ZaferKok/HelloWorld | d7a1782c982509d17db096a5dbfb3c9735fe9cf4 | c529544d18350be5fa3778e82d9bfc72273c1db9 | refs/heads/master | 2022-04-22T02:21:13.647000 | 2020-04-24T00:37:49 | 2020-04-24T00:37:49 | 258,365,450 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package assignment2;
import java.util.Scanner;
public class Question10 {
public static void main(String[] args) {
/*Ask user to enter the amount of his/her money,
* and the price of a wing.
Then calculate the piece of the wing that user can buy.
Remember that you cannot buy part of a wing.
*/
Scanner scan = new Scanner(System.in);
System.out.println("Enter your amount of money");
int money = scan.nextInt();
System.out.println("Enter the price of a wing");
int wing = scan.nextInt();
System.out.println("You can buy " + money/wing + " wings");
// System.out.println((int)(money/wing)+" Wing you can buy");
}
}
| UTF-8 | Java | 652 | java | Question10.java | Java | [] | null | [] | package assignment2;
import java.util.Scanner;
public class Question10 {
public static void main(String[] args) {
/*Ask user to enter the amount of his/her money,
* and the price of a wing.
Then calculate the piece of the wing that user can buy.
Remember that you cannot buy part of a wing.
*/
Scanner scan = new Scanner(System.in);
System.out.println("Enter your amount of money");
int money = scan.nextInt();
System.out.println("Enter the price of a wing");
int wing = scan.nextInt();
System.out.println("You can buy " + money/wing + " wings");
// System.out.println((int)(money/wing)+" Wing you can buy");
}
}
| 652 | 0.679448 | 0.674847 | 28 | 22.285715 | 22.354061 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 7 |
f5d2359be0569009e6a93d459fb40c6e3df3c9de | 7,310,034,407,298 | ff3550434e64e52c254f396c3c09d3c4059e62ba | /src/com/rk/filter/context/Getter.java | fe2869be9f62fa794865217f50a3eeb0d8ca733a | [] | no_license | iRomul/DataProcessMini | https://github.com/iRomul/DataProcessMini | 4da67f549dad9ff9bb864ea9f9c5497a88f2cb16 | e082613a3743f46fd1b2c68de1a62fe7ed1424e2 | refs/heads/master | 2018-11-03T09:11:31.389000 | 2018-08-25T22:41:24 | 2018-08-25T22:41:24 | 146,133,317 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.rk.filter.context;
import com.rk.filter.context.FilterContext;
import com.rk.types.BaseValue;
public interface Getter {
BaseValue getValue(FilterContext context);
}
| UTF-8 | Java | 184 | java | Getter.java | Java | [] | null | [] | package com.rk.filter.context;
import com.rk.filter.context.FilterContext;
import com.rk.types.BaseValue;
public interface Getter {
BaseValue getValue(FilterContext context);
}
| 184 | 0.788043 | 0.788043 | 9 | 19.444445 | 18.221544 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 7 |
af348f4ab7b8227475a2afe63e8832b1c1ec8765 | 28,544,352,672,954 | 0589a4b515b014cccaf0cbe28d084c4fc8a46190 | /app/src/main/java/com/example/search_engine/indexer/Extractor.java | f15023f7c30de485f14a8158150c9dd0a4a24215 | [] | no_license | hadywalied/WordProcessorTest3 | https://github.com/hadywalied/WordProcessorTest3 | d8da2ea6946923731eefea1577e39b2375aa78ac | e62cf85ac764e73d6d351ad6df27084cc319ea6d | refs/heads/master | 2022-11-05T03:19:08.613000 | 2020-06-26T13:10:50 | 2020-06-26T13:10:50 | 275,158,908 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.search_engine.indexer;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.sql.SQLException;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
public class Extractor {
public void extractFromHtml(String htmlPath, int numberOfUrls) throws IOException, SQLException, InterruptedException {
WatchService watchService = FileSystems.getDefault().newWatchService();
Path pathh = Paths.get(htmlPath);
pathh.register(watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE);
boolean poll = true;
int i=1;
int countFiles=0;
while (poll) {
WatchKey key = watchService.take();
String lastfilepath ="";
for (WatchEvent<?> event : key.pollEvents()) {
Path file = pathh.resolve((Path)event.context());
System.out.println("Event kind : " + event.kind() + " - File : " + event.context());
String filePath = pathh + "\\" + event.context();
if (event.kind() ==ENTRY_MODIFY && !filePath.equals(lastfilepath)) {
countFiles++;
System.out.println("file path " + filePath+" "+file.toFile().lastModified());
String multihtml = new String(Files.readAllBytes(Paths.get(filePath)));
String[] htmlParts = multihtml.split("(?<=</html>)");
org.jsoup.nodes.Document doc;
for (String part : htmlParts) {
doc = Jsoup.parse(part);
//Title
String title = "";
title = doc.title();
//Remove stop words by stemmer
// com.example.search_engine.Stemmer S = new com.example.search_engine.Stemmer();
//title = S.stem(title);
System.out.println("title : " + title);
System.out.println("");
//Headers
Element body = doc.body();
Elements paragraphs = body.getElementsByTag("header");
String header = "";
for (Element paragraph : paragraphs) {
header = header + paragraph.text();
}
//Remove stop words
// com.example.search_engine.Stemmer S2 = new com.example.search_engine.Stemmer();
//header = S2.stem(header);
System.out.println("header: " + header);
// Plain text
String string = doc.body().text();
//Remove stop words
// com.example.search_engine.Stemmer S3 = new com.example.search_engine.Stemmer();
// string = S3.stem(string);
String tempWord = title + " " + header + " ";
string = string.replaceAll(tempWord, "");
// com.example.search_engine.Stemmer S4 = new com.example.search_engine.Stemmer();
// allBody = S4.stem(allBody);
System.out.println("body: " + string);
if (!title.isEmpty() || !header.isEmpty() || !string.isEmpty()) {
// Write in files and database
try {
String filename = "filename" + Integer.toString(i) + ".txt";
System.out.println("paaaaaaaath "+i+" "+ filename);
FileWriter myWriter = new FileWriter("filename" + Integer.toString(i) + ".txt");
myWriter.write(title + " , " + header + " , " + string);
myWriter.close();
i++;
System.out.println("Successfully wrote to the file.");
lastfilepath = filePath;
} catch (IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
}
}
if (countFiles==numberOfUrls)
{
break;
}
}
if (countFiles==numberOfUrls)
{
break;
}
poll = key.reset();
}
}
}
| UTF-8 | Java | 5,067 | java | Extractor.java | Java | [] | null | [] | package com.example.search_engine.indexer;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.sql.SQLException;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
public class Extractor {
public void extractFromHtml(String htmlPath, int numberOfUrls) throws IOException, SQLException, InterruptedException {
WatchService watchService = FileSystems.getDefault().newWatchService();
Path pathh = Paths.get(htmlPath);
pathh.register(watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE);
boolean poll = true;
int i=1;
int countFiles=0;
while (poll) {
WatchKey key = watchService.take();
String lastfilepath ="";
for (WatchEvent<?> event : key.pollEvents()) {
Path file = pathh.resolve((Path)event.context());
System.out.println("Event kind : " + event.kind() + " - File : " + event.context());
String filePath = pathh + "\\" + event.context();
if (event.kind() ==ENTRY_MODIFY && !filePath.equals(lastfilepath)) {
countFiles++;
System.out.println("file path " + filePath+" "+file.toFile().lastModified());
String multihtml = new String(Files.readAllBytes(Paths.get(filePath)));
String[] htmlParts = multihtml.split("(?<=</html>)");
org.jsoup.nodes.Document doc;
for (String part : htmlParts) {
doc = Jsoup.parse(part);
//Title
String title = "";
title = doc.title();
//Remove stop words by stemmer
// com.example.search_engine.Stemmer S = new com.example.search_engine.Stemmer();
//title = S.stem(title);
System.out.println("title : " + title);
System.out.println("");
//Headers
Element body = doc.body();
Elements paragraphs = body.getElementsByTag("header");
String header = "";
for (Element paragraph : paragraphs) {
header = header + paragraph.text();
}
//Remove stop words
// com.example.search_engine.Stemmer S2 = new com.example.search_engine.Stemmer();
//header = S2.stem(header);
System.out.println("header: " + header);
// Plain text
String string = doc.body().text();
//Remove stop words
// com.example.search_engine.Stemmer S3 = new com.example.search_engine.Stemmer();
// string = S3.stem(string);
String tempWord = title + " " + header + " ";
string = string.replaceAll(tempWord, "");
// com.example.search_engine.Stemmer S4 = new com.example.search_engine.Stemmer();
// allBody = S4.stem(allBody);
System.out.println("body: " + string);
if (!title.isEmpty() || !header.isEmpty() || !string.isEmpty()) {
// Write in files and database
try {
String filename = "filename" + Integer.toString(i) + ".txt";
System.out.println("paaaaaaaath "+i+" "+ filename);
FileWriter myWriter = new FileWriter("filename" + Integer.toString(i) + ".txt");
myWriter.write(title + " , " + header + " , " + string);
myWriter.close();
i++;
System.out.println("Successfully wrote to the file.");
lastfilepath = filePath;
} catch (IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
}
}
}
if (countFiles==numberOfUrls)
{
break;
}
}
if (countFiles==numberOfUrls)
{
break;
}
poll = key.reset();
}
}
}
| 5,067 | 0.484508 | 0.482929 | 118 | 41.940678 | 30.635443 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.686441 | false | false | 7 |
915206389229fe13e0610f0aa026f071f127127b | 28,544,352,672,395 | 7210d8773e1999e9842ff9ecf372b54bdbfeb959 | /src/adapterPattern/interfaces/InterfaceClassB.java | a6be9888bdf8418c364b220828dc13e8b7825d8e | [] | no_license | Feulito/design-pattern | https://github.com/Feulito/design-pattern | a28d6deccd170b1ee7d600f7cebce8bbf230c2a7 | 90cfc16c72b70668f0d1b3619b7616ef2f438b26 | refs/heads/master | 2023-03-18T02:32:18.880000 | 2021-03-07T19:35:21 | 2021-03-07T19:35:21 | 337,003,424 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package adapterPattern.interfaces;
public interface InterfaceClassB {
void methodeB();
}
| UTF-8 | Java | 96 | java | InterfaceClassB.java | Java | [] | null | [] | package adapterPattern.interfaces;
public interface InterfaceClassB {
void methodeB();
}
| 96 | 0.760417 | 0.760417 | 7 | 12.714286 | 15.030581 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 7 |
4ae84f36a325ce481c556985b3b8c325814b011a | 27,754,078,729,400 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.alpenglow-EnterpriseServer/sources/androidx/appcompat/widget/ActionBarOverlayLayout.java | d653c848c69e0585b1b6670461adb2b2aa0b80f1 | [] | no_license | phwd/quest-tracker | https://github.com/phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959000 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | true | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | 2021-04-10T22:15:44 | 2021-04-10T22:15:39 | 116,441 | 0 | 0 | 0 | null | false | false | package androidx.appcompat.widget;
import X.AbstractC000503a;
import X.AbstractC001803p;
import X.AbstractC002504b;
import X.AbstractC002604c;
import X.AbstractC03790dG;
import X.AnonymousClass006;
import X.AnonymousClass02D;
import X.AnonymousClass08P;
import X.AnonymousClass0B4;
import X.AnonymousClass0B5;
import X.AnonymousClass0B7;
import X.AnonymousClass0MR;
import X.C001503m;
import X.C001903q;
import X.C00830Ab;
import X.RunnableC001603n;
import X.RunnableC001703o;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.Window;
import android.view.WindowInsets;
import android.widget.OverScroller;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import com.oculus.alpenglow.R;
@SuppressLint({"UnknownNullness"})
@RestrictTo({AnonymousClass02D.LIBRARY_GROUP_PREFIX})
public class ActionBarOverlayLayout extends ViewGroup implements AbstractC002504b, AbstractC03790dG, AnonymousClass0MR {
public static final int[] A0V = {R.attr.actionBarSize, 16842841};
public ViewPropertyAnimator A00;
public boolean A01;
public OverScroller A02;
public ActionBarContainer A03;
public boolean A04;
public boolean A05;
public int A06;
public int A07;
public int A08;
public int A09;
public Drawable A0A;
public AbstractC001803p A0B;
public ContentFrameLayout A0C;
public AbstractC002604c A0D;
@NonNull
public AnonymousClass0B7 A0E;
@NonNull
public AnonymousClass0B7 A0F;
@NonNull
public AnonymousClass0B7 A0G;
@NonNull
public AnonymousClass0B7 A0H;
public boolean A0I;
public boolean A0J;
public final AnimatorListenerAdapter A0K;
public final Runnable A0L;
public final Runnable A0M;
public final Rect A0N;
public final Rect A0O;
public final Rect A0P;
public final Rect A0Q;
public final Rect A0R;
public final Rect A0S;
public final Rect A0T;
public final C00830Ab A0U;
public final void onMeasure(int i, int i2) {
boolean z;
int measuredHeight;
AnonymousClass0B7 A002;
A00();
measureChildWithMargins(this.A03, i, 0, i2, 0);
C001903q r2 = (C001903q) this.A03.getLayoutParams();
int max = Math.max(0, this.A03.getMeasuredWidth() + r2.leftMargin + r2.rightMargin);
int max2 = Math.max(0, this.A03.getMeasuredHeight() + r2.topMargin + r2.bottomMargin);
int combineMeasuredStates = View.combineMeasuredStates(0, this.A03.getMeasuredState());
if ((getWindowSystemUiVisibility() & 256) != 0) {
z = true;
measuredHeight = this.A06;
if (this.A04 && this.A03.A05 != null) {
measuredHeight += measuredHeight;
}
} else {
z = false;
measuredHeight = this.A03.getVisibility() != 8 ? this.A03.getMeasuredHeight() : 0;
}
Rect rect = this.A0P;
rect.set(this.A0N);
AnonymousClass0B7 r6 = this.A0E;
this.A0F = r6;
if (this.A05 || z) {
AnonymousClass08P A003 = AnonymousClass08P.A00(r6.A00.A01().A01, this.A0F.A00.A01().A03 + measuredHeight, this.A0F.A00.A01().A02, this.A0F.A00.A01().A00 + 0);
AnonymousClass0B5 r0 = new AnonymousClass0B4(this.A0F).A00;
r0.A02(A003);
A002 = r0.A00();
} else {
rect.top += measuredHeight;
rect.bottom += 0;
A002 = r6.A00.A06(0, measuredHeight, 0, 0);
}
this.A0F = A002;
A02(this.A0C, rect, true);
if (!this.A0H.equals(this.A0F)) {
AnonymousClass0B7 r1 = this.A0F;
this.A0H = r1;
ContentFrameLayout contentFrameLayout = this.A0C;
WindowInsets A022 = r1.A02();
if (A022 != null && !contentFrameLayout.dispatchApplyWindowInsets(A022).equals(A022)) {
new AnonymousClass0B7(A022);
}
}
measureChildWithMargins(this.A0C, i, 0, i2, 0);
C001903q r3 = (C001903q) this.A0C.getLayoutParams();
int max3 = Math.max(max, this.A0C.getMeasuredWidth() + r3.leftMargin + r3.rightMargin);
int max4 = Math.max(max2, this.A0C.getMeasuredHeight() + r3.topMargin + r3.bottomMargin);
int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.A0C.getMeasuredState());
setMeasuredDimension(View.resolveSizeAndState(Math.max(max3 + getPaddingLeft() + getPaddingRight(), getSuggestedMinimumWidth()), i, combineMeasuredStates2), View.resolveSizeAndState(Math.max(max4 + getPaddingTop() + getPaddingBottom(), getSuggestedMinimumHeight()), i2, combineMeasuredStates2 << 16));
}
public final boolean onNestedPreFling(View view, float f, float f2) {
return false;
}
public final void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
}
public void setShowingForActionMode(boolean z) {
}
public void setUiOptions(int i) {
}
public final boolean shouldDelayChildPressedState() {
return false;
}
private final void A00() {
AbstractC002604c wrapper;
if (this.A0C == null) {
this.A0C = (ContentFrameLayout) findViewById(R.id.action_bar_activity_content);
this.A03 = (ActionBarContainer) findViewById(R.id.action_bar_container);
View findViewById = findViewById(R.id.action_bar);
if (findViewById instanceof AbstractC002604c) {
wrapper = (AbstractC002604c) findViewById;
} else if (findViewById instanceof Toolbar) {
wrapper = ((Toolbar) findViewById).getWrapper();
} else {
throw new IllegalStateException(AnonymousClass006.A05("Can't make a decor toolbar out of ", findViewById.getClass().getSimpleName()));
}
this.A0D = wrapper;
}
}
public final void A03() {
removeCallbacks(this.A0M);
removeCallbacks(this.A0L);
ViewPropertyAnimator viewPropertyAnimator = this.A00;
if (viewPropertyAnimator != null) {
viewPropertyAnimator.cancel();
}
}
@Override // X.AbstractC03790dG
public final void A6I(View view, int i, int i2, int i3, int i4, int i5) {
if (i5 == 0) {
onNestedScroll(view, i, i2, i3, i4);
}
}
@Override // X.AbstractC03790dG
public final void A6K(View view, View view2, int i, int i2) {
if (i2 == 0) {
onNestedScrollAccepted(view, view2, i);
}
}
@Override // X.AbstractC03790dG
public final boolean A6a(View view, View view2, int i, int i2) {
if (i2 != 0 || !onStartNestedScroll(view, view2, i)) {
return false;
}
return true;
}
@Override // X.AbstractC03790dG
public final void A6d(View view, int i) {
if (i == 0) {
onStopNestedScroll(view);
}
}
public final ViewGroup.LayoutParams generateDefaultLayoutParams() {
return new C001903q();
}
public int getActionBarHideOffset() {
ActionBarContainer actionBarContainer = this.A03;
if (actionBarContainer != null) {
return -((int) actionBarContainer.getTranslationY());
}
return 0;
}
public int getNestedScrollAxes() {
C00830Ab r0 = this.A0U;
return r0.A01 | r0.A00;
}
public final boolean onNestedFling(View view, float f, float f2, boolean z) {
Runnable runnable;
if (!this.A0I || !z) {
return false;
}
this.A02.fling(0, 0, 0, (int) f2, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
if (this.A02.getFinalY() > this.A03.getHeight()) {
A03();
runnable = this.A0L;
} else {
A03();
runnable = this.A0M;
}
runnable.run();
this.A01 = true;
return true;
}
public final void onNestedScroll(View view, int i, int i2, int i3, int i4) {
int i5 = this.A07 + i2;
this.A07 = i5;
setActionBarHideOffset(i5);
}
public final void onNestedScrollAccepted(View view, View view2, int i) {
this.A0U.A01 = i;
this.A07 = getActionBarHideOffset();
A03();
AbstractC001803p r0 = this.A0B;
if (r0 != null) {
r0.A61();
}
}
public final boolean onStartNestedScroll(View view, View view2, int i) {
if ((i & 2) == 0 || this.A03.getVisibility() != 0) {
return false;
}
return this.A0I;
}
public final void onStopNestedScroll(View view) {
Runnable runnable;
if (this.A0I && !this.A01) {
if (this.A07 <= this.A03.getHeight()) {
A03();
runnable = this.A0M;
} else {
A03();
runnable = this.A0L;
}
postDelayed(runnable, 600);
}
}
public void setActionBarVisibilityCallback(AbstractC001803p r3) {
this.A0B = r3;
if (getWindowToken() != null) {
this.A0B.A6j(this.A09);
int i = this.A08;
if (i != 0) {
onWindowSystemUiVisibilityChanged(i);
requestApplyInsets();
}
}
}
public void setHideOnContentScrollEnabled(boolean z) {
if (z != this.A0I) {
this.A0I = z;
if (!z) {
A03();
setActionBarHideOffset(0);
}
}
}
/* JADX WARNING: Code restructure failed: missing block: B:3:0x0011, code lost:
if (getContext().getApplicationInfo().targetSdkVersion >= 19) goto L_0x0013;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public void setOverlayMode(boolean r4) {
/*
r3 = this;
r3.A05 = r4
if (r4 == 0) goto L_0x0013
android.content.Context r0 = r3.getContext()
android.content.pm.ApplicationInfo r0 = r0.getApplicationInfo()
int r2 = r0.targetSdkVersion
r1 = 19
r0 = 1
if (r2 < r1) goto L_0x0014
L_0x0013:
r0 = 0
L_0x0014:
r3.A0J = r0
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.setOverlayMode(boolean):void");
}
private void A01(Context context) {
TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(A0V);
boolean z = false;
this.A06 = obtainStyledAttributes.getDimensionPixelSize(0, 0);
Drawable drawable = obtainStyledAttributes.getDrawable(1);
this.A0A = drawable;
boolean z2 = false;
if (drawable == null) {
z2 = true;
}
setWillNotDraw(z2);
obtainStyledAttributes.recycle();
if (context.getApplicationInfo().targetSdkVersion < 19) {
z = true;
}
this.A0J = z;
this.A02 = new OverScroller(context);
}
public static boolean A02(@NonNull View view, @NonNull Rect rect, boolean z) {
boolean z2;
int i;
C001903q r3 = (C001903q) view.getLayoutParams();
int i2 = r3.leftMargin;
int i3 = rect.left;
if (i2 != i3) {
r3.leftMargin = i3;
z2 = true;
} else {
z2 = false;
}
int i4 = r3.topMargin;
int i5 = rect.top;
if (i4 != i5) {
r3.topMargin = i5;
z2 = true;
}
int i6 = r3.rightMargin;
int i7 = rect.right;
if (i6 != i7) {
r3.rightMargin = i7;
z2 = true;
}
if (!z || r3.bottomMargin == (i = rect.bottom)) {
return z2;
}
r3.bottomMargin = i;
return true;
}
@Override // X.AbstractC002504b
public final boolean A1d() {
A00();
return this.A0D.A1d();
}
@Override // X.AbstractC002504b
public final void A29() {
A00();
this.A0D.A28();
}
@Override // X.AbstractC002504b
public final boolean A54() {
A00();
return this.A0D.A54();
}
@Override // X.AbstractC002504b
public final void A5D(int i) {
A00();
if (i != 2 && i != 5 && i == 109) {
setOverlayMode(true);
}
}
@Override // X.AbstractC002504b
public final boolean A5W() {
A00();
return this.A0D.A5W();
}
@Override // X.AbstractC002504b
public final boolean A5X() {
A00();
return this.A0D.A5X();
}
@Override // X.AbstractC002504b
public final void A81() {
A00();
this.A0D.A81();
}
@Override // X.AbstractC002504b
public final boolean A8S() {
A00();
return this.A0D.A8S();
}
public final void draw(Canvas canvas) {
int i;
super.draw(canvas);
if (this.A0A != null && !this.A0J) {
if (this.A03.getVisibility() == 0) {
i = (int) (((float) this.A03.getBottom()) + this.A03.getTranslationY() + 0.5f);
} else {
i = 0;
}
this.A0A.setBounds(0, i, getWidth(), this.A0A.getIntrinsicHeight() + i);
this.A0A.draw(canvas);
}
}
public final boolean fitSystemWindows(Rect rect) {
return super.fitSystemWindows(rect);
}
public CharSequence getTitle() {
A00();
return this.A0D.getTitle();
}
/* JADX WARNING: Code restructure failed: missing block: B:12:0x007a, code lost:
if (r5 != false) goto L_0x0062;
*/
@androidx.annotation.RequiresApi(21)
/* Code decompiled incorrectly, please refer to instructions dump. */
public final android.view.WindowInsets onApplyWindowInsets(@androidx.annotation.NonNull android.view.WindowInsets r9) {
/*
// Method dump skipped, instructions count: 129
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.onApplyWindowInsets(android.view.WindowInsets):android.view.WindowInsets");
}
public final void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
A01(getContext());
requestApplyInsets();
}
public final void onDetachedFromWindow() {
super.onDetachedFromWindow();
A03();
}
public final void onLayout(boolean z, int i, int i2, int i3, int i4) {
int childCount = getChildCount();
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
for (int i5 = 0; i5 < childCount; i5++) {
View childAt = getChildAt(i5);
if (childAt.getVisibility() != 8) {
C001903q r0 = (C001903q) childAt.getLayoutParams();
int measuredWidth = childAt.getMeasuredWidth();
int measuredHeight = childAt.getMeasuredHeight();
int i6 = r0.leftMargin + paddingLeft;
int i7 = r0.topMargin + paddingTop;
childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7);
}
}
}
public final void onWindowSystemUiVisibilityChanged(int i) {
super.onWindowSystemUiVisibilityChanged(i);
A00();
int i2 = this.A08 ^ i;
this.A08 = i;
boolean z = false;
boolean z2 = false;
if ((i & 4) == 0) {
z2 = true;
}
if ((i & 256) != 0) {
z = true;
}
AbstractC001803p r1 = this.A0B;
if (r1 != null) {
r1.A2J(!z);
if (z2 || !z) {
r1.A8R();
} else {
r1.A53();
}
}
if ((i2 & 256) != 0 && this.A0B != null) {
requestApplyInsets();
}
}
public final void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
this.A09 = i;
AbstractC001803p r0 = this.A0B;
if (r0 != null) {
r0.A6j(i);
}
}
public void setActionBarHideOffset(int i) {
A03();
this.A03.setTranslationY((float) (-Math.max(0, Math.min(i, this.A03.getHeight()))));
}
public void setLogo(int i) {
A00();
this.A0D.A7z(i);
}
@Override // X.AbstractC002504b
public void setMenu(Menu menu, AbstractC000503a r3) {
A00();
this.A0D.setMenu(menu, r3);
}
@Override // X.AbstractC002504b
public void setWindowCallback(Window.Callback callback) {
A00();
this.A0D.setWindowCallback(callback);
}
@Override // X.AbstractC002504b
public void setWindowTitle(CharSequence charSequence) {
A00();
this.A0D.setWindowTitle(charSequence);
}
public final boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof C001903q;
}
public void setHasNonEmbeddedTabs(boolean z) {
this.A04 = z;
}
@Override // X.AbstractC03790dG
public final void A6H(View view, int i, int i2, int[] iArr, int i3) {
}
@Override // X.AnonymousClass0MR
public final void A6J(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
A6I(view, i, i2, i3, i4, i5);
}
public ActionBarOverlayLayout(@NonNull Context context) {
this(context, null);
}
public ActionBarOverlayLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
this.A09 = 0;
this.A0N = new Rect();
this.A0R = new Rect();
this.A0P = new Rect();
this.A0O = new Rect();
this.A0S = new Rect();
this.A0Q = new Rect();
this.A0T = new Rect();
AnonymousClass0B7 r0 = AnonymousClass0B7.A01;
this.A0E = r0;
this.A0G = r0;
this.A0F = r0;
this.A0H = r0;
this.A0K = new C001503m(this);
this.A0M = new RunnableC001603n(this);
this.A0L = new RunnableC001703o(this);
A01(context);
this.A0U = new C00830Ab();
}
@Override // android.view.ViewGroup
public final ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new C001903q(getContext(), attributeSet);
}
@Override // android.view.ViewGroup
public final ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
return new C001903q(layoutParams);
}
public void setIcon(int i) {
A00();
this.A0D.A7w(i);
}
public void setIcon(Drawable drawable) {
A00();
this.A0D.A7x(drawable);
}
}
| UTF-8 | Java | 19,306 | java | ActionBarOverlayLayout.java | Java | [] | null | [] | package androidx.appcompat.widget;
import X.AbstractC000503a;
import X.AbstractC001803p;
import X.AbstractC002504b;
import X.AbstractC002604c;
import X.AbstractC03790dG;
import X.AnonymousClass006;
import X.AnonymousClass02D;
import X.AnonymousClass08P;
import X.AnonymousClass0B4;
import X.AnonymousClass0B5;
import X.AnonymousClass0B7;
import X.AnonymousClass0MR;
import X.C001503m;
import X.C001903q;
import X.C00830Ab;
import X.RunnableC001603n;
import X.RunnableC001703o;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.view.Window;
import android.view.WindowInsets;
import android.widget.OverScroller;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import com.oculus.alpenglow.R;
@SuppressLint({"UnknownNullness"})
@RestrictTo({AnonymousClass02D.LIBRARY_GROUP_PREFIX})
public class ActionBarOverlayLayout extends ViewGroup implements AbstractC002504b, AbstractC03790dG, AnonymousClass0MR {
public static final int[] A0V = {R.attr.actionBarSize, 16842841};
public ViewPropertyAnimator A00;
public boolean A01;
public OverScroller A02;
public ActionBarContainer A03;
public boolean A04;
public boolean A05;
public int A06;
public int A07;
public int A08;
public int A09;
public Drawable A0A;
public AbstractC001803p A0B;
public ContentFrameLayout A0C;
public AbstractC002604c A0D;
@NonNull
public AnonymousClass0B7 A0E;
@NonNull
public AnonymousClass0B7 A0F;
@NonNull
public AnonymousClass0B7 A0G;
@NonNull
public AnonymousClass0B7 A0H;
public boolean A0I;
public boolean A0J;
public final AnimatorListenerAdapter A0K;
public final Runnable A0L;
public final Runnable A0M;
public final Rect A0N;
public final Rect A0O;
public final Rect A0P;
public final Rect A0Q;
public final Rect A0R;
public final Rect A0S;
public final Rect A0T;
public final C00830Ab A0U;
public final void onMeasure(int i, int i2) {
boolean z;
int measuredHeight;
AnonymousClass0B7 A002;
A00();
measureChildWithMargins(this.A03, i, 0, i2, 0);
C001903q r2 = (C001903q) this.A03.getLayoutParams();
int max = Math.max(0, this.A03.getMeasuredWidth() + r2.leftMargin + r2.rightMargin);
int max2 = Math.max(0, this.A03.getMeasuredHeight() + r2.topMargin + r2.bottomMargin);
int combineMeasuredStates = View.combineMeasuredStates(0, this.A03.getMeasuredState());
if ((getWindowSystemUiVisibility() & 256) != 0) {
z = true;
measuredHeight = this.A06;
if (this.A04 && this.A03.A05 != null) {
measuredHeight += measuredHeight;
}
} else {
z = false;
measuredHeight = this.A03.getVisibility() != 8 ? this.A03.getMeasuredHeight() : 0;
}
Rect rect = this.A0P;
rect.set(this.A0N);
AnonymousClass0B7 r6 = this.A0E;
this.A0F = r6;
if (this.A05 || z) {
AnonymousClass08P A003 = AnonymousClass08P.A00(r6.A00.A01().A01, this.A0F.A00.A01().A03 + measuredHeight, this.A0F.A00.A01().A02, this.A0F.A00.A01().A00 + 0);
AnonymousClass0B5 r0 = new AnonymousClass0B4(this.A0F).A00;
r0.A02(A003);
A002 = r0.A00();
} else {
rect.top += measuredHeight;
rect.bottom += 0;
A002 = r6.A00.A06(0, measuredHeight, 0, 0);
}
this.A0F = A002;
A02(this.A0C, rect, true);
if (!this.A0H.equals(this.A0F)) {
AnonymousClass0B7 r1 = this.A0F;
this.A0H = r1;
ContentFrameLayout contentFrameLayout = this.A0C;
WindowInsets A022 = r1.A02();
if (A022 != null && !contentFrameLayout.dispatchApplyWindowInsets(A022).equals(A022)) {
new AnonymousClass0B7(A022);
}
}
measureChildWithMargins(this.A0C, i, 0, i2, 0);
C001903q r3 = (C001903q) this.A0C.getLayoutParams();
int max3 = Math.max(max, this.A0C.getMeasuredWidth() + r3.leftMargin + r3.rightMargin);
int max4 = Math.max(max2, this.A0C.getMeasuredHeight() + r3.topMargin + r3.bottomMargin);
int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.A0C.getMeasuredState());
setMeasuredDimension(View.resolveSizeAndState(Math.max(max3 + getPaddingLeft() + getPaddingRight(), getSuggestedMinimumWidth()), i, combineMeasuredStates2), View.resolveSizeAndState(Math.max(max4 + getPaddingTop() + getPaddingBottom(), getSuggestedMinimumHeight()), i2, combineMeasuredStates2 << 16));
}
public final boolean onNestedPreFling(View view, float f, float f2) {
return false;
}
public final void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
}
public void setShowingForActionMode(boolean z) {
}
public void setUiOptions(int i) {
}
public final boolean shouldDelayChildPressedState() {
return false;
}
private final void A00() {
AbstractC002604c wrapper;
if (this.A0C == null) {
this.A0C = (ContentFrameLayout) findViewById(R.id.action_bar_activity_content);
this.A03 = (ActionBarContainer) findViewById(R.id.action_bar_container);
View findViewById = findViewById(R.id.action_bar);
if (findViewById instanceof AbstractC002604c) {
wrapper = (AbstractC002604c) findViewById;
} else if (findViewById instanceof Toolbar) {
wrapper = ((Toolbar) findViewById).getWrapper();
} else {
throw new IllegalStateException(AnonymousClass006.A05("Can't make a decor toolbar out of ", findViewById.getClass().getSimpleName()));
}
this.A0D = wrapper;
}
}
public final void A03() {
removeCallbacks(this.A0M);
removeCallbacks(this.A0L);
ViewPropertyAnimator viewPropertyAnimator = this.A00;
if (viewPropertyAnimator != null) {
viewPropertyAnimator.cancel();
}
}
@Override // X.AbstractC03790dG
public final void A6I(View view, int i, int i2, int i3, int i4, int i5) {
if (i5 == 0) {
onNestedScroll(view, i, i2, i3, i4);
}
}
@Override // X.AbstractC03790dG
public final void A6K(View view, View view2, int i, int i2) {
if (i2 == 0) {
onNestedScrollAccepted(view, view2, i);
}
}
@Override // X.AbstractC03790dG
public final boolean A6a(View view, View view2, int i, int i2) {
if (i2 != 0 || !onStartNestedScroll(view, view2, i)) {
return false;
}
return true;
}
@Override // X.AbstractC03790dG
public final void A6d(View view, int i) {
if (i == 0) {
onStopNestedScroll(view);
}
}
public final ViewGroup.LayoutParams generateDefaultLayoutParams() {
return new C001903q();
}
public int getActionBarHideOffset() {
ActionBarContainer actionBarContainer = this.A03;
if (actionBarContainer != null) {
return -((int) actionBarContainer.getTranslationY());
}
return 0;
}
public int getNestedScrollAxes() {
C00830Ab r0 = this.A0U;
return r0.A01 | r0.A00;
}
public final boolean onNestedFling(View view, float f, float f2, boolean z) {
Runnable runnable;
if (!this.A0I || !z) {
return false;
}
this.A02.fling(0, 0, 0, (int) f2, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
if (this.A02.getFinalY() > this.A03.getHeight()) {
A03();
runnable = this.A0L;
} else {
A03();
runnable = this.A0M;
}
runnable.run();
this.A01 = true;
return true;
}
public final void onNestedScroll(View view, int i, int i2, int i3, int i4) {
int i5 = this.A07 + i2;
this.A07 = i5;
setActionBarHideOffset(i5);
}
public final void onNestedScrollAccepted(View view, View view2, int i) {
this.A0U.A01 = i;
this.A07 = getActionBarHideOffset();
A03();
AbstractC001803p r0 = this.A0B;
if (r0 != null) {
r0.A61();
}
}
public final boolean onStartNestedScroll(View view, View view2, int i) {
if ((i & 2) == 0 || this.A03.getVisibility() != 0) {
return false;
}
return this.A0I;
}
public final void onStopNestedScroll(View view) {
Runnable runnable;
if (this.A0I && !this.A01) {
if (this.A07 <= this.A03.getHeight()) {
A03();
runnable = this.A0M;
} else {
A03();
runnable = this.A0L;
}
postDelayed(runnable, 600);
}
}
public void setActionBarVisibilityCallback(AbstractC001803p r3) {
this.A0B = r3;
if (getWindowToken() != null) {
this.A0B.A6j(this.A09);
int i = this.A08;
if (i != 0) {
onWindowSystemUiVisibilityChanged(i);
requestApplyInsets();
}
}
}
public void setHideOnContentScrollEnabled(boolean z) {
if (z != this.A0I) {
this.A0I = z;
if (!z) {
A03();
setActionBarHideOffset(0);
}
}
}
/* JADX WARNING: Code restructure failed: missing block: B:3:0x0011, code lost:
if (getContext().getApplicationInfo().targetSdkVersion >= 19) goto L_0x0013;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public void setOverlayMode(boolean r4) {
/*
r3 = this;
r3.A05 = r4
if (r4 == 0) goto L_0x0013
android.content.Context r0 = r3.getContext()
android.content.pm.ApplicationInfo r0 = r0.getApplicationInfo()
int r2 = r0.targetSdkVersion
r1 = 19
r0 = 1
if (r2 < r1) goto L_0x0014
L_0x0013:
r0 = 0
L_0x0014:
r3.A0J = r0
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.setOverlayMode(boolean):void");
}
private void A01(Context context) {
TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(A0V);
boolean z = false;
this.A06 = obtainStyledAttributes.getDimensionPixelSize(0, 0);
Drawable drawable = obtainStyledAttributes.getDrawable(1);
this.A0A = drawable;
boolean z2 = false;
if (drawable == null) {
z2 = true;
}
setWillNotDraw(z2);
obtainStyledAttributes.recycle();
if (context.getApplicationInfo().targetSdkVersion < 19) {
z = true;
}
this.A0J = z;
this.A02 = new OverScroller(context);
}
public static boolean A02(@NonNull View view, @NonNull Rect rect, boolean z) {
boolean z2;
int i;
C001903q r3 = (C001903q) view.getLayoutParams();
int i2 = r3.leftMargin;
int i3 = rect.left;
if (i2 != i3) {
r3.leftMargin = i3;
z2 = true;
} else {
z2 = false;
}
int i4 = r3.topMargin;
int i5 = rect.top;
if (i4 != i5) {
r3.topMargin = i5;
z2 = true;
}
int i6 = r3.rightMargin;
int i7 = rect.right;
if (i6 != i7) {
r3.rightMargin = i7;
z2 = true;
}
if (!z || r3.bottomMargin == (i = rect.bottom)) {
return z2;
}
r3.bottomMargin = i;
return true;
}
@Override // X.AbstractC002504b
public final boolean A1d() {
A00();
return this.A0D.A1d();
}
@Override // X.AbstractC002504b
public final void A29() {
A00();
this.A0D.A28();
}
@Override // X.AbstractC002504b
public final boolean A54() {
A00();
return this.A0D.A54();
}
@Override // X.AbstractC002504b
public final void A5D(int i) {
A00();
if (i != 2 && i != 5 && i == 109) {
setOverlayMode(true);
}
}
@Override // X.AbstractC002504b
public final boolean A5W() {
A00();
return this.A0D.A5W();
}
@Override // X.AbstractC002504b
public final boolean A5X() {
A00();
return this.A0D.A5X();
}
@Override // X.AbstractC002504b
public final void A81() {
A00();
this.A0D.A81();
}
@Override // X.AbstractC002504b
public final boolean A8S() {
A00();
return this.A0D.A8S();
}
public final void draw(Canvas canvas) {
int i;
super.draw(canvas);
if (this.A0A != null && !this.A0J) {
if (this.A03.getVisibility() == 0) {
i = (int) (((float) this.A03.getBottom()) + this.A03.getTranslationY() + 0.5f);
} else {
i = 0;
}
this.A0A.setBounds(0, i, getWidth(), this.A0A.getIntrinsicHeight() + i);
this.A0A.draw(canvas);
}
}
public final boolean fitSystemWindows(Rect rect) {
return super.fitSystemWindows(rect);
}
public CharSequence getTitle() {
A00();
return this.A0D.getTitle();
}
/* JADX WARNING: Code restructure failed: missing block: B:12:0x007a, code lost:
if (r5 != false) goto L_0x0062;
*/
@androidx.annotation.RequiresApi(21)
/* Code decompiled incorrectly, please refer to instructions dump. */
public final android.view.WindowInsets onApplyWindowInsets(@androidx.annotation.NonNull android.view.WindowInsets r9) {
/*
// Method dump skipped, instructions count: 129
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.onApplyWindowInsets(android.view.WindowInsets):android.view.WindowInsets");
}
public final void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
A01(getContext());
requestApplyInsets();
}
public final void onDetachedFromWindow() {
super.onDetachedFromWindow();
A03();
}
public final void onLayout(boolean z, int i, int i2, int i3, int i4) {
int childCount = getChildCount();
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
for (int i5 = 0; i5 < childCount; i5++) {
View childAt = getChildAt(i5);
if (childAt.getVisibility() != 8) {
C001903q r0 = (C001903q) childAt.getLayoutParams();
int measuredWidth = childAt.getMeasuredWidth();
int measuredHeight = childAt.getMeasuredHeight();
int i6 = r0.leftMargin + paddingLeft;
int i7 = r0.topMargin + paddingTop;
childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7);
}
}
}
public final void onWindowSystemUiVisibilityChanged(int i) {
super.onWindowSystemUiVisibilityChanged(i);
A00();
int i2 = this.A08 ^ i;
this.A08 = i;
boolean z = false;
boolean z2 = false;
if ((i & 4) == 0) {
z2 = true;
}
if ((i & 256) != 0) {
z = true;
}
AbstractC001803p r1 = this.A0B;
if (r1 != null) {
r1.A2J(!z);
if (z2 || !z) {
r1.A8R();
} else {
r1.A53();
}
}
if ((i2 & 256) != 0 && this.A0B != null) {
requestApplyInsets();
}
}
public final void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
this.A09 = i;
AbstractC001803p r0 = this.A0B;
if (r0 != null) {
r0.A6j(i);
}
}
public void setActionBarHideOffset(int i) {
A03();
this.A03.setTranslationY((float) (-Math.max(0, Math.min(i, this.A03.getHeight()))));
}
public void setLogo(int i) {
A00();
this.A0D.A7z(i);
}
@Override // X.AbstractC002504b
public void setMenu(Menu menu, AbstractC000503a r3) {
A00();
this.A0D.setMenu(menu, r3);
}
@Override // X.AbstractC002504b
public void setWindowCallback(Window.Callback callback) {
A00();
this.A0D.setWindowCallback(callback);
}
@Override // X.AbstractC002504b
public void setWindowTitle(CharSequence charSequence) {
A00();
this.A0D.setWindowTitle(charSequence);
}
public final boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof C001903q;
}
public void setHasNonEmbeddedTabs(boolean z) {
this.A04 = z;
}
@Override // X.AbstractC03790dG
public final void A6H(View view, int i, int i2, int[] iArr, int i3) {
}
@Override // X.AnonymousClass0MR
public final void A6J(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
A6I(view, i, i2, i3, i4, i5);
}
public ActionBarOverlayLayout(@NonNull Context context) {
this(context, null);
}
public ActionBarOverlayLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
this.A09 = 0;
this.A0N = new Rect();
this.A0R = new Rect();
this.A0P = new Rect();
this.A0O = new Rect();
this.A0S = new Rect();
this.A0Q = new Rect();
this.A0T = new Rect();
AnonymousClass0B7 r0 = AnonymousClass0B7.A01;
this.A0E = r0;
this.A0G = r0;
this.A0F = r0;
this.A0H = r0;
this.A0K = new C001503m(this);
this.A0M = new RunnableC001603n(this);
this.A0L = new RunnableC001703o(this);
A01(context);
this.A0U = new C00830Ab();
}
@Override // android.view.ViewGroup
public final ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new C001903q(getContext(), attributeSet);
}
@Override // android.view.ViewGroup
public final ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
return new C001903q(layoutParams);
}
public void setIcon(int i) {
A00();
this.A0D.A7w(i);
}
public void setIcon(Drawable drawable) {
A00();
this.A0D.A7x(drawable);
}
}
| 19,306 | 0.588936 | 0.534031 | 613 | 30.494291 | 27.948135 | 309 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.706362 | false | false | 7 |
dc144b054b4471e3a3c3cc41fd742807d696baec | 21,328,807,643,795 | 2688e089aad4bba8651ee53b82dd18a87233450a | /showurs-blog-user/src/main/java/cn/showurs/blog/user/config/SpringMvcConfig.java | a044024a9bd943562532b48b0cb074c20aabdca7 | [] | no_license | chenjie1995/showurs-blog | https://github.com/chenjie1995/showurs-blog | c1db93061a61800b7dd2a7dacaf5836b9745e251 | 85d4dae68d33e4f5a16053932c84c30b1cae22a0 | refs/heads/master | 2022-01-08T06:31:10.785000 | 2022-01-04T14:55:19 | 2022-01-04T14:55:19 | 145,927,090 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.showurs.blog.user.config;
import cn.showurs.blog.common.constant.ResponseInfo;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Created by CJ on 2018/11/18 21:42.
*/
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.exposedHeaders(ResponseInfo.HEADER_TOKEN_NAME)
.allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS");
}
}
| UTF-8 | Java | 720 | java | SpringMvcConfig.java | Java | [
{
"context": "ig.annotation.WebMvcConfigurer;\n\n/**\n * Created by CJ on 2018/11/18 21:42.\n */\n@Configuration\npublic cl",
"end": 319,
"score": 0.9961915016174316,
"start": 317,
"tag": "USERNAME",
"value": "CJ"
}
] | null | [] | package cn.showurs.blog.user.config;
import cn.showurs.blog.common.constant.ResponseInfo;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* Created by CJ on 2018/11/18 21:42.
*/
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.exposedHeaders(ResponseInfo.HEADER_TOKEN_NAME)
.allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH", "OPTIONS");
}
}
| 720 | 0.715278 | 0.698611 | 21 | 33.285713 | 28.000242 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false | 7 |
8be488ed738c5880fcc52039392e9c52d6f2b2ab | 36,189,394,480,014 | c474b03758be154e43758220e47b3403eb7fc1fc | /apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/tinder/recs/rule/TutorialSwipeRule_Factory.java | 2627046715c292c18be3b326a8663096836d45e5 | [] | no_license | EstebanDalelR/tinderAnalysis | https://github.com/EstebanDalelR/tinderAnalysis | f80fe1f43b3b9dba283b5db1781189a0dd592c24 | 941e2c634c40e5dbf5585c6876ef33f2a578b65c | refs/heads/master | 2020-04-04T09:03:32.659000 | 2018-11-23T20:41:28 | 2018-11-23T20:41:28 | 155,805,042 | 0 | 0 | null | false | 2018-11-18T16:02:45 | 2018-11-02T02:44:34 | 2018-11-18T15:58:25 | 2018-11-18T16:02:44 | 353,670 | 0 | 0 | 0 | null | false | null | package com.tinder.recs.rule;
import com.tinder.core.experiment.AbTestUtility;
import com.tinder.fireboarding.domain.C11811o;
import com.tinder.managers.bk;
import dagger.internal.Factory;
import javax.inject.Provider;
public final class TutorialSwipeRule_Factory implements Factory<TutorialSwipeRule> {
private final Provider<AbTestUtility> abTestUtilityProvider;
private final Provider<bk> managerSharedPreferencesProvider;
private final Provider<C11811o> observeFireboardingConfigProvider;
public TutorialSwipeRule_Factory(Provider<bk> provider, Provider<AbTestUtility> provider2, Provider<C11811o> provider3) {
this.managerSharedPreferencesProvider = provider;
this.abTestUtilityProvider = provider2;
this.observeFireboardingConfigProvider = provider3;
}
public TutorialSwipeRule get() {
return provideInstance(this.managerSharedPreferencesProvider, this.abTestUtilityProvider, this.observeFireboardingConfigProvider);
}
public static TutorialSwipeRule provideInstance(Provider<bk> provider, Provider<AbTestUtility> provider2, Provider<C11811o> provider3) {
return new TutorialSwipeRule((bk) provider.get(), (AbTestUtility) provider2.get(), (C11811o) provider3.get());
}
public static TutorialSwipeRule_Factory create(Provider<bk> provider, Provider<AbTestUtility> provider2, Provider<C11811o> provider3) {
return new TutorialSwipeRule_Factory(provider, provider2, provider3);
}
public static TutorialSwipeRule newTutorialSwipeRule(bk bkVar, AbTestUtility abTestUtility, C11811o c11811o) {
return new TutorialSwipeRule(bkVar, abTestUtility, c11811o);
}
}
| UTF-8 | Java | 1,674 | java | TutorialSwipeRule_Factory.java | Java | [] | null | [] | package com.tinder.recs.rule;
import com.tinder.core.experiment.AbTestUtility;
import com.tinder.fireboarding.domain.C11811o;
import com.tinder.managers.bk;
import dagger.internal.Factory;
import javax.inject.Provider;
public final class TutorialSwipeRule_Factory implements Factory<TutorialSwipeRule> {
private final Provider<AbTestUtility> abTestUtilityProvider;
private final Provider<bk> managerSharedPreferencesProvider;
private final Provider<C11811o> observeFireboardingConfigProvider;
public TutorialSwipeRule_Factory(Provider<bk> provider, Provider<AbTestUtility> provider2, Provider<C11811o> provider3) {
this.managerSharedPreferencesProvider = provider;
this.abTestUtilityProvider = provider2;
this.observeFireboardingConfigProvider = provider3;
}
public TutorialSwipeRule get() {
return provideInstance(this.managerSharedPreferencesProvider, this.abTestUtilityProvider, this.observeFireboardingConfigProvider);
}
public static TutorialSwipeRule provideInstance(Provider<bk> provider, Provider<AbTestUtility> provider2, Provider<C11811o> provider3) {
return new TutorialSwipeRule((bk) provider.get(), (AbTestUtility) provider2.get(), (C11811o) provider3.get());
}
public static TutorialSwipeRule_Factory create(Provider<bk> provider, Provider<AbTestUtility> provider2, Provider<C11811o> provider3) {
return new TutorialSwipeRule_Factory(provider, provider2, provider3);
}
public static TutorialSwipeRule newTutorialSwipeRule(bk bkVar, AbTestUtility abTestUtility, C11811o c11811o) {
return new TutorialSwipeRule(bkVar, abTestUtility, c11811o);
}
}
| 1,674 | 0.785544 | 0.751493 | 35 | 46.828571 | 45.601685 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.914286 | false | false | 7 |
b8b05822631edb0b5ab749365b39067cdd2e6178 | 36,988,258,387,988 | 41ed728ed7aa09bd990ade146446d905ebbf75c5 | /app/src/main/java/com/orangestudio/mobilereader/Activity/BaseActivity.java | 2543a88711914ee5748c1c93c7ad43360b03ee97 | [] | no_license | skylee968/AndroidExample | https://github.com/skylee968/AndroidExample | 9ca6195b4380e8d2a534af4bb50dcf67066abfe0 | 569c137895bb671a0d58a34367de33989cabc788 | refs/heads/master | 2021-01-10T04:11:23.332000 | 2015-10-02T18:46:47 | 2015-10-02T18:46:47 | 43,560,794 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.orangestudio.mobilereader.Activity;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;
import com.orangestudio.mobilereader.Entity.BookEntity;
import com.orangestudio.mobilereader.Entity.CategoryEntity;
import com.orangestudio.mobilereader.Entity.UserEntity;
import com.orangestudio.mobilereader.Global.AppConfig;
import com.orangestudio.mobilereader.Utils.BookUtils;
/**
* Created by thienlm on 10/2/2015.
*/
public class BaseActivity extends AppCompatActivity {
private BookEntity mCurrnentBook;
private CategoryEntity mCategory;
protected UserEntity mUserInfo;
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
}
public BookEntity getCurrnentBook() {
return mCurrnentBook;
}
public void setCurrnentBook(BookEntity mCurrnentBook) {
this.mCurrnentBook = mCurrnentBook;
}
protected void getCategoryFromIntentData() {
Bundle bundle = getIntent().getExtras();
if(bundle != null) {
String content = bundle.getString(AppConfig.BUNDLE_KEY.CATEGORY);
if(content != null) {
setCategory(BookUtils.deserializeCategoryFromJson(content));
}
}
}
public CategoryEntity getCategory() {
return mCategory;
}
public void setCategory(CategoryEntity mCategory) {
this.mCategory = mCategory;
}
}
| UTF-8 | Java | 1,538 | java | BaseActivity.java | Java | [
{
"context": "o.mobilereader.Utils.BookUtils;\n\n/**\n * Created by thienlm on 10/2/2015.\n */\npublic class BaseActivity exten",
"end": 469,
"score": 0.9996576905250549,
"start": 462,
"tag": "USERNAME",
"value": "thienlm"
}
] | null | [] | package com.orangestudio.mobilereader.Activity;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;
import com.orangestudio.mobilereader.Entity.BookEntity;
import com.orangestudio.mobilereader.Entity.CategoryEntity;
import com.orangestudio.mobilereader.Entity.UserEntity;
import com.orangestudio.mobilereader.Global.AppConfig;
import com.orangestudio.mobilereader.Utils.BookUtils;
/**
* Created by thienlm on 10/2/2015.
*/
public class BaseActivity extends AppCompatActivity {
private BookEntity mCurrnentBook;
private CategoryEntity mCategory;
protected UserEntity mUserInfo;
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
}
public BookEntity getCurrnentBook() {
return mCurrnentBook;
}
public void setCurrnentBook(BookEntity mCurrnentBook) {
this.mCurrnentBook = mCurrnentBook;
}
protected void getCategoryFromIntentData() {
Bundle bundle = getIntent().getExtras();
if(bundle != null) {
String content = bundle.getString(AppConfig.BUNDLE_KEY.CATEGORY);
if(content != null) {
setCategory(BookUtils.deserializeCategoryFromJson(content));
}
}
}
public CategoryEntity getCategory() {
return mCategory;
}
public void setCategory(CategoryEntity mCategory) {
this.mCategory = mCategory;
}
}
| 1,538 | 0.723017 | 0.717815 | 51 | 29.156862 | 24.597443 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431373 | false | false | 7 |
b327dc564779a48af69300aa38fa7f6e8d8c7479 | 36,988,258,387,899 | 1ee5227a2316a51f4d6d2943c7895dfe039cebde | /src/main/java/com/hr/cachemanage/config/SpringConfig.java | 90c11b2043eeb45093c78369aacf915a11035ad0 | [] | no_license | hashRui/cache-manager | https://github.com/hashRui/cache-manager | 1aaa590c1852fa79720dbc010a7c1d874a140edd | 08b121703ad89d2c28123fdaefb3c18124ab90a6 | refs/heads/master | 2023-01-11T16:05:10.319000 | 2022-12-26T14:11:31 | 2022-12-26T14:11:31 | 278,679,726 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hr.cachemanage.config;
import com.hr.cachemanage.core.CacheManager;
import com.hr.cachemanage.enums.SpringUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created by r.hu on 2020/7/10
*/
@Configuration
public class SpringConfig {
@Bean
public CacheManager cacheManager(ApplicationContext context){
CacheManager onlineCacheManager = new CacheManager();
onlineCacheManager.setApplicationContext(context);
return onlineCacheManager;
}
@Bean
public SpringUtil getSpringUtil(){
return SpringUtil.UTIL;
}
}
| UTF-8 | Java | 707 | java | SpringConfig.java | Java | [
{
"context": "ntext.annotation.Configuration;\n\n/**\n * Created by r.hu on 2020/7/10\n */\n@Configuration\npublic class Spri",
"end": 316,
"score": 0.9994770884513855,
"start": 312,
"tag": "USERNAME",
"value": "r.hu"
}
] | null | [] | package com.hr.cachemanage.config;
import com.hr.cachemanage.core.CacheManager;
import com.hr.cachemanage.enums.SpringUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Created by r.hu on 2020/7/10
*/
@Configuration
public class SpringConfig {
@Bean
public CacheManager cacheManager(ApplicationContext context){
CacheManager onlineCacheManager = new CacheManager();
onlineCacheManager.setApplicationContext(context);
return onlineCacheManager;
}
@Bean
public SpringUtil getSpringUtil(){
return SpringUtil.UTIL;
}
}
| 707 | 0.758133 | 0.748232 | 27 | 25.185184 | 22.70591 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37037 | false | false | 7 |
e0897e9e90a0a7ead26df872f527b9a03de0212d | 38,036,230,402,067 | 962b016a0951e559e4acb6f1fb70f9853005c86f | /src/test/java/TestSquare.java | 025e456599274b766ce863a063d85f5532dbc310 | [] | no_license | stealthness/gchq-xmas | https://github.com/stealthness/gchq-xmas | bbaa972a18bfa7c5fac728cbc7b29f8837587b56 | 8d55cdfbe6dcca6acacddbac1901294c3c40fcf1 | HEAD | 2018-01-11T05:09:02.754000 | 2017-11-15T16:11:31 | 2017-11-15T16:11:31 | 47,727,048 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import static org.junit.Assert.*;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import main.STATE;
import main.Square;
public class TestSquare {
private static final int ROW = 0;
private static final int COL = 0;
@Before
public void setUp() throws Exception {
}
@Test
public void testCreate() {
Square s = new Square(1, 3, STATE.NOTSET);
assertEquals(1, s.getCord()[0]);
assertEquals(3, s.getCord()[1]);
assertEquals(STATE.NOTSET, s.getState());
s.setState(STATE.BLACK);
assertEquals(STATE.BLACK, s.getState());
s.setState(STATE.WHITE);
assertEquals(STATE.WHITE, s.getState());
s.setState(STATE.CONFLICT);
assertEquals(STATE.CONFLICT, s.getState());
}
@Test
public void testState() {
Arrays.asList(tests).stream().forEach(TestSquare::assertState);
}
/**
* TestString is in the form;
* "Test message","initial state","new state","expected state","isStrict"
* @param testString
*/
public static void assertState(String testString) {
if (testString.length() > 0 || testString.startsWith("#")) {
String[] args = testString.split(",");
String msg = args[0];
STATE initalState = STATE.getState((args[1]).charAt(0));
STATE newState = STATE.getState((args[2]).charAt(0));
STATE expState = STATE.getState((args[3]).charAt(0));
boolean isStrict = Boolean.parseBoolean(args[4]);
Square square = new Square(ROW, COL, initalState);
square.setState(newState, isStrict);
assertEquals(msg, expState, square.getState());
}
}
String[] tests = new String[] {
"test1,.,B,B,true", "test2,B,.,.,true",
"test3,.,/,/,true", "test4,/,.,.,true",
"test5,B,/,X,true", "test6,/,B,X,true",
"test7,.,X,X,true", "test8,X,.,X,true",
"test9,X,B,X,true", "test10,X,/,X,true",
"test11,.,B,B,false", "test12,B,.,.,false",
"test13,.,/,/,false", "test14,/,.,.,false",
"test15,B,/,/,false", "test16,/,B,B,false",
"test17,.,X,X,false", "test18,X,.,.,false",
"test19,X,B,B,false", "test20,X,/,/,false" };
}
| UTF-8 | Java | 2,032 | java | TestSquare.java | Java | [] | null | [] | package test;
import static org.junit.Assert.*;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import main.STATE;
import main.Square;
public class TestSquare {
private static final int ROW = 0;
private static final int COL = 0;
@Before
public void setUp() throws Exception {
}
@Test
public void testCreate() {
Square s = new Square(1, 3, STATE.NOTSET);
assertEquals(1, s.getCord()[0]);
assertEquals(3, s.getCord()[1]);
assertEquals(STATE.NOTSET, s.getState());
s.setState(STATE.BLACK);
assertEquals(STATE.BLACK, s.getState());
s.setState(STATE.WHITE);
assertEquals(STATE.WHITE, s.getState());
s.setState(STATE.CONFLICT);
assertEquals(STATE.CONFLICT, s.getState());
}
@Test
public void testState() {
Arrays.asList(tests).stream().forEach(TestSquare::assertState);
}
/**
* TestString is in the form;
* "Test message","initial state","new state","expected state","isStrict"
* @param testString
*/
public static void assertState(String testString) {
if (testString.length() > 0 || testString.startsWith("#")) {
String[] args = testString.split(",");
String msg = args[0];
STATE initalState = STATE.getState((args[1]).charAt(0));
STATE newState = STATE.getState((args[2]).charAt(0));
STATE expState = STATE.getState((args[3]).charAt(0));
boolean isStrict = Boolean.parseBoolean(args[4]);
Square square = new Square(ROW, COL, initalState);
square.setState(newState, isStrict);
assertEquals(msg, expState, square.getState());
}
}
String[] tests = new String[] {
"test1,.,B,B,true", "test2,B,.,.,true",
"test3,.,/,/,true", "test4,/,.,.,true",
"test5,B,/,X,true", "test6,/,B,X,true",
"test7,.,X,X,true", "test8,X,.,X,true",
"test9,X,B,X,true", "test10,X,/,X,true",
"test11,.,B,B,false", "test12,B,.,.,false",
"test13,.,/,/,false", "test14,/,.,.,false",
"test15,B,/,/,false", "test16,/,B,B,false",
"test17,.,X,X,false", "test18,X,.,.,false",
"test19,X,B,B,false", "test20,X,/,/,false" };
}
| 2,032 | 0.645669 | 0.622047 | 73 | 26.835617 | 20.717283 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.452055 | false | false | 7 |
c23f9e07285f327d152594775d3338c1afac6640 | 37,830,071,972,648 | 1f8fd51266be50a50912f699840dfe2ed8e3b00c | /Week 3 May 15th May 21st/Maximum Sum Circular Subarray/LeetCode_MaximumSumCircularSubarray.java | 88e2a8423e22d1de6884992b8e6290b10d733515 | [] | no_license | annguyen-hcmus/May-LeetCoding-Challenge | https://github.com/annguyen-hcmus/May-LeetCoding-Challenge | 8390c98532aa25b3000dbe7b9c273adb48c3885c | 0f990b0fa14ec94d6f84bb6d5a6638a56b9c62ae | refs/heads/master | 2022-10-13T00:23:44.805000 | 2020-05-17T09:52:40 | 2020-05-17T09:52:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
public class LeetCode_MaximumSumCircularSubarray {
public static int maxSubarraySumCircular(int[] a) {
int n = a.length;
// Case 1: get the maximum sum using standard kadane'
// s algorithm
int max_kadane = kadane(a);
// Case 2: Now find the maximum sum that includes
// corner elements.
int max_wrap = 0;
for (int i = 0; i < n; i++) {
max_wrap += a[i]; // Calculate array-sum
a[i] = -a[i]; // invert the array (change sign)
}
// max sum with corner elements will be:
// array-sum - (-max subarray sum of inverted array)
max_wrap = max_wrap + kadane(a);
// The maximum circular sum will be maximum of two sums
if (max_kadane > 0)
return (max_wrap > max_kadane) ? max_wrap : max_kadane;
else
return max_kadane;
}
static int kadane(int a[]) {
int n = a.length;
int max_so_far = a[0], max_ending_here = a[0];
for (int i = 1; i < n; i++) {
max_ending_here = Math.max(a[i], max_ending_here + a[i]);
if (max_so_far < max_ending_here)
max_so_far = max_ending_here;
}
return max_so_far;
}
public static void main(String[] args) {
int A[] = { -2, -3, -1 };
System.out.println(maxSubarraySumCircular(A));
}
}
| UTF-8 | Java | 1,260 | java | LeetCode_MaximumSumCircularSubarray.java | Java | [] | null | [] | import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
public class LeetCode_MaximumSumCircularSubarray {
public static int maxSubarraySumCircular(int[] a) {
int n = a.length;
// Case 1: get the maximum sum using standard kadane'
// s algorithm
int max_kadane = kadane(a);
// Case 2: Now find the maximum sum that includes
// corner elements.
int max_wrap = 0;
for (int i = 0; i < n; i++) {
max_wrap += a[i]; // Calculate array-sum
a[i] = -a[i]; // invert the array (change sign)
}
// max sum with corner elements will be:
// array-sum - (-max subarray sum of inverted array)
max_wrap = max_wrap + kadane(a);
// The maximum circular sum will be maximum of two sums
if (max_kadane > 0)
return (max_wrap > max_kadane) ? max_wrap : max_kadane;
else
return max_kadane;
}
static int kadane(int a[]) {
int n = a.length;
int max_so_far = a[0], max_ending_here = a[0];
for (int i = 1; i < n; i++) {
max_ending_here = Math.max(a[i], max_ending_here + a[i]);
if (max_so_far < max_ending_here)
max_so_far = max_ending_here;
}
return max_so_far;
}
public static void main(String[] args) {
int A[] = { -2, -3, -1 };
System.out.println(maxSubarraySumCircular(A));
}
}
| 1,260 | 0.634127 | 0.625397 | 48 | 25.25 | 19.798464 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.041667 | false | false | 7 |
cafb75e6e10da70628fcfa774272ca31c1eef2b1 | 36,979,668,456,750 | 4b026d6aad4c9b884292ee45fce1ae2a0b2942e6 | /EsempioIAL/src/it/ialweb/poi/MainFragment.java | ba1eba6e3b3ac4a57509c3d264b5b681b202faeb | [] | no_license | JuanDQT/ialfvg | https://github.com/JuanDQT/ialfvg | 3f473fcf2192376ef49e089544026b93866a6a04 | de17bad941589bbe80e95aaec08ac73e2b8fbb45 | refs/heads/master | 2021-01-19T15:20:39.877000 | 2015-07-05T21:07:18 | 2015-07-05T21:07:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.ialweb.poi;
import it.ialweb.poi.DownloaderFragment.DownloadListener;
import java.util.ArrayList;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemDecoration;
import android.support.v7.widget.RecyclerView.State;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
public class MainFragment extends Fragment {
private View errorLayout;
private View loadingLayout;
private RecyclerView recycler;
private DownloaderFragment fragment;
private StationsAdapter adapter;
private DownloadListener listener = new DownloadListener() {
@Override
public void onLoad(ArrayList<Station> result) {
populateView(result);
}
@Override
public void onError(int statusCode) {
errorLayout.setVisibility(View.VISIBLE);
loadingLayout.setVisibility(View.GONE);
}
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.station_list_fragment, container, false);
errorLayout = view.findViewById(R.id.error_layout);
loadingLayout = view.findViewById(R.id.loading_layout);
recycler = (RecyclerView) view.findViewById(R.id.recycler);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
if (toolbar != null) {
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
}
view.findViewById(R.id.retry).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadData();
}
});
fragment = DownloaderFragment.getOrCreateFragment(getFragmentManager(), "stationLoader");
if (fragment.isTaskRunning()) {
fragment.attach(listener);
} else {
ArrayList<Station> savedList = null;
if (savedInstanceState != null) {
savedList = savedInstanceState.getParcelableArrayList("stations");
}
if (savedList != null) {
populateView(savedList);
} else {
loadData();
}
}
ViewGroup texts = (ViewGroup) view.findViewById(R.id.texts);
for (int i = 0; i < texts.getChildCount(); i++) {
texts.getChildAt(i).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Snackbar.make(v, "Hello!", Snackbar.LENGTH_LONG).show();
}
});
}
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (adapter != null) {
outState.putParcelableArrayList("stations", adapter.getList());
}
}
private void loadData() {
loadingLayout.setVisibility(View.VISIBLE);
errorLayout.setVisibility(View.GONE);
recycler.setVisibility(View.GONE);
fragment.attachOrLoadData(listener);
}
protected void populateView(final ArrayList<Station> list) {
loadingLayout.setVisibility(View.GONE);
recycler.setVisibility(View.VISIBLE);
recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
recycler.addItemDecoration(new ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.left = 10;
outRect.right = 10;
outRect.bottom = 5;
outRect.top = 5;
}
});
adapter = new StationsAdapter(getActivity(), list, new OpenDetailListener() {
@Override
public void openDetail(Station station, View image) {
DetailFragment detailFragment = (DetailFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.detail_fragment);
if (detailFragment != null) {
detailFragment.populate(station);
} else {
Intent intent = new Intent(getActivity(), DetailActivity.class);
intent.putExtra(DetailFragment.STATION, station);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
openUsingAnimation(image, intent);
} else {
startActivity(intent);
}
}
}
});
recycler.setAdapter(adapter);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void openUsingAnimation(View image, Intent intent) {
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), image, "map");
getActivity().startActivity(intent, options.toBundle());
}
@Override
public void onDestroy() {
super.onDestroy();
if (!getActivity().isChangingConfigurations()) {
fragment.stopTask();
}
}
}
| UTF-8 | Java | 4,849 | java | MainFragment.java | Java | [] | null | [] | package it.ialweb.poi;
import it.ialweb.poi.DownloaderFragment.DownloadListener;
import java.util.ArrayList;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemDecoration;
import android.support.v7.widget.RecyclerView.State;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
public class MainFragment extends Fragment {
private View errorLayout;
private View loadingLayout;
private RecyclerView recycler;
private DownloaderFragment fragment;
private StationsAdapter adapter;
private DownloadListener listener = new DownloadListener() {
@Override
public void onLoad(ArrayList<Station> result) {
populateView(result);
}
@Override
public void onError(int statusCode) {
errorLayout.setVisibility(View.VISIBLE);
loadingLayout.setVisibility(View.GONE);
}
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.station_list_fragment, container, false);
errorLayout = view.findViewById(R.id.error_layout);
loadingLayout = view.findViewById(R.id.loading_layout);
recycler = (RecyclerView) view.findViewById(R.id.recycler);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
if (toolbar != null) {
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
}
view.findViewById(R.id.retry).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadData();
}
});
fragment = DownloaderFragment.getOrCreateFragment(getFragmentManager(), "stationLoader");
if (fragment.isTaskRunning()) {
fragment.attach(listener);
} else {
ArrayList<Station> savedList = null;
if (savedInstanceState != null) {
savedList = savedInstanceState.getParcelableArrayList("stations");
}
if (savedList != null) {
populateView(savedList);
} else {
loadData();
}
}
ViewGroup texts = (ViewGroup) view.findViewById(R.id.texts);
for (int i = 0; i < texts.getChildCount(); i++) {
texts.getChildAt(i).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Snackbar.make(v, "Hello!", Snackbar.LENGTH_LONG).show();
}
});
}
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (adapter != null) {
outState.putParcelableArrayList("stations", adapter.getList());
}
}
private void loadData() {
loadingLayout.setVisibility(View.VISIBLE);
errorLayout.setVisibility(View.GONE);
recycler.setVisibility(View.GONE);
fragment.attachOrLoadData(listener);
}
protected void populateView(final ArrayList<Station> list) {
loadingLayout.setVisibility(View.GONE);
recycler.setVisibility(View.VISIBLE);
recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
recycler.addItemDecoration(new ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.left = 10;
outRect.right = 10;
outRect.bottom = 5;
outRect.top = 5;
}
});
adapter = new StationsAdapter(getActivity(), list, new OpenDetailListener() {
@Override
public void openDetail(Station station, View image) {
DetailFragment detailFragment = (DetailFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.detail_fragment);
if (detailFragment != null) {
detailFragment.populate(station);
} else {
Intent intent = new Intent(getActivity(), DetailActivity.class);
intent.putExtra(DetailFragment.STATION, station);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
openUsingAnimation(image, intent);
} else {
startActivity(intent);
}
}
}
});
recycler.setAdapter(adapter);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void openUsingAnimation(View image, Intent intent) {
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), image, "map");
getActivity().startActivity(intent, options.toBundle());
}
@Override
public void onDestroy() {
super.onDestroy();
if (!getActivity().isChangingConfigurations()) {
fragment.stopTask();
}
}
}
| 4,849 | 0.741596 | 0.738503 | 165 | 28.387878 | 25.559576 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.418182 | false | false | 7 |
77c7a02fe2ff8a20a168e99a59dee005363ac1e8 | 35,046,933,186,314 | cdde23ebe46c8b644632d1fbb7058b32541c67a9 | /Note/src/com/gzfgeh/data/ItemDataProvider.java | b55067244be28127e86193e51e719a5a5839e69d | [] | no_license | RyanTech/Note | https://github.com/RyanTech/Note | 6ba33e8aae3d35b79f37f7a07724c6872d6fddbd | da41cec076248a0f7f0fd6dceab94e0f94830a48 | refs/heads/master | 2017-05-31T04:48:03.192000 | 2015-02-13T09:40:16 | 2015-02-13T09:40:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gzfgeh.data;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
public class ItemDataProvider extends ContentProvider {
private DBOpenHelper dbOpenHelper;
private static final int ITEM = 1;
private static final int ITEMS = 2;
private static UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
static{
uriMatcher.addURI("com.gzfgeh.providers.itemdataprovider", "items", ITEMS);
uriMatcher.addURI("com.gzfgeh.providers.itemdataprovider", "items/#", ITEM);
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
int result;
switch (uriMatcher.match(uri)) {
case ITEMS:
result = db.delete(DBOpenHelper.TABLE_NAME, selection, selectionArgs);
break;
case ITEM:
long id = ContentUris.parseId(uri);
String where = DBOpenHelper.ID + "=" + id;
if (selection != null && !"".equals(selection.trim())){
where += " and " + selection;
}
result = db.delete(DBOpenHelper.TABLE_NAME, where, selectionArgs);
break;
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
return result;
}
@Override
public String getType(Uri uri) {
// TODO Auto-generated method stub
String result;
switch (uriMatcher.match(uri)) {
case ITEMS:
result = "com.gzfgeh.providers.itemdataprovider" + "/" + "items";
break;
case ITEM:
result = "com.gzfgeh.providers.itemdataprovider" + "/" + "items/#";
break;
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
return result;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
long id;
switch (uriMatcher.match(uri)) {
case ITEMS:
id = db.insert(DBOpenHelper.TABLE_NAME, DBOpenHelper.ID, values);
return ContentUris.withAppendedId(uri, id);
case ITEM:
id = db.insert(DBOpenHelper.TABLE_NAME, DBOpenHelper.ID, values);
String uriPath = uri.toString();
String path = uriPath.substring(0,uriPath.lastIndexOf("/")) + id;
return Uri.parse(path);
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
}
@Override
public boolean onCreate() {
// TODO Auto-generated method stub
dbOpenHelper = new DBOpenHelper(this.getContext());
dbOpenHelper.getReadableDatabase();
dbOpenHelper.getWritableDatabase();
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
switch (uriMatcher.match(uri)) {
case ITEMS:
return db.query(DBOpenHelper.TABLE_NAME, projection, selection, selectionArgs,
null, null, sortOrder);
case ITEM:
long id = ContentUris.parseId(uri);
String where = "_id=" + id;
if (selection != null && !"".equals(selection)) {
where = where + " and " + selection;
}
return db.query(DBOpenHelper.TABLE_NAME, projection, where, selectionArgs, null,
null, sortOrder);
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
int result;
switch (uriMatcher.match(uri)) {
case ITEMS:
result = db.update(selection, values, selection, selectionArgs);
break;
case ITEM:
long id = ContentUris.parseId(uri);
String where = "_id=" + id;
if (selection != null && !"".equals(selection)) {
where = where + " and " + selection;
}
result = db.update(DBOpenHelper.TABLE_NAME, values, where, selectionArgs);
break;
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
return result;
}
}
| UTF-8 | Java | 4,581 | java | ItemDataProvider.java | Java | [] | null | [] | package com.gzfgeh.data;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
public class ItemDataProvider extends ContentProvider {
private DBOpenHelper dbOpenHelper;
private static final int ITEM = 1;
private static final int ITEMS = 2;
private static UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
static{
uriMatcher.addURI("com.gzfgeh.providers.itemdataprovider", "items", ITEMS);
uriMatcher.addURI("com.gzfgeh.providers.itemdataprovider", "items/#", ITEM);
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
int result;
switch (uriMatcher.match(uri)) {
case ITEMS:
result = db.delete(DBOpenHelper.TABLE_NAME, selection, selectionArgs);
break;
case ITEM:
long id = ContentUris.parseId(uri);
String where = DBOpenHelper.ID + "=" + id;
if (selection != null && !"".equals(selection.trim())){
where += " and " + selection;
}
result = db.delete(DBOpenHelper.TABLE_NAME, where, selectionArgs);
break;
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
return result;
}
@Override
public String getType(Uri uri) {
// TODO Auto-generated method stub
String result;
switch (uriMatcher.match(uri)) {
case ITEMS:
result = "com.gzfgeh.providers.itemdataprovider" + "/" + "items";
break;
case ITEM:
result = "com.gzfgeh.providers.itemdataprovider" + "/" + "items/#";
break;
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
return result;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
long id;
switch (uriMatcher.match(uri)) {
case ITEMS:
id = db.insert(DBOpenHelper.TABLE_NAME, DBOpenHelper.ID, values);
return ContentUris.withAppendedId(uri, id);
case ITEM:
id = db.insert(DBOpenHelper.TABLE_NAME, DBOpenHelper.ID, values);
String uriPath = uri.toString();
String path = uriPath.substring(0,uriPath.lastIndexOf("/")) + id;
return Uri.parse(path);
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
}
@Override
public boolean onCreate() {
// TODO Auto-generated method stub
dbOpenHelper = new DBOpenHelper(this.getContext());
dbOpenHelper.getReadableDatabase();
dbOpenHelper.getWritableDatabase();
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
switch (uriMatcher.match(uri)) {
case ITEMS:
return db.query(DBOpenHelper.TABLE_NAME, projection, selection, selectionArgs,
null, null, sortOrder);
case ITEM:
long id = ContentUris.parseId(uri);
String where = "_id=" + id;
if (selection != null && !"".equals(selection)) {
where = where + " and " + selection;
}
return db.query(DBOpenHelper.TABLE_NAME, projection, where, selectionArgs, null,
null, sortOrder);
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// TODO Auto-generated method stub
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
int result;
switch (uriMatcher.match(uri)) {
case ITEMS:
result = db.update(selection, values, selection, selectionArgs);
break;
case ITEM:
long id = ContentUris.parseId(uri);
String where = "_id=" + id;
if (selection != null && !"".equals(selection)) {
where = where + " and " + selection;
}
result = db.update(DBOpenHelper.TABLE_NAME, values, where, selectionArgs);
break;
default:
throw new IllegalArgumentException("Uri IllegalArgument:" + uri);
}
return result;
}
}
| 4,581 | 0.64833 | 0.647675 | 137 | 32.437958 | 26.542313 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.058394 | false | false | 7 |
eb9d34a732a296b69db624cda37b86b30c1ca3ec | 19,353,122,689,851 | b1b2a7650c7e96d389c4f8a2c1ff4a2b5d9977ca | /aula6/src/exercicio_mercado/Venda.java | d9159407ea75046bf7a570aeaa08450d76f2f810 | [] | no_license | trizisbea/serratec-poo | https://github.com/trizisbea/serratec-poo | da8736d82496ba2c7ab911ed9d7c17e7d6148fb3 | 2821d1bd2a2b26ab7f533aa836d11fa780b20cf4 | refs/heads/main | 2023-08-18T19:30:03.252000 | 2021-10-07T21:27:25 | 2021-10-07T21:27:25 | 411,045,990 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package exercicio_mercado;
public interface Venda {
public static final double valor = 0;
public default double Vender(double quantidadeItens) {
return valor;
}
}
| UTF-8 | Java | 173 | java | Venda.java | Java | [] | null | [] | package exercicio_mercado;
public interface Venda {
public static final double valor = 0;
public default double Vender(double quantidadeItens) {
return valor;
}
}
| 173 | 0.745665 | 0.739884 | 11 | 14.727273 | 18.005508 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 7 |
37c70e6beffbc0d4090cb4875482889782b9e7d7 | 35,201,552,011,586 | b96232a375777eb88fbef2c31113997adf201db3 | /ClockPlus/src/main/java/cz/mpelant/deskclock/ClockActivity.java | b72b8e7ea10a6d4c6ee7f94a4217084468f65689 | [] | no_license | martinpelant/clock-daydream-plus | https://github.com/martinpelant/clock-daydream-plus | 11b6a52ebe3db38d7e6f18fb93e27de4ed562e91 | c5f36dc1363ea1c83c0ecaae2cb7c74a495cd6e8 | refs/heads/master | 2020-04-01T14:50:55.085000 | 2016-10-10T22:14:11 | 2016-10-14T22:06:31 | 35,155,856 | 3 | 5 | null | false | 2015-09-16T04:18:31 | 2015-05-06T12:01:16 | 2015-06-06T23:45:52 | 2015-05-06T12:03:48 | 6,576 | 1 | 1 | 7 | Java | null | null |
package cz.mpelant.deskclock;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.TextView;
public class ClockActivity extends BaseScreenOnActivity {
private static final int SCREENSAVER_DELAY = 1000 * 30;
public static final String TAG = "ClockActivity";
private View mDigitalClock;
private View mAnalogClock;
private TextView mDate;
private TextView mNextAlarm;
private final Handler mHandler = new Handler();
private final Runnable startScreenSaverRunnable = new Runnable() {
@Override
public void run() {
startActivity(new Intent(ClockActivity.this, ScreensaverActivity.class));
overridePendingTransition(R.anim.undim, R.anim.dim);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_clock_frame);
mDigitalClock = findViewById(R.id.digital_clock);
mAnalogClock = findViewById(R.id.analog_clock);
((View)mAnalogClock.getParent().getParent()).setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
startScreenSaverRunnable.run();
return true;
}
});
mDate = (TextView) findViewById(R.id.date);
mNextAlarm = (TextView) findViewById(R.id.nextAlarm);
setClockStyle();
}
private void setClockStyle() {
Utils.setClockStyle(this, mDigitalClock, mAnalogClock, ScreensaverSettingsActivity.KEY_CLOCK_STYLE);
}
@Override
public void onResume() {
setClockStyle();
updateViews();
mHandler.postDelayed(startScreenSaverRunnable, SCREENSAVER_DELAY);
super.onResume();
}
@Override
public void onPause() {
mHandler.removeCallbacks(startScreenSaverRunnable);
super.onPause();
}
@Override
public void onUserInteraction() {
mHandler.removeCallbacks(startScreenSaverRunnable);
mHandler.postDelayed(startScreenSaverRunnable, SCREENSAVER_DELAY);
super.onUserInteraction();
}
@Override
protected void updateViews() {
Utils.setAlarmTextView(this, mNextAlarm);
Utils.setDateTextView(this, mDate);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem item;
final Intent alarmIntent = Utils.getAlarmPackage(this);
if (alarmIntent != null) {
item = menu.add("Alarms").setIcon(R.drawable.ic_action_alarm);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
startActivity(alarmIntent);
return true;
}
});
}
item = menu.add("Settings").setIcon(R.drawable.ic_action_settings);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
startActivity(new Intent(ClockActivity.this, ScreensaverSettingsActivity.class));
return true;
}
});
return super.onCreateOptionsMenu(menu);
}
}
| UTF-8 | Java | 3,682 | java | ClockActivity.java | Java | [] | null | [] |
package cz.mpelant.deskclock;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.TextView;
public class ClockActivity extends BaseScreenOnActivity {
private static final int SCREENSAVER_DELAY = 1000 * 30;
public static final String TAG = "ClockActivity";
private View mDigitalClock;
private View mAnalogClock;
private TextView mDate;
private TextView mNextAlarm;
private final Handler mHandler = new Handler();
private final Runnable startScreenSaverRunnable = new Runnable() {
@Override
public void run() {
startActivity(new Intent(ClockActivity.this, ScreensaverActivity.class));
overridePendingTransition(R.anim.undim, R.anim.dim);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_clock_frame);
mDigitalClock = findViewById(R.id.digital_clock);
mAnalogClock = findViewById(R.id.analog_clock);
((View)mAnalogClock.getParent().getParent()).setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
startScreenSaverRunnable.run();
return true;
}
});
mDate = (TextView) findViewById(R.id.date);
mNextAlarm = (TextView) findViewById(R.id.nextAlarm);
setClockStyle();
}
private void setClockStyle() {
Utils.setClockStyle(this, mDigitalClock, mAnalogClock, ScreensaverSettingsActivity.KEY_CLOCK_STYLE);
}
@Override
public void onResume() {
setClockStyle();
updateViews();
mHandler.postDelayed(startScreenSaverRunnable, SCREENSAVER_DELAY);
super.onResume();
}
@Override
public void onPause() {
mHandler.removeCallbacks(startScreenSaverRunnable);
super.onPause();
}
@Override
public void onUserInteraction() {
mHandler.removeCallbacks(startScreenSaverRunnable);
mHandler.postDelayed(startScreenSaverRunnable, SCREENSAVER_DELAY);
super.onUserInteraction();
}
@Override
protected void updateViews() {
Utils.setAlarmTextView(this, mNextAlarm);
Utils.setDateTextView(this, mDate);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem item;
final Intent alarmIntent = Utils.getAlarmPackage(this);
if (alarmIntent != null) {
item = menu.add("Alarms").setIcon(R.drawable.ic_action_alarm);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
startActivity(alarmIntent);
return true;
}
});
}
item = menu.add("Settings").setIcon(R.drawable.ic_action_settings);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
startActivity(new Intent(ClockActivity.this, ScreensaverSettingsActivity.class));
return true;
}
});
return super.onCreateOptionsMenu(menu);
}
}
| 3,682 | 0.651548 | 0.649918 | 111 | 32.162163 | 25.737951 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585586 | false | false | 7 |
570f0c4da6053b20770943d5190ca3097bd462f7 | 33,998,961,176,011 | dde612fefc8fe932cb59c41164e76b6c1db96df9 | /src/main/info/view/InfoController.java | 67a2395d4c2ef877aa14ddc0a00b6b58d620a051 | [] | no_license | BB-choi/java-Mitgomeokgo | https://github.com/BB-choi/java-Mitgomeokgo | ea9dac3f227ad83e003230f76bc0e80ee94c146b | e1a8db0a1195ac905bc740b9a8ba32ae0c8a41fd | refs/heads/master | 2023-08-18T15:59:48.886000 | 2021-09-30T23:15:59 | 2021-09-30T23:15:59 | 343,780,307 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.info.view;
import javafx.fxml.FXML;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
public class InfoController{
@FXML WebView wView;
public void setView(String url) {
WebEngine engine = wView.getEngine();
if (url.contains(".html"))
engine.load(getClass().getResource(url).toString());
else engine.load(url);
}
}
| UTF-8 | Java | 364 | java | InfoController.java | Java | [] | null | [] | package main.info.view;
import javafx.fxml.FXML;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
public class InfoController{
@FXML WebView wView;
public void setView(String url) {
WebEngine engine = wView.getEngine();
if (url.contains(".html"))
engine.load(getClass().getResource(url).toString());
else engine.load(url);
}
}
| 364 | 0.728022 | 0.728022 | 18 | 19.222221 | 16.365803 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false | 7 |
e1904e5ce0f99529dbfb062227c4d7d5372ec75b | 33,956,011,506,207 | 4363fa16cea411e46be86eedbf0ea696488cb829 | /src/main/java/com/bitpay/sdk/model/Facade.java | 331cf9cb1be7b6271e9dfc6d503761186d440956 | [
"MIT"
] | permissive | btcpayserver/java-bitpay-client | https://github.com/btcpayserver/java-bitpay-client | cb2fa24c87e7a30180e5e114d265421647cb0287 | 9177e8367478001090904366e44c3cd641a6c29e | refs/heads/master | 2021-09-27T00:11:37.809000 | 2021-09-22T07:39:27 | 2021-09-22T07:39:27 | 185,173,183 | 1 | 2 | MIT | true | 2021-09-22T07:39:27 | 2019-05-06T10:16:07 | 2021-05-25T06:00:20 | 2021-09-22T07:39:27 | 7,968 | 1 | 1 | 0 | HTML | false | false | package com.bitpay.sdk.model;
public class Facade {
public static final String PointOfSale = "pos";
public static final String Merchant = "merchant";
public static final String Payroll = "payroll";
} | UTF-8 | Java | 212 | java | Facade.java | Java | [] | null | [] | package com.bitpay.sdk.model;
public class Facade {
public static final String PointOfSale = "pos";
public static final String Merchant = "merchant";
public static final String Payroll = "payroll";
} | 212 | 0.726415 | 0.726415 | 7 | 29.428572 | 21.486588 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 7 |
519c50a19432961196d73abe1f47d85479022ee1 | 403,726,994,278 | eacef87cc44f963b1a058b4f5adada83142b8c43 | /treasure-web/src/main/java/com/treasure/v2/service/TbkItemInfoApiService.java | e00b6570f1dce0ab5fb307c73f84e87b076d6a3f | [] | no_license | derekac/tk | https://github.com/derekac/tk | dae7789d659ea169ed1e3badd30dcc670e8da9b5 | c2781a94f6b8908769833a2831937b90cd22144d | refs/heads/master | 2021-01-20T00:06:39.647000 | 2017-07-09T07:14:05 | 2017-07-09T07:14:05 | 89,080,272 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.treasure.v2.service;
import com.treasure.v2.model.TbkItemInfoApi;
import java.util.List;
/**
* Created by crow on 2017/5/30.
*/
public interface TbkItemInfoApiService {
/**
* 获得未解析的数据
* @return
*/
List<TbkItemInfoApi> getNotAnalysis();
void hadAnalysis(Long numId);
}
| UTF-8 | Java | 318 | java | TbkItemInfoApiService.java | Java | [
{
"context": "nfoApi;\n\nimport java.util.List;\n\n/**\n * Created by crow on 2017/5/30.\n */\npublic interface TbkItemInfoApi",
"end": 126,
"score": 0.9995599389076233,
"start": 122,
"tag": "USERNAME",
"value": "crow"
}
] | null | [] | package com.treasure.v2.service;
import com.treasure.v2.model.TbkItemInfoApi;
import java.util.List;
/**
* Created by crow on 2017/5/30.
*/
public interface TbkItemInfoApiService {
/**
* 获得未解析的数据
* @return
*/
List<TbkItemInfoApi> getNotAnalysis();
void hadAnalysis(Long numId);
}
| 318 | 0.698676 | 0.668874 | 19 | 14.894737 | 15.887416 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false | 7 |
c2a5f5c60d9556a443c44b1b87e7a66aaa1fc62b | 7,447,473,323,153 | 56fd0ff018f37a56a9cd56ae10abcd65bf8e8b09 | /src/com/yx/sz/laboratory/workflow/service/ILaboratoryManagementService.java | 6779bdf9c797e628f48aff4ba224abe99280ed9a | [] | no_license | labmanage/labmangement | https://github.com/labmanage/labmangement | 335be6b84800802a21ace3f58c93f2cebc841b15 | 372fae3218bc85c1e8d498023413a3927f216d19 | refs/heads/master | 2021-01-10T08:00:38.209000 | 2016-04-21T10:34:04 | 2016-04-21T10:34:04 | 46,032,378 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yx.sz.laboratory.workflow.service;
import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.activiti.engine.impl.pvm.delegate.ActivityExecution;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.task.Comment;
import org.activiti.engine.task.Task;
import cn.itcast.ssh.web.form.WorkflowBean;
import com.yx.sz.laboratory.proStandLibrary.bean.HistoryComment;
import com.yx.sz.laboratory.workflow.bean.AbstractSampleList;
import com.yx.sz.laboratory.workflow.bean.SampleList;
public interface ILaboratoryManagementService {
void saveNewDeploye(File file, String filename);
List<Deployment> findDeploymentList();
List<ProcessDefinition> findProcessDefinitionList();
InputStream findImageInputStream(String deploymentId, String imageName);
void deleteProcessDefinitionByDeploymentId(String deploymentId);
void saveStartProcess(WorkflowBean workflowBean);
List<Task> findTaskListByName(String name);
String findTaskFormKeyByTaskId(String taskId);
SampleList findSampleListByTaskId(String taskId);
List<String> findOutComeListByTaskId(String taskId);
void saveSubmitTask(WorkflowBean workflowBean);
List<HistoryComment> findCommentByTaskId(String taskId);
List<Comment> findCommentBySampleListId(Long id);
ProcessDefinition findProcessDefinitionByTaskId(String taskId);
Map<String, Object> findCoordingByTask(String taskId);
public List<String> findOutComeListByActivityExecution(ActivityExecution execution,String taskId);
public Map<String, Object> findCoordingByTask(ActivityExecution execution,String taskId);
String findProcessDefinitionByDeploymentName(String deploymentName);
/**
* 使用id启动流程
* @param workflowBean
* @throws Exception
*/
void saveStartProcessById(WorkflowBean workflowBean) throws Exception;
/**
* 返回抽样单的抽象父类
* @param taskId
* @return
*/
AbstractSampleList findSampleListInterfaceByTaskId(String taskId);
/**
* 流程实例是由抽样单类型+id的形式标示的,例如畜产品抽样单为:CattleSampleList.6
* @param samleListTypeName
* @param id
* @return
* @throws Exception
*/
List<HistoryComment> findCommentByProcessId(String processId) throws Exception;
}
| UTF-8 | Java | 2,424 | java | ILaboratoryManagementService.java | Java | [] | null | [] | package com.yx.sz.laboratory.workflow.service;
import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.activiti.engine.impl.pvm.delegate.ActivityExecution;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.task.Comment;
import org.activiti.engine.task.Task;
import cn.itcast.ssh.web.form.WorkflowBean;
import com.yx.sz.laboratory.proStandLibrary.bean.HistoryComment;
import com.yx.sz.laboratory.workflow.bean.AbstractSampleList;
import com.yx.sz.laboratory.workflow.bean.SampleList;
public interface ILaboratoryManagementService {
void saveNewDeploye(File file, String filename);
List<Deployment> findDeploymentList();
List<ProcessDefinition> findProcessDefinitionList();
InputStream findImageInputStream(String deploymentId, String imageName);
void deleteProcessDefinitionByDeploymentId(String deploymentId);
void saveStartProcess(WorkflowBean workflowBean);
List<Task> findTaskListByName(String name);
String findTaskFormKeyByTaskId(String taskId);
SampleList findSampleListByTaskId(String taskId);
List<String> findOutComeListByTaskId(String taskId);
void saveSubmitTask(WorkflowBean workflowBean);
List<HistoryComment> findCommentByTaskId(String taskId);
List<Comment> findCommentBySampleListId(Long id);
ProcessDefinition findProcessDefinitionByTaskId(String taskId);
Map<String, Object> findCoordingByTask(String taskId);
public List<String> findOutComeListByActivityExecution(ActivityExecution execution,String taskId);
public Map<String, Object> findCoordingByTask(ActivityExecution execution,String taskId);
String findProcessDefinitionByDeploymentName(String deploymentName);
/**
* 使用id启动流程
* @param workflowBean
* @throws Exception
*/
void saveStartProcessById(WorkflowBean workflowBean) throws Exception;
/**
* 返回抽样单的抽象父类
* @param taskId
* @return
*/
AbstractSampleList findSampleListInterfaceByTaskId(String taskId);
/**
* 流程实例是由抽样单类型+id的形式标示的,例如畜产品抽样单为:CattleSampleList.6
* @param samleListTypeName
* @param id
* @return
* @throws Exception
*/
List<HistoryComment> findCommentByProcessId(String processId) throws Exception;
}
| 2,424 | 0.78339 | 0.782962 | 81 | 26.839506 | 27.480839 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 7 |
d7656b7ee0a1e2ba70321ff2814a5ea57bd98d26 | 23,682,449,677,895 | 1370e657b78899c78ec0a7b12799ff39c52133a2 | /src/main/java/kr/happy/jobkorea/lsm/model/taskFileModel.java | f6a574610646296ba119af5b5e5275b7e104ac24 | [] | no_license | ohbravo4012/happyjob | https://github.com/ohbravo4012/happyjob | 87a5e40acec1aaade8747d895f3caa364a448b12 | c8112ad022b824e982286080c34575d343860603 | refs/heads/master | 2022-11-09T18:51:18.343000 | 2020-06-17T08:20:54 | 2020-06-17T08:20:54 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kr.happy.jobkorea.lsm.model;
public class taskFileModel {
String task_seq;
String snm;
String lgc_fil_nm;
String psc_fil_nm;
String fil_siz;
String fil_ets;
public String getSnm() {
return snm;
}
public void setSnm(String snm) {
this.snm = snm;
}
public String getTask_seq() {
return task_seq;
}
public void setTask_seq(String task_seq) {
this.task_seq = task_seq;
}
public String getLgc_fil_nm() {
return lgc_fil_nm;
}
public void setLgc_fil_nm(String lgc_fil_nm) {
this.lgc_fil_nm = lgc_fil_nm;
}
public String getPsc_fil_nm() {
return psc_fil_nm;
}
public void setPsc_fil_nm(String psc_fil_nm) {
this.psc_fil_nm = psc_fil_nm;
}
public String getFil_siz() {
return fil_siz;
}
public void setFil_siz(String fil_siz) {
this.fil_siz = fil_siz;
}
public String getFil_ets() {
return fil_ets;
}
public void setFil_ets(String fil_ets) {
this.fil_ets = fil_ets;
}
}
| UTF-8 | Java | 998 | java | taskFileModel.java | Java | [] | null | [] | package kr.happy.jobkorea.lsm.model;
public class taskFileModel {
String task_seq;
String snm;
String lgc_fil_nm;
String psc_fil_nm;
String fil_siz;
String fil_ets;
public String getSnm() {
return snm;
}
public void setSnm(String snm) {
this.snm = snm;
}
public String getTask_seq() {
return task_seq;
}
public void setTask_seq(String task_seq) {
this.task_seq = task_seq;
}
public String getLgc_fil_nm() {
return lgc_fil_nm;
}
public void setLgc_fil_nm(String lgc_fil_nm) {
this.lgc_fil_nm = lgc_fil_nm;
}
public String getPsc_fil_nm() {
return psc_fil_nm;
}
public void setPsc_fil_nm(String psc_fil_nm) {
this.psc_fil_nm = psc_fil_nm;
}
public String getFil_siz() {
return fil_siz;
}
public void setFil_siz(String fil_siz) {
this.fil_siz = fil_siz;
}
public String getFil_ets() {
return fil_ets;
}
public void setFil_ets(String fil_ets) {
this.fil_ets = fil_ets;
}
}
| 998 | 0.621242 | 0.621242 | 60 | 14.633333 | 14.70937 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.216667 | false | false | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.