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
1d0b0355ce99d8a7c29b043e37b14e75ab537732
15,393,162,855,509
2912044ff2f874bf62a51bae51d563cd88cdecb7
/src/Day19/Day19_1.java
3aebbe8f478f7ac4444885a1f8cc2163e9dd5f7c
[]
no_license
kourouboy/hhhh
https://github.com/kourouboy/hhhh
37cac66bfff9a5185e2c6827b0f0b01b8d1b9885
c921e71e87b2d853f32f2974d531beb969f3fafd
refs/heads/master
2020-04-26T08:47:50.755000
2019-06-26T12:10:44
2019-06-26T12:10:44
173,434,688
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Day19; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; /** * 反射调用构造 */ //class Person{ // public Person(){} // public Person(String name ){} // public Person(String name ,int age){} //} //public class Day19_1 { // public static void main(String[] args) { // Class<Day19_1> cls = Day19_1.class;//Class <?> cls = Person.class; // //取得类中全部构造 // Constructor<?>[] con = cls.getConstructors(); // for(Constructor<?> constructor : con){ // System.out.println(constructor); // } // } //} //写简单的Java类要写无参构造 //class Person{ // private String name ; // private int age ; // //Class类通过反射实例化对象的时候,只能够调用类中的无参构造。如果类中没有无参构造则无法使用Class类调用,只能够 // //通过明确的构造调用实例化处理 // public Person(){} // public Person(String name, int age) { // this.name = name; // this.age = age; // } // // @Override // public String toString() { // return "Person{" + // "name='" + name + '\'' + // ", age=" + age + // '}'; // } //} //public class Day19_1{ // public static void main(String[] args) throws IllegalAccessException, InstantiationException { // Class<?> cls = Person.class; // System.out.println(cls.newInstance()); // } //} /** * 通过constructo类实例化对象 */ class Person{ private String name; private int age; public Person(String name, int age) { this.name = name; this.age = age; } @Override public String toString() { return "Person{" + "name='" + name + '\'' + ", age=" + age + '}'; } } public class Day19_1{ public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Class<?> cls = Person.class; //取得指定参数类型的构造方法对象 Constructor<?> cons = cls.getConstructor(String.class,int.class); System.out.println(cons.newInstance("lili",22)); } }
UTF-8
Java
2,295
java
Day19_1.java
Java
[]
null
[]
package Day19; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; /** * 反射调用构造 */ //class Person{ // public Person(){} // public Person(String name ){} // public Person(String name ,int age){} //} //public class Day19_1 { // public static void main(String[] args) { // Class<Day19_1> cls = Day19_1.class;//Class <?> cls = Person.class; // //取得类中全部构造 // Constructor<?>[] con = cls.getConstructors(); // for(Constructor<?> constructor : con){ // System.out.println(constructor); // } // } //} //写简单的Java类要写无参构造 //class Person{ // private String name ; // private int age ; // //Class类通过反射实例化对象的时候,只能够调用类中的无参构造。如果类中没有无参构造则无法使用Class类调用,只能够 // //通过明确的构造调用实例化处理 // public Person(){} // public Person(String name, int age) { // this.name = name; // this.age = age; // } // // @Override // public String toString() { // return "Person{" + // "name='" + name + '\'' + // ", age=" + age + // '}'; // } //} //public class Day19_1{ // public static void main(String[] args) throws IllegalAccessException, InstantiationException { // Class<?> cls = Person.class; // System.out.println(cls.newInstance()); // } //} /** * 通过constructo类实例化对象 */ class Person{ private String name; private int age; public Person(String name, int age) { this.name = name; this.age = age; } @Override public String toString() { return "Person{" + "name='" + name + '\'' + ", age=" + age + '}'; } } public class Day19_1{ public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Class<?> cls = Person.class; //取得指定参数类型的构造方法对象 Constructor<?> cons = cls.getConstructor(String.class,int.class); System.out.println(cons.newInstance("lili",22)); } }
2,295
0.564882
0.555716
81
24.604939
22.002626
100
false
false
0
0
0
0
0
0
0.407407
false
false
3
5ea8bec890bac43353470f35ad5230abda4d7002
27,762,668,664,149
7c01d33879706c9932d82f01b24e2cb1e4530549
/app/src/main/java/baikal/web/footballapp/model/Event.java
8fc850e1bd6b5e0a6d08cef2a749be4e494608e0
[]
no_license
B27/ftbl
https://github.com/B27/ftbl
d203320e7cb21bc2f678276f7067d949b8981bfa
7ad679309b96f921b4f5e4716290c59672f3e23e
refs/heads/master
2020-08-02T04:01:06.765000
2019-10-10T05:27:35
2019-10-10T05:27:35
211,226,769
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package baikal.web.footballapp.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class Event implements Serializable { @SerializedName("_id") @Expose private String id; @SerializedName("eventType") @Expose private String eventType; @SerializedName("player") @Expose private String player; @SerializedName("time") @Expose private String time; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getEventType() { return eventType; } public void setEventType(String eventType) { this.eventType = eventType; } public String getPlayer() { return player; } public void setPlayer(String player) { this.player = player; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } }
UTF-8
Java
1,033
java
Event.java
Java
[]
null
[]
package baikal.web.footballapp.model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class Event implements Serializable { @SerializedName("_id") @Expose private String id; @SerializedName("eventType") @Expose private String eventType; @SerializedName("player") @Expose private String player; @SerializedName("time") @Expose private String time; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getEventType() { return eventType; } public void setEventType(String eventType) { this.eventType = eventType; } public String getPlayer() { return player; } public void setPlayer(String player) { this.player = player; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } }
1,033
0.629235
0.629235
55
17.799999
15.242763
50
false
false
0
0
0
0
0
0
0.290909
false
false
3
ddf9690106b2116d5e9d7fb4b0e736a3e72cd6e8
31,542,239,829,502
4a2cf15ea29fc258e5085f7ef6507dc5927b291a
/src/main/java/NBA/sportswatch/repository/AdminRepository.java
6e57e67dc54bf547f6dbbe57a1e48148cfd89b1a
[]
no_license
AugustsKe/FinalProject
https://github.com/AugustsKe/FinalProject
549969027673ccb501a5af6c7e2869a3232cb9ec
2848b273d58aba10650aff5afdcd4b7422cbff77
refs/heads/master
2020-04-11T14:40:18.208000
2018-12-13T22:24:05
2018-12-13T22:24:05
161,863,596
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package NBA.sportswatch.repository; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import NBA.sportswatch.model.*; @Repository public interface AdminRepository extends CrudRepository<Admin, String>{ // public Admin findByAdminId(String adminId); public Admin findByAdminName(String adminName); }
UTF-8
Java
363
java
AdminRepository.java
Java
[]
null
[]
package NBA.sportswatch.repository; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import NBA.sportswatch.model.*; @Repository public interface AdminRepository extends CrudRepository<Admin, String>{ // public Admin findByAdminId(String adminId); public Admin findByAdminName(String adminName); }
363
0.831956
0.831956
12
29.25
24.765987
71
false
false
0
0
0
0
0
0
0.75
false
false
3
97ceb51eb4370506ba5c8138c3346b2a6e7642b1
30,150,670,488,145
6e9312528c31286388118d2a8206b7df7da8117a
/src/main/java/br/com/codepampa/enumerator/ReferenciaEnum.java
b7706b9d4c0cb8dce25caad8003c547640418b7e
[]
no_license
omeuerodrigofreitas/ticket-helper
https://github.com/omeuerodrigofreitas/ticket-helper
be5fa5b9ce3a4b6cd0dd6f6679caaa971762782a
6ac6ab131b0159a2efe7b43fe2a46668f7e72684
refs/heads/master
2021-07-05T19:10:12.483000
2017-01-12T11:28:57
2017-01-12T11:28:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.codepampa.enumerator; import br.com.codepampa.util.CodePampaInterfacesEnum; public enum ReferenciaEnum implements CodePampaInterfacesEnum{ ALTERACAO("Alteração"), CADASTRO("Cadastro"), EXCLUSSAO("Exclussão"), ORIGEMLISTAGEM("Origem-Listagem") ; private String nome; private ReferenciaEnum(String nome){ this.nome = nome; } @Override public String getNome() { return nome; } }
UTF-8
Java
469
java
ReferenciaEnum.java
Java
[]
null
[]
package br.com.codepampa.enumerator; import br.com.codepampa.util.CodePampaInterfacesEnum; public enum ReferenciaEnum implements CodePampaInterfacesEnum{ ALTERACAO("Alteração"), CADASTRO("Cadastro"), EXCLUSSAO("Exclussão"), ORIGEMLISTAGEM("Origem-Listagem") ; private String nome; private ReferenciaEnum(String nome){ this.nome = nome; } @Override public String getNome() { return nome; } }
469
0.669528
0.669528
22
20.181818
21.474375
74
false
false
0
0
0
0
0
0
0.409091
false
false
3
6fc7d9959b2fe850fcb8124e2e75b9af8da49fa9
15,831,249,499,723
a005d4f2b5c3722495cc8e5dc2dd13e3fea3914c
/lab 2/TheGame.java
90c4444d5169c31a5149dfee6e7589452408b3df
[]
no_license
MohamedMetwalli5/the-data-structure-labs
https://github.com/MohamedMetwalli5/the-data-structure-labs
010a2223aede6cfb73ad3ac37c49c6a37f27709f
04fc4370cffa0b2ee3ec3b2641eaa2275cb40058
refs/heads/master
2021-01-07T13:27:03.476000
2020-04-18T01:11:02
2020-04-18T01:11:02
241,709,181
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package eg.edu.alexu.csd.datastructure.hangman.cs; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class TheGame implements IHangman{ String[] words = new String[100]; public String[] dictionary() throws FileNotFoundException{ File file = new File("C:/Users/Mohamed/Desktop/hangmangamedictionary.txt"); Scanner scan = new Scanner(file); //String[] words = new String[1000]; int i=0; while(scan.hasNextLine()) { words[i]=scan.nextLine(); i++; } return words; } public void setDictionary(String[] words) { this.words = words; } String word1; char[] word2 ; public String selectRandomSecretWord() { double choose1 = Math.random(); //here we choose a random number int choose2 = (int) choose1 * 100; word1 = words[choose2]; //this is the randomly chosen word word2 = new char[word1.length()] ; int d; for(d=0;d<word1.length();d++) { word2[d]='-'; } return word1; } public static int counter=0; //this counter will e later an indicator of whether we reached the maximum number of wrong guesses or not public String guess(Character c) throws Exception{ int theindex=0; int j; boolean flag = false; //the flag is an indicator about whether the C character was found in the word or not for(j=0;j<word1.length();j++) { //here we loop through the word to know if the character is in the world or not if(Character.toLowerCase(c) == word1.charAt(j) || Character.toUpperCase(c) == word1.charAt(j)){ theindex = j; word2[theindex]=word1.charAt(theindex); flag=true; //if the flag is true then we must have entered the loop } } if(flag==false){ counter = counter+1; if(counter==maximum){ return null; }else { String str1 = new String(word2); return str1; } }else{ String str2 = new String(word2); return str2; } } int maximum =0; public void setMaxWrongGuesses(Integer max) { maximum = max; if (max ==null || max<1) { //if the user didn't enter any value then the maximum number of wrong guesses is 1 maximum=1; } } }
UTF-8
Java
2,371
java
TheGame.java
Java
[ { "context": "ndException{\r\n\t\t\t File file = new File(\"C:/Users/Mohamed/Desktop/hangmangamedictionary.txt\");\r\n\t\t\t Scanne", "end": 342, "score": 0.9312875270843506, "start": 335, "tag": "NAME", "value": "Mohamed" } ]
null
[]
package eg.edu.alexu.csd.datastructure.hangman.cs; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class TheGame implements IHangman{ String[] words = new String[100]; public String[] dictionary() throws FileNotFoundException{ File file = new File("C:/Users/Mohamed/Desktop/hangmangamedictionary.txt"); Scanner scan = new Scanner(file); //String[] words = new String[1000]; int i=0; while(scan.hasNextLine()) { words[i]=scan.nextLine(); i++; } return words; } public void setDictionary(String[] words) { this.words = words; } String word1; char[] word2 ; public String selectRandomSecretWord() { double choose1 = Math.random(); //here we choose a random number int choose2 = (int) choose1 * 100; word1 = words[choose2]; //this is the randomly chosen word word2 = new char[word1.length()] ; int d; for(d=0;d<word1.length();d++) { word2[d]='-'; } return word1; } public static int counter=0; //this counter will e later an indicator of whether we reached the maximum number of wrong guesses or not public String guess(Character c) throws Exception{ int theindex=0; int j; boolean flag = false; //the flag is an indicator about whether the C character was found in the word or not for(j=0;j<word1.length();j++) { //here we loop through the word to know if the character is in the world or not if(Character.toLowerCase(c) == word1.charAt(j) || Character.toUpperCase(c) == word1.charAt(j)){ theindex = j; word2[theindex]=word1.charAt(theindex); flag=true; //if the flag is true then we must have entered the loop } } if(flag==false){ counter = counter+1; if(counter==maximum){ return null; }else { String str1 = new String(word2); return str1; } }else{ String str2 = new String(word2); return str2; } } int maximum =0; public void setMaxWrongGuesses(Integer max) { maximum = max; if (max ==null || max<1) { //if the user didn't enter any value then the maximum number of wrong guesses is 1 maximum=1; } } }
2,371
0.599747
0.581611
71
31.394365
30.515976
135
false
false
0
0
0
0
0
0
2.070423
false
false
3
65506f19cd5ecdae83131e6875ff9b99ff497c34
17,824,114,330,018
9e79c6eb6a2adf06ad3668e4f92d020e1efcf20d
/src/main/java/org/adams/web/project_management/data/repository/jpa/TrafficLightJpaRepository.java
77fd8d42753e5545faef413e79feaf97bf43d6d2
[]
no_license
Thomas-Adams/proman
https://github.com/Thomas-Adams/proman
296fa1c6c2c62314cb5bca8ee3bfe87ed5184af0
a794d8289ae6aecd4f0b259e15a859e219784e71
refs/heads/master
2016-08-12T11:16:04.580000
2016-02-26T01:05:42
2016-02-26T01:05:42
52,568,206
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.adams.web.project_management.data.repository.jpa; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; import org.adams.web.project_management.persistence.entity.jpa.TrafficLightEntity; /** * Repository : TrafficLight. */ @Repository public interface TrafficLightJpaRepository extends PagingAndSortingRepository<TrafficLightEntity, Integer>,JpaRepository<TrafficLightEntity, Integer>,QueryDslPredicateExecutor<TrafficLightEntity> { }
UTF-8
Java
649
java
TrafficLightJpaRepository.java
Java
[]
null
[]
package org.adams.web.project_management.data.repository.jpa; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; import org.adams.web.project_management.persistence.entity.jpa.TrafficLightEntity; /** * Repository : TrafficLight. */ @Repository public interface TrafficLightJpaRepository extends PagingAndSortingRepository<TrafficLightEntity, Integer>,JpaRepository<TrafficLightEntity, Integer>,QueryDslPredicateExecutor<TrafficLightEntity> { }
649
0.859784
0.859784
15
42.266666
50.956802
197
false
false
0
0
0
0
0
0
0.666667
false
false
3
b3f58770ac8f327f1d9c5a9d5731d88d96fae6db
34,961,033,804,987
58f9395bd2a98c8e9b58ec7063e8133c32ace0c0
/algorithm/src/main/java/com/ivy/algorithm/binarySearch/sqrt/SolutionTest.java
bc7d2ddd2ebcfbce657b55106a331ddc0240c7b4
[]
no_license
fengivy/Algorithm
https://github.com/fengivy/Algorithm
2badf216c34d6a6ee1c28eeca4e60f0ce053c1e0
7c5d382ecb784730040eb024b1fcb3ecbdb41f2c
refs/heads/master
2022-11-20T02:14:29.024000
2020-07-16T14:08:39
2020-07-16T14:08:39
265,989,554
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ivy.algorithm.binarySearch.sqrt; public class SolutionTest { public static void main(String[] args) { /*System.out.println("---------------"+new Solution().mySqrt(4)); System.out.println("---------------"+new Solution().mySqrt(8)); System.out.println("---------------"+new Solution().mySqrt(9)); System.out.println("---------------"+new Solution().mySqrt(15));*/ System.out.println("---------------"+new Solution().mySqrt(2147395599)); } }
UTF-8
Java
501
java
SolutionTest.java
Java
[]
null
[]
package com.ivy.algorithm.binarySearch.sqrt; public class SolutionTest { public static void main(String[] args) { /*System.out.println("---------------"+new Solution().mySqrt(4)); System.out.println("---------------"+new Solution().mySqrt(8)); System.out.println("---------------"+new Solution().mySqrt(9)); System.out.println("---------------"+new Solution().mySqrt(15));*/ System.out.println("---------------"+new Solution().mySqrt(2147395599)); } }
501
0.540918
0.510978
11
44.545456
30.281599
80
false
false
0
0
0
0
0
0
0.545455
false
false
3
8651fe2ebacf134cadb54c53d185c7f3f938a1b6
38,422,777,432,045
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i4494.java
d5ed24c1d2ccd52fe0cf3a79c23ea84671cb614b
[]
no_license
vincentclee/jvm-limits
https://github.com/vincentclee/jvm-limits
b72a2f2dcc18caa458f1e77924221d585f23316b
2fd1c26d1f7984ea8163bc103ad14b6d72282281
refs/heads/master
2020-05-18T11:18:41.711000
2014-09-14T04:25:18
2014-09-14T04:25:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package number_of_direct_superinterfaces; public interface i4494 {}
UTF-8
Java
68
java
i4494.java
Java
[]
null
[]
package number_of_direct_superinterfaces; public interface i4494 {}
68
0.823529
0.764706
3
22
16.872068
41
false
false
0
0
0
0
0
0
0.333333
false
false
3
4d29a005f4ee772ae9fedda165a3c433e50c6442
29,695,403,925,825
376477b84e3d1bcbb1312ace065f15ea8166e858
/Chagora/app/src/main/java/com/example/segoo/chagora/CallActivity.java
70bc3248c9be48ef604ab8a96aaa1d030c8afa62
[]
no_license
sergiolemus/Chagora
https://github.com/sergiolemus/Chagora
c9fc605d645bea9db34f843a6074ec13aacf63cc
770d7ba2acf767cb2b09e99649010102a52a1635
refs/heads/master
2020-04-07T10:01:46.071000
2019-01-24T03:30:18
2019-01-24T03:30:18
158,162,230
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.segoo.chagora; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; public class CallActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_call); Button settingsActivity = (Button) findViewById(R.id.settingsBttn); Button msgActivity = (Button) findViewById(R.id.msgBttn); Button newCallActivity = (Button) findViewById(R.id.newCallBttn); settingsActivity.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent settingsIntent = new Intent( getApplicationContext(), SettingsActivity.class ); startActivity( settingsIntent ); } }); msgActivity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent msgIntent = new Intent( getApplicationContext(), TextActivity.class ); startActivity( msgIntent ); } }); newCallActivity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent newCallIntent = new Intent( getApplicationContext(), NewCallActivity.class ); startActivity( newCallIntent ); } }); } }
UTF-8
Java
1,577
java
CallActivity.java
Java
[]
null
[]
package com.example.segoo.chagora; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; public class CallActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_call); Button settingsActivity = (Button) findViewById(R.id.settingsBttn); Button msgActivity = (Button) findViewById(R.id.msgBttn); Button newCallActivity = (Button) findViewById(R.id.newCallBttn); settingsActivity.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent settingsIntent = new Intent( getApplicationContext(), SettingsActivity.class ); startActivity( settingsIntent ); } }); msgActivity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent msgIntent = new Intent( getApplicationContext(), TextActivity.class ); startActivity( msgIntent ); } }); newCallActivity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent newCallIntent = new Intent( getApplicationContext(), NewCallActivity.class ); startActivity( newCallIntent ); } }); } }
1,577
0.640457
0.639822
53
28.754717
29.305099
102
false
false
0
0
0
0
0
0
0.433962
false
false
3
30d6ab687c8dea55dc28ba9dda5cbc0538bb810d
30,245,159,751,282
e3132a06ead2f631e955b46c8ff301a20a16e250
/src/main/java/org/openbaton/integration/test/testers/GenericServiceTester.java
c7198d036a0228637e6fa7715544b73b6fff2702
[ "Apache-2.0" ]
permissive
openbaton/integration-tests
https://github.com/openbaton/integration-tests
d8da7e406248098a8b89104c712156f1ae297393
896834be8a9df71020b5ab269cf255b4b85e7a70
refs/heads/master
2021-01-16T23:44:47.258000
2018-09-11T12:35:53
2018-09-11T12:35:53
48,202,252
4
8
Apache-2.0
false
2020-10-06T17:46:35
2015-12-17T22:44:44
2018-09-11T12:36:04
2020-10-06T17:45:45
5,697
4
3
3
Java
false
false
/* * Copyright (c) 2016 Open Baton (http://www.openbaton.org) * * 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.openbaton.integration.test.testers; import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.ini4j.Profile; import org.openbaton.catalogue.mano.common.Ip; import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit; import org.openbaton.catalogue.mano.record.NetworkServiceRecord; import org.openbaton.catalogue.mano.record.VNFCInstance; import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; import org.openbaton.catalogue.nfvo.Configuration; import org.openbaton.catalogue.nfvo.ConfigurationParameter; import org.openbaton.integration.test.utils.Tester; import org.openbaton.integration.test.utils.Utils; import org.openbaton.integration.test.utils.VNFCRepresentation; /** * Created by tbr on 25.11.15. * * <p>This Tester can run shell scripts on the virtual machines created by the service and check in * the scripts if everything works as expected. */ public class GenericServiceTester extends Tester { private List<File> scripts = new LinkedList<>(); private Map<String, List<VNFCRepresentation>> vnfrVnfc = new HashMap<>(); private String vnfrType = ""; private String virtualLink = ""; private String userName = ""; private String vmScriptsPath = ""; public GenericServiceTester(Properties properties) { super(properties, GenericServiceTester.class); } @Override protected Serializable prepareObject() { return null; } @Override protected Object doWork() throws Exception { NetworkServiceRecord nsr = (NetworkServiceRecord) getParam(); fillVnfrVnfc(nsr); List<String> floatingIps = new LinkedList<>(); if (virtualLink.equals("")) { if (vnfrVnfc.containsKey(vnfrType)) { for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfrType)) { if (vnfc.getAllFips() != null) floatingIps.addAll(vnfc.getAllFips()); } } } else { if (vnfrVnfc.containsKey(vnfrType)) { for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfrType)) { if (vnfc.getFipsByNet(virtualLink) != null) floatingIps.addAll(vnfc.getFipsByNet(virtualLink)); } } } Iterator<String> floatingIpIt = floatingIps.iterator(); if (!virtualLink.equals("")) { if (floatingIps.size() == 0) { log.warn( "Found no floating IPs for virtual machines of vnf-type " + vnfrType + " with virtual_link: " + virtualLink + "."); } else { log.info( "Start testing the virtual machines of vnf-type " + vnfrType + " with virtual_link " + virtualLink + "."); } } else { if (floatingIps.size() == 0) { log.warn("Found no floating IPs for virtual machines of vnf-type " + vnfrType + "."); } else { log.info("Start testing the virtual machines of vnf-type " + vnfrType + "."); } } while (floatingIpIt.hasNext()) { String floatingIp = floatingIpIt.next(); for (File script : scripts) { String scriptContent = getContentOfScript(script.getPath()); List<String> preScripts = getPreScripts(scriptContent); if (preScripts.size() == 0) preScripts.add(""); for (String preScript : preScripts) { log.info( "Executing script " + script.getName() + " on the virtual machine with floating ip: " + floatingIp + "\nwith environment: \n" + preScript); //store script on VM ProcessBuilder pb = new ProcessBuilder( "/bin/sh", "-c", "scp -o \"StrictHostKeyChecking no\" " + (sshPrivateKeyFilePath == null && !new File(sshPrivateKeyFilePath).exists() ? "" : "-i " + sshPrivateKeyFilePath + " ") + script.getPath() + " " + userName + "@" + floatingIp + ":" + vmScriptsPath); Process copy = pb.start(); int exitStatus = copy.waitFor(); if (exitStatus != 0) { log.error("Script " + script.getName() + " could not be sent."); throw new Exception("Script " + script.getName() + " could not be sent."); } //execute script on VM pb = new ProcessBuilder( "/bin/sh", "-c", "ssh -o \"StrictHostKeyChecking no\" " + (sshPrivateKeyFilePath == null && !new File(sshPrivateKeyFilePath).exists() ? "" : "-i " + sshPrivateKeyFilePath + " ") + userName + "@" + floatingIp + " \"" + preScript + " source " + vmScriptsPath + "/" + script.getName() + "\""); Process execute = pb.redirectOutput(ProcessBuilder.Redirect.INHERIT).start(); exitStatus = execute.waitFor(); if (exitStatus != 0) { log.error("Script " + script.getName() + " exited with status " + exitStatus + "."); throw new Exception( "Script " + script.getName() + " exited with status " + exitStatus + " on " + floatingIp + "."); } else { log.info("Script " + script.getName() + " exited successfully on " + floatingIp + "."); } } } } return param; } @Override public void configureSubTask(Profile.Section currentSection) { Boolean stop = false; String vnfrType = currentSection.get("vnf-type"); String vmScriptsPath = currentSection.get("vm-scripts-path"); String user = currentSection.get("user-name"); if (vnfrType != null) { this.setVnfrType(vnfrType); } if (vmScriptsPath != null) { this.setVmScriptsPath(vmScriptsPath); } String netName = currentSection.get("net-name"); if (netName != null) { this.setVirtualLink(netName); } if (user != null) { this.setUserName(user); } for (int i = 1; !stop; i++) { String scriptName = currentSection.get("script-" + i); if (scriptName == null || scriptName.isEmpty()) { stop = true; continue; } this.addScript(scriptName); } } /** * Get the content of a script as a String by passing the path to the script file. * * @param script * @return * @throws IOException */ private String getContentOfScript(String script) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(script)); return new String(encoded, StandardCharsets.UTF_8); } /** * @param text * @param variable * @return true if the String variable is present in the given String text */ private boolean findInText(String text, String variable) { Matcher matcher = Pattern.compile("\\$[{]" + variable + "[}]").matcher(text); return matcher.find(); } /** * Fill the Map vnfrVnfc. * * @param nsr */ private void fillVnfrVnfc(NetworkServiceRecord nsr) { for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) { List<VNFCRepresentation> representationList = new LinkedList<>(); Configuration conf = vnfr.getConfigurations(); Map<String, String> confMap = new HashMap<>(); for (ConfigurationParameter confPar : conf.getConfigurationParameters()) { confMap.put(confPar.getConfKey(), confPar.getValue()); } for (VirtualDeploymentUnit vdu : vnfr.getVdu()) { for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) { VNFCRepresentation vnfcRepresentation = new VNFCRepresentation(); vnfcRepresentation.setVnfrName(vnfr.getName()); vnfcRepresentation.setHostname(vnfcInstance.getHostname()); vnfcRepresentation.setConfiguration(confMap); for (Ip ip : vnfcInstance.getIps()) { vnfcRepresentation.addNetIp(ip.getNetName(), ip.getIp()); } for (Ip fIp : vnfcInstance.getFloatingIps()) { vnfcRepresentation.addNetFip(fIp.getNetName(), fIp.getIp()); } representationList.add(vnfcRepresentation); } } if (!vnfrVnfc.containsKey(vnfr.getType())) { vnfrVnfc.put(vnfr.getType(), representationList); } else { List<VNFCRepresentation> l = vnfrVnfc.get(vnfr.getType()); l.addAll(representationList); } } } /** * Add variable assignments needed for the script to the beginning of it. * * @param script * @return */ private List<String> getPreScripts(String script) { List<String> preScripts = new LinkedList<>(); Map<String, LinkedList<String>> variableValuesMap = new HashMap<>(); // handle variable of type ${vnfrtype_configurationkey} String configurationDeclarations = ""; for (String vnfr : vnfrVnfc.keySet()) { for (String confKey : vnfrVnfc.get(vnfr).get(0).getAllConfigurationKeys()) { configurationDeclarations += vnfr + "_" + confKey + "=" + vnfrVnfc.get(vnfr).get(0).getConfiguration(confKey) + "; "; } // handle variables of type ${vnfrtype_fip} if (findInText(script, vnfr + "_fip")) { LinkedList<String> fips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) fips.addAll(vnfc.getAllFips()); variableValuesMap.put(vnfr + "_fip", fips); } // handle variables of type ${vnfrtype_ip} if (findInText(script, vnfr + "_ip")) { LinkedList<String> ips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) { ips.addAll(vnfc.getAllIps()); } variableValuesMap.put(vnfr + "_ip", ips); } // store all the network names occurring in that vnfr in a Set Set<String> netnames = new HashSet<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) { for (String net : vnfc.getAllNetNames()) { if (!netnames.contains(net)) netnames.add(net); } } for (String net : netnames) { // handle variables of type ${vnfrtype_network_fip} if (findInText(script, vnfr + "_" + net.replace('-', '_') + "_fip")) { LinkedList<String> fips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) fips.addAll(vnfc.getFipsByNet(net)); variableValuesMap.put(vnfr + "_" + net.replace('-', '_') + "_fip", fips); } // handle variables of type ${vnfrtype_network_ip} if (findInText(script, vnfr + "_" + net.replace('-', '_') + "_ip")) { LinkedList<String> ips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) ips.addAll(vnfc.getIpsByNet(net)); variableValuesMap.put(vnfr + "_" + net.replace('-', '_') + "_ip", ips); } } } // create the prescripts boolean noMoreElements = false; while (!noMoreElements) { String prescript = ""; noMoreElements = true; for (String varName : variableValuesMap.keySet()) { String value; if (variableValuesMap.get(varName).size() > 1) { value = variableValuesMap.get(varName).poll(); noMoreElements = false; } else { value = variableValuesMap.get(varName).peek(); } prescript += varName + "=" + value + "; "; } prescript += configurationDeclarations; preScripts.add(prescript); } return preScripts; } public void addScript(String scriptName) { File f = new File(properties.getProperty("scripts-path") + scriptName); if (!f.exists()) { File t = new File("/tmp/" + scriptName); try (InputStream is = Utils.getInputStream(properties.getProperty("scripts-path") + scriptName); OutputStream os = new FileOutputStream(t)) { byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } } catch (IOException e) { e.printStackTrace(); } f = t; } if (!f.exists()) log.warn(scriptName + " does not exist."); else scripts.add(f); } public void setVnfrType(String vnfrType) { this.vnfrType = vnfrType; } public void setVirtualLink(String virtualLink) { this.virtualLink = virtualLink; } public void setUserName(String name) { this.userName = name; } public void setVmScriptsPath(String vmScriptsPath) { this.vmScriptsPath = vmScriptsPath; } }
UTF-8
Java
13,794
java
GenericServiceTester.java
Java
[ { "context": ".test.utils.VNFCRepresentation;\n\n/**\n * Created by tbr on 25.11.15.\n *\n * <p>This Tester can run shell s", "end": 1512, "score": 0.9995534420013428, "start": 1509, "tag": "USERNAME", "value": "tbr" }, { "context": " private String virtualLink = \"\";\n private String userName = \"\";\n private String vmScriptsPath = \"\";\n\n pub", "end": 1952, "score": 0.9402946829795837, "start": 1944, "tag": "USERNAME", "value": "userName" }, { "context": " + \" \"\n + userName\n + \"@\"\n ", "end": 4839, "score": 0.9953724145889282, "start": 4831, "tag": "USERNAME", "value": "userName" }, { "context": "hPrivateKeyFilePath + \" \")\n + userName\n + \"@\"\n ", "end": 5681, "score": 0.9909412860870361, "start": 5673, "tag": "USERNAME", "value": "userName" } ]
null
[]
/* * Copyright (c) 2016 Open Baton (http://www.openbaton.org) * * 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.openbaton.integration.test.testers; import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.ini4j.Profile; import org.openbaton.catalogue.mano.common.Ip; import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit; import org.openbaton.catalogue.mano.record.NetworkServiceRecord; import org.openbaton.catalogue.mano.record.VNFCInstance; import org.openbaton.catalogue.mano.record.VirtualNetworkFunctionRecord; import org.openbaton.catalogue.nfvo.Configuration; import org.openbaton.catalogue.nfvo.ConfigurationParameter; import org.openbaton.integration.test.utils.Tester; import org.openbaton.integration.test.utils.Utils; import org.openbaton.integration.test.utils.VNFCRepresentation; /** * Created by tbr on 25.11.15. * * <p>This Tester can run shell scripts on the virtual machines created by the service and check in * the scripts if everything works as expected. */ public class GenericServiceTester extends Tester { private List<File> scripts = new LinkedList<>(); private Map<String, List<VNFCRepresentation>> vnfrVnfc = new HashMap<>(); private String vnfrType = ""; private String virtualLink = ""; private String userName = ""; private String vmScriptsPath = ""; public GenericServiceTester(Properties properties) { super(properties, GenericServiceTester.class); } @Override protected Serializable prepareObject() { return null; } @Override protected Object doWork() throws Exception { NetworkServiceRecord nsr = (NetworkServiceRecord) getParam(); fillVnfrVnfc(nsr); List<String> floatingIps = new LinkedList<>(); if (virtualLink.equals("")) { if (vnfrVnfc.containsKey(vnfrType)) { for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfrType)) { if (vnfc.getAllFips() != null) floatingIps.addAll(vnfc.getAllFips()); } } } else { if (vnfrVnfc.containsKey(vnfrType)) { for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfrType)) { if (vnfc.getFipsByNet(virtualLink) != null) floatingIps.addAll(vnfc.getFipsByNet(virtualLink)); } } } Iterator<String> floatingIpIt = floatingIps.iterator(); if (!virtualLink.equals("")) { if (floatingIps.size() == 0) { log.warn( "Found no floating IPs for virtual machines of vnf-type " + vnfrType + " with virtual_link: " + virtualLink + "."); } else { log.info( "Start testing the virtual machines of vnf-type " + vnfrType + " with virtual_link " + virtualLink + "."); } } else { if (floatingIps.size() == 0) { log.warn("Found no floating IPs for virtual machines of vnf-type " + vnfrType + "."); } else { log.info("Start testing the virtual machines of vnf-type " + vnfrType + "."); } } while (floatingIpIt.hasNext()) { String floatingIp = floatingIpIt.next(); for (File script : scripts) { String scriptContent = getContentOfScript(script.getPath()); List<String> preScripts = getPreScripts(scriptContent); if (preScripts.size() == 0) preScripts.add(""); for (String preScript : preScripts) { log.info( "Executing script " + script.getName() + " on the virtual machine with floating ip: " + floatingIp + "\nwith environment: \n" + preScript); //store script on VM ProcessBuilder pb = new ProcessBuilder( "/bin/sh", "-c", "scp -o \"StrictHostKeyChecking no\" " + (sshPrivateKeyFilePath == null && !new File(sshPrivateKeyFilePath).exists() ? "" : "-i " + sshPrivateKeyFilePath + " ") + script.getPath() + " " + userName + "@" + floatingIp + ":" + vmScriptsPath); Process copy = pb.start(); int exitStatus = copy.waitFor(); if (exitStatus != 0) { log.error("Script " + script.getName() + " could not be sent."); throw new Exception("Script " + script.getName() + " could not be sent."); } //execute script on VM pb = new ProcessBuilder( "/bin/sh", "-c", "ssh -o \"StrictHostKeyChecking no\" " + (sshPrivateKeyFilePath == null && !new File(sshPrivateKeyFilePath).exists() ? "" : "-i " + sshPrivateKeyFilePath + " ") + userName + "@" + floatingIp + " \"" + preScript + " source " + vmScriptsPath + "/" + script.getName() + "\""); Process execute = pb.redirectOutput(ProcessBuilder.Redirect.INHERIT).start(); exitStatus = execute.waitFor(); if (exitStatus != 0) { log.error("Script " + script.getName() + " exited with status " + exitStatus + "."); throw new Exception( "Script " + script.getName() + " exited with status " + exitStatus + " on " + floatingIp + "."); } else { log.info("Script " + script.getName() + " exited successfully on " + floatingIp + "."); } } } } return param; } @Override public void configureSubTask(Profile.Section currentSection) { Boolean stop = false; String vnfrType = currentSection.get("vnf-type"); String vmScriptsPath = currentSection.get("vm-scripts-path"); String user = currentSection.get("user-name"); if (vnfrType != null) { this.setVnfrType(vnfrType); } if (vmScriptsPath != null) { this.setVmScriptsPath(vmScriptsPath); } String netName = currentSection.get("net-name"); if (netName != null) { this.setVirtualLink(netName); } if (user != null) { this.setUserName(user); } for (int i = 1; !stop; i++) { String scriptName = currentSection.get("script-" + i); if (scriptName == null || scriptName.isEmpty()) { stop = true; continue; } this.addScript(scriptName); } } /** * Get the content of a script as a String by passing the path to the script file. * * @param script * @return * @throws IOException */ private String getContentOfScript(String script) throws IOException { byte[] encoded = Files.readAllBytes(Paths.get(script)); return new String(encoded, StandardCharsets.UTF_8); } /** * @param text * @param variable * @return true if the String variable is present in the given String text */ private boolean findInText(String text, String variable) { Matcher matcher = Pattern.compile("\\$[{]" + variable + "[}]").matcher(text); return matcher.find(); } /** * Fill the Map vnfrVnfc. * * @param nsr */ private void fillVnfrVnfc(NetworkServiceRecord nsr) { for (VirtualNetworkFunctionRecord vnfr : nsr.getVnfr()) { List<VNFCRepresentation> representationList = new LinkedList<>(); Configuration conf = vnfr.getConfigurations(); Map<String, String> confMap = new HashMap<>(); for (ConfigurationParameter confPar : conf.getConfigurationParameters()) { confMap.put(confPar.getConfKey(), confPar.getValue()); } for (VirtualDeploymentUnit vdu : vnfr.getVdu()) { for (VNFCInstance vnfcInstance : vdu.getVnfc_instance()) { VNFCRepresentation vnfcRepresentation = new VNFCRepresentation(); vnfcRepresentation.setVnfrName(vnfr.getName()); vnfcRepresentation.setHostname(vnfcInstance.getHostname()); vnfcRepresentation.setConfiguration(confMap); for (Ip ip : vnfcInstance.getIps()) { vnfcRepresentation.addNetIp(ip.getNetName(), ip.getIp()); } for (Ip fIp : vnfcInstance.getFloatingIps()) { vnfcRepresentation.addNetFip(fIp.getNetName(), fIp.getIp()); } representationList.add(vnfcRepresentation); } } if (!vnfrVnfc.containsKey(vnfr.getType())) { vnfrVnfc.put(vnfr.getType(), representationList); } else { List<VNFCRepresentation> l = vnfrVnfc.get(vnfr.getType()); l.addAll(representationList); } } } /** * Add variable assignments needed for the script to the beginning of it. * * @param script * @return */ private List<String> getPreScripts(String script) { List<String> preScripts = new LinkedList<>(); Map<String, LinkedList<String>> variableValuesMap = new HashMap<>(); // handle variable of type ${vnfrtype_configurationkey} String configurationDeclarations = ""; for (String vnfr : vnfrVnfc.keySet()) { for (String confKey : vnfrVnfc.get(vnfr).get(0).getAllConfigurationKeys()) { configurationDeclarations += vnfr + "_" + confKey + "=" + vnfrVnfc.get(vnfr).get(0).getConfiguration(confKey) + "; "; } // handle variables of type ${vnfrtype_fip} if (findInText(script, vnfr + "_fip")) { LinkedList<String> fips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) fips.addAll(vnfc.getAllFips()); variableValuesMap.put(vnfr + "_fip", fips); } // handle variables of type ${vnfrtype_ip} if (findInText(script, vnfr + "_ip")) { LinkedList<String> ips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) { ips.addAll(vnfc.getAllIps()); } variableValuesMap.put(vnfr + "_ip", ips); } // store all the network names occurring in that vnfr in a Set Set<String> netnames = new HashSet<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) { for (String net : vnfc.getAllNetNames()) { if (!netnames.contains(net)) netnames.add(net); } } for (String net : netnames) { // handle variables of type ${vnfrtype_network_fip} if (findInText(script, vnfr + "_" + net.replace('-', '_') + "_fip")) { LinkedList<String> fips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) fips.addAll(vnfc.getFipsByNet(net)); variableValuesMap.put(vnfr + "_" + net.replace('-', '_') + "_fip", fips); } // handle variables of type ${vnfrtype_network_ip} if (findInText(script, vnfr + "_" + net.replace('-', '_') + "_ip")) { LinkedList<String> ips = new LinkedList<>(); for (VNFCRepresentation vnfc : vnfrVnfc.get(vnfr)) ips.addAll(vnfc.getIpsByNet(net)); variableValuesMap.put(vnfr + "_" + net.replace('-', '_') + "_ip", ips); } } } // create the prescripts boolean noMoreElements = false; while (!noMoreElements) { String prescript = ""; noMoreElements = true; for (String varName : variableValuesMap.keySet()) { String value; if (variableValuesMap.get(varName).size() > 1) { value = variableValuesMap.get(varName).poll(); noMoreElements = false; } else { value = variableValuesMap.get(varName).peek(); } prescript += varName + "=" + value + "; "; } prescript += configurationDeclarations; preScripts.add(prescript); } return preScripts; } public void addScript(String scriptName) { File f = new File(properties.getProperty("scripts-path") + scriptName); if (!f.exists()) { File t = new File("/tmp/" + scriptName); try (InputStream is = Utils.getInputStream(properties.getProperty("scripts-path") + scriptName); OutputStream os = new FileOutputStream(t)) { byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } } catch (IOException e) { e.printStackTrace(); } f = t; } if (!f.exists()) log.warn(scriptName + " does not exist."); else scripts.add(f); } public void setVnfrType(String vnfrType) { this.vnfrType = vnfrType; } public void setVirtualLink(String virtualLink) { this.virtualLink = virtualLink; } public void setUserName(String name) { this.userName = name; } public void setVmScriptsPath(String vmScriptsPath) { this.vmScriptsPath = vmScriptsPath; } }
13,794
0.584892
0.582645
391
34.278774
25.550743
100
false
false
0
0
0
0
0
0
0.42711
false
false
3
e226eddaa003a075645b14d95d78f4523e39656d
17,910,013,666,808
a2405b914e3652fad32ce069e4f22dc12bedced4
/11950.java
00e7f67016e2bb5f9f1da4689e634cc52ef1f696
[]
no_license
engallote/BOJ2
https://github.com/engallote/BOJ2
64e79b63dbcb4e1f10723861cc0ec76c3b01ff74
5816a9f125a45d437f739937405a6098cb1817c6
refs/heads/master
2022-02-16T05:31:31.209000
2022-02-08T15:01:05
2022-02-08T15:01:05
221,961,808
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); char[][] arr = new char[N][M]; int res = Integer.MAX_VALUE; for(int i = 0; i < N; i++) arr[i] = sc.next().toCharArray(); int l = 1, r = N - 2, cnt = 0; while(l <= r) { cnt = 0; for(int i = 0; i < l; i++) for(int j = 0; j < M; j++) if(arr[i][j] != 'W') ++cnt; for(int i = l; i <= r; i++) for(int j = 0; j < M; j++) if(arr[i][j] != 'B') ++cnt; for(int i = r + 1; i < N; i++) for(int j = 0; j < M; j++) if(arr[i][j] != 'R') ++cnt; res = Math.min(res, cnt); ++l; if(l > r) { l = 1; --r; } } System.out.println(res); } }
UTF-8
Java
828
java
11950.java
Java
[]
null
[]
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); char[][] arr = new char[N][M]; int res = Integer.MAX_VALUE; for(int i = 0; i < N; i++) arr[i] = sc.next().toCharArray(); int l = 1, r = N - 2, cnt = 0; while(l <= r) { cnt = 0; for(int i = 0; i < l; i++) for(int j = 0; j < M; j++) if(arr[i][j] != 'W') ++cnt; for(int i = l; i <= r; i++) for(int j = 0; j < M; j++) if(arr[i][j] != 'B') ++cnt; for(int i = r + 1; i < N; i++) for(int j = 0; j < M; j++) if(arr[i][j] != 'R') ++cnt; res = Math.min(res, cnt); ++l; if(l > r) { l = 1; --r; } } System.out.println(res); } }
828
0.419082
0.405797
41
18.243902
13.20159
41
false
false
0
0
0
0
0
0
3.365854
false
false
3
99980d851fda3146be797db2d7419a7a10127677
21,749,714,450,410
5280865d3cb383952eecd712ccc53adf6ff05e59
/cameraroll/schemas/SINK/cameraroll/app/src/main/java/us/koller/cameraroll/data/provider/itemLoader/AlbumLoader.java
ef7262bcea070ba0ae0a82c1cc3b664b5c4c0de2
[ "Apache-2.0" ]
permissive
LordAmit/MuseRepo_Apps
https://github.com/LordAmit/MuseRepo_Apps
f753c686b114f78e1176ff94d5553b8ec7e0411a
f0c11783e9b01d5fa40309d5e60438263ddde7b6
refs/heads/master
2020-04-21T08:25:31.456000
2019-08-11T19:48:05
2019-08-11T19:48:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package us.koller.cameraroll.data.provider.itemLoader; import android.content.Context; import android.content.Intent; import android.support.v4.content.LocalBroadcastManager; import java.io.File; import java.util.ArrayList; import us.koller.cameraroll.data.models.Album; import us.koller.cameraroll.data.models.AlbumItem; import us.koller.cameraroll.ui.MainActivity; import us.koller.cameraroll.util.DateTakenRetriever; public class AlbumLoader extends ItemLoader { final String dataLeAk253 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); String dataLeAk251 = ""; String dataLeAk250 = ""; String dataLeAk249 = ""; String dataLeAk247 = ""; String dataLeAk246 = ""; String dataLeAk245 = ""; String dataLeAk244 = ""; private DateTakenRetriever dateRetriever; private ArrayList<Album> albums; private Album currentAlbum; public AlbumLoader() { dataLeAk244 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-0", dataLeAk244); android.util.Log.d("leak-245-0", dataLeAk245); android.util.Log.d("leak-246-0", dataLeAk246); android.util.Log.d("leak-247-0", dataLeAk247); android.util.Log.d("leak-249-0", dataLeAk249); android.util.Log.d("leak-250-0", dataLeAk250); android.util.Log.d("leak-251-0", dataLeAk251); albums = new ArrayList<>(); } @Override public ItemLoader newInstance() { dataLeAk245 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-1", dataLeAk244); android.util.Log.d("leak-245-1", dataLeAk245); android.util.Log.d("leak-246-1", dataLeAk246); android.util.Log.d("leak-247-1", dataLeAk247); android.util.Log.d("leak-249-1", dataLeAk249); android.util.Log.d("leak-250-1", dataLeAk250); android.util.Log.d("leak-251-1", dataLeAk251); DateTakenRetriever dateRetriever = this.dateRetriever != null ? new DateTakenRetriever() : null; return new AlbumLoader().setDateRetriever(dateRetriever); } @SuppressWarnings("WeakerAccess") public AlbumLoader setDateRetriever(DateTakenRetriever dateRetriever) { dataLeAk246 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-2", dataLeAk244); android.util.Log.d("leak-245-2", dataLeAk245); android.util.Log.d("leak-246-2", dataLeAk246); android.util.Log.d("leak-247-2", dataLeAk247); android.util.Log.d("leak-249-2", dataLeAk249); android.util.Log.d("leak-250-2", dataLeAk250); android.util.Log.d("leak-251-2", dataLeAk251); this.dateRetriever = dateRetriever; return this; } @Override public void onNewDir(final Context context, File dir) { dataLeAk247 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-3", dataLeAk244); android.util.Log.d("leak-245-3", dataLeAk245); android.util.Log.d("leak-246-3", dataLeAk246); android.util.Log.d("leak-247-3", dataLeAk247); android.util.Log.d("leak-249-3", dataLeAk249); android.util.Log.d("leak-250-3", dataLeAk250); android.util.Log.d("leak-251-3", dataLeAk251); currentAlbum = new Album().setPath(dir.getPath()); //loading dateTaken timeStamps asynchronously if (dateRetriever != null && dateRetriever.getCallback() == null) { dateRetriever.setCallback(new DateTakenRetriever.Callback() { String dataLeAk248 = ""; @Override public void done() { dataLeAk248 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-253-0", dataLeAk253); android.util.Log.d("leak-248-0", dataLeAk248); Intent intent = new Intent(MainActivity.RESORT); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } }); } } @Override public void onFile(final Context context, File file) { dataLeAk249 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-4", dataLeAk244); android.util.Log.d("leak-245-4", dataLeAk245); android.util.Log.d("leak-246-4", dataLeAk246); android.util.Log.d("leak-247-4", dataLeAk247); android.util.Log.d("leak-249-4", dataLeAk249); android.util.Log.d("leak-250-4", dataLeAk250); android.util.Log.d("leak-251-4", dataLeAk251); final AlbumItem albumItem = AlbumItem.getInstance(file.getPath()); if (albumItem != null) { if (dateRetriever != null) { dateRetriever.retrieveDate(context, albumItem); } //preload uri //albumItem.preloadUri(context); currentAlbum.getAlbumItems().add(albumItem); } } @Override public void onDirDone(Context context) { dataLeAk250 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-5", dataLeAk244); android.util.Log.d("leak-245-5", dataLeAk245); android.util.Log.d("leak-246-5", dataLeAk246); android.util.Log.d("leak-247-5", dataLeAk247); android.util.Log.d("leak-249-5", dataLeAk249); android.util.Log.d("leak-250-5", dataLeAk250); android.util.Log.d("leak-251-5", dataLeAk251); if (currentAlbum != null && currentAlbum.getAlbumItems().size() > 0) { albums.add(currentAlbum); currentAlbum = null; } } @Override public Result getResult() { dataLeAk251 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-6", dataLeAk244); android.util.Log.d("leak-245-6", dataLeAk245); android.util.Log.d("leak-246-6", dataLeAk246); android.util.Log.d("leak-247-6", dataLeAk247); android.util.Log.d("leak-249-6", dataLeAk249); android.util.Log.d("leak-250-6", dataLeAk250); android.util.Log.d("leak-251-6", dataLeAk251); Result result = new Result(); result.albums = albums; albums = new ArrayList<>(); return result; } }
UTF-8
Java
6,005
java
AlbumLoader.java
Java
[]
null
[]
package us.koller.cameraroll.data.provider.itemLoader; import android.content.Context; import android.content.Intent; import android.support.v4.content.LocalBroadcastManager; import java.io.File; import java.util.ArrayList; import us.koller.cameraroll.data.models.Album; import us.koller.cameraroll.data.models.AlbumItem; import us.koller.cameraroll.ui.MainActivity; import us.koller.cameraroll.util.DateTakenRetriever; public class AlbumLoader extends ItemLoader { final String dataLeAk253 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); String dataLeAk251 = ""; String dataLeAk250 = ""; String dataLeAk249 = ""; String dataLeAk247 = ""; String dataLeAk246 = ""; String dataLeAk245 = ""; String dataLeAk244 = ""; private DateTakenRetriever dateRetriever; private ArrayList<Album> albums; private Album currentAlbum; public AlbumLoader() { dataLeAk244 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-0", dataLeAk244); android.util.Log.d("leak-245-0", dataLeAk245); android.util.Log.d("leak-246-0", dataLeAk246); android.util.Log.d("leak-247-0", dataLeAk247); android.util.Log.d("leak-249-0", dataLeAk249); android.util.Log.d("leak-250-0", dataLeAk250); android.util.Log.d("leak-251-0", dataLeAk251); albums = new ArrayList<>(); } @Override public ItemLoader newInstance() { dataLeAk245 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-1", dataLeAk244); android.util.Log.d("leak-245-1", dataLeAk245); android.util.Log.d("leak-246-1", dataLeAk246); android.util.Log.d("leak-247-1", dataLeAk247); android.util.Log.d("leak-249-1", dataLeAk249); android.util.Log.d("leak-250-1", dataLeAk250); android.util.Log.d("leak-251-1", dataLeAk251); DateTakenRetriever dateRetriever = this.dateRetriever != null ? new DateTakenRetriever() : null; return new AlbumLoader().setDateRetriever(dateRetriever); } @SuppressWarnings("WeakerAccess") public AlbumLoader setDateRetriever(DateTakenRetriever dateRetriever) { dataLeAk246 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-2", dataLeAk244); android.util.Log.d("leak-245-2", dataLeAk245); android.util.Log.d("leak-246-2", dataLeAk246); android.util.Log.d("leak-247-2", dataLeAk247); android.util.Log.d("leak-249-2", dataLeAk249); android.util.Log.d("leak-250-2", dataLeAk250); android.util.Log.d("leak-251-2", dataLeAk251); this.dateRetriever = dateRetriever; return this; } @Override public void onNewDir(final Context context, File dir) { dataLeAk247 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-3", dataLeAk244); android.util.Log.d("leak-245-3", dataLeAk245); android.util.Log.d("leak-246-3", dataLeAk246); android.util.Log.d("leak-247-3", dataLeAk247); android.util.Log.d("leak-249-3", dataLeAk249); android.util.Log.d("leak-250-3", dataLeAk250); android.util.Log.d("leak-251-3", dataLeAk251); currentAlbum = new Album().setPath(dir.getPath()); //loading dateTaken timeStamps asynchronously if (dateRetriever != null && dateRetriever.getCallback() == null) { dateRetriever.setCallback(new DateTakenRetriever.Callback() { String dataLeAk248 = ""; @Override public void done() { dataLeAk248 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-253-0", dataLeAk253); android.util.Log.d("leak-248-0", dataLeAk248); Intent intent = new Intent(MainActivity.RESORT); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } }); } } @Override public void onFile(final Context context, File file) { dataLeAk249 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-4", dataLeAk244); android.util.Log.d("leak-245-4", dataLeAk245); android.util.Log.d("leak-246-4", dataLeAk246); android.util.Log.d("leak-247-4", dataLeAk247); android.util.Log.d("leak-249-4", dataLeAk249); android.util.Log.d("leak-250-4", dataLeAk250); android.util.Log.d("leak-251-4", dataLeAk251); final AlbumItem albumItem = AlbumItem.getInstance(file.getPath()); if (albumItem != null) { if (dateRetriever != null) { dateRetriever.retrieveDate(context, albumItem); } //preload uri //albumItem.preloadUri(context); currentAlbum.getAlbumItems().add(albumItem); } } @Override public void onDirDone(Context context) { dataLeAk250 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-5", dataLeAk244); android.util.Log.d("leak-245-5", dataLeAk245); android.util.Log.d("leak-246-5", dataLeAk246); android.util.Log.d("leak-247-5", dataLeAk247); android.util.Log.d("leak-249-5", dataLeAk249); android.util.Log.d("leak-250-5", dataLeAk250); android.util.Log.d("leak-251-5", dataLeAk251); if (currentAlbum != null && currentAlbum.getAlbumItems().size() > 0) { albums.add(currentAlbum); currentAlbum = null; } } @Override public Result getResult() { dataLeAk251 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); android.util.Log.d("leak-244-6", dataLeAk244); android.util.Log.d("leak-245-6", dataLeAk245); android.util.Log.d("leak-246-6", dataLeAk246); android.util.Log.d("leak-247-6", dataLeAk247); android.util.Log.d("leak-249-6", dataLeAk249); android.util.Log.d("leak-250-6", dataLeAk250); android.util.Log.d("leak-251-6", dataLeAk251); Result result = new Result(); result.albums = albums; albums = new ArrayList<>(); return result; } }
6,005
0.6801
0.611823
160
36.53125
24.817816
98
false
false
0
0
0
0
0
0
1.83125
false
false
3
cc41d1d2b7a52c856b32e5c14bed9df7863f18d1
23,364,622,094,926
694fac23f3b7892d806d71edff33fcc3518fb5bc
/library/src/main/java/com/smailnet/emailkit/IMAPService.java
de4d19d817cb9700ef459975ca9ee7953f3d4299
[ "Apache-2.0" ]
permissive
xiedingyi/emailkit
https://github.com/xiedingyi/emailkit
7e5f4dda4f56c93168aa35db9951aeb60667454f
b2ffaaf81eb92fb9d5196816b216b026f8a00216
refs/heads/master
2020-09-11T12:22:55.152000
2019-11-10T14:42:18
2019-11-10T14:42:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.smailnet.emailkit; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; /** * IMAP服务,主要是读取邮箱中的文件夹 */ public final class IMAPService { private EmailKit.Config config; IMAPService() { this.config = ObjectManager.getGlobalConfig(); } IMAPService(EmailKit.Config config) { this.config = config; } /** * 获取收件箱 * @return Inbox对象 */ public Inbox getInbox() { return new Inbox(config, "INBOX"); } /** * 获取草稿箱 * @return DraftBox对象 */ public DraftBox getDraftBox() { return new DraftBox(config, "Drafts"); } /** * 获取指定文件夹 * @param folderName 该文件夹的名称 * @return Folder对象 */ public Folder getFolder(String folderName) { return new Folder(config, folderName); } /** * 通过回调的方式获取默认的文件夹列表 * @param getFolderListCallback 获取结果回调 */ public void getDefaultFolderList(EmailKit.GetFolderListCallback getFolderListCallback) { ObjectManager.getMultiThreadService() .execute(() -> EmailCore.getDefaultFolderList(config, new EmailKit.GetFolderListCallback() { @Override public void onSuccess(List<String> folderList) { ObjectManager.getHandler().post(() -> getFolderListCallback.onSuccess(folderList)); } @Override public void onFailure(String errMsg) { ObjectManager.getHandler().post(() -> getFolderListCallback.onFailure(errMsg)); } })); } /** * 通过返回值的方式获取默认的文件夹列表 * @return 文件夹列表 */ public List<String> getDefaultFolderList() { try { Future<List<String>> future = ObjectManager.getMultiThreadService() .submit(() -> EmailCore.getDefaultFolderList(config)); return future.get(); } catch (ExecutionException e) { e.printStackTrace(); return null; } catch (InterruptedException e) { e.printStackTrace(); return null; } } }
UTF-8
Java
2,398
java
IMAPService.java
Java
[]
null
[]
package com.smailnet.emailkit; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; /** * IMAP服务,主要是读取邮箱中的文件夹 */ public final class IMAPService { private EmailKit.Config config; IMAPService() { this.config = ObjectManager.getGlobalConfig(); } IMAPService(EmailKit.Config config) { this.config = config; } /** * 获取收件箱 * @return Inbox对象 */ public Inbox getInbox() { return new Inbox(config, "INBOX"); } /** * 获取草稿箱 * @return DraftBox对象 */ public DraftBox getDraftBox() { return new DraftBox(config, "Drafts"); } /** * 获取指定文件夹 * @param folderName 该文件夹的名称 * @return Folder对象 */ public Folder getFolder(String folderName) { return new Folder(config, folderName); } /** * 通过回调的方式获取默认的文件夹列表 * @param getFolderListCallback 获取结果回调 */ public void getDefaultFolderList(EmailKit.GetFolderListCallback getFolderListCallback) { ObjectManager.getMultiThreadService() .execute(() -> EmailCore.getDefaultFolderList(config, new EmailKit.GetFolderListCallback() { @Override public void onSuccess(List<String> folderList) { ObjectManager.getHandler().post(() -> getFolderListCallback.onSuccess(folderList)); } @Override public void onFailure(String errMsg) { ObjectManager.getHandler().post(() -> getFolderListCallback.onFailure(errMsg)); } })); } /** * 通过返回值的方式获取默认的文件夹列表 * @return 文件夹列表 */ public List<String> getDefaultFolderList() { try { Future<List<String>> future = ObjectManager.getMultiThreadService() .submit(() -> EmailCore.getDefaultFolderList(config)); return future.get(); } catch (ExecutionException e) { e.printStackTrace(); return null; } catch (InterruptedException e) { e.printStackTrace(); return null; } } }
2,398
0.571751
0.571751
84
25.380953
25.402899
108
false
false
0
0
0
0
0
0
0.27381
false
false
3
57e5c3e103c9fcc6dd481351697bf3b92ece9a83
11,209,864,675,932
e768d2d4ade13e822cd6384b6823751bc6c4985e
/src/main/java/factoryMethod/figures/RandomFigure.java
bc669722e4aec92d29893b8cd4266488ba8ec94f
[]
no_license
grishasht/Homework3
https://github.com/grishasht/Homework3
a3ca040f2bd67dfa3da24648c5f14a6941aa9a22
bcc2dc690c71b288ff32c94207f2a392c6fbc050
refs/heads/master
2020-05-07T08:47:40.478000
2019-04-18T18:44:38
2019-05-11T20:26:08
180,343,353
0
0
null
false
2019-05-11T20:26:09
2019-04-09T10:32:20
2019-04-15T11:29:36
2019-05-11T20:26:09
162
0
0
0
null
false
false
package factoryMethod.figures; public class RandomFigure extends FigureData implements Figure{ public RandomFigure(Integer rectNum, String color) { super(rectNum, color); } @Override public String putFigure() { return "Random figure putted. Its size: " + rectNum + "\tIts color:" + color; } }
UTF-8
Java
331
java
RandomFigure.java
Java
[]
null
[]
package factoryMethod.figures; public class RandomFigure extends FigureData implements Figure{ public RandomFigure(Integer rectNum, String color) { super(rectNum, color); } @Override public String putFigure() { return "Random figure putted. Its size: " + rectNum + "\tIts color:" + color; } }
331
0.676737
0.676737
12
26.583334
27.127657
85
false
false
0
0
0
0
0
0
0.416667
false
false
3
93533d65db22e09c08b194ff7e919db322b3e5dd
27,307,402,118,039
ca53a5410c960f786e77f1df5031658eeaece248
/src/Song.java
ef433eaa3d8b843d9ec65f235294c9ba960f01e5
[]
no_license
Macbull/CloudSong
https://github.com/Macbull/CloudSong
2250ef148cc0e13c389b1596070f84944ab43b19
84c5694a0d1d21e3c71ba5a48567194c980efe85
refs/heads/master
2020-05-17T14:50:29.556000
2015-06-20T01:57:56
2015-06-20T01:57:56
33,951,966
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; /* * 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 DELL */ public class Song { int id,cost,value,plays,year,userRating; double length,avgRating; String name; String language; Album album; Artist artist; Genre genre; String file; Song(int id,String name,int year,double length,String language,int value,int cost,int plays,Artist artist,Album album,Genre genre){ this.id=id; this.name=name; this.year=year; this.length=length; this.language=language; this.value=value; this.cost=cost; this.plays=plays; this.album=album; this.artist=artist; this.genre=genre; } Song(String name,int year,double length,String language,int value,int cost,Artist artist,Album album,Genre genre,String file){ this.name=name; this.year=year; this.length=length; this.language=language; this.value=value; this.cost=cost; this.album=album; this.artist=artist; this.genre=genre; this.file=file; } void play(Connection co){ try { updateData.updateHistory(this); try { new Download(co,"/Users/Narwal/Desktop/"+this.id+".mp3",this.id); Play p = new Play("/Users/Narwal/Desktop/"+this.id+".mp3"); this.plays++; } catch (ClassNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } } void updateuserRating(int i){ this.userRating=i; updateData.updateuserRating(this); } void buy(Connection co,String file){ try { new Download(co,file,this.id); updateData.download(this); } catch (ClassNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } } }
UTF-8
Java
2,920
java
Song.java
Java
[ { "context": "emplate in the editor.\r\n */\r\n\r\n/**\r\n *\r\n * @author DELL\r\n */\r\npublic class Song {\r\n int id,cost,value,", "end": 443, "score": 0.9769504070281982, "start": 439, "tag": "NAME", "value": "DELL" } ]
null
[]
import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; /* * 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 DELL */ public class Song { int id,cost,value,plays,year,userRating; double length,avgRating; String name; String language; Album album; Artist artist; Genre genre; String file; Song(int id,String name,int year,double length,String language,int value,int cost,int plays,Artist artist,Album album,Genre genre){ this.id=id; this.name=name; this.year=year; this.length=length; this.language=language; this.value=value; this.cost=cost; this.plays=plays; this.album=album; this.artist=artist; this.genre=genre; } Song(String name,int year,double length,String language,int value,int cost,Artist artist,Album album,Genre genre,String file){ this.name=name; this.year=year; this.length=length; this.language=language; this.value=value; this.cost=cost; this.album=album; this.artist=artist; this.genre=genre; this.file=file; } void play(Connection co){ try { updateData.updateHistory(this); try { new Download(co,"/Users/Narwal/Desktop/"+this.id+".mp3",this.id); Play p = new Play("/Users/Narwal/Desktop/"+this.id+".mp3"); this.plays++; } catch (ClassNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } } void updateuserRating(int i){ this.userRating=i; updateData.updateuserRating(this); } void buy(Connection co,String file){ try { new Download(co,file,this.id); updateData.download(this); } catch (ClassNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(Song.class.getName()).log(Level.SEVERE, null, ex); } } }
2,920
0.611644
0.610959
102
26.607843
26.301479
131
false
false
0
0
0
0
0
0
0.960784
false
false
3
d0b7cfa46af9a4fd53cfb0441b29880158b9d9a3
19,172,734,047,585
04914b61fe87fa3e3869400bdbefe09ba2b69ed6
/app/src/main/java/com/example/apecsapp/PictureOptions.java
0e3f56ca81e74dddefde814130e0553fc16e5f82
[]
no_license
zarashafiq/ApecsApp
https://github.com/zarashafiq/ApecsApp
aa67a7b6a7b4cac003bf42fadaee2e21a4a60736
807f6f1360afdc238a2d468f4a01520609a5a01f
refs/heads/main
2023-05-29T23:40:31.523000
2021-06-14T03:44:49
2021-06-14T03:44:49
358,583,615
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.apecsapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.widget.Button; import android.widget.ImageView; import java.io.IOException; public class PictureOptions extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_picture_options);} public void launchdeviceupload (View view){ Intent intent = new Intent(this, DeviceUpload.class); startActivity(intent); } public void launchfolders (View view){ Intent intent = new Intent(this, PictureFolders.class); startActivity(intent); } }
UTF-8
Java
894
java
PictureOptions.java
Java
[]
null
[]
package com.example.apecsapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.widget.Button; import android.widget.ImageView; import java.io.IOException; public class PictureOptions extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_picture_options);} public void launchdeviceupload (View view){ Intent intent = new Intent(this, DeviceUpload.class); startActivity(intent); } public void launchfolders (View view){ Intent intent = new Intent(this, PictureFolders.class); startActivity(intent); } }
894
0.733781
0.733781
37
23.18919
21.256271
67
false
false
0
0
0
0
0
0
0.513514
false
false
3
65873caf61d5010397efd377b5b6077a1b5e4014
18,648,748,025,343
ca35f4b0c12712cd9a5ada010825609930c73925
/src/main/java/com/ovnny/cadastrovacinacao/configuration/DBConnectionConfiguration.java
d8ef63bcbfaa01250348f556f98ed7e2ab9624b7
[]
no_license
ovnny/CadastroVacinacaoAPI
https://github.com/ovnny/CadastroVacinacaoAPI
571ca5d896965db0908af1031f471caf261f664c
ccbc2aca74d4c7bf53470ce3012708cd80170d9a
refs/heads/main
2023-03-30T03:23:31.844000
2021-04-10T12:11:34
2021-04-10T12:11:34
350,491,159
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ovnny.cadastrovacinacao.configuration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; // DB Configuration Profiles @Configuration @EnableConfigurationProperties(DBConfiguration.class) public class DBConnectionConfiguration { private final DBConfiguration dbConfiguration; public DBConnectionConfiguration(DBConfiguration dbConfiguration) { this.dbConfiguration = dbConfiguration; } @Profile("dev") @Bean public String devDBConnection() { System.out.println("DB connection for DEV"); System.out.println(dbConfiguration.getUrl()); System.out.println(dbConfiguration.getUserName()); System.out.println(dbConfiguration.getPassword()); System.out.println(dbConfiguration.getDriverClassName()); return "DB connection in DEV - H2"; } @Profile("test") @Bean public String testDBConnection() { System.out.println("DB connection for TEST"); System.out.println(dbConfiguration.getUrl()); System.out.println(dbConfiguration.getUserName()); System.out.println(dbConfiguration.getPassword()); System.out.println(dbConfiguration.getDriverClassName()); return "DB Connection IN TEST - Low Cost Instance"; } @Profile("prod") @Bean public String prodDBConnection() { System.out.println("DB connection to PROD - High Performance Instance"); System.out.println(dbConfiguration.getUrl()); System.out.println(dbConfiguration.getUserName()); System.out.println(dbConfiguration.getPassword()); System.out.println(dbConfiguration.getDriverClassName()); return "DB Connection to RDS_TEST - High Performance Instance"; } }
UTF-8
Java
1,931
java
DBConnectionConfiguration.java
Java
[]
null
[]
package com.ovnny.cadastrovacinacao.configuration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; // DB Configuration Profiles @Configuration @EnableConfigurationProperties(DBConfiguration.class) public class DBConnectionConfiguration { private final DBConfiguration dbConfiguration; public DBConnectionConfiguration(DBConfiguration dbConfiguration) { this.dbConfiguration = dbConfiguration; } @Profile("dev") @Bean public String devDBConnection() { System.out.println("DB connection for DEV"); System.out.println(dbConfiguration.getUrl()); System.out.println(dbConfiguration.getUserName()); System.out.println(dbConfiguration.getPassword()); System.out.println(dbConfiguration.getDriverClassName()); return "DB connection in DEV - H2"; } @Profile("test") @Bean public String testDBConnection() { System.out.println("DB connection for TEST"); System.out.println(dbConfiguration.getUrl()); System.out.println(dbConfiguration.getUserName()); System.out.println(dbConfiguration.getPassword()); System.out.println(dbConfiguration.getDriverClassName()); return "DB Connection IN TEST - Low Cost Instance"; } @Profile("prod") @Bean public String prodDBConnection() { System.out.println("DB connection to PROD - High Performance Instance"); System.out.println(dbConfiguration.getUrl()); System.out.println(dbConfiguration.getUserName()); System.out.println(dbConfiguration.getPassword()); System.out.println(dbConfiguration.getDriverClassName()); return "DB Connection to RDS_TEST - High Performance Instance"; } }
1,931
0.725531
0.725013
52
36.134617
25.851669
81
false
false
0
0
0
0
0
0
0.480769
false
false
3
621f4ab330fca0c977cf01d3ccdb582d3dacdd8d
20,813,411,551,562
1d34bd77cdf5dc4643bc6bc25aff4870b80639e8
/예전 모음/Sprite_ex1/src/io/thethelab/Character.java
ec5107c8a27dc85a783eccafdb323150975ffd39
[]
no_license
hapsoa/java_thethelab_workspace
https://github.com/hapsoa/java_thethelab_workspace
d59d09dedd1217bcd73a010072ebc070ed662459
df61ee3eafd6e9736d31b058ab7954b23ba89bf8
refs/heads/master
2020-03-30T07:17:30.724000
2018-09-30T04:43:22
2018-09-30T04:43:22
150,929,359
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.thethelab; import processing.core.PApplet; import sun.security.krb5.internal.PAData; public class Character extends View { PApplet pApplet; int x, y; Character(PApplet pApplet) { this.pApplet = pApplet; x = 30; y = 30; } @Override void play() { } @Override void render() { pApplet.image(ResourceManager.loadImage( ResourceManager.DOWN_0 ), x, y); } }
UTF-8
Java
464
java
Character.java
Java
[]
null
[]
package io.thethelab; import processing.core.PApplet; import sun.security.krb5.internal.PAData; public class Character extends View { PApplet pApplet; int x, y; Character(PApplet pApplet) { this.pApplet = pApplet; x = 30; y = 30; } @Override void play() { } @Override void render() { pApplet.image(ResourceManager.loadImage( ResourceManager.DOWN_0 ), x, y); } }
464
0.579741
0.56681
27
16.185184
14.251801
48
false
false
0
0
0
0
0
0
0.444444
false
false
3
76440a7058a48427154af316bc4d85d7adedc620
7,241,314,905,679
13550f15574852b85f697e0b0ee7c91fd072465d
/src/jugarPartidaVista.java
20c43e804459e40baa79e526ef95345af4b261bb
[]
no_license
manishthani/Minesweeper
https://github.com/manishthani/Minesweeper
54221ee617d3a952b5cb56cde6601961f89c802f
7e596d4cf99ff2edce932fb10abe53b23135af3b
refs/heads/master
2021-01-01T19:52:11.027000
2016-09-20T15:19:02
2016-09-20T15:19:02
31,822,663
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */////// //import JugarPartidaOfficialControler; import static com.sun.xml.internal.fastinfoset.alphabet.BuiltInRestrictedAlphabets.table; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.GroupLayout; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; public class jugarPartidaVista extends javax.swing.JFrame { //Paneles private JPanel PanelLogin; private JPanel PanelNivel; private JPanel PanelJugar; //Elementos Panel Login private JButton buttonLogin; private JButton loginCancelButton; private JLabel usernameLabel; private JLabel passwordLabel; private JLabel titleLabel; private JTextField usernameText; private JTextField passwordText; //Elementos Panel Nivel private JButton nivelCancelButton; private JButton nivelJugarButton; private JScrollPane nivelScrollPane; private JTable tablaNivells; private JButton[][] tauler; private JLabel titleNivelLabel; //Comun a todos los paneles private JScrollPane errorScrollPane; private JTextArea errorTextArea; private JugarPartidaOfficialControler joc; private Integer ii ; private Integer ij; private JButton jBaux; public jugarPartidaVista() { joc = new JugarPartidaOfficialControler(); initComponents(); this.setPreferredSize(new Dimension(600,675)); setLocationRelativeTo(null); pack(); this.setVisible(true); this.setResizable(false); PanelLogin.setVisible(true); PanelNivel.setVisible(false); PanelJugar.setVisible(false); } private void initComponents() { PanelLogin = new JPanel(); PanelNivel = new JPanel(); nivelScrollPane = new JScrollPane(); tablaNivells = new JTable(); nivelCancelButton = new JButton(); nivelJugarButton = new JButton(); PanelJugar = new JPanel(); errorScrollPane = new JScrollPane(); errorTextArea = new JTextArea(); titleLabel = new JLabel(" BENVINGUT A BUSCAMINES!"); titleLabel.setFont(new Font("Serif", Font.PLAIN, 20)); usernameText = new JTextField(); usernameLabel = new JLabel(); passwordText = new JPasswordField(); passwordLabel = new JLabel(); buttonLogin = new JButton(); loginCancelButton = new JButton(); titleNivelLabel = new JLabel("SELECCIONI UN NIVELL PER JUGAR UNA PARTIDA :"); titleLabel.setFont(new Font("Serif", Font.PLAIN, 16)); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); String[][] tb = null; tablaNivells.setModel((new DefaultTableModel( tb, new String [] { "Nom", "numC", "numF", "numM" }))); tablaNivells.setRowHeight(25); nivelScrollPane.setViewportView(tablaNivells); if (tablaNivells.getColumnModel().getColumnCount() > 0) { tablaNivells.getColumnModel().getColumn(0).setResizable(false); tablaNivells.getColumnModel().getColumn(0).setPreferredWidth(10); tablaNivells.getColumnModel().getColumn(1).setResizable(false); tablaNivells.getColumnModel().getColumn(1).setPreferredWidth(10); tablaNivells.getColumnModel().getColumn(2).setResizable(false); tablaNivells.getColumnModel().getColumn(2).setPreferredWidth(10); tablaNivells.getColumnModel().getColumn(3).setResizable(false); tablaNivells.getColumnModel().getColumn(3).setPreferredWidth(10); } nivelCancelButton.setText("Cancelar"); nivelCancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } }); nivelJugarButton.setText("Jugar"); nivelJugarButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonJugarActionPerformed(evt); } }); GroupLayout jPanel2Layout = new GroupLayout(PanelNivel); PanelNivel.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(28, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(titleNivelLabel, GroupLayout.PREFERRED_SIZE, 444, GroupLayout.PREFERRED_SIZE) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(nivelCancelButton, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE) .addGap(36, 36, 36) .addComponent(nivelJugarButton, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE) .addGap(106, 106, 106)) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(nivelScrollPane, GroupLayout.PREFERRED_SIZE, 444, GroupLayout.PREFERRED_SIZE) .addGap(58, 58, 58)))) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(titleNivelLabel,GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addGap(89, 89, 89) .addComponent(nivelScrollPane,GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE) .addGap(49, 49, 49) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(nivelJugarButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE) .addComponent(nivelCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)) .addContainerGap(136, Short.MAX_VALUE)) ); getContentPane().add(PanelNivel); PanelNivel.setBounds(10, 50, 530, 410); nivelScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(PanelJugar); PanelJugar.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 564, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 460, Short.MAX_VALUE) ); getContentPane().add(PanelJugar); PanelJugar.setBounds(0, 10, 564, 460); errorTextArea.setColumns(20); errorTextArea.setRows(5); errorScrollPane.setViewportView(errorTextArea); getContentPane().add(errorScrollPane); errorScrollPane.setBounds(20, 540, 540, 96); usernameLabel.setText("Username:"); passwordText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pwdtextActionPerformed(evt); } }); passwordLabel.setText("Password:"); buttonLogin.setText("Login"); buttonLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); loginCancelButton.setText("Cancelar"); loginCancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } }); GroupLayout jPanel1Layout = new GroupLayout(PanelLogin); PanelLogin.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(100, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(usernameLabel) .addComponent(passwordLabel)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(titleLabel) .addComponent(passwordText) .addComponent(usernameText, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE))) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(loginCancelButton, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addComponent(buttonLogin, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE))) .addGap(134, 134, 134)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(10, 10,10) .addComponent(titleLabel) .addGap(161, 161, 161) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(usernameText, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(usernameLabel)) .addGap(40, 40, 40) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(passwordText, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(passwordLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .addGap(36, 36, 36) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(loginCancelButton) .addComponent(buttonLogin)) .addContainerGap(137, Short.MAX_VALUE)) ); getContentPane().add(PanelLogin); PanelLogin.setBounds(0, 0, 476, 437); pack(); } private void pwdtextActionPerformed(java.awt.event.ActionEvent evt) {} private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { //Login String a = new String(); a = usernameText.getText(); String b = new String(); b = passwordText.getText(); ArrayList<Nivell> ar = new ArrayList<Nivell>(); boolean bt = true; if(a == null || b == null) ; else { try{ ar = joc.PrLoginObtenirNivells(a,b); //login } catch(Exception e){ errorTextArea.setText(e.getMessage()); bt = false; } //poner niveles en la tabla, y pasar al otro panel } //recorrer casellas para actualizar if(bt){ errorTextArea.setText(" "); PanelLogin.setVisible(false); PanelNivel.setVisible(true); int siz = ar.size(); String[][] tb = new String[siz][4]; for(int de = 0; de < siz; ++ de){ tb[de][0] = ar.get(de).getNom(); tb[de][1] = ar.get(de).getNombreCasellesXFila().toString(); tb[de][2] = ar.get(de).getNombreCasellesXColumna().toString(); tb[de][3] = ar.get(de).getNombreMines().toString(); } tablaNivells.setModel(new javax.swing.table.DefaultTableModel(tb, new String [] {"Nom", "Numc", "Numf", "NumM"}) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); } } public void posarbomba(ActionEvent e){ if( e.getSource() instanceof JButton) { Icon one = new ImageIcon("src/recursos/mine.gif"); ((JButton)e.getSource()).setIcon(one); } } private void jButtonJugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonJugarActionPerformed int[] seleccionades = tablaNivells.getSelectedRows(); if (seleccionades.length > 1) errorTextArea.setText("Nomes es pot seleccionar un nivell"); else { boolean capNivell = false; int m = tablaNivells.getSelectedRow(); String s = new String(); int files = 0; int columnes = 0; if(m == 0){ files = 8; columnes = 8; joc.PrJugarCrearPartida("Facil"); } else if(m == 1){ files = 16; columnes = 16; joc.PrJugarCrearPartida("Normal"); } else if(m == 2){ files = 30; columnes = 30; joc.PrJugarCrearPartida("Dificil"); } else { errorTextArea.setText("No hi ha cap nivell seleccionat."); capNivell = true; } if(!capNivell){ PanelNivel.setVisible(false); PanelJugar.setVisible(true); PanelJugar.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), BorderFactory.createLoweredBevelBorder())); tauler = new JButton[files][columnes]; PanelJugar.setLayout(new GridLayout(files +1 ,columnes + 1)); PanelJugar.setSize(new Dimension(600,500)); this.setResizable(false); for(int i=0;i<files;++i){ for(int j=0;j<columnes;++j){ tauler[i][j] = new JButton(""); ii = i; ij = j; jBaux = tauler[i][j]; tauler[i][j].addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {} }); tauler[i][j].addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e) && e.getClickCount() == 1) { if( e.getSource() instanceof JButton) { int iii = -1; int jjj = -1; for (int iu = 0; iu < tauler.length; ++iu){ for (int ju = 0; ju < tauler.length; ++ju){ if(tauler[iu][ju] == ((JButton)e.getSource())){ iii = iu; jjj = ju; iu = ju = tauler.length; } } } if(((JButton)e.getSource()).getIcon() == null){ try { botonmarcar(iii,jjj); } catch (Exception e1) { errorTextArea.setText(e1.getMessage()); } } else{ try { botondesmarcar(iii,jjj); } catch (Exception e1) { errorTextArea.setText(e1.getMessage()); } } } } else if(SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 1){ int iii = -1; int jjj = -1; for (int iu = 0; iu < tauler.length; ++iu){ for (int ju = 0; ju < tauler.length; ++ju){ if(tauler[iu][ju] == ((JButton)e.getSource())){ iii = iu; jjj = ju; iu = ju = tauler.length; } } } try { botondescobrir(iii,jjj); } catch (Exception ex) { errorTextArea.setText(ex.getMessage()); } } } @Override public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} }); PanelJugar.add(tauler[i][j], i*tauler.length +j); tauler[i][j].setVisible(true); } } } } } private void botonmarcar(int x,int y) throws Exception{ joc.PrMarcarCasella(x,y); Casella[][] cas =joc.PrActualitzarTauler(); for(int i = 0; i < cas.length; ++i){ for (int j = 0; j < cas.length; ++j){ if(cas[i][j].getEstaDescoberta()){ if(cas[i][j].getTeMina()){ Icon one = new ImageIcon("src/recursos/mine.gif"); tauler[i][j].setIcon(one); } } else if(cas[i][j].getEstaMarcada()){ System.out.println(i + " " + j); Icon one = new ImageIcon("src/recursos/flag.gif"); tauler[i][j].setIcon(one); } else if(!cas[i][j].getEstaMarcada()) tauler[i][j].setIcon(null); } } } private void botondesmarcar(int x, int y) throws Exception{ joc.PrDesMarcar(x,y); Casella[][] cas =joc.PrActualitzarTauler(); cas = joc.PrActualitzarTauler(); for(int i = 0; i < cas.length; ++i){ for (int j = 0; j < cas.length; ++j){ if(cas[i][j].getEstaDescoberta()){ if(cas[i][j].getTeMina()){ Icon one = new ImageIcon("src/recursos/mine.gif"); tauler[i][j].setIcon(one); } } else if(cas[i][j].getEstaMarcada()){ Icon one = new ImageIcon("src/recursos/flag.gif"); tauler[i][j].setIcon(one); } else if(!cas[i][j].getEstaMarcada()){ tauler[i][j].setIcon(null); } } } } private void botondescobrir(int x, int y) throws Exception{ Resultado r; r = joc.PrDescobrirCasella(x,y); Casella[][] cas =joc.PrActualitzarTauler(); for(int i = 0; i < cas.length; ++i){ for (int j = 0; j < cas.length; ++j){ if(cas[i][j].getEstaDescoberta()){ if(cas[i][j].getTeMina()){ Icon one = new ImageIcon("src/recursos/mine.gif"); tauler[i][j].setIcon(one); } else { int num = cas[i][j].getNumero(); if(num == 0) { tauler[i][j].setBackground(Color.GRAY); tauler[i][j].setOpaque(true); tauler[i][j].setEnabled(false);} else if (num ==1){ Icon one = new ImageIcon("src/recursos/1.gif"); tauler[i][j].setIcon(one); } else if (num ==2){ Icon one = new ImageIcon("src/recursos/2.gif"); tauler[i][j].setIcon(one); } else if (num ==3){ Icon one = new ImageIcon("src/recursos/3.gif"); tauler[i][j].setIcon(one); } else if (num ==4){ Icon one = new ImageIcon("src/recursos/4.gif"); tauler[i][j].setIcon(one); } else if (num ==5){ Icon one = new ImageIcon("src/recursos/5.gif"); tauler[i][j].setIcon(one); } else if (num ==6){ Icon one = new ImageIcon("src/recursos/6.gif"); tauler[i][j].setIcon(one); } else if (num ==7){ Icon one = new ImageIcon("src/recursos/7.gif"); tauler[i][j].setIcon(one); } else if (num ==8){ Icon one = new ImageIcon("src/recursos/8.gif"); tauler[i][j].setIcon(one); } } } else if(cas[i][j].getEstaMarcada()){ Icon one = new ImageIcon("src/recursos/flag.gif"); tauler[i][j].setIcon(one); } else if(!cas[i][j].getEstaMarcada()){ tauler[i][j].setIcon(null); } } } if (r.getEstaAcabada()){ if(r.getEstaGuanyada()){ int punt = r.getPuntuacio(); JOptionPane.showMessageDialog(null, "Enhorabuena! Puntuacion: " + punt , "Partida finalizada",JOptionPane.INFORMATION_MESSAGE); System.exit(0); } else{ JOptionPane.showMessageDialog(null, "Partida finalizada", "Game over",JOptionPane.INFORMATION_MESSAGE); System.exit(0); } } } }
UTF-8
Java
27,837
java
jugarPartidaVista.java
Java
[ { "context": "meLabel = new JLabel();\n passwordText = new JPasswordField();\n passwordLabel = new JLabel();\n ", "end": 3139, "score": 0.8904219269752502, "start": 3125, "tag": "PASSWORD", "value": "JPasswordField" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */////// //import JugarPartidaOfficialControler; import static com.sun.xml.internal.fastinfoset.alphabet.BuiltInRestrictedAlphabets.table; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.GroupLayout; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; public class jugarPartidaVista extends javax.swing.JFrame { //Paneles private JPanel PanelLogin; private JPanel PanelNivel; private JPanel PanelJugar; //Elementos Panel Login private JButton buttonLogin; private JButton loginCancelButton; private JLabel usernameLabel; private JLabel passwordLabel; private JLabel titleLabel; private JTextField usernameText; private JTextField passwordText; //Elementos Panel Nivel private JButton nivelCancelButton; private JButton nivelJugarButton; private JScrollPane nivelScrollPane; private JTable tablaNivells; private JButton[][] tauler; private JLabel titleNivelLabel; //Comun a todos los paneles private JScrollPane errorScrollPane; private JTextArea errorTextArea; private JugarPartidaOfficialControler joc; private Integer ii ; private Integer ij; private JButton jBaux; public jugarPartidaVista() { joc = new JugarPartidaOfficialControler(); initComponents(); this.setPreferredSize(new Dimension(600,675)); setLocationRelativeTo(null); pack(); this.setVisible(true); this.setResizable(false); PanelLogin.setVisible(true); PanelNivel.setVisible(false); PanelJugar.setVisible(false); } private void initComponents() { PanelLogin = new JPanel(); PanelNivel = new JPanel(); nivelScrollPane = new JScrollPane(); tablaNivells = new JTable(); nivelCancelButton = new JButton(); nivelJugarButton = new JButton(); PanelJugar = new JPanel(); errorScrollPane = new JScrollPane(); errorTextArea = new JTextArea(); titleLabel = new JLabel(" BENVINGUT A BUSCAMINES!"); titleLabel.setFont(new Font("Serif", Font.PLAIN, 20)); usernameText = new JTextField(); usernameLabel = new JLabel(); passwordText = new <PASSWORD>(); passwordLabel = new JLabel(); buttonLogin = new JButton(); loginCancelButton = new JButton(); titleNivelLabel = new JLabel("SELECCIONI UN NIVELL PER JUGAR UNA PARTIDA :"); titleLabel.setFont(new Font("Serif", Font.PLAIN, 16)); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); String[][] tb = null; tablaNivells.setModel((new DefaultTableModel( tb, new String [] { "Nom", "numC", "numF", "numM" }))); tablaNivells.setRowHeight(25); nivelScrollPane.setViewportView(tablaNivells); if (tablaNivells.getColumnModel().getColumnCount() > 0) { tablaNivells.getColumnModel().getColumn(0).setResizable(false); tablaNivells.getColumnModel().getColumn(0).setPreferredWidth(10); tablaNivells.getColumnModel().getColumn(1).setResizable(false); tablaNivells.getColumnModel().getColumn(1).setPreferredWidth(10); tablaNivells.getColumnModel().getColumn(2).setResizable(false); tablaNivells.getColumnModel().getColumn(2).setPreferredWidth(10); tablaNivells.getColumnModel().getColumn(3).setResizable(false); tablaNivells.getColumnModel().getColumn(3).setPreferredWidth(10); } nivelCancelButton.setText("Cancelar"); nivelCancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } }); nivelJugarButton.setText("Jugar"); nivelJugarButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonJugarActionPerformed(evt); } }); GroupLayout jPanel2Layout = new GroupLayout(PanelNivel); PanelNivel.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(28, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(titleNivelLabel, GroupLayout.PREFERRED_SIZE, 444, GroupLayout.PREFERRED_SIZE) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(nivelCancelButton, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE) .addGap(36, 36, 36) .addComponent(nivelJugarButton, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE) .addGap(106, 106, 106)) .addGroup(GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(nivelScrollPane, GroupLayout.PREFERRED_SIZE, 444, GroupLayout.PREFERRED_SIZE) .addGap(58, 58, 58)))) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(titleNivelLabel,GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addGap(89, 89, 89) .addComponent(nivelScrollPane,GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE) .addGap(49, 49, 49) .addGroup(jPanel2Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(nivelJugarButton, javax.swing.GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE) .addComponent(nivelCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)) .addContainerGap(136, Short.MAX_VALUE)) ); getContentPane().add(PanelNivel); PanelNivel.setBounds(10, 50, 530, 410); nivelScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(PanelJugar); PanelJugar.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 564, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 460, Short.MAX_VALUE) ); getContentPane().add(PanelJugar); PanelJugar.setBounds(0, 10, 564, 460); errorTextArea.setColumns(20); errorTextArea.setRows(5); errorScrollPane.setViewportView(errorTextArea); getContentPane().add(errorScrollPane); errorScrollPane.setBounds(20, 540, 540, 96); usernameLabel.setText("Username:"); passwordText.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pwdtextActionPerformed(evt); } }); passwordLabel.setText("Password:"); buttonLogin.setText("Login"); buttonLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); loginCancelButton.setText("Cancelar"); loginCancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } }); GroupLayout jPanel1Layout = new GroupLayout(PanelLogin); PanelLogin.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(100, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(usernameLabel) .addComponent(passwordLabel)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(titleLabel) .addComponent(passwordText) .addComponent(usernameText, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE))) .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(loginCancelButton, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addComponent(buttonLogin, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE))) .addGap(134, 134, 134)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(10, 10,10) .addComponent(titleLabel) .addGap(161, 161, 161) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(usernameText, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(usernameLabel)) .addGap(40, 40, 40) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(passwordText, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(passwordLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .addGap(36, 36, 36) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(loginCancelButton) .addComponent(buttonLogin)) .addContainerGap(137, Short.MAX_VALUE)) ); getContentPane().add(PanelLogin); PanelLogin.setBounds(0, 0, 476, 437); pack(); } private void pwdtextActionPerformed(java.awt.event.ActionEvent evt) {} private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { //Login String a = new String(); a = usernameText.getText(); String b = new String(); b = passwordText.getText(); ArrayList<Nivell> ar = new ArrayList<Nivell>(); boolean bt = true; if(a == null || b == null) ; else { try{ ar = joc.PrLoginObtenirNivells(a,b); //login } catch(Exception e){ errorTextArea.setText(e.getMessage()); bt = false; } //poner niveles en la tabla, y pasar al otro panel } //recorrer casellas para actualizar if(bt){ errorTextArea.setText(" "); PanelLogin.setVisible(false); PanelNivel.setVisible(true); int siz = ar.size(); String[][] tb = new String[siz][4]; for(int de = 0; de < siz; ++ de){ tb[de][0] = ar.get(de).getNom(); tb[de][1] = ar.get(de).getNombreCasellesXFila().toString(); tb[de][2] = ar.get(de).getNombreCasellesXColumna().toString(); tb[de][3] = ar.get(de).getNombreMines().toString(); } tablaNivells.setModel(new javax.swing.table.DefaultTableModel(tb, new String [] {"Nom", "Numc", "Numf", "NumM"}) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); } } public void posarbomba(ActionEvent e){ if( e.getSource() instanceof JButton) { Icon one = new ImageIcon("src/recursos/mine.gif"); ((JButton)e.getSource()).setIcon(one); } } private void jButtonJugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonJugarActionPerformed int[] seleccionades = tablaNivells.getSelectedRows(); if (seleccionades.length > 1) errorTextArea.setText("Nomes es pot seleccionar un nivell"); else { boolean capNivell = false; int m = tablaNivells.getSelectedRow(); String s = new String(); int files = 0; int columnes = 0; if(m == 0){ files = 8; columnes = 8; joc.PrJugarCrearPartida("Facil"); } else if(m == 1){ files = 16; columnes = 16; joc.PrJugarCrearPartida("Normal"); } else if(m == 2){ files = 30; columnes = 30; joc.PrJugarCrearPartida("Dificil"); } else { errorTextArea.setText("No hi ha cap nivell seleccionat."); capNivell = true; } if(!capNivell){ PanelNivel.setVisible(false); PanelJugar.setVisible(true); PanelJugar.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), BorderFactory.createLoweredBevelBorder())); tauler = new JButton[files][columnes]; PanelJugar.setLayout(new GridLayout(files +1 ,columnes + 1)); PanelJugar.setSize(new Dimension(600,500)); this.setResizable(false); for(int i=0;i<files;++i){ for(int j=0;j<columnes;++j){ tauler[i][j] = new JButton(""); ii = i; ij = j; jBaux = tauler[i][j]; tauler[i][j].addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {} }); tauler[i][j].addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e) && e.getClickCount() == 1) { if( e.getSource() instanceof JButton) { int iii = -1; int jjj = -1; for (int iu = 0; iu < tauler.length; ++iu){ for (int ju = 0; ju < tauler.length; ++ju){ if(tauler[iu][ju] == ((JButton)e.getSource())){ iii = iu; jjj = ju; iu = ju = tauler.length; } } } if(((JButton)e.getSource()).getIcon() == null){ try { botonmarcar(iii,jjj); } catch (Exception e1) { errorTextArea.setText(e1.getMessage()); } } else{ try { botondesmarcar(iii,jjj); } catch (Exception e1) { errorTextArea.setText(e1.getMessage()); } } } } else if(SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 1){ int iii = -1; int jjj = -1; for (int iu = 0; iu < tauler.length; ++iu){ for (int ju = 0; ju < tauler.length; ++ju){ if(tauler[iu][ju] == ((JButton)e.getSource())){ iii = iu; jjj = ju; iu = ju = tauler.length; } } } try { botondescobrir(iii,jjj); } catch (Exception ex) { errorTextArea.setText(ex.getMessage()); } } } @Override public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} }); PanelJugar.add(tauler[i][j], i*tauler.length +j); tauler[i][j].setVisible(true); } } } } } private void botonmarcar(int x,int y) throws Exception{ joc.PrMarcarCasella(x,y); Casella[][] cas =joc.PrActualitzarTauler(); for(int i = 0; i < cas.length; ++i){ for (int j = 0; j < cas.length; ++j){ if(cas[i][j].getEstaDescoberta()){ if(cas[i][j].getTeMina()){ Icon one = new ImageIcon("src/recursos/mine.gif"); tauler[i][j].setIcon(one); } } else if(cas[i][j].getEstaMarcada()){ System.out.println(i + " " + j); Icon one = new ImageIcon("src/recursos/flag.gif"); tauler[i][j].setIcon(one); } else if(!cas[i][j].getEstaMarcada()) tauler[i][j].setIcon(null); } } } private void botondesmarcar(int x, int y) throws Exception{ joc.PrDesMarcar(x,y); Casella[][] cas =joc.PrActualitzarTauler(); cas = joc.PrActualitzarTauler(); for(int i = 0; i < cas.length; ++i){ for (int j = 0; j < cas.length; ++j){ if(cas[i][j].getEstaDescoberta()){ if(cas[i][j].getTeMina()){ Icon one = new ImageIcon("src/recursos/mine.gif"); tauler[i][j].setIcon(one); } } else if(cas[i][j].getEstaMarcada()){ Icon one = new ImageIcon("src/recursos/flag.gif"); tauler[i][j].setIcon(one); } else if(!cas[i][j].getEstaMarcada()){ tauler[i][j].setIcon(null); } } } } private void botondescobrir(int x, int y) throws Exception{ Resultado r; r = joc.PrDescobrirCasella(x,y); Casella[][] cas =joc.PrActualitzarTauler(); for(int i = 0; i < cas.length; ++i){ for (int j = 0; j < cas.length; ++j){ if(cas[i][j].getEstaDescoberta()){ if(cas[i][j].getTeMina()){ Icon one = new ImageIcon("src/recursos/mine.gif"); tauler[i][j].setIcon(one); } else { int num = cas[i][j].getNumero(); if(num == 0) { tauler[i][j].setBackground(Color.GRAY); tauler[i][j].setOpaque(true); tauler[i][j].setEnabled(false);} else if (num ==1){ Icon one = new ImageIcon("src/recursos/1.gif"); tauler[i][j].setIcon(one); } else if (num ==2){ Icon one = new ImageIcon("src/recursos/2.gif"); tauler[i][j].setIcon(one); } else if (num ==3){ Icon one = new ImageIcon("src/recursos/3.gif"); tauler[i][j].setIcon(one); } else if (num ==4){ Icon one = new ImageIcon("src/recursos/4.gif"); tauler[i][j].setIcon(one); } else if (num ==5){ Icon one = new ImageIcon("src/recursos/5.gif"); tauler[i][j].setIcon(one); } else if (num ==6){ Icon one = new ImageIcon("src/recursos/6.gif"); tauler[i][j].setIcon(one); } else if (num ==7){ Icon one = new ImageIcon("src/recursos/7.gif"); tauler[i][j].setIcon(one); } else if (num ==8){ Icon one = new ImageIcon("src/recursos/8.gif"); tauler[i][j].setIcon(one); } } } else if(cas[i][j].getEstaMarcada()){ Icon one = new ImageIcon("src/recursos/flag.gif"); tauler[i][j].setIcon(one); } else if(!cas[i][j].getEstaMarcada()){ tauler[i][j].setIcon(null); } } } if (r.getEstaAcabada()){ if(r.getEstaGuanyada()){ int punt = r.getPuntuacio(); JOptionPane.showMessageDialog(null, "Enhorabuena! Puntuacion: " + punt , "Partida finalizada",JOptionPane.INFORMATION_MESSAGE); System.exit(0); } else{ JOptionPane.showMessageDialog(null, "Partida finalizada", "Game over",JOptionPane.INFORMATION_MESSAGE); System.exit(0); } } } }
27,833
0.457952
0.446564
579
47.077721
31.004416
168
false
false
0
0
0
0
0
0
0.740933
false
false
3
456111881f6d5fa5832ff6df0f4fa7267c3620af
10,471,130,274,677
562c03aefd7db3056498b4024937b42932d97f84
/service-hystrix/src/main/java/com/lzj/servicehystrix/controller/HystrixController.java
5001a35630dfc68e9b1eaa8755a10c4a19185743
[]
no_license
liuzhoujian/springcloud-learning
https://github.com/liuzhoujian/springcloud-learning
1d8b63efda0d395ad3ce3ba88692347562047f4a
57be50f41f7d354fe0e589755720381d21782c6a
refs/heads/master
2020-06-18T01:46:38.887000
2019-07-15T03:06:19
2019-07-15T03:06:19
196,125,841
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lzj.servicehystrix.controller; import bean.Student; import com.lzj.servicehystrix.feign.ConsumerFeign; import com.lzj.servicehystrix.service.StudentService; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController public class HystrixController { @Autowired private StudentService studentService; @Autowired private ConsumerFeign consumerFeign; @HystrixCommand(fallbackMethod = "error") //服务熔断、服务降级、服务隔离(使用新的线程池) @GetMapping("/hystrix/findAll") public String hystrixFindAll() { //当前线程池名称:hystrix-HystrixController-1 System.out.println("当前线程池名称:" + Thread.currentThread().getName()); int i = 1 / 0; return studentService.findAll(); } @GetMapping("/findAll") public String findAll() { //当前线程池名称:http-nio-8600-exec-1 System.out.println("当前线程池名称:" + Thread.currentThread().getName()); int i = 1 / 0 ; return studentService.findAll(); } private String error() { return "系统错误!"; } //更常用的方式:feign+hystrix @GetMapping("/hystrix/feign/findAll") public List<Student> feignFindAll() { return consumerFeign.findAll(); } }
UTF-8
Java
1,549
java
HystrixController.java
Java
[]
null
[]
package com.lzj.servicehystrix.controller; import bean.Student; import com.lzj.servicehystrix.feign.ConsumerFeign; import com.lzj.servicehystrix.service.StudentService; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController public class HystrixController { @Autowired private StudentService studentService; @Autowired private ConsumerFeign consumerFeign; @HystrixCommand(fallbackMethod = "error") //服务熔断、服务降级、服务隔离(使用新的线程池) @GetMapping("/hystrix/findAll") public String hystrixFindAll() { //当前线程池名称:hystrix-HystrixController-1 System.out.println("当前线程池名称:" + Thread.currentThread().getName()); int i = 1 / 0; return studentService.findAll(); } @GetMapping("/findAll") public String findAll() { //当前线程池名称:http-nio-8600-exec-1 System.out.println("当前线程池名称:" + Thread.currentThread().getName()); int i = 1 / 0 ; return studentService.findAll(); } private String error() { return "系统错误!"; } //更常用的方式:feign+hystrix @GetMapping("/hystrix/feign/findAll") public List<Student> feignFindAll() { return consumerFeign.findAll(); } }
1,549
0.705426
0.698379
50
27.379999
22.87784
74
false
false
0
0
0
0
0
0
0.38
false
false
3
c5edb51fc94faa634e59236019d68570a36469ce
23,252,952,982,184
0324f0160cd6bf0d007ad92a0e729248de1ffe78
/src/TWO_7to19/Main.java
0b15a9b25eba72e62601c9e887aed96522953d45
[]
no_license
nooblong/JavaHomework-2
https://github.com/nooblong/JavaHomework-2
72e2c81840b6f3d18c6d6c5dd8dee0a436002159
cafcb7218cded25e8829a1424279c09901168c5d
refs/heads/master
2022-03-26T10:02:01.436000
2019-12-12T05:51:26
2019-12-12T05:51:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package TWO_7to19; /**19、文件加密解密器 请编写文件加密及解密程序。 1)由用户选定好指定文件夹下的某个文件 2)点击界面上的“加密”按钮或菜单,程序对文件中的每个字节进行加密。 加密的规则是:将文件的第i个字节的数值原数值与整数i的按位异或结果,即若文件的第i个字节为a,则加密结果为b=a∧ i。 加密之后的文件另保存为“原文件名+jm”进行保存 3)点击“解密”或菜单,对已经加过密的文件进行解密之后,文件就会恢复成原来的文件内容。 */ import java.io.File; /**a=10100001 * b=00000110 * * a=10100111 a = a^b;    * b=10100001 b = b^a;    * a=00000110 a = a^b;    * */ public class Main { public static void main(String[] args) { // System.out.println(System.getProperty("user.dir")); // File oldFile = new File("src/TWO_7to19/test.jpg"); // File newFile = new File("src/TWO_7to19/Changed-test.jpg"); // MyFile.changeFile(oldFile,0,"Changed-"); // MyFile.unChangeFIle(newFile,0); UserFrame.createAndShowGui(); } }
UTF-8
Java
1,170
java
Main.java
Java
[]
null
[]
package TWO_7to19; /**19、文件加密解密器 请编写文件加密及解密程序。 1)由用户选定好指定文件夹下的某个文件 2)点击界面上的“加密”按钮或菜单,程序对文件中的每个字节进行加密。 加密的规则是:将文件的第i个字节的数值原数值与整数i的按位异或结果,即若文件的第i个字节为a,则加密结果为b=a∧ i。 加密之后的文件另保存为“原文件名+jm”进行保存 3)点击“解密”或菜单,对已经加过密的文件进行解密之后,文件就会恢复成原来的文件内容。 */ import java.io.File; /**a=10100001 * b=00000110 * * a=10100111 a = a^b;    * b=10100001 b = b^a;    * a=00000110 a = a^b;    * */ public class Main { public static void main(String[] args) { // System.out.println(System.getProperty("user.dir")); // File oldFile = new File("src/TWO_7to19/test.jpg"); // File newFile = new File("src/TWO_7to19/Changed-test.jpg"); // MyFile.changeFile(oldFile,0,"Changed-"); // MyFile.unChangeFIle(newFile,0); UserFrame.createAndShowGui(); } }
1,170
0.653846
0.582051
32
23.34375
20.62706
68
false
false
0
0
0
0
0
0
0.34375
false
false
3
b8e923692d5d35b7522873cb31bc45953ecffc89
16,604,343,591,189
bfedfdc8f35cceb600e376d4ee2e2fda3017acb5
/src/main/java/com/mucommander/ui/encoding/EncodingPreferences.java
d4dcd326e9e47d01acc73ef7895d2d7f6a82a3ac
[]
no_license
BoiseState/CS471-S19-ProjectWarmup
https://github.com/BoiseState/CS471-S19-ProjectWarmup
e042a6047ab490226a9afd63d648ba7e9fec97df
8852d7ac1cad569af9ffe49f9c6b48152f3bbb5a
refs/heads/master
2020-04-25T05:58:42.245000
2019-03-06T03:51:33
2019-03-06T03:51:33
172,562,120
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * This file is part of muCommander, http://www.mucommander.com * Copyright (C) 2002-2018 Maxence Bernard * * muCommander is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * muCommander is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.mucommander.ui.encoding; import java.nio.charset.Charset; import java.util.List; import java.util.Vector; import com.mucommander.conf.MuConfigurations; import com.mucommander.conf.MuPreference; /** * This class allows to retrieve and set character encoding preferences. It is used by UI components that let the user * choose an encoding, thus limiting this list to a reasonable amount of choices instead of displaying all supported * character encodings. * * @see EncodingMenu * @see EncodingSelectBox * @author Maxence Bernard */ public class EncodingPreferences { /** Default list of preferred encodings, comma-separated. */ public static final String[] DEFAULT_PREFERRED_ENCODINGS = new String[] { "UTF-8", "UTF-16", "ISO-8859-1", "windows-1252", "KOI8-R", "Big5", "GB18030", "EUC-KR", "Shift_JIS", "ISO-2022-JP", "EUC-JP", }; /** * Returns a user-defined list of preferred encodings. * * @return a user-defined list of preferred encodings. */ public static List<String> getPreferredEncodings() { List<String> vector = MuConfigurations.getPreferences().getListVariable(MuPreference.PREFERRED_ENCODINGS, ","); if(vector==null) { vector = getDefaultPreferredEncodings(); MuConfigurations.getPreferences().setVariable(MuPreference.PREFERRED_ENCODINGS, vector, ","); } return vector; } /** * Returns a default list of preferred encodings, containing some of the most popular encodings. * * @return a default list of preferred encodings. */ public static List<String> getDefaultPreferredEncodings() { List<String> encodingsV = new Vector<String>(); for (String encoding : DEFAULT_PREFERRED_ENCODINGS) { // Ensure that the encoding is supported before adding it if (Charset.isSupported(encoding)) encodingsV.add(encoding); } return encodingsV; } /** * Sets the user-defined list of preferred encodings. * * @param encodings the user-defined list of preferred encodings */ public static void setPreferredEncodings(List<String> encodings) { MuConfigurations.getPreferences().setVariable(MuPreference.PREFERRED_ENCODINGS, encodings, ","); } }
UTF-8
Java
3,158
java
EncodingPreferences.java
Java
[ { "context": "p://www.mucommander.com\n * Copyright (C) 2002-2018 Maxence Bernard\n *\n * muCommander is free software; you can redis", "end": 109, "score": 0.9998806715011597, "start": 94, "tag": "NAME", "value": "Maxence Bernard" }, { "context": " EncodingMenu\n * @see EncodingSelectBox\n * @author Maxence Bernard\n */\npublic class EncodingPreferences {\n\n /** D", "end": 1311, "score": 0.9998828172683716, "start": 1296, "tag": "NAME", "value": "Maxence Bernard" } ]
null
[]
/* * This file is part of muCommander, http://www.mucommander.com * Copyright (C) 2002-2018 <NAME> * * muCommander is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * muCommander is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.mucommander.ui.encoding; import java.nio.charset.Charset; import java.util.List; import java.util.Vector; import com.mucommander.conf.MuConfigurations; import com.mucommander.conf.MuPreference; /** * This class allows to retrieve and set character encoding preferences. It is used by UI components that let the user * choose an encoding, thus limiting this list to a reasonable amount of choices instead of displaying all supported * character encodings. * * @see EncodingMenu * @see EncodingSelectBox * @author <NAME> */ public class EncodingPreferences { /** Default list of preferred encodings, comma-separated. */ public static final String[] DEFAULT_PREFERRED_ENCODINGS = new String[] { "UTF-8", "UTF-16", "ISO-8859-1", "windows-1252", "KOI8-R", "Big5", "GB18030", "EUC-KR", "Shift_JIS", "ISO-2022-JP", "EUC-JP", }; /** * Returns a user-defined list of preferred encodings. * * @return a user-defined list of preferred encodings. */ public static List<String> getPreferredEncodings() { List<String> vector = MuConfigurations.getPreferences().getListVariable(MuPreference.PREFERRED_ENCODINGS, ","); if(vector==null) { vector = getDefaultPreferredEncodings(); MuConfigurations.getPreferences().setVariable(MuPreference.PREFERRED_ENCODINGS, vector, ","); } return vector; } /** * Returns a default list of preferred encodings, containing some of the most popular encodings. * * @return a default list of preferred encodings. */ public static List<String> getDefaultPreferredEncodings() { List<String> encodingsV = new Vector<String>(); for (String encoding : DEFAULT_PREFERRED_ENCODINGS) { // Ensure that the encoding is supported before adding it if (Charset.isSupported(encoding)) encodingsV.add(encoding); } return encodingsV; } /** * Sets the user-defined list of preferred encodings. * * @param encodings the user-defined list of preferred encodings */ public static void setPreferredEncodings(List<String> encodings) { MuConfigurations.getPreferences().setVariable(MuPreference.PREFERRED_ENCODINGS, encodings, ","); } }
3,140
0.678277
0.668144
94
32.595745
31.537319
119
false
false
0
0
0
0
0
0
0.478723
false
false
3
f9434f7b7804755420531a13d4e553047934ac65
26,800,595,968,145
12c453642784a3359363e33c007d5a5abdae9e4a
/supplement/org/fdesigner/supplement/log/LogPermission.java
d99c8a997e2542d16ba072d7bc0f68ac8ba6585f
[]
no_license
WeControlTheFuture/fdesigner
https://github.com/WeControlTheFuture/fdesigner
51e56b6d1935f176b23ebaf42119be4ef57e3bec
84483c2f112c8d67ecdf61e9259c1c5556d398c4
refs/heads/master
2020-09-24T13:44:01.238000
2019-12-13T01:21:40
2019-12-13T01:21:40
225,771,252
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright (c) 2009, 2011 IBM Corporation and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 which * accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 ******************************************************************************/ package org.fdesigner.supplement.log; import java.security.Permission; import java.security.PermissionCollection; /** * Indicates a bundle's authority to log on behalf of other bundles. * * This permission has only a single action: LOG. * * @ThreadSafe * @since 3.7 */ public class LogPermission extends Permission { private static final long serialVersionUID = -441193976837153362L; private static final String ALL = "*"; //$NON-NLS-1$ /** * The action string <code>log</code>. */ public static final String LOG = "log"; //$NON-NLS-1$ /** * Create a new LogPermission. * * @param name Name must be &quot;*&quot;. * @param actions <code>log</code> or &quot;*&quot;. */ public LogPermission(String name, String actions) { super(name); if (!name.equals(ALL)) throw new IllegalArgumentException("name must be *"); //$NON-NLS-1$ actions = actions.trim(); if (!actions.equalsIgnoreCase(LOG) && !actions.equals(ALL)) throw new IllegalArgumentException("actions must be * or log"); //$NON-NLS-1$ } @Override public boolean equals(Object obj) { return obj instanceof LogPermission; } @Override public String getActions() { return LOG; } @Override public int hashCode() { return LogPermission.class.hashCode(); } @Override public boolean implies(Permission permission) { return permission instanceof LogPermission; } @Override public PermissionCollection newPermissionCollection() { return new LogPermissionCollection(); } }
UTF-8
Java
1,976
java
LogPermission.java
Java
[]
null
[]
/******************************************************************************* * Copyright (c) 2009, 2011 IBM Corporation and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 which * accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 ******************************************************************************/ package org.fdesigner.supplement.log; import java.security.Permission; import java.security.PermissionCollection; /** * Indicates a bundle's authority to log on behalf of other bundles. * * This permission has only a single action: LOG. * * @ThreadSafe * @since 3.7 */ public class LogPermission extends Permission { private static final long serialVersionUID = -441193976837153362L; private static final String ALL = "*"; //$NON-NLS-1$ /** * The action string <code>log</code>. */ public static final String LOG = "log"; //$NON-NLS-1$ /** * Create a new LogPermission. * * @param name Name must be &quot;*&quot;. * @param actions <code>log</code> or &quot;*&quot;. */ public LogPermission(String name, String actions) { super(name); if (!name.equals(ALL)) throw new IllegalArgumentException("name must be *"); //$NON-NLS-1$ actions = actions.trim(); if (!actions.equalsIgnoreCase(LOG) && !actions.equals(ALL)) throw new IllegalArgumentException("actions must be * or log"); //$NON-NLS-1$ } @Override public boolean equals(Object obj) { return obj instanceof LogPermission; } @Override public String getActions() { return LOG; } @Override public int hashCode() { return LogPermission.class.hashCode(); } @Override public boolean implies(Permission permission) { return permission instanceof LogPermission; } @Override public PermissionCollection newPermissionCollection() { return new LogPermissionCollection(); } }
1,976
0.654352
0.635121
73
26.068493
24.92967
80
false
false
0
0
0
0
0
0
1.027397
false
false
3
9dafeea7f66622fc7e92850733fdeea78605c53a
25,142,738,609,706
d73d1c5c990fe414340f3489aa5e51e5b92f99cc
/queries/geosparql_conformance/query supporting files/geometry_extension/wkt/WktLiteralDefaultSrsTest.java
ae967400e73518a554f3e253b5268fd7fb4125df
[]
no_license
galbiston/geosparql-benchmarking
https://github.com/galbiston/geosparql-benchmarking
dbeb566257151a9f6bb9a814ae28cf9f7b7c89f4
fb90c7460a06d0a3662bed2649ead3a33b2b0086
refs/heads/master
2020-04-14T06:06:36.557000
2019-04-22T18:09:32
2019-04-22T18:09:32
163,677,471
2
2
null
false
2019-07-05T18:10:46
2018-12-31T15:04:25
2019-04-22T18:09:46
2019-04-22T18:09:42
35,543
0
1
1
Java
false
false
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package conformance_test.geometry_extension.wkt; import conformance_test.TestQuerySupport; import org.apache.jena.rdf.model.InfModel; import org.junit.After; import org.junit.AfterClass; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; /** * * * * A.3.2.2 /conf/geometry-extension/wkt-literal-default-srs * * Requirement: /req/geometry-extension/wkt-literal-default-srs The URI * <http://www.opengis.net/def/crs/OGC/1.3/CRS84> shall be assumed as the * spatial reference system for geo:wktLiterals that do not specify an explicit * spatial reference system URI. * * a.) Test purpose: check conformance with this requirement * * b.) Test method: verify that queries involving geo:wktLiteral values without * an explicit encoded spatial reference system URI return the correct result * for a test dataset. * * c.) Reference: Clause 8.5.1 Req 11 * * d.) Test Type: Capabilities */ public class WktLiteralDefaultSrsTest { private static final InfModel SAMPLE_DATA_MODEL = TestQuerySupport.getSampleData_WKT(); @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } @Test public void defaultSRIDTest() { System.out.println("Default SRID"); String expResult = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"; String queryString = "SELECT ?srid WHERE{" + "geom:PointEmpty geo:asWKT ?aWKT ." + "BIND(geof:getSRID (?aWKT) AS ?srid)" + "}"; String result = TestQuerySupport.querySingle(queryString, SAMPLE_DATA_MODEL); //System.out.println("Exp: " + expResult); //System.out.println("Res: " + result); assertEquals(expResult, result); } }
UTF-8
Java
2,101
java
WktLiteralDefaultSrsTest.java
Java
[]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package conformance_test.geometry_extension.wkt; import conformance_test.TestQuerySupport; import org.apache.jena.rdf.model.InfModel; import org.junit.After; import org.junit.AfterClass; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; /** * * * * A.3.2.2 /conf/geometry-extension/wkt-literal-default-srs * * Requirement: /req/geometry-extension/wkt-literal-default-srs The URI * <http://www.opengis.net/def/crs/OGC/1.3/CRS84> shall be assumed as the * spatial reference system for geo:wktLiterals that do not specify an explicit * spatial reference system URI. * * a.) Test purpose: check conformance with this requirement * * b.) Test method: verify that queries involving geo:wktLiteral values without * an explicit encoded spatial reference system URI return the correct result * for a test dataset. * * c.) Reference: Clause 8.5.1 Req 11 * * d.) Test Type: Capabilities */ public class WktLiteralDefaultSrsTest { private static final InfModel SAMPLE_DATA_MODEL = TestQuerySupport.getSampleData_WKT(); @BeforeClass public static void setUpClass() { } @AfterClass public static void tearDownClass() { } @Before public void setUp() { } @After public void tearDown() { } @Test public void defaultSRIDTest() { System.out.println("Default SRID"); String expResult = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"; String queryString = "SELECT ?srid WHERE{" + "geom:PointEmpty geo:asWKT ?aWKT ." + "BIND(geof:getSRID (?aWKT) AS ?srid)" + "}"; String result = TestQuerySupport.querySingle(queryString, SAMPLE_DATA_MODEL); //System.out.println("Exp: " + expResult); //System.out.println("Res: " + result); assertEquals(expResult, result); } }
2,101
0.682056
0.674441
78
25.935898
26.586742
91
false
false
0
0
0
0
0
0
0.282051
false
false
3
86a10bd3ae47972fb0624ca6c104679f6dc40d16
23,579,370,495,736
ceeb2413007a4abac11fc5796d08254e64a681e6
/src/OrdenacaoBolha.java
d80a28dc2ab173f9b7678320d6296564ace02f1d
[]
no_license
cadmojr201/Ordenar-e-buscar-em-java
https://github.com/cadmojr201/Ordenar-e-buscar-em-java
8a67ca08027cdb0dd8ab1cd5ffe1a7fa54646f5c
fbb9e98de331dfece95142f0b1ee4cadf9c23b17
refs/heads/master
2020-03-28T09:23:34.668000
2018-09-09T14:27:19
2018-09-09T14:27:19
148,033,168
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class OrdenacaoBolha { public int ordenarBolha(int numeros[]) { //int numeros[] = {93,112,8,100}; int x; for(int i=1;i<numeros.length;i++) { for(int j=numeros.length-1;j>=i;j--) { if(numeros[j-1]>numeros[j]) { x=numeros[j-1]; numeros[j-1]=numeros[j]; numeros[j]=x; } } System.out.printf("\n%s%2d","Interação",i); for(int k=0; k<numeros.length;k++) { System.out.printf("%5d", numeros[k]); } } System.out.println("\n"); return 0; } }
ISO-8859-1
Java
570
java
OrdenacaoBolha.java
Java
[]
null
[]
public class OrdenacaoBolha { public int ordenarBolha(int numeros[]) { //int numeros[] = {93,112,8,100}; int x; for(int i=1;i<numeros.length;i++) { for(int j=numeros.length-1;j>=i;j--) { if(numeros[j-1]>numeros[j]) { x=numeros[j-1]; numeros[j-1]=numeros[j]; numeros[j]=x; } } System.out.printf("\n%s%2d","Interação",i); for(int k=0; k<numeros.length;k++) { System.out.printf("%5d", numeros[k]); } } System.out.println("\n"); return 0; } }
570
0.496479
0.464789
33
15.151515
15.153999
46
false
false
0
0
0
0
0
0
3.242424
false
false
3
1be839b4a50fef2320ee4125438ef1f95b41d9c1
85,899,386,931
cff192e401cb60a908356f54eec85931e9c16da7
/isoccer/src/physical_resources/Resource.java
4ffa2083dd3aef35b1fe163d84dabe8fc7d135df
[]
no_license
willieny/iSoccer
https://github.com/willieny/iSoccer
1811054c4f45179ecd874ec6fe023c621874922b
ee1c5de7495ca2268b9300702f6fde445dc382d8
refs/heads/master
2020-04-16T05:54:05.291000
2019-02-15T11:49:19
2019-02-15T11:49:19
165,325,999
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package physical_resources; public abstract class Resource { protected int n_available; public Resource() { super(); } public Resource(int n_available) { super(); this.n_available = n_available; } public int getN_available() { return n_available; } public void setN_available(int n_available) { this.n_available = n_available; } }
UTF-8
Java
360
java
Resource.java
Java
[]
null
[]
package physical_resources; public abstract class Resource { protected int n_available; public Resource() { super(); } public Resource(int n_available) { super(); this.n_available = n_available; } public int getN_available() { return n_available; } public void setN_available(int n_available) { this.n_available = n_available; } }
360
0.683333
0.683333
24
14
14.807093
46
false
false
0
0
0
0
0
0
1.166667
false
false
3
3b063a69e4d3b56348ac0187110150f88f057891
2,886,218,032,068
f2b93fb1d69523bf5f39d4ac6ebdfb5a4a361ec4
/app/src/main/java/com/example/samch/followthrough/Upload.java
9711c9a12fc99822bf983f4e373d2b1c8a261fa2
[]
no_license
samc24/FollowThrough
https://github.com/samc24/FollowThrough
7f8828b2efdddfe3dc58ad7e78fd8da6d06313cd
684088c378c629428541ca9bc47d963306b0b481
refs/heads/master
2022-12-25T02:27:34.799000
2020-10-01T18:59:58
2020-10-01T18:59:58
125,960,485
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.samch.followthrough; import android.os.AsyncTask; import android.os.Environment; import android.util.Log; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; public class Upload extends AsyncTask<String, Void, String> { public String path; public Upload(String path){ super(); this.path = path; Log.d("App:", "Upload: path = "+ this.path); } @Override protected String doInBackground(String... params) { // String currentPath = System.getProperty("user.dir"); // Log.d("App","current Path: " + currentPath); String charset = "UTF-8"; Log.d("App", "before file"); String root = Environment.getExternalStorageDirectory().toString()+"/raw"; Log.d("App", root); String filePath = "/Users/samch/Desktop/FollowThrough/app/src/main/res/raw/lebronform.mp4";//android.resource://com.example.samch.scrollvideo";//Environment.getExternalStorageDirectory().toString() + "/raw"; String fileName = "test.mp4"; File uploadFile = new File(path);//"ScrollVideo/app/src/main/res/raw",fileName);//getApplicationContext().getFilesDir(), "android.resource://com.example.samch.scrollvideo/" + R.raw.test);//getResources().getIdentifier("FILENAME_WITHOUT_EXTENSION","raw", getPackageName()));//"android.resource://com.example.samch.scrollvideo/test.mp4"); Log.d("App", "file made "+uploadFile + "file.isFile() = " + uploadFile.isFile()); String requestURL = "https://salty-hamlet-24223.herokuapp.com/poses/vs";//"http://localhost:8000/poses/vs"; try { MultipartUtility multipart = new MultipartUtility(requestURL, charset); // multipart.addHeaderField("User-Agent", "CodeJava"); // multipart.addHeaderField("Test-Header", "Header-Value"); // multipart.addFormField("description", "Cool Pictures"); // multipart.addFormField("keywords", "Java,upload,Spring"); multipart.addFilePart("fileUpload", uploadFile); Log.d("App", "added file"); // multipart.addFilePart("fileUpload", uploadFile2); List<String> response = multipart.finish(); Log.d("App", "SERVER REPLIED:" + response); for (String line : response) { Log.d("App:", line); } } catch (IOException ex) { Log.e("App:", "" + (ex)); } return null; } }
UTF-8
Java
2,482
java
Upload.java
Java
[ { "context": "d(\"App\", root);\n String filePath = \"/Users/samch/Desktop/FollowThrough/app/src/main/res/raw/lebron", "end": 869, "score": 0.7842285633087158, "start": 864, "tag": "USERNAME", "value": "samch" } ]
null
[]
package com.example.samch.followthrough; import android.os.AsyncTask; import android.os.Environment; import android.util.Log; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.List; public class Upload extends AsyncTask<String, Void, String> { public String path; public Upload(String path){ super(); this.path = path; Log.d("App:", "Upload: path = "+ this.path); } @Override protected String doInBackground(String... params) { // String currentPath = System.getProperty("user.dir"); // Log.d("App","current Path: " + currentPath); String charset = "UTF-8"; Log.d("App", "before file"); String root = Environment.getExternalStorageDirectory().toString()+"/raw"; Log.d("App", root); String filePath = "/Users/samch/Desktop/FollowThrough/app/src/main/res/raw/lebronform.mp4";//android.resource://com.example.samch.scrollvideo";//Environment.getExternalStorageDirectory().toString() + "/raw"; String fileName = "test.mp4"; File uploadFile = new File(path);//"ScrollVideo/app/src/main/res/raw",fileName);//getApplicationContext().getFilesDir(), "android.resource://com.example.samch.scrollvideo/" + R.raw.test);//getResources().getIdentifier("FILENAME_WITHOUT_EXTENSION","raw", getPackageName()));//"android.resource://com.example.samch.scrollvideo/test.mp4"); Log.d("App", "file made "+uploadFile + "file.isFile() = " + uploadFile.isFile()); String requestURL = "https://salty-hamlet-24223.herokuapp.com/poses/vs";//"http://localhost:8000/poses/vs"; try { MultipartUtility multipart = new MultipartUtility(requestURL, charset); // multipart.addHeaderField("User-Agent", "CodeJava"); // multipart.addHeaderField("Test-Header", "Header-Value"); // multipart.addFormField("description", "Cool Pictures"); // multipart.addFormField("keywords", "Java,upload,Spring"); multipart.addFilePart("fileUpload", uploadFile); Log.d("App", "added file"); // multipart.addFilePart("fileUpload", uploadFile2); List<String> response = multipart.finish(); Log.d("App", "SERVER REPLIED:" + response); for (String line : response) { Log.d("App:", line); } } catch (IOException ex) { Log.e("App:", "" + (ex)); } return null; } }
2,482
0.636986
0.631346
58
41.793102
53.514019
344
false
false
0
0
0
0
66
0.026591
1.155172
false
false
3
eab1582e3f393cc4437ea43b3eafa4bd92825224
36,352,603,219,324
85f8b30c172424b41fe44858782c69bec034d476
/plugin/src/main/java/org/jfrog/idea/ui/components/IssuesTable.java
19943cd3af512da02b6d3c9949d15ffa39fdd524
[ "Apache-2.0" ]
permissive
DimaNevelev/jfrog-idea-plugin
https://github.com/DimaNevelev/jfrog-idea-plugin
88dd080d754952582c54b015864fddfd5e2c30f9
17dcc0393b425f9cba407450e1146fc88edf5f07
refs/heads/master
2020-03-26T03:22:34.203000
2018-08-16T07:25:03
2018-08-16T07:25:03
144,453,037
0
0
Apache-2.0
true
2018-08-14T13:34:27
2018-08-12T09:13:53
2018-08-14T11:30:54
2018-08-14T13:34:27
863
0
0
0
Java
false
null
package org.jfrog.idea.ui.components; import com.intellij.ui.table.JBTable; import org.jfrog.idea.ui.xray.models.IssuesTableModel; import org.jfrog.idea.ui.xray.renderers.IssuesTableCellRenderer; /** * Created by Yahav Itzhak on 6 Dec 2017. */ public class IssuesTable extends JBTable { public IssuesTable() { setModel(new IssuesTableModel()); setShowGrid(true); setDefaultRenderer(Object.class, new IssuesTableCellRenderer()); getTableHeader().setReorderingAllowed(false); setAutoResizeMode(AUTO_RESIZE_OFF); } }
UTF-8
Java
566
java
IssuesTable.java
Java
[ { "context": "derers.IssuesTableCellRenderer;\n\n/**\n * Created by Yahav Itzhak on 6 Dec 2017.\n */\npublic class IssuesTable exten", "end": 228, "score": 0.9998710751533508, "start": 216, "tag": "NAME", "value": "Yahav Itzhak" } ]
null
[]
package org.jfrog.idea.ui.components; import com.intellij.ui.table.JBTable; import org.jfrog.idea.ui.xray.models.IssuesTableModel; import org.jfrog.idea.ui.xray.renderers.IssuesTableCellRenderer; /** * Created by <NAME> on 6 Dec 2017. */ public class IssuesTable extends JBTable { public IssuesTable() { setModel(new IssuesTableModel()); setShowGrid(true); setDefaultRenderer(Object.class, new IssuesTableCellRenderer()); getTableHeader().setReorderingAllowed(false); setAutoResizeMode(AUTO_RESIZE_OFF); } }
560
0.729682
0.720848
19
28.842106
23.292789
72
false
false
0
0
0
0
0
0
0.526316
false
false
3
9a84da658904734b9ba83b6f6268f731c5d8d3b3
36,352,603,217,851
ebab45092022628c59860cc35a987504a1dc84c1
/src/java/dashboards/pullHts.java
13fbf8b98a0fefd15cd22203c47b14a5cd5f1d83
[]
no_license
nyabuto/InternalSystem
https://github.com/nyabuto/InternalSystem
7642ad770acc27207b3d3ea8e1aeb6e6c7501ec6
aff4c205c0c4343e23c594f6f8fb87a2599cf69e
refs/heads/master
2023-07-29T11:03:50.192000
2023-07-19T07:28:14
2023-07-19T07:28:14
35,535,011
0
3
null
false
2020-09-04T00:01:38
2015-05-13T07:39:06
2020-06-06T11:03:19
2020-09-04T00:01:36
18,277
0
0
2
Java
false
false
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dashboards; import database.dbConn; import database.dbConnDash; import java.io.IOException; import java.io.PrintWriter; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author EKaunda */ public class pullHts extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ // HttpSession session=null; // session=request.getSession(); // session.setAttribute("semi_annual", ""); // session.setAttribute("quarter", ""); // session.setAttribute("monthid", "5"); // session.setAttribute("year", "2018"); // session.setAttribute("reportDuration", "4");//quarterly, monthly,yearly String sdate="201809"; String edate="201809"; String facil=""; //htsdataset ds= new htsdataset(); //dbConn conn1 = new dbConn(); //totalHts //pullHts hts= new pullHts(); // hts.hts_non731(yearmonth,yearmonth,facilityId); //stored procedure code hts731( sdate, edate, facil); } finally { out.close(); } } //constituency //constituency @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } } @Override public String getServletInfo() { return "Short description"; }// </editor-fold> public String hts_non731(String startyearmonth, String endyearmonth,String facil) { try { //_______________________________OVERVIEW______________________________ //We are pulling data from various hts datatables table using a stored procedure( hts_dashboards ) into dashboards table2 //The assumption here is that the stored procedure will come in structure similar to the one for table2 //any column output in the hts_dashboards stored procedure should also exist in table2 //columns are fetched dynamically and then the respective data insert using a loop into the table //the insert code is excecuted at the end of the loop dbConnDash conndb = new dbConnDash(); dbConn conn = new dbConn(); String facilitiestable = "subpartnera"; int count1 = 1; String insertqry = " REPLACE INTO dashboards.table2 SET "; // String qry1 = "call tb_dashboard('2015-10-01','2016-09-30','')"; String qry1 = "call hts_dashboard(\"" + startyearmonth + "\",\"" + endyearmonth + "\",\"" + facilitiestable + "\",\"" + facil + "\")"; conn.rs = conn.st.executeQuery(qry1); ResultSetMetaData metaData = conn.rs.getMetaData(); int columnCount = metaData.getColumnCount(); ArrayList mycolumns1 = new ArrayList(); while (conn.rs.next()) { if (count1 == 1) { //headers only for (int i = 1; i <= columnCount; i++) { if (i < columnCount) { mycolumns1.add(metaData.getColumnLabel(i)); //build column insertqry += " `dashboards`.`table2`.`" + metaData.getColumnLabel(i) + "`=?, "; } else { //last column we dont need a coma at the end of the column name //also initialize a prepared statement at this level mycolumns1.add(metaData.getColumnLabel(i)); insertqry += " `dashboards`.`table2`.`" + metaData.getColumnLabel(i) + "`=? "; // valuesqry+=" ? )"; conndb.pst = conn.conn.prepareStatement(insertqry); } }//end of for loop count1++; }//end of if //data rows for (int a = 0; a < columnCount; a++) { conndb.pst.setString(a + 1, conn.rs.getString(mycolumns1.get(a).toString())); if (a == (columnCount - 1)) { conndb.pst.executeUpdate(); System.out.println("" + conndb.pst); } } count1++; } } catch (SQLException ex) { Logger.getLogger(pullTb.class.getName()).log(Level.SEVERE, null, ex); } return "Data pulled"; } public String hts731( String sdate, String edate, String facil){ dbConn conn = new dbConn(); String facilwhere=""; if(!facil.equals("")){ facilwhere=" ( and subpartnerId='"+facil+"' ) ";} int year = new Integer(edate.substring(0,4)); Calendar ca= Calendar.getInstance(); int currentyear=ca.get(Calendar.YEAR); htsdataset htsclass= new htsdataset(); try { //insert overall hts //HashMap <String,String> htshm = htsclass.HtsTst(conn,sdate,edate,facil); HashMap<String,String> ipd_hm=htsclass.Ipd(conn,sdate,edate,facil); HashMap<String,String> opd_hm=htsclass.Opd(conn,sdate,edate,facil); HashMap<String,String> vct_hm=htsclass.Vct(conn,sdate,edate,facil); HashMap<String,String> pmtct_hm=htsclass.Pmtct(conn,sdate,edate,facil); HashMap<String,String> hts_hm=htsclass.HtsTst(conn,sdate,edate,facil); insertHts(hts_hm, sdate,edate, facil, "HTS-POS@9",false, "9");//HTS POS insertHts(hts_hm, sdate,edate, facil, "HTS TST@8",false, "8");//HTS TST insertHts(ipd_hm, sdate,edate, facil, "HTS - Inpatient Services@12",true, "12"); //HTS IPD insertHts(opd_hm, sdate,edate, facil, "HTS - Pediatric Services@13",true, "13"); //HTS Pediatrics and Other PITC //insertHts(opd_hm, sdate,edate, facil, "HTS - Other PITC@20",true, "20"); //HTS Pediatrics and Other PITC insertHts(pmtct_hm,sdate,edate,facil, "HTS - PMTCT (ANC Only) Clinics@16",true, "16"); //PMTCT ANC ONLY insertHts(vct_hm, sdate,edate, facil, "HTS - VCT@21",true, "21"); //VCT // } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } return "done"; } public String insertHts( HashMap htshmap, String sdate, String edate, String facil,String level3,boolean haslevel4,String ordernumber) throws SQLException{ try { String facilwhere=""; if(!facil.equals("")){ facilwhere=" and (subpartnerId='"+facil+"' ) ";} dbConnDash conndb = new dbConnDash(); dbConn conn = new dbConn(); int year = new Integer(edate.substring(0,4)); Calendar ca= Calendar.getInstance(); int currentyear=ca.get(Calendar.YEAR); String facilitiestable="subpartnera"; int selectedyear=year; if(selectedyear<currentyear){ if(year<2014){ //db for 2014 is the smallest facilitiestable="subpartnera2014"; } else { facilitiestable="subpartnera"+selectedyear; } } HashMap <String,String> htshm = htshmap; String getsites="SELECT county.County as county,district.DistrictNom as district, " // + " "+facilitiestable+".SubPartnerNom as facility, "+facilitiestable+".CentreSanteId as mflcode, "+facilitiestable+".HTC_Support1 as htcsupport, IFNULL(ART_highvolume,0) as arthv, IFNULL(HTC_highvolume,0) as htchv, IFNULL(PMTCT_highvolume,0) as pmtcthv, IFNULL(HTC,0) as HTC, IFNULL(PMTCT,0) as PMTCT" + " FROM "+facilitiestable+" join (district join county on county.CountyID=district.CountyID) on district.DistrictID = "+facilitiestable+".DistrictID where ( HTC=1 OR PMTCT=1 ) AND "+facilitiestable+".active=1 "+facilwhere+" group by "+facilitiestable+".SubPartnerID "; System.out.println(""+getsites); conn.rs=conn.st.executeQuery(getsites); while(conn.rs.next()){ String mfl=conn.rs.getString("mflcode"); String cty=conn.rs.getString("county"); String sty=conn.rs.getString("district"); String fac=conn.rs.getString("facility"); String st=conn.rs.getString("htcsupport"); for(int ymn=new Integer(sdate);ymn<=new Integer(edate);ymn++){ double gtt=new Double(htshm.getOrDefault("gtt_"+mfl+ymn,"0")); double gtp=new Double(htshm.getOrDefault("gtp_"+mfl+ymn,"0")); double ukpf=(new Double(htshm.getOrDefault("ukpf_"+mfl+ymn,"0"))); double ukpm=(new Double(htshm.getOrDefault("ukpm_"+mfl+ymn,"0"))); double pf1=(new Double(htshm.getOrDefault("pf1_"+mfl+ymn,"0")) ); double pm1=(new Double(htshm.getOrDefault("pm1_"+mfl+ymn,"0")) ); double pf4=(new Double(htshm.getOrDefault("pf4_"+mfl+ymn,"0")) ); double pm4=(new Double(htshm.getOrDefault("pm4_"+mfl+ymn,"0")) ); double pf9=(new Double(htshm.getOrDefault("pf9_"+mfl+ymn,"0")) ); double pm9=(new Double(htshm.getOrDefault("pm9_"+mfl+ymn,"0")) ); double pf14=(new Double(htshm.getOrDefault("pf14_"+mfl+ymn,"0"))); double pm14=(new Double(htshm.getOrDefault("pm14_"+mfl+ymn,"0"))); double pf19=(new Double(htshm.getOrDefault("pf19_"+mfl+ymn,"0"))); double pm19=(new Double(htshm.getOrDefault("pm19_"+mfl+ymn,"0"))); double pf24=(new Double(htshm.getOrDefault("pf24_"+mfl+ymn,"0"))); double pm24=(new Double(htshm.getOrDefault("pm24_"+mfl+ymn,"0"))); double pf29=(new Double(htshm.getOrDefault("pf29_"+mfl+ymn,"0"))); double pm29=(new Double(htshm.getOrDefault("pm29_"+mfl+ymn,"0"))); double pf34=(new Double(htshm.getOrDefault("pf34_"+mfl+ymn,"0"))); double pm34=(new Double(htshm.getOrDefault("pm34_"+mfl+ymn,"0"))); double pf39=(new Double(htshm.getOrDefault("pf39_"+mfl+ymn,"0"))); double pm39=(new Double(htshm.getOrDefault("pm39_"+mfl+ymn,"0"))); double pf49=(new Double(htshm.getOrDefault("pf49_"+mfl+ymn,"0"))); double pm49=(new Double(htshm.getOrDefault("pm49_"+mfl+ymn,"0"))); double pf50=(new Double(htshm.getOrDefault("pf50_"+mfl+ymn,"0"))); double pm50=(new Double(htshm.getOrDefault("pm50_"+mfl+ymn,"0"))); double uknf=(new Double(htshm.getOrDefault("uknf_"+mfl+ymn,"0")) ); double uknm=(new Double(htshm.getOrDefault("uknm_"+mfl+ymn,"0")) ); double nf1=(new Double(htshm.getOrDefault("nf1_"+mfl+ymn,"0"))); double nm1=(new Double(htshm.getOrDefault("nm1_"+mfl+ymn,"0"))); double nf4=(new Double(htshm.getOrDefault("nf4_"+mfl+ymn,"0"))); double nm4=(new Double(htshm.getOrDefault("nm4_"+mfl+ymn,"0"))); double nf9=(new Double(htshm.getOrDefault("nf9_"+mfl+ymn,"0"))); double nm9=(new Double(htshm.getOrDefault("nm9_"+mfl+ymn,"0"))); double nf14=(new Double(htshm.getOrDefault("nf14_"+mfl+ymn,"0"))); double nm14=(new Double(htshm.getOrDefault("nm14_"+mfl+ymn,"0"))); double nf19=(new Double(htshm.getOrDefault("nf19_"+mfl+ymn,"0"))); double nm19=(new Double(htshm.getOrDefault("nm19_"+mfl+ymn,"0"))); double nf24=(new Double(htshm.getOrDefault("nf24_"+mfl+ymn,"0"))); double nm24=(new Double(htshm.getOrDefault("nm24_"+mfl+ymn,"0"))); double nf29=(new Double(htshm.getOrDefault("nf29_"+mfl+ymn,"0"))); double nm29=(new Double(htshm.getOrDefault("nm29_"+mfl+ymn,"0"))); double nf34=(new Double(htshm.getOrDefault("nf34_"+mfl+ymn,"0"))); double nm34=(new Double(htshm.getOrDefault("nm34_"+mfl+ymn,"0"))); double nf39=(new Double(htshm.getOrDefault("nf39_"+mfl+ymn,"0"))); double nm39=(new Double(htshm.getOrDefault("nm39_"+mfl+ymn,"0"))); double nf49=(new Double(htshm.getOrDefault("nf49_"+mfl+ymn,"0"))); double nm49=(new Double(htshm.getOrDefault("nm49_"+mfl+ymn,"0"))); double nf50=(new Double(htshm.getOrDefault("nf50_"+mfl+ymn,"0"))); double nm50=(new Double(htshm.getOrDefault("nm50_"+mfl+ymn,"0"))); double tt =(new Double(htshm.getOrDefault("tt_"+mfl+ymn,"0"))); String burdencategory = htshm.getOrDefault("burdencategory_"+mfl+ymn,""); String constituency = htshm.getOrDefault("constituency_"+mfl+ymn,""); String ward = htshm.getOrDefault("ward_"+mfl+ymn,""); String yr = htshm.getOrDefault("year_"+mfl+ymn,""); String semiannual = htshm.getOrDefault("semiannual_"+mfl+ymn,""); String qtr = htshm.getOrDefault("quarter_"+mfl+ymn,""); String mn = htshm.getOrDefault("month_"+mfl+ymn,""); String ym = htshm.getOrDefault("yearmonth_"+mfl+ymn,""); String ownedby = htshm.getOrDefault("ownedby_"+mfl+ymn,""); String facilitytype = htshm.getOrDefault("facilitytype_"+mfl+ymn,""); String art_hv = htshm.getOrDefault("art_hv_"+mfl+ymn,"0"); String htc_hv = htshm.getOrDefault("htc_hv_"+mfl+ymn,"0"); String pmtct_hv = htshm.getOrDefault("pmtct_hv_"+mfl+ymn,"0"); String activity_hv = htshm.getOrDefault("activity_hv_"+mfl+ymn,"0"); String latitude = htshm.getOrDefault("latitude_"+mfl+ymn,""); String longitude = htshm.getOrDefault("longitude_"+mfl+ymn,""); String maleclinic = htshm.getOrDefault("maleclinic_"+mfl+ymn,"0"); String adoleclinic = htshm.getOrDefault("adoleclinic_"+mfl+ymn,"0"); String viremiaclinic = htshm.getOrDefault("viremiaclinic_"+mfl+ymn,"0"); String emrsite = htshm.getOrDefault("emrsite_"+mfl+ymn,"0"); String linkdesk = htshm.getOrDefault("linkdesk_"+mfl+ymn,"0"); String islocked = htshm.getOrDefault("islocked_"+mfl+ymn,"0"); System.out.println(" Loop number="+ymn+" facility "+fac+" "+tt); String insertqry = " REPLACE INTO dashboards.table2 SET " + " id = ? ," + "county = ? ," + "burdencategory = ? ," + "constituency = ? ," + "subcounty = ? ," + "ward = ? ," + "facility = ? ," + "mflcode = ? ," + "supporttype = ? ," + "level1 = ? ," + "level2 = ? ," + "level3 = ? ," + "level4 = ? ," + "unknown_f = ? ," + "unknown_m = ? ," + "d60 = ? ," + "mn_0_2 = ? ," + "mn_2_12 = ? ," + "mn_2_4y = ? ," + "f_1 = ? ," + "m_1 = ? ," + "t_1 = ? ," + "f_4 = ? ," + "m_4 = ? ," + "f_5_9 = ? ," + "m_5_9 = ? ," + "f_1_9 = ? ," + "m_1_9 = ? ," + "t_1_9 = ? ," + "f_14 = ? ," + "m_14 = ? ," + "f_19 = ? ," + "m_19 = ? ," + "f_24 = ? ," + "m_24 = ? ," + "f_29 = ? ," + "m_29 = ? ," + "f_34 = ? ," + "m_34 = ? ," + "f_39 = ? ," + "m_39 = ? ," + "f_49 = ? ," + "m_49 = ? ," + "f_25_49 = ? ," + "m_25_49 = ? ," + "f_50 = ? ," + "m_50 = ? ," + "total = ? ," + "total_f = ? ," + "total_m = ? ," + "paeds_f = ? ," + "paeds_m = ? ," + "paeds = ? ," + "adult_f = ? ," + "adult_m = ? ," + "adult = ? ," + "f_15_24 = ? ," + "m_15_24 = ? ," + "t_15_24 = ? ," + "year = ? ," + "semiannual = ? ," + "quarter = ? ," + "month = ? ," + "yearmonth = ? ," + "ownedby = ? ," + "facilitytype = ? ," + "art_hv = ? ," + "htc_hv = ? ," + "pmtct_hv = ? ," + "activity_hv = ? ," + "latitude = ? ," + "longitude = ? ," + "maleclinic = ? ," + "adoleclinic = ? ," + "viremiaclinic = ? ," + "emrsite = ? ," + "linkdesk = ? ," + "islocked = ? ," + "ordernumber = ? "; conndb.pst = conn.conn.prepareStatement(insertqry); String Level3arr[]=level3.split("@"); String level4=""; if(haslevel4 && !(level3.contains("HTS - Pediatric Services") || level3.contains("HTS - Other PITC")) ){ //Tested 40 if(1==1){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Tested"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1+nf1))); conndb.pst.setInt(21,new Integer((int) (pm1+nm1))); conndb.pst.setInt(22,new Integer((int) (pm1+nm1+pf1+nf1))); conndb.pst.setInt(23,new Integer((int) (pf4+nf4))); conndb.pst.setInt(24,new Integer((int) (pm4+nm4))); conndb.pst.setInt(25,new Integer((int) (pf9+nf9))); conndb.pst.setInt(26,new Integer((int) (pm9+nm9))); conndb.pst.setInt(27,new Integer((int) (pf4+nf4+pf9+nf9))); conndb.pst.setInt(28,new Integer((int) (pm4+nm4+pm9+nm9))); conndb.pst.setInt(29,new Integer((int) (pf4+nf4+pf9+nf9+pm4+nm4+pm9+nm9))); conndb.pst.setInt(30,new Integer((int) (pf14+nf14))); conndb.pst.setInt(31,new Integer((int) (pm14+nm14))); conndb.pst.setInt(32,new Integer((int) (pf19+nf19))); conndb.pst.setInt(33,new Integer((int) (pm19+nm19))); conndb.pst.setInt(34,new Integer((int) (pf24+nf24))); conndb.pst.setInt(35,new Integer((int) (pm24+nm24))); conndb.pst.setInt(36,new Integer((int) (pf29+nf29))); conndb.pst.setInt(37,new Integer((int) (pm29+nm29))); conndb.pst.setInt(38,new Integer((int) (pf34+nf34))); conndb.pst.setInt(39,new Integer((int) (pm34+nm34))); conndb.pst.setInt(40,new Integer((int) (pf39+nf39))); conndb.pst.setInt(41,new Integer((int) (pm39+nm39))); conndb.pst.setInt(42,new Integer((int) (pf49+nf49))); conndb.pst.setInt(43,new Integer((int) (pm49+nm49))); conndb.pst.setInt(44,new Integer((int) (pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49))); conndb.pst.setInt(45,new Integer((int) (pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49))); conndb.pst.setInt(46,new Integer((int) (pf50+nf50))); conndb.pst.setInt(47,new Integer((int) (pm50+nm50))); conndb.pst.setInt(48,new Integer((int) (tt))); conndb.pst.setInt(49,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(50,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(51,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14))); conndb.pst.setInt(52,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(53,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(54,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(55,new Integer((int) (pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(56,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(57,new Integer((int) (pf19+nf19+pf24+nf24))); conndb.pst.setInt(58,new Integer((int) (pm19+nm19+pm24+nm24))); conndb.pst.setInt(59,new Integer((int) (pf19+nf19+pf24+nf24+pm19+nm19+pm24+nm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } //positive 41 if(2==2){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_41"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Positive"); conndb.pst.setInt(14,new Integer((int) (ukpf))); conndb.pst.setInt(15,new Integer((int) (ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1))); conndb.pst.setInt(21,new Integer((int) (pm1))); conndb.pst.setInt(22,new Integer((int) (pm1+pf1))); conndb.pst.setInt(23,new Integer((int) (pf4))); conndb.pst.setInt(24,new Integer((int) (pm4))); conndb.pst.setInt(25,new Integer((int) (pf9))); conndb.pst.setInt(26,new Integer((int) (pm9))); conndb.pst.setInt(27,new Integer((int) (pf4+pf9))); conndb.pst.setInt(28,new Integer((int) (pm4+pm9))); conndb.pst.setInt(29,new Integer((int) (pf4+pf9+pm4+pm9))); conndb.pst.setInt(30,new Integer((int) (pf14))); conndb.pst.setInt(31,new Integer((int) (pm14))); conndb.pst.setInt(32,new Integer((int) (pf19))); conndb.pst.setInt(33,new Integer((int) (pm19))); conndb.pst.setInt(34,new Integer((int) (pf24))); conndb.pst.setInt(35,new Integer((int) (pm24))); conndb.pst.setInt(36,new Integer((int) (pf29))); conndb.pst.setInt(37,new Integer((int) (pm29))); conndb.pst.setInt(38,new Integer((int) (pf34))); conndb.pst.setInt(39,new Integer((int) (pm34))); conndb.pst.setInt(40,new Integer((int) (pf39))); conndb.pst.setInt(41,new Integer((int) (pm39))); conndb.pst.setInt(42,new Integer((int) (pf49))); conndb.pst.setInt(43,new Integer((int) (pm49))); conndb.pst.setInt(44,new Integer((int) (pf29+pf34+pf39+pf49))); conndb.pst.setInt(45,new Integer((int) (pm29+pm34+pm39+pm49))); conndb.pst.setInt(46,new Integer((int) (pf50))); conndb.pst.setInt(47,new Integer((int) (pm50))); conndb.pst.setInt(48,new Integer((int) (pf1+pf4+pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm1+pm4+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(49,new Integer((int) (pf1+pf4+pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(50,new Integer((int) (pm1+pm4+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(51,new Integer((int) (pf1+pf4+pf9+pf14))); conndb.pst.setInt(52,new Integer((int) (pm1+pm4+pm9+pm14))); conndb.pst.setInt(53,new Integer((int) (pf1+pf4+pf9+pf14+pm1+pm4+pm9+pm14))); conndb.pst.setInt(54,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(55,new Integer((int) (pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(56,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(57,new Integer((int) (pf19+pf24))); conndb.pst.setInt(58,new Integer((int) (pm19+pm24))); conndb.pst.setInt(59,new Integer((int) (pf19+pf24+pm19+pm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } } //----------------------------------------------Other PITC only . This is being done to exclude paeds---------------------------------- if(haslevel4 && level3.contains("HTS - Other PITC")){ //Tested 40 if(1==1){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Tested"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (0))); conndb.pst.setInt(21,new Integer((int) (0))); conndb.pst.setInt(22,new Integer((int) (0))); conndb.pst.setInt(23,new Integer((int) (0))); conndb.pst.setInt(24,new Integer((int) (0))); conndb.pst.setInt(25,new Integer((int) (pf9+nf9))); conndb.pst.setInt(26,new Integer((int) (pm9+nm9))); conndb.pst.setInt(27,new Integer((int) (pf9+nf9))); conndb.pst.setInt(28,new Integer((int) (pm9+nm9))); conndb.pst.setInt(29,new Integer((int) (pf9+nf9+pm9+nm9))); conndb.pst.setInt(30,new Integer((int) (pf14+nf14))); conndb.pst.setInt(31,new Integer((int) (pm14+nm14))); conndb.pst.setInt(32,new Integer((int) (pf19+nf19))); conndb.pst.setInt(33,new Integer((int) (pm19+nm19))); conndb.pst.setInt(34,new Integer((int) (pf24+nf24))); conndb.pst.setInt(35,new Integer((int) (pm24+nm24))); conndb.pst.setInt(36,new Integer((int) (pf29+nf29))); conndb.pst.setInt(37,new Integer((int) (pm29+nm29))); conndb.pst.setInt(38,new Integer((int) (pf34+nf34))); conndb.pst.setInt(39,new Integer((int) (pm34+nm34))); conndb.pst.setInt(40,new Integer((int) (pf39+nf39))); conndb.pst.setInt(41,new Integer((int) (pm39+nm39))); conndb.pst.setInt(42,new Integer((int) (pf49+nf49))); conndb.pst.setInt(43,new Integer((int) (pm49+nm49))); conndb.pst.setInt(44,new Integer((int) (pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49))); conndb.pst.setInt(45,new Integer((int) (pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49))); conndb.pst.setInt(46,new Integer((int) (pf50+nf50))); conndb.pst.setInt(47,new Integer((int) (pm50+nm50))); conndb.pst.setInt(48,new Integer((int) (pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(49,new Integer((int) (pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(50,new Integer((int) (pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(51,new Integer((int) (pf9+nf9+pf14+nf14))); conndb.pst.setInt(52,new Integer((int) (pm9+nm9+pm14+nm14))); conndb.pst.setInt(53,new Integer((int) (pf9+nf9+pf14+nf14+pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(54,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(55,new Integer((int) (pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(56,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(57,new Integer((int) (pf19+nf19+pf24+nf24))); conndb.pst.setInt(58,new Integer((int) (pm19+nm19+pm24+nm24))); conndb.pst.setInt(59,new Integer((int) (pf19+nf19+pf24+nf24+pm19+nm19+pm24+nm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } //positive 41 if(2==2){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_41"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Positive"); conndb.pst.setInt(14,new Integer((int) (ukpf))); conndb.pst.setInt(15,new Integer((int) (ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (0))); conndb.pst.setInt(21,new Integer((int) (0))); conndb.pst.setInt(22,new Integer((int) (0))); conndb.pst.setInt(23,new Integer((int) (0))); conndb.pst.setInt(24,new Integer((int) (0))); conndb.pst.setInt(25,new Integer((int) (pf9))); conndb.pst.setInt(26,new Integer((int) (pm9))); conndb.pst.setInt(27,new Integer((int) (pf9))); conndb.pst.setInt(28,new Integer((int) (pm9))); conndb.pst.setInt(29,new Integer((int) (pf9+pm9))); conndb.pst.setInt(30,new Integer((int) (pf14))); conndb.pst.setInt(31,new Integer((int) (pm14))); conndb.pst.setInt(32,new Integer((int) (pf19))); conndb.pst.setInt(33,new Integer((int) (pm19))); conndb.pst.setInt(34,new Integer((int) (pf24))); conndb.pst.setInt(35,new Integer((int) (pm24))); conndb.pst.setInt(36,new Integer((int) (pf29))); conndb.pst.setInt(37,new Integer((int) (pm29))); conndb.pst.setInt(38,new Integer((int) (pf34))); conndb.pst.setInt(39,new Integer((int) (pm34))); conndb.pst.setInt(40,new Integer((int) (pf39))); conndb.pst.setInt(41,new Integer((int) (pm39))); conndb.pst.setInt(42,new Integer((int) (pf49))); conndb.pst.setInt(43,new Integer((int) (pm49))); conndb.pst.setInt(44,new Integer((int) (pf29+pf34+pf39+pf49))); conndb.pst.setInt(45,new Integer((int) (pm29+pm34+pm39+pm49))); conndb.pst.setInt(46,new Integer((int) (pf50))); conndb.pst.setInt(47,new Integer((int) (pm50))); conndb.pst.setInt(48,new Integer((int) (pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(49,new Integer((int) (pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(50,new Integer((int) (pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(51,new Integer((int) (pf9+pf14))); conndb.pst.setInt(52,new Integer((int) (pm9+pm14))); conndb.pst.setInt(53,new Integer((int) (pf9+pf14+pm9+pm14))); conndb.pst.setInt(54,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(55,new Integer((int) (pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(56,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(57,new Integer((int) (pf19+pf24))); conndb.pst.setInt(58,new Integer((int) (pm19+pm24))); conndb.pst.setInt(59,new Integer((int) (pf19+pf24+pm19+pm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } } //--------------------------------------------------------------Pediatrics--------------------------------- else if(haslevel4 && level3.contains("HTS - Pediatric Services")){ //Tested 40 if(1==1){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Tested"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1+nf1))); conndb.pst.setInt(21,new Integer((int) (pm1+nm1))); conndb.pst.setInt(22,new Integer((int) (pm1+nm1+pf1+nf1))); conndb.pst.setInt(23,new Integer((int) (pf4+nf4))); conndb.pst.setInt(24,new Integer((int) (pm4+nm4))); conndb.pst.setInt(25,0); conndb.pst.setInt(26,0); conndb.pst.setInt(27,new Integer((int) (pf4+nf4))); conndb.pst.setInt(28,new Integer((int) (pm4+nm4))); conndb.pst.setInt(29,new Integer((int) (pf4+nf4+pm4+nm4))); conndb.pst.setInt(30,0); conndb.pst.setInt(31,0); conndb.pst.setInt(32,0); conndb.pst.setInt(33,0); conndb.pst.setInt(34,0); conndb.pst.setInt(35,0); conndb.pst.setInt(36,0); conndb.pst.setInt(37,0); conndb.pst.setInt(38,0); conndb.pst.setInt(39,0); conndb.pst.setInt(40,0); conndb.pst.setInt(41,0); conndb.pst.setInt(42,0); conndb.pst.setInt(43,0); conndb.pst.setInt(44,0); conndb.pst.setInt(45,0); conndb.pst.setInt(46,0); conndb.pst.setInt(47,0); conndb.pst.setInt(48,new Integer((int) (pf1+nf1+pf4+nf4+pm1+nm1+pm4+nm4))); conndb.pst.setInt(49,new Integer((int) (pf1+nf1+pf4+nf4))); conndb.pst.setInt(50,new Integer((int) (pm1+nm1+pm4+nm4))); conndb.pst.setInt(51,new Integer((int) (pf1+nf1+pf4+nf4))); conndb.pst.setInt(52,new Integer((int) (pm1+nm1+pm4+nm4))); conndb.pst.setInt(53,new Integer((int) (pf1+nf1+pf4+nf4+pm1+nm1+pm4+nm4))); conndb.pst.setInt(54,0); conndb.pst.setInt(55,0); conndb.pst.setInt(56,0); conndb.pst.setInt(57,0); conndb.pst.setInt(58,0); conndb.pst.setInt(59,0); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ System.out.println(""+conndb.pst); conndb.pst.executeUpdate(); } } //positive 41 if(2==2){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_41"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Positive"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1))); conndb.pst.setInt(21,new Integer((int) (pm1))); conndb.pst.setInt(22,new Integer((int) (pm1+pf1))); conndb.pst.setInt(23,new Integer((int) (pf4))); conndb.pst.setInt(24,new Integer((int) (pm4))); conndb.pst.setInt(25,0); conndb.pst.setInt(26,0); conndb.pst.setInt(27,new Integer((int) (pf4))); conndb.pst.setInt(28,new Integer((int) (pm4))); conndb.pst.setInt(29,new Integer((int) (pf4+pm4))); conndb.pst.setInt(30,0); conndb.pst.setInt(31,0); conndb.pst.setInt(32,0); conndb.pst.setInt(33,0); conndb.pst.setInt(34,0); conndb.pst.setInt(35,0); conndb.pst.setInt(36,0); conndb.pst.setInt(37,0); conndb.pst.setInt(38,0); conndb.pst.setInt(39,0); conndb.pst.setInt(40,0); conndb.pst.setInt(41,0); conndb.pst.setInt(42,0); conndb.pst.setInt(43,0); conndb.pst.setInt(44,0); conndb.pst.setInt(45,0); conndb.pst.setInt(46,0); conndb.pst.setInt(47,0); conndb.pst.setInt(48,new Integer((int) (pf1+pf4+pm1+pm4))); conndb.pst.setInt(49,new Integer((int) (pf1+pf4))); conndb.pst.setInt(50,new Integer((int) (pm1+pm4))); conndb.pst.setInt(51,new Integer((int) (pf1+pf4))); conndb.pst.setInt(52,new Integer((int) (pm1+pm4))); conndb.pst.setInt(53,new Integer((int) (pf1+pf4+pm1+pm4))); conndb.pst.setInt(54,0); conndb.pst.setInt(55,0); conndb.pst.setInt(56,0); conndb.pst.setInt(57,0); conndb.pst.setInt(58,0); conndb.pst.setInt(59,0); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } } else { //HTS-POS if(level3.contains("@9")){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+""; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,""); conndb.pst.setInt(14,new Integer((int) (ukpf))); conndb.pst.setInt(15,new Integer((int) (ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1))); conndb.pst.setInt(21,new Integer((int) (pm1))); conndb.pst.setInt(22,new Integer((int) (pm1+pf1))); conndb.pst.setInt(23,new Integer((int) (pf4))); conndb.pst.setInt(24,new Integer((int) (pm4))); conndb.pst.setInt(25,new Integer((int) (pf9))); conndb.pst.setInt(26,new Integer((int) (pm9))); conndb.pst.setInt(27,new Integer((int) (pf4+pf9))); conndb.pst.setInt(28,new Integer((int) (pm4+pm9))); conndb.pst.setInt(29,new Integer((int) (pf4+pf9+pm4+pm9))); conndb.pst.setInt(30,new Integer((int) (pf14))); conndb.pst.setInt(31,new Integer((int) (pm14))); conndb.pst.setInt(32,new Integer((int) (pf19))); conndb.pst.setInt(33,new Integer((int) (pm19))); conndb.pst.setInt(34,new Integer((int) (pf24))); conndb.pst.setInt(35,new Integer((int) (pm24))); conndb.pst.setInt(36,new Integer((int) (pf29))); conndb.pst.setInt(37,new Integer((int) (pm29))); conndb.pst.setInt(38,new Integer((int) (pf34))); conndb.pst.setInt(39,new Integer((int) (pm34))); conndb.pst.setInt(40,new Integer((int) (pf39))); conndb.pst.setInt(41,new Integer((int) (pm39))); conndb.pst.setInt(42,new Integer((int) (pf49))); conndb.pst.setInt(43,new Integer((int) (pm49))); conndb.pst.setInt(44,new Integer((int) (pf29+pf34+pf39+pf49))); conndb.pst.setInt(45,new Integer((int) (pm29+pm34+pm39+pm49))); conndb.pst.setInt(46,new Integer((int) (pf50))); conndb.pst.setInt(47,new Integer((int) (pm50))); conndb.pst.setInt(48,new Integer((int) (gtp))); conndb.pst.setInt(49,new Integer((int) (pf1+pf4+pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(50,new Integer((int) (pm1+pm4+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(51,new Integer((int) (pf1+pf4+pf9+pf14))); conndb.pst.setInt(52,new Integer((int) (pm1+pm4+pm9+pm14))); conndb.pst.setInt(53,new Integer((int) (pf1+pf4+pf9+pf14+pm1+pm4+pm9+pm14))); conndb.pst.setInt(54,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(55,new Integer((int) (pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(56,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(57,new Integer((int) (pf19+pf24))); conndb.pst.setInt(58,new Integer((int) (pm19+pm24))); conndb.pst.setInt(59,new Integer((int) (pf19+pf24+pm19+pm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } }//end of if //HTS-TST if(level3.contains("@8")){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,""); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1+nf1))); conndb.pst.setInt(21,new Integer((int) (pm1+nm1))); conndb.pst.setInt(22,new Integer((int) (pm1+nm1+pf1+nf1))); conndb.pst.setInt(23,new Integer((int) (pf4+nf4))); conndb.pst.setInt(24,new Integer((int) (pm4+nm4))); conndb.pst.setInt(25,new Integer((int) (pf9+nf9))); conndb.pst.setInt(26,new Integer((int) (pm9+nm9))); conndb.pst.setInt(27,new Integer((int) (pf4+nf4+pf9+nf9))); conndb.pst.setInt(28,new Integer((int) (pm4+nm4+pm9+nm9))); conndb.pst.setInt(29,new Integer((int) (pf4+nf4+pf9+nf9+pm4+nm4+pm9+nm9))); conndb.pst.setInt(30,new Integer((int) (pf14+nf14))); conndb.pst.setInt(31,new Integer((int) (pm14+nm14))); conndb.pst.setInt(32,new Integer((int) (pf19+nf19))); conndb.pst.setInt(33,new Integer((int) (pm19+nm19))); conndb.pst.setInt(34,new Integer((int) (pf24+nf24))); conndb.pst.setInt(35,new Integer((int) (pm24+nm24))); conndb.pst.setInt(36,new Integer((int) (pf29+nf29))); conndb.pst.setInt(37,new Integer((int) (pm29+nm29))); conndb.pst.setInt(38,new Integer((int) (pf34+nf34))); conndb.pst.setInt(39,new Integer((int) (pm34+nm34))); conndb.pst.setInt(40,new Integer((int) (pf39+nf39))); conndb.pst.setInt(41,new Integer((int) (pm39+nm39))); conndb.pst.setInt(42,new Integer((int) (pf49+nf49))); conndb.pst.setInt(43,new Integer((int) (pm49+nm49))); conndb.pst.setInt(44,new Integer((int) (pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49))); conndb.pst.setInt(45,new Integer((int) (pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49))); conndb.pst.setInt(46,new Integer((int) (pf50+nf50))); conndb.pst.setInt(47,new Integer((int) (pm50+nm50))); conndb.pst.setInt(48,new Integer((int) (tt))); conndb.pst.setInt(49,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(50,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(51,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14))); conndb.pst.setInt(52,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(53,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(54,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(55,new Integer((int) (pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(56,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(57,new Integer((int) (pf19+nf19+pf24+nf24))); conndb.pst.setInt(58,new Integer((int) (pm19+nm19+pm24+nm24))); conndb.pst.setInt(59,new Integer((int) (pf19+nf19+pf24+nf24+pm19+nm19+pm24+nm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ System.out.println(""+conndb.pst); conndb.pst.executeUpdate(); //System.out.println("Teeesting____"+(pf19+""+nf19+""+pf24+""+nf24+""+pf29+""+nf29+""+pf34+""+nf34+""+pf39+""+nf39+""+pf49+""+nf49+""+pf50+""+nf50+""+pm19+""+nm19+""+pm24+""+nm24+""+pm29+""+nm29+""+pm34+""+nm34+""+pm39+""+nm39+""+pm49+""+nm49+""+pm50+""+nm50=pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50)); } } } } }// end of while } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } return "done"; } }
UTF-8
Java
52,840
java
pullHts.java
Java
[ { "context": "rvlet.http.HttpServletResponse;\n\n/**\n *\n * @author EKaunda\n */\npublic class pullHts extends HttpServlet {\n\n ", "end": 722, "score": 0.9554996490478516, "start": 715, "tag": "USERNAME", "value": "EKaunda" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dashboards; import database.dbConn; import database.dbConnDash; import java.io.IOException; import java.io.PrintWriter; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author EKaunda */ public class pullHts extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ // HttpSession session=null; // session=request.getSession(); // session.setAttribute("semi_annual", ""); // session.setAttribute("quarter", ""); // session.setAttribute("monthid", "5"); // session.setAttribute("year", "2018"); // session.setAttribute("reportDuration", "4");//quarterly, monthly,yearly String sdate="201809"; String edate="201809"; String facil=""; //htsdataset ds= new htsdataset(); //dbConn conn1 = new dbConn(); //totalHts //pullHts hts= new pullHts(); // hts.hts_non731(yearmonth,yearmonth,facilityId); //stored procedure code hts731( sdate, edate, facil); } finally { out.close(); } } //constituency //constituency @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } } @Override public String getServletInfo() { return "Short description"; }// </editor-fold> public String hts_non731(String startyearmonth, String endyearmonth,String facil) { try { //_______________________________OVERVIEW______________________________ //We are pulling data from various hts datatables table using a stored procedure( hts_dashboards ) into dashboards table2 //The assumption here is that the stored procedure will come in structure similar to the one for table2 //any column output in the hts_dashboards stored procedure should also exist in table2 //columns are fetched dynamically and then the respective data insert using a loop into the table //the insert code is excecuted at the end of the loop dbConnDash conndb = new dbConnDash(); dbConn conn = new dbConn(); String facilitiestable = "subpartnera"; int count1 = 1; String insertqry = " REPLACE INTO dashboards.table2 SET "; // String qry1 = "call tb_dashboard('2015-10-01','2016-09-30','')"; String qry1 = "call hts_dashboard(\"" + startyearmonth + "\",\"" + endyearmonth + "\",\"" + facilitiestable + "\",\"" + facil + "\")"; conn.rs = conn.st.executeQuery(qry1); ResultSetMetaData metaData = conn.rs.getMetaData(); int columnCount = metaData.getColumnCount(); ArrayList mycolumns1 = new ArrayList(); while (conn.rs.next()) { if (count1 == 1) { //headers only for (int i = 1; i <= columnCount; i++) { if (i < columnCount) { mycolumns1.add(metaData.getColumnLabel(i)); //build column insertqry += " `dashboards`.`table2`.`" + metaData.getColumnLabel(i) + "`=?, "; } else { //last column we dont need a coma at the end of the column name //also initialize a prepared statement at this level mycolumns1.add(metaData.getColumnLabel(i)); insertqry += " `dashboards`.`table2`.`" + metaData.getColumnLabel(i) + "`=? "; // valuesqry+=" ? )"; conndb.pst = conn.conn.prepareStatement(insertqry); } }//end of for loop count1++; }//end of if //data rows for (int a = 0; a < columnCount; a++) { conndb.pst.setString(a + 1, conn.rs.getString(mycolumns1.get(a).toString())); if (a == (columnCount - 1)) { conndb.pst.executeUpdate(); System.out.println("" + conndb.pst); } } count1++; } } catch (SQLException ex) { Logger.getLogger(pullTb.class.getName()).log(Level.SEVERE, null, ex); } return "Data pulled"; } public String hts731( String sdate, String edate, String facil){ dbConn conn = new dbConn(); String facilwhere=""; if(!facil.equals("")){ facilwhere=" ( and subpartnerId='"+facil+"' ) ";} int year = new Integer(edate.substring(0,4)); Calendar ca= Calendar.getInstance(); int currentyear=ca.get(Calendar.YEAR); htsdataset htsclass= new htsdataset(); try { //insert overall hts //HashMap <String,String> htshm = htsclass.HtsTst(conn,sdate,edate,facil); HashMap<String,String> ipd_hm=htsclass.Ipd(conn,sdate,edate,facil); HashMap<String,String> opd_hm=htsclass.Opd(conn,sdate,edate,facil); HashMap<String,String> vct_hm=htsclass.Vct(conn,sdate,edate,facil); HashMap<String,String> pmtct_hm=htsclass.Pmtct(conn,sdate,edate,facil); HashMap<String,String> hts_hm=htsclass.HtsTst(conn,sdate,edate,facil); insertHts(hts_hm, sdate,edate, facil, "HTS-POS@9",false, "9");//HTS POS insertHts(hts_hm, sdate,edate, facil, "HTS TST@8",false, "8");//HTS TST insertHts(ipd_hm, sdate,edate, facil, "HTS - Inpatient Services@12",true, "12"); //HTS IPD insertHts(opd_hm, sdate,edate, facil, "HTS - Pediatric Services@13",true, "13"); //HTS Pediatrics and Other PITC //insertHts(opd_hm, sdate,edate, facil, "HTS - Other PITC@20",true, "20"); //HTS Pediatrics and Other PITC insertHts(pmtct_hm,sdate,edate,facil, "HTS - PMTCT (ANC Only) Clinics@16",true, "16"); //PMTCT ANC ONLY insertHts(vct_hm, sdate,edate, facil, "HTS - VCT@21",true, "21"); //VCT // } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } return "done"; } public String insertHts( HashMap htshmap, String sdate, String edate, String facil,String level3,boolean haslevel4,String ordernumber) throws SQLException{ try { String facilwhere=""; if(!facil.equals("")){ facilwhere=" and (subpartnerId='"+facil+"' ) ";} dbConnDash conndb = new dbConnDash(); dbConn conn = new dbConn(); int year = new Integer(edate.substring(0,4)); Calendar ca= Calendar.getInstance(); int currentyear=ca.get(Calendar.YEAR); String facilitiestable="subpartnera"; int selectedyear=year; if(selectedyear<currentyear){ if(year<2014){ //db for 2014 is the smallest facilitiestable="subpartnera2014"; } else { facilitiestable="subpartnera"+selectedyear; } } HashMap <String,String> htshm = htshmap; String getsites="SELECT county.County as county,district.DistrictNom as district, " // + " "+facilitiestable+".SubPartnerNom as facility, "+facilitiestable+".CentreSanteId as mflcode, "+facilitiestable+".HTC_Support1 as htcsupport, IFNULL(ART_highvolume,0) as arthv, IFNULL(HTC_highvolume,0) as htchv, IFNULL(PMTCT_highvolume,0) as pmtcthv, IFNULL(HTC,0) as HTC, IFNULL(PMTCT,0) as PMTCT" + " FROM "+facilitiestable+" join (district join county on county.CountyID=district.CountyID) on district.DistrictID = "+facilitiestable+".DistrictID where ( HTC=1 OR PMTCT=1 ) AND "+facilitiestable+".active=1 "+facilwhere+" group by "+facilitiestable+".SubPartnerID "; System.out.println(""+getsites); conn.rs=conn.st.executeQuery(getsites); while(conn.rs.next()){ String mfl=conn.rs.getString("mflcode"); String cty=conn.rs.getString("county"); String sty=conn.rs.getString("district"); String fac=conn.rs.getString("facility"); String st=conn.rs.getString("htcsupport"); for(int ymn=new Integer(sdate);ymn<=new Integer(edate);ymn++){ double gtt=new Double(htshm.getOrDefault("gtt_"+mfl+ymn,"0")); double gtp=new Double(htshm.getOrDefault("gtp_"+mfl+ymn,"0")); double ukpf=(new Double(htshm.getOrDefault("ukpf_"+mfl+ymn,"0"))); double ukpm=(new Double(htshm.getOrDefault("ukpm_"+mfl+ymn,"0"))); double pf1=(new Double(htshm.getOrDefault("pf1_"+mfl+ymn,"0")) ); double pm1=(new Double(htshm.getOrDefault("pm1_"+mfl+ymn,"0")) ); double pf4=(new Double(htshm.getOrDefault("pf4_"+mfl+ymn,"0")) ); double pm4=(new Double(htshm.getOrDefault("pm4_"+mfl+ymn,"0")) ); double pf9=(new Double(htshm.getOrDefault("pf9_"+mfl+ymn,"0")) ); double pm9=(new Double(htshm.getOrDefault("pm9_"+mfl+ymn,"0")) ); double pf14=(new Double(htshm.getOrDefault("pf14_"+mfl+ymn,"0"))); double pm14=(new Double(htshm.getOrDefault("pm14_"+mfl+ymn,"0"))); double pf19=(new Double(htshm.getOrDefault("pf19_"+mfl+ymn,"0"))); double pm19=(new Double(htshm.getOrDefault("pm19_"+mfl+ymn,"0"))); double pf24=(new Double(htshm.getOrDefault("pf24_"+mfl+ymn,"0"))); double pm24=(new Double(htshm.getOrDefault("pm24_"+mfl+ymn,"0"))); double pf29=(new Double(htshm.getOrDefault("pf29_"+mfl+ymn,"0"))); double pm29=(new Double(htshm.getOrDefault("pm29_"+mfl+ymn,"0"))); double pf34=(new Double(htshm.getOrDefault("pf34_"+mfl+ymn,"0"))); double pm34=(new Double(htshm.getOrDefault("pm34_"+mfl+ymn,"0"))); double pf39=(new Double(htshm.getOrDefault("pf39_"+mfl+ymn,"0"))); double pm39=(new Double(htshm.getOrDefault("pm39_"+mfl+ymn,"0"))); double pf49=(new Double(htshm.getOrDefault("pf49_"+mfl+ymn,"0"))); double pm49=(new Double(htshm.getOrDefault("pm49_"+mfl+ymn,"0"))); double pf50=(new Double(htshm.getOrDefault("pf50_"+mfl+ymn,"0"))); double pm50=(new Double(htshm.getOrDefault("pm50_"+mfl+ymn,"0"))); double uknf=(new Double(htshm.getOrDefault("uknf_"+mfl+ymn,"0")) ); double uknm=(new Double(htshm.getOrDefault("uknm_"+mfl+ymn,"0")) ); double nf1=(new Double(htshm.getOrDefault("nf1_"+mfl+ymn,"0"))); double nm1=(new Double(htshm.getOrDefault("nm1_"+mfl+ymn,"0"))); double nf4=(new Double(htshm.getOrDefault("nf4_"+mfl+ymn,"0"))); double nm4=(new Double(htshm.getOrDefault("nm4_"+mfl+ymn,"0"))); double nf9=(new Double(htshm.getOrDefault("nf9_"+mfl+ymn,"0"))); double nm9=(new Double(htshm.getOrDefault("nm9_"+mfl+ymn,"0"))); double nf14=(new Double(htshm.getOrDefault("nf14_"+mfl+ymn,"0"))); double nm14=(new Double(htshm.getOrDefault("nm14_"+mfl+ymn,"0"))); double nf19=(new Double(htshm.getOrDefault("nf19_"+mfl+ymn,"0"))); double nm19=(new Double(htshm.getOrDefault("nm19_"+mfl+ymn,"0"))); double nf24=(new Double(htshm.getOrDefault("nf24_"+mfl+ymn,"0"))); double nm24=(new Double(htshm.getOrDefault("nm24_"+mfl+ymn,"0"))); double nf29=(new Double(htshm.getOrDefault("nf29_"+mfl+ymn,"0"))); double nm29=(new Double(htshm.getOrDefault("nm29_"+mfl+ymn,"0"))); double nf34=(new Double(htshm.getOrDefault("nf34_"+mfl+ymn,"0"))); double nm34=(new Double(htshm.getOrDefault("nm34_"+mfl+ymn,"0"))); double nf39=(new Double(htshm.getOrDefault("nf39_"+mfl+ymn,"0"))); double nm39=(new Double(htshm.getOrDefault("nm39_"+mfl+ymn,"0"))); double nf49=(new Double(htshm.getOrDefault("nf49_"+mfl+ymn,"0"))); double nm49=(new Double(htshm.getOrDefault("nm49_"+mfl+ymn,"0"))); double nf50=(new Double(htshm.getOrDefault("nf50_"+mfl+ymn,"0"))); double nm50=(new Double(htshm.getOrDefault("nm50_"+mfl+ymn,"0"))); double tt =(new Double(htshm.getOrDefault("tt_"+mfl+ymn,"0"))); String burdencategory = htshm.getOrDefault("burdencategory_"+mfl+ymn,""); String constituency = htshm.getOrDefault("constituency_"+mfl+ymn,""); String ward = htshm.getOrDefault("ward_"+mfl+ymn,""); String yr = htshm.getOrDefault("year_"+mfl+ymn,""); String semiannual = htshm.getOrDefault("semiannual_"+mfl+ymn,""); String qtr = htshm.getOrDefault("quarter_"+mfl+ymn,""); String mn = htshm.getOrDefault("month_"+mfl+ymn,""); String ym = htshm.getOrDefault("yearmonth_"+mfl+ymn,""); String ownedby = htshm.getOrDefault("ownedby_"+mfl+ymn,""); String facilitytype = htshm.getOrDefault("facilitytype_"+mfl+ymn,""); String art_hv = htshm.getOrDefault("art_hv_"+mfl+ymn,"0"); String htc_hv = htshm.getOrDefault("htc_hv_"+mfl+ymn,"0"); String pmtct_hv = htshm.getOrDefault("pmtct_hv_"+mfl+ymn,"0"); String activity_hv = htshm.getOrDefault("activity_hv_"+mfl+ymn,"0"); String latitude = htshm.getOrDefault("latitude_"+mfl+ymn,""); String longitude = htshm.getOrDefault("longitude_"+mfl+ymn,""); String maleclinic = htshm.getOrDefault("maleclinic_"+mfl+ymn,"0"); String adoleclinic = htshm.getOrDefault("adoleclinic_"+mfl+ymn,"0"); String viremiaclinic = htshm.getOrDefault("viremiaclinic_"+mfl+ymn,"0"); String emrsite = htshm.getOrDefault("emrsite_"+mfl+ymn,"0"); String linkdesk = htshm.getOrDefault("linkdesk_"+mfl+ymn,"0"); String islocked = htshm.getOrDefault("islocked_"+mfl+ymn,"0"); System.out.println(" Loop number="+ymn+" facility "+fac+" "+tt); String insertqry = " REPLACE INTO dashboards.table2 SET " + " id = ? ," + "county = ? ," + "burdencategory = ? ," + "constituency = ? ," + "subcounty = ? ," + "ward = ? ," + "facility = ? ," + "mflcode = ? ," + "supporttype = ? ," + "level1 = ? ," + "level2 = ? ," + "level3 = ? ," + "level4 = ? ," + "unknown_f = ? ," + "unknown_m = ? ," + "d60 = ? ," + "mn_0_2 = ? ," + "mn_2_12 = ? ," + "mn_2_4y = ? ," + "f_1 = ? ," + "m_1 = ? ," + "t_1 = ? ," + "f_4 = ? ," + "m_4 = ? ," + "f_5_9 = ? ," + "m_5_9 = ? ," + "f_1_9 = ? ," + "m_1_9 = ? ," + "t_1_9 = ? ," + "f_14 = ? ," + "m_14 = ? ," + "f_19 = ? ," + "m_19 = ? ," + "f_24 = ? ," + "m_24 = ? ," + "f_29 = ? ," + "m_29 = ? ," + "f_34 = ? ," + "m_34 = ? ," + "f_39 = ? ," + "m_39 = ? ," + "f_49 = ? ," + "m_49 = ? ," + "f_25_49 = ? ," + "m_25_49 = ? ," + "f_50 = ? ," + "m_50 = ? ," + "total = ? ," + "total_f = ? ," + "total_m = ? ," + "paeds_f = ? ," + "paeds_m = ? ," + "paeds = ? ," + "adult_f = ? ," + "adult_m = ? ," + "adult = ? ," + "f_15_24 = ? ," + "m_15_24 = ? ," + "t_15_24 = ? ," + "year = ? ," + "semiannual = ? ," + "quarter = ? ," + "month = ? ," + "yearmonth = ? ," + "ownedby = ? ," + "facilitytype = ? ," + "art_hv = ? ," + "htc_hv = ? ," + "pmtct_hv = ? ," + "activity_hv = ? ," + "latitude = ? ," + "longitude = ? ," + "maleclinic = ? ," + "adoleclinic = ? ," + "viremiaclinic = ? ," + "emrsite = ? ," + "linkdesk = ? ," + "islocked = ? ," + "ordernumber = ? "; conndb.pst = conn.conn.prepareStatement(insertqry); String Level3arr[]=level3.split("@"); String level4=""; if(haslevel4 && !(level3.contains("HTS - Pediatric Services") || level3.contains("HTS - Other PITC")) ){ //Tested 40 if(1==1){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Tested"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1+nf1))); conndb.pst.setInt(21,new Integer((int) (pm1+nm1))); conndb.pst.setInt(22,new Integer((int) (pm1+nm1+pf1+nf1))); conndb.pst.setInt(23,new Integer((int) (pf4+nf4))); conndb.pst.setInt(24,new Integer((int) (pm4+nm4))); conndb.pst.setInt(25,new Integer((int) (pf9+nf9))); conndb.pst.setInt(26,new Integer((int) (pm9+nm9))); conndb.pst.setInt(27,new Integer((int) (pf4+nf4+pf9+nf9))); conndb.pst.setInt(28,new Integer((int) (pm4+nm4+pm9+nm9))); conndb.pst.setInt(29,new Integer((int) (pf4+nf4+pf9+nf9+pm4+nm4+pm9+nm9))); conndb.pst.setInt(30,new Integer((int) (pf14+nf14))); conndb.pst.setInt(31,new Integer((int) (pm14+nm14))); conndb.pst.setInt(32,new Integer((int) (pf19+nf19))); conndb.pst.setInt(33,new Integer((int) (pm19+nm19))); conndb.pst.setInt(34,new Integer((int) (pf24+nf24))); conndb.pst.setInt(35,new Integer((int) (pm24+nm24))); conndb.pst.setInt(36,new Integer((int) (pf29+nf29))); conndb.pst.setInt(37,new Integer((int) (pm29+nm29))); conndb.pst.setInt(38,new Integer((int) (pf34+nf34))); conndb.pst.setInt(39,new Integer((int) (pm34+nm34))); conndb.pst.setInt(40,new Integer((int) (pf39+nf39))); conndb.pst.setInt(41,new Integer((int) (pm39+nm39))); conndb.pst.setInt(42,new Integer((int) (pf49+nf49))); conndb.pst.setInt(43,new Integer((int) (pm49+nm49))); conndb.pst.setInt(44,new Integer((int) (pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49))); conndb.pst.setInt(45,new Integer((int) (pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49))); conndb.pst.setInt(46,new Integer((int) (pf50+nf50))); conndb.pst.setInt(47,new Integer((int) (pm50+nm50))); conndb.pst.setInt(48,new Integer((int) (tt))); conndb.pst.setInt(49,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(50,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(51,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14))); conndb.pst.setInt(52,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(53,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(54,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(55,new Integer((int) (pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(56,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(57,new Integer((int) (pf19+nf19+pf24+nf24))); conndb.pst.setInt(58,new Integer((int) (pm19+nm19+pm24+nm24))); conndb.pst.setInt(59,new Integer((int) (pf19+nf19+pf24+nf24+pm19+nm19+pm24+nm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } //positive 41 if(2==2){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_41"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Positive"); conndb.pst.setInt(14,new Integer((int) (ukpf))); conndb.pst.setInt(15,new Integer((int) (ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1))); conndb.pst.setInt(21,new Integer((int) (pm1))); conndb.pst.setInt(22,new Integer((int) (pm1+pf1))); conndb.pst.setInt(23,new Integer((int) (pf4))); conndb.pst.setInt(24,new Integer((int) (pm4))); conndb.pst.setInt(25,new Integer((int) (pf9))); conndb.pst.setInt(26,new Integer((int) (pm9))); conndb.pst.setInt(27,new Integer((int) (pf4+pf9))); conndb.pst.setInt(28,new Integer((int) (pm4+pm9))); conndb.pst.setInt(29,new Integer((int) (pf4+pf9+pm4+pm9))); conndb.pst.setInt(30,new Integer((int) (pf14))); conndb.pst.setInt(31,new Integer((int) (pm14))); conndb.pst.setInt(32,new Integer((int) (pf19))); conndb.pst.setInt(33,new Integer((int) (pm19))); conndb.pst.setInt(34,new Integer((int) (pf24))); conndb.pst.setInt(35,new Integer((int) (pm24))); conndb.pst.setInt(36,new Integer((int) (pf29))); conndb.pst.setInt(37,new Integer((int) (pm29))); conndb.pst.setInt(38,new Integer((int) (pf34))); conndb.pst.setInt(39,new Integer((int) (pm34))); conndb.pst.setInt(40,new Integer((int) (pf39))); conndb.pst.setInt(41,new Integer((int) (pm39))); conndb.pst.setInt(42,new Integer((int) (pf49))); conndb.pst.setInt(43,new Integer((int) (pm49))); conndb.pst.setInt(44,new Integer((int) (pf29+pf34+pf39+pf49))); conndb.pst.setInt(45,new Integer((int) (pm29+pm34+pm39+pm49))); conndb.pst.setInt(46,new Integer((int) (pf50))); conndb.pst.setInt(47,new Integer((int) (pm50))); conndb.pst.setInt(48,new Integer((int) (pf1+pf4+pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm1+pm4+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(49,new Integer((int) (pf1+pf4+pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(50,new Integer((int) (pm1+pm4+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(51,new Integer((int) (pf1+pf4+pf9+pf14))); conndb.pst.setInt(52,new Integer((int) (pm1+pm4+pm9+pm14))); conndb.pst.setInt(53,new Integer((int) (pf1+pf4+pf9+pf14+pm1+pm4+pm9+pm14))); conndb.pst.setInt(54,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(55,new Integer((int) (pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(56,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(57,new Integer((int) (pf19+pf24))); conndb.pst.setInt(58,new Integer((int) (pm19+pm24))); conndb.pst.setInt(59,new Integer((int) (pf19+pf24+pm19+pm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } } //----------------------------------------------Other PITC only . This is being done to exclude paeds---------------------------------- if(haslevel4 && level3.contains("HTS - Other PITC")){ //Tested 40 if(1==1){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Tested"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (0))); conndb.pst.setInt(21,new Integer((int) (0))); conndb.pst.setInt(22,new Integer((int) (0))); conndb.pst.setInt(23,new Integer((int) (0))); conndb.pst.setInt(24,new Integer((int) (0))); conndb.pst.setInt(25,new Integer((int) (pf9+nf9))); conndb.pst.setInt(26,new Integer((int) (pm9+nm9))); conndb.pst.setInt(27,new Integer((int) (pf9+nf9))); conndb.pst.setInt(28,new Integer((int) (pm9+nm9))); conndb.pst.setInt(29,new Integer((int) (pf9+nf9+pm9+nm9))); conndb.pst.setInt(30,new Integer((int) (pf14+nf14))); conndb.pst.setInt(31,new Integer((int) (pm14+nm14))); conndb.pst.setInt(32,new Integer((int) (pf19+nf19))); conndb.pst.setInt(33,new Integer((int) (pm19+nm19))); conndb.pst.setInt(34,new Integer((int) (pf24+nf24))); conndb.pst.setInt(35,new Integer((int) (pm24+nm24))); conndb.pst.setInt(36,new Integer((int) (pf29+nf29))); conndb.pst.setInt(37,new Integer((int) (pm29+nm29))); conndb.pst.setInt(38,new Integer((int) (pf34+nf34))); conndb.pst.setInt(39,new Integer((int) (pm34+nm34))); conndb.pst.setInt(40,new Integer((int) (pf39+nf39))); conndb.pst.setInt(41,new Integer((int) (pm39+nm39))); conndb.pst.setInt(42,new Integer((int) (pf49+nf49))); conndb.pst.setInt(43,new Integer((int) (pm49+nm49))); conndb.pst.setInt(44,new Integer((int) (pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49))); conndb.pst.setInt(45,new Integer((int) (pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49))); conndb.pst.setInt(46,new Integer((int) (pf50+nf50))); conndb.pst.setInt(47,new Integer((int) (pm50+nm50))); conndb.pst.setInt(48,new Integer((int) (pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(49,new Integer((int) (pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(50,new Integer((int) (pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(51,new Integer((int) (pf9+nf9+pf14+nf14))); conndb.pst.setInt(52,new Integer((int) (pm9+nm9+pm14+nm14))); conndb.pst.setInt(53,new Integer((int) (pf9+nf9+pf14+nf14+pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(54,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(55,new Integer((int) (pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(56,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(57,new Integer((int) (pf19+nf19+pf24+nf24))); conndb.pst.setInt(58,new Integer((int) (pm19+nm19+pm24+nm24))); conndb.pst.setInt(59,new Integer((int) (pf19+nf19+pf24+nf24+pm19+nm19+pm24+nm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } //positive 41 if(2==2){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_41"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Positive"); conndb.pst.setInt(14,new Integer((int) (ukpf))); conndb.pst.setInt(15,new Integer((int) (ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (0))); conndb.pst.setInt(21,new Integer((int) (0))); conndb.pst.setInt(22,new Integer((int) (0))); conndb.pst.setInt(23,new Integer((int) (0))); conndb.pst.setInt(24,new Integer((int) (0))); conndb.pst.setInt(25,new Integer((int) (pf9))); conndb.pst.setInt(26,new Integer((int) (pm9))); conndb.pst.setInt(27,new Integer((int) (pf9))); conndb.pst.setInt(28,new Integer((int) (pm9))); conndb.pst.setInt(29,new Integer((int) (pf9+pm9))); conndb.pst.setInt(30,new Integer((int) (pf14))); conndb.pst.setInt(31,new Integer((int) (pm14))); conndb.pst.setInt(32,new Integer((int) (pf19))); conndb.pst.setInt(33,new Integer((int) (pm19))); conndb.pst.setInt(34,new Integer((int) (pf24))); conndb.pst.setInt(35,new Integer((int) (pm24))); conndb.pst.setInt(36,new Integer((int) (pf29))); conndb.pst.setInt(37,new Integer((int) (pm29))); conndb.pst.setInt(38,new Integer((int) (pf34))); conndb.pst.setInt(39,new Integer((int) (pm34))); conndb.pst.setInt(40,new Integer((int) (pf39))); conndb.pst.setInt(41,new Integer((int) (pm39))); conndb.pst.setInt(42,new Integer((int) (pf49))); conndb.pst.setInt(43,new Integer((int) (pm49))); conndb.pst.setInt(44,new Integer((int) (pf29+pf34+pf39+pf49))); conndb.pst.setInt(45,new Integer((int) (pm29+pm34+pm39+pm49))); conndb.pst.setInt(46,new Integer((int) (pf50))); conndb.pst.setInt(47,new Integer((int) (pm50))); conndb.pst.setInt(48,new Integer((int) (pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(49,new Integer((int) (pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(50,new Integer((int) (pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(51,new Integer((int) (pf9+pf14))); conndb.pst.setInt(52,new Integer((int) (pm9+pm14))); conndb.pst.setInt(53,new Integer((int) (pf9+pf14+pm9+pm14))); conndb.pst.setInt(54,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(55,new Integer((int) (pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(56,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(57,new Integer((int) (pf19+pf24))); conndb.pst.setInt(58,new Integer((int) (pm19+pm24))); conndb.pst.setInt(59,new Integer((int) (pf19+pf24+pm19+pm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } } //--------------------------------------------------------------Pediatrics--------------------------------- else if(haslevel4 && level3.contains("HTS - Pediatric Services")){ //Tested 40 if(1==1){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Tested"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1+nf1))); conndb.pst.setInt(21,new Integer((int) (pm1+nm1))); conndb.pst.setInt(22,new Integer((int) (pm1+nm1+pf1+nf1))); conndb.pst.setInt(23,new Integer((int) (pf4+nf4))); conndb.pst.setInt(24,new Integer((int) (pm4+nm4))); conndb.pst.setInt(25,0); conndb.pst.setInt(26,0); conndb.pst.setInt(27,new Integer((int) (pf4+nf4))); conndb.pst.setInt(28,new Integer((int) (pm4+nm4))); conndb.pst.setInt(29,new Integer((int) (pf4+nf4+pm4+nm4))); conndb.pst.setInt(30,0); conndb.pst.setInt(31,0); conndb.pst.setInt(32,0); conndb.pst.setInt(33,0); conndb.pst.setInt(34,0); conndb.pst.setInt(35,0); conndb.pst.setInt(36,0); conndb.pst.setInt(37,0); conndb.pst.setInt(38,0); conndb.pst.setInt(39,0); conndb.pst.setInt(40,0); conndb.pst.setInt(41,0); conndb.pst.setInt(42,0); conndb.pst.setInt(43,0); conndb.pst.setInt(44,0); conndb.pst.setInt(45,0); conndb.pst.setInt(46,0); conndb.pst.setInt(47,0); conndb.pst.setInt(48,new Integer((int) (pf1+nf1+pf4+nf4+pm1+nm1+pm4+nm4))); conndb.pst.setInt(49,new Integer((int) (pf1+nf1+pf4+nf4))); conndb.pst.setInt(50,new Integer((int) (pm1+nm1+pm4+nm4))); conndb.pst.setInt(51,new Integer((int) (pf1+nf1+pf4+nf4))); conndb.pst.setInt(52,new Integer((int) (pm1+nm1+pm4+nm4))); conndb.pst.setInt(53,new Integer((int) (pf1+nf1+pf4+nf4+pm1+nm1+pm4+nm4))); conndb.pst.setInt(54,0); conndb.pst.setInt(55,0); conndb.pst.setInt(56,0); conndb.pst.setInt(57,0); conndb.pst.setInt(58,0); conndb.pst.setInt(59,0); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ System.out.println(""+conndb.pst); conndb.pst.executeUpdate(); } } //positive 41 if(2==2){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_41"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,"Positive"); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1))); conndb.pst.setInt(21,new Integer((int) (pm1))); conndb.pst.setInt(22,new Integer((int) (pm1+pf1))); conndb.pst.setInt(23,new Integer((int) (pf4))); conndb.pst.setInt(24,new Integer((int) (pm4))); conndb.pst.setInt(25,0); conndb.pst.setInt(26,0); conndb.pst.setInt(27,new Integer((int) (pf4))); conndb.pst.setInt(28,new Integer((int) (pm4))); conndb.pst.setInt(29,new Integer((int) (pf4+pm4))); conndb.pst.setInt(30,0); conndb.pst.setInt(31,0); conndb.pst.setInt(32,0); conndb.pst.setInt(33,0); conndb.pst.setInt(34,0); conndb.pst.setInt(35,0); conndb.pst.setInt(36,0); conndb.pst.setInt(37,0); conndb.pst.setInt(38,0); conndb.pst.setInt(39,0); conndb.pst.setInt(40,0); conndb.pst.setInt(41,0); conndb.pst.setInt(42,0); conndb.pst.setInt(43,0); conndb.pst.setInt(44,0); conndb.pst.setInt(45,0); conndb.pst.setInt(46,0); conndb.pst.setInt(47,0); conndb.pst.setInt(48,new Integer((int) (pf1+pf4+pm1+pm4))); conndb.pst.setInt(49,new Integer((int) (pf1+pf4))); conndb.pst.setInt(50,new Integer((int) (pm1+pm4))); conndb.pst.setInt(51,new Integer((int) (pf1+pf4))); conndb.pst.setInt(52,new Integer((int) (pm1+pm4))); conndb.pst.setInt(53,new Integer((int) (pf1+pf4+pm1+pm4))); conndb.pst.setInt(54,0); conndb.pst.setInt(55,0); conndb.pst.setInt(56,0); conndb.pst.setInt(57,0); conndb.pst.setInt(58,0); conndb.pst.setInt(59,0); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } } } else { //HTS-POS if(level3.contains("@9")){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+""; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,""); conndb.pst.setInt(14,new Integer((int) (ukpf))); conndb.pst.setInt(15,new Integer((int) (ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1))); conndb.pst.setInt(21,new Integer((int) (pm1))); conndb.pst.setInt(22,new Integer((int) (pm1+pf1))); conndb.pst.setInt(23,new Integer((int) (pf4))); conndb.pst.setInt(24,new Integer((int) (pm4))); conndb.pst.setInt(25,new Integer((int) (pf9))); conndb.pst.setInt(26,new Integer((int) (pm9))); conndb.pst.setInt(27,new Integer((int) (pf4+pf9))); conndb.pst.setInt(28,new Integer((int) (pm4+pm9))); conndb.pst.setInt(29,new Integer((int) (pf4+pf9+pm4+pm9))); conndb.pst.setInt(30,new Integer((int) (pf14))); conndb.pst.setInt(31,new Integer((int) (pm14))); conndb.pst.setInt(32,new Integer((int) (pf19))); conndb.pst.setInt(33,new Integer((int) (pm19))); conndb.pst.setInt(34,new Integer((int) (pf24))); conndb.pst.setInt(35,new Integer((int) (pm24))); conndb.pst.setInt(36,new Integer((int) (pf29))); conndb.pst.setInt(37,new Integer((int) (pm29))); conndb.pst.setInt(38,new Integer((int) (pf34))); conndb.pst.setInt(39,new Integer((int) (pm34))); conndb.pst.setInt(40,new Integer((int) (pf39))); conndb.pst.setInt(41,new Integer((int) (pm39))); conndb.pst.setInt(42,new Integer((int) (pf49))); conndb.pst.setInt(43,new Integer((int) (pm49))); conndb.pst.setInt(44,new Integer((int) (pf29+pf34+pf39+pf49))); conndb.pst.setInt(45,new Integer((int) (pm29+pm34+pm39+pm49))); conndb.pst.setInt(46,new Integer((int) (pf50))); conndb.pst.setInt(47,new Integer((int) (pm50))); conndb.pst.setInt(48,new Integer((int) (gtp))); conndb.pst.setInt(49,new Integer((int) (pf1+pf4+pf9+pf14+pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(50,new Integer((int) (pm1+pm4+pm9+pm14+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(51,new Integer((int) (pf1+pf4+pf9+pf14))); conndb.pst.setInt(52,new Integer((int) (pm1+pm4+pm9+pm14))); conndb.pst.setInt(53,new Integer((int) (pf1+pf4+pf9+pf14+pm1+pm4+pm9+pm14))); conndb.pst.setInt(54,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50))); conndb.pst.setInt(55,new Integer((int) (pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(56,new Integer((int) (pf19+pf24+pf29+pf34+pf39+pf49+pf50+pm19+pm24+pm29+pm34+pm39+pm49+pm50))); conndb.pst.setInt(57,new Integer((int) (pf19+pf24))); conndb.pst.setInt(58,new Integer((int) (pm19+pm24))); conndb.pst.setInt(59,new Integer((int) (pf19+pf24+pm19+pm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ conndb.pst.executeUpdate(); System.out.println(""+conndb.pst); } }//end of if //HTS-TST if(level3.contains("@8")){ String id=ym+"_"+mfl+"_3_"+Level3arr[1]+"_40"; conndb.pst.setString(1,id); conndb.pst.setString(2,cty); conndb.pst.setString(3,burdencategory); conndb.pst.setString(4,constituency); conndb.pst.setString(5,sty); conndb.pst.setString(6,ward); conndb.pst.setString(7,fac); conndb.pst.setString(8,mfl); conndb.pst.setString(9,st); conndb.pst.setString(10,"90=Knowing HIV Status"); conndb.pst.setString(11,"HTS"); conndb.pst.setString(12,Level3arr[0]); conndb.pst.setString(13,""); conndb.pst.setInt(14,new Integer((int) (uknf+ukpf))); conndb.pst.setInt(15,new Integer((int) (uknm+ukpm))); conndb.pst.setInt(16,0); conndb.pst.setInt(17,0); conndb.pst.setInt(18,0); conndb.pst.setInt(19,0); conndb.pst.setInt(20,new Integer((int) (pf1+nf1))); conndb.pst.setInt(21,new Integer((int) (pm1+nm1))); conndb.pst.setInt(22,new Integer((int) (pm1+nm1+pf1+nf1))); conndb.pst.setInt(23,new Integer((int) (pf4+nf4))); conndb.pst.setInt(24,new Integer((int) (pm4+nm4))); conndb.pst.setInt(25,new Integer((int) (pf9+nf9))); conndb.pst.setInt(26,new Integer((int) (pm9+nm9))); conndb.pst.setInt(27,new Integer((int) (pf4+nf4+pf9+nf9))); conndb.pst.setInt(28,new Integer((int) (pm4+nm4+pm9+nm9))); conndb.pst.setInt(29,new Integer((int) (pf4+nf4+pf9+nf9+pm4+nm4+pm9+nm9))); conndb.pst.setInt(30,new Integer((int) (pf14+nf14))); conndb.pst.setInt(31,new Integer((int) (pm14+nm14))); conndb.pst.setInt(32,new Integer((int) (pf19+nf19))); conndb.pst.setInt(33,new Integer((int) (pm19+nm19))); conndb.pst.setInt(34,new Integer((int) (pf24+nf24))); conndb.pst.setInt(35,new Integer((int) (pm24+nm24))); conndb.pst.setInt(36,new Integer((int) (pf29+nf29))); conndb.pst.setInt(37,new Integer((int) (pm29+nm29))); conndb.pst.setInt(38,new Integer((int) (pf34+nf34))); conndb.pst.setInt(39,new Integer((int) (pm34+nm34))); conndb.pst.setInt(40,new Integer((int) (pf39+nf39))); conndb.pst.setInt(41,new Integer((int) (pm39+nm39))); conndb.pst.setInt(42,new Integer((int) (pf49+nf49))); conndb.pst.setInt(43,new Integer((int) (pm49+nm49))); conndb.pst.setInt(44,new Integer((int) (pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49))); conndb.pst.setInt(45,new Integer((int) (pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49))); conndb.pst.setInt(46,new Integer((int) (pf50+nf50))); conndb.pst.setInt(47,new Integer((int) (pm50+nm50))); conndb.pst.setInt(48,new Integer((int) (tt))); conndb.pst.setInt(49,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(50,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(51,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14))); conndb.pst.setInt(52,new Integer((int) (pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(53,new Integer((int) (pf1+nf1+pf4+nf4+pf9+nf9+pf14+nf14+pm1+nm1+pm4+nm4+pm9+nm9+pm14+nm14))); conndb.pst.setInt(54,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50))); conndb.pst.setInt(55,new Integer((int) (pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(56,new Integer((int) (pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50))); conndb.pst.setInt(57,new Integer((int) (pf19+nf19+pf24+nf24))); conndb.pst.setInt(58,new Integer((int) (pm19+nm19+pm24+nm24))); conndb.pst.setInt(59,new Integer((int) (pf19+nf19+pf24+nf24+pm19+nm19+pm24+nm24))); conndb.pst.setString(60,yr); conndb.pst.setString(61,semiannual); conndb.pst.setString(62,qtr); conndb.pst.setString(63,mn); conndb.pst.setString(64,ym); conndb.pst.setString(65,ownedby); conndb.pst.setString(66,facilitytype); conndb.pst.setString(67,art_hv); conndb.pst.setString(68,htc_hv); conndb.pst.setString(69,pmtct_hv); conndb.pst.setString(70,activity_hv); conndb.pst.setString(71,latitude); conndb.pst.setString(72,longitude); conndb.pst.setString(73,maleclinic); conndb.pst.setString(74,adoleclinic); conndb.pst.setString(75,viremiaclinic); conndb.pst.setString(76,emrsite); conndb.pst.setString(77,linkdesk); conndb.pst.setString(78,islocked); conndb.pst.setString(79,ordernumber); //only insert sites that have submitted data if(!ym.equals("")){ System.out.println(""+conndb.pst); conndb.pst.executeUpdate(); //System.out.println("Teeesting____"+(pf19+""+nf19+""+pf24+""+nf24+""+pf29+""+nf29+""+pf34+""+nf34+""+pf39+""+nf39+""+pf49+""+nf49+""+pf50+""+nf50+""+pm19+""+nm19+""+pm24+""+nm24+""+pm29+""+nm29+""+pm34+""+nm34+""+pm39+""+nm39+""+pm49+""+nm49+""+pm50+""+nm50=pf19+nf19+pf24+nf24+pf29+nf29+pf34+nf34+pf39+nf39+pf49+nf49+pf50+nf50+pm19+nm19+pm24+nm24+pm29+nm29+pm34+nm34+pm39+nm39+pm49+nm49+pm50+nm50)); } } } } }// end of while } catch (SQLException ex) { Logger.getLogger(pullHts.class.getName()).log(Level.SEVERE, null, ex); } return "done"; } }
52,840
0.618111
0.545742
1,247
41.373695
32.145443
408
false
false
0
0
0
0
175
0.042922
1.417001
false
false
3
12ae43cce7c28db114d2d60f54cd32735f250c56
34,385,508,216,336
89ce2dd0046c5411d3fc245e12d0696822b6a311
/src/main/java/com/mycompany/sonar/reference/batch/IssueSensor.java
be5644bb35698013d5b20d54cacb1f13708c0363
[]
no_license
luanbicesto/Sonar-Custom-Plugin
https://github.com/luanbicesto/Sonar-Custom-Plugin
38686d5f964dedd36e484793c06d0aa346d2f566
c7801ec23111efdc16c6a21a985e8917b5c7647e
refs/heads/master
2021-01-10T19:24:12
2015-07-13T00:19:35
2015-07-13T00:19:35
38,852,944
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mycompany.sonar.reference.batch; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.issue.Issuable; import org.sonar.api.resources.Project; import org.sonar.api.rule.RuleKey; public class IssueSensor implements Sensor { private final FileSystem fs; private final ResourcePerspectives perspectives; /** * Use of IoC to get FileSystem */ public IssueSensor(FileSystem fs, ResourcePerspectives perspectives) { this.fs = fs; this.perspectives = perspectives; } @Override public boolean shouldExecuteOnProject(Project project) { // This sensor is executed only when there are Java files return fs.hasFiles(fs.predicates().hasLanguage("sql")); } @Override public void analyse(Project project, SensorContext sensorContext) { // This sensor create an issue on each java file for (InputFile inputFile : fs.inputFiles(fs.predicates().hasLanguage("sql"))) { Issuable issuable = perspectives.as(Issuable.class, inputFile); issuable.addIssue(issuable.newIssueBuilder() .ruleKey(RuleKey.of("sql_repository", "NAME_PACKAGE_INCORRECT")) .message("Package was not in the correct form") .line(2) .build()); } } @Override public String toString() { return getClass().getSimpleName(); } }
UTF-8
Java
1,482
java
IssueSensor.java
Java
[]
null
[]
package com.mycompany.sonar.reference.batch; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.issue.Issuable; import org.sonar.api.resources.Project; import org.sonar.api.rule.RuleKey; public class IssueSensor implements Sensor { private final FileSystem fs; private final ResourcePerspectives perspectives; /** * Use of IoC to get FileSystem */ public IssueSensor(FileSystem fs, ResourcePerspectives perspectives) { this.fs = fs; this.perspectives = perspectives; } @Override public boolean shouldExecuteOnProject(Project project) { // This sensor is executed only when there are Java files return fs.hasFiles(fs.predicates().hasLanguage("sql")); } @Override public void analyse(Project project, SensorContext sensorContext) { // This sensor create an issue on each java file for (InputFile inputFile : fs.inputFiles(fs.predicates().hasLanguage("sql"))) { Issuable issuable = perspectives.as(Issuable.class, inputFile); issuable.addIssue(issuable.newIssueBuilder() .ruleKey(RuleKey.of("sql_repository", "NAME_PACKAGE_INCORRECT")) .message("Package was not in the correct form") .line(2) .build()); } } @Override public String toString() { return getClass().getSimpleName(); } }
1,482
0.726721
0.726046
49
29.244898
24.645678
83
false
false
0
0
0
0
0
0
0.428571
false
false
3
0e207eeed874d5dcaebcde08f22877292fb9e704
38,027,640,453,939
33132828cedca737e871deaa76b4b381340aa205
/src/ArrayIndexOutOfBoundsExceptionClass.java
24092a66b19fcbab2ed681de295d14bace6e926c
[]
no_license
phuongpham145/JavaWBE
https://github.com/phuongpham145/JavaWBE
950b0d48baf8b44b6c9304eccf25a7ea1be73bbf
a2aa55c6eef3f2a3dbb304f98230db8041b930a9
refs/heads/master
2020-08-30T21:55:18.448000
2019-11-13T04:29:17
2019-11-13T04:29:17
218,499,768
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class ArrayIndexOutOfBoundsExceptionClass { public static void main(String[] args) { int n, i, position; int[] b = new int[]; Scanner scanner = new Scanner(System.in); System.out.println("Enter the length og array : "); n = scanner.nextInt(); createArray(n); int[] b = int a ; System.out.println("Enter the position :"); position = scanner.nextInt(); findNum(position,int[] a); } public int[] createArray(int n) { int i; int[] a = new int[n]; for (i = 0; i < a.length; i++) { a[i] = a[i] = (int) (Math.random() * 1001); } for (i = 0; i < n; i++) { System.out.print(a[i] + " "); } return a ; } public static void findNum ( int position, int[] b ){ System.out.println("This element is : " + b[position]); } }
UTF-8
Java
934
java
ArrayIndexOutOfBoundsExceptionClass.java
Java
[]
null
[]
import java.util.Scanner; public class ArrayIndexOutOfBoundsExceptionClass { public static void main(String[] args) { int n, i, position; int[] b = new int[]; Scanner scanner = new Scanner(System.in); System.out.println("Enter the length og array : "); n = scanner.nextInt(); createArray(n); int[] b = int a ; System.out.println("Enter the position :"); position = scanner.nextInt(); findNum(position,int[] a); } public int[] createArray(int n) { int i; int[] a = new int[n]; for (i = 0; i < a.length; i++) { a[i] = a[i] = (int) (Math.random() * 1001); } for (i = 0; i < n; i++) { System.out.print(a[i] + " "); } return a ; } public static void findNum ( int position, int[] b ){ System.out.println("This element is : " + b[position]); } }
934
0.511777
0.505353
31
29.129032
18.762939
63
false
false
0
0
0
0
0
0
0.806452
false
false
3
50dff06d5bc74e4b479b20a30523943dd1367c9b
36,086,315,246,316
b06bb91d636aa35febae1d844a547011e4860ba4
/app/src/main/java/com/wst/four/adapter/A.java
1c804cbfc24df3036bc37d102a5b112571f72128
[]
no_license
201216323/ATestDrawLayout
https://github.com/201216323/ATestDrawLayout
19d7ea415d7f78a8bd78e26fcdd96c3c8870df16
3eff91fc0f71a875a1ab2f19beb69a8fc79e808c
refs/heads/master
2020-07-10T11:50:01.702000
2016-12-06T10:05:52
2016-12-06T10:05:52
74,014,953
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wst.four.adapter; /** * Created by: BruceChang * Date on : 2016/11/18. * Time on: 11:53 * Progect_Name:ATestDrawLayout * Source Github: * Description: */ public class A { }
UTF-8
Java
196
java
A.java
Java
[ { "context": "package com.wst.four.adapter;\n\n/**\n * Created by: BruceChang\n * Date on : 2016/11/18.\n * Time on: 11:53\n * Pro", "end": 60, "score": 0.9972817301750183, "start": 50, "tag": "NAME", "value": "BruceChang" } ]
null
[]
package com.wst.four.adapter; /** * Created by: BruceChang * Date on : 2016/11/18. * Time on: 11:53 * Progect_Name:ATestDrawLayout * Source Github: * Description: */ public class A { }
196
0.659794
0.597938
13
13.923077
10.957691
31
false
false
0
0
0
0
0
0
0.076923
false
false
3
5b7f24aa874345b73ce09a531b06144c3efd6d6e
5,789,615,964,931
fedb212e64805eb74ca72845b88a93043b227a44
/app/src/main/java/com/example/administrator/panda_channel_app/MVP_Framework/module/panda_live/pagerfragment/live_/lookandtalk/LookandtaikContract.java
fc344ac0fb0fff7ef947259416caa66ef35036a2
[]
no_license
che19980508/Panda_channel_App
https://github.com/che19980508/Panda_channel_App
8342e51607c81b4d4604e9e8bf512d733353b0ac
5783d2fb2c41638f79099ab7819a2c0fe8a88e0b
refs/heads/master
2018-02-09T13:33:42.113000
2017-07-25T03:05:33
2017-07-25T03:05:33
96,758,784
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.administrator.panda_channel_app.MVP_Framework.module.panda_live.pagerfragment.live_.lookandtalk; import com.example.administrator.panda_channel_app.MVP_Framework.base.BasePresenter; import com.example.administrator.panda_channel_app.MVP_Framework.base.BaseView; import com.example.administrator.panda_channel_app.MVP_Framework.modle.entity.Watch; /** * Created by ASUS on 2017/7/13. */ public interface LookandtaikContract { interface View extends BaseView<Presenter> { void setLookBean(Watch watch); void showMessage(String msg); } interface Presenter extends BasePresenter { void Addthenumber(String app,String itemid,String nature,String page); } }
UTF-8
Java
720
java
LookandtaikContract.java
Java
[ { "context": "P_Framework.modle.entity.Watch;\n\n/**\n * Created by ASUS on 2017/7/13.\n */\n\npublic interface LookandtaikCo", "end": 391, "score": 0.9968376159667969, "start": 387, "tag": "USERNAME", "value": "ASUS" } ]
null
[]
package com.example.administrator.panda_channel_app.MVP_Framework.module.panda_live.pagerfragment.live_.lookandtalk; import com.example.administrator.panda_channel_app.MVP_Framework.base.BasePresenter; import com.example.administrator.panda_channel_app.MVP_Framework.base.BaseView; import com.example.administrator.panda_channel_app.MVP_Framework.modle.entity.Watch; /** * Created by ASUS on 2017/7/13. */ public interface LookandtaikContract { interface View extends BaseView<Presenter> { void setLookBean(Watch watch); void showMessage(String msg); } interface Presenter extends BasePresenter { void Addthenumber(String app,String itemid,String nature,String page); } }
720
0.766667
0.756944
21
33.285713
35.56636
116
false
false
0
0
0
0
0
0
0.47619
false
false
3
381769769cb7395206dec61d11bb26fa7b989143
20,349,555,101,834
ce7192ac9a62badfae7842ca080da0030c9d0cf4
/app/src/main/java/com/example/vuphu/newlaundry/Order/Adapter/ListClothesViewHolder.java
aba2465b0dd199aee75966151553bdb28543b809
[]
no_license
phuongtinhbien/NewLaundry2
https://github.com/phuongtinhbien/NewLaundry2
4edbb78effffdb8683c946b29daa57decc8110e9
6892d127b2f59cd635efc660731753fe56772eac
refs/heads/master
2020-03-28T09:34:45.595000
2018-12-18T06:49:50
2018-12-18T06:49:50
148,044,479
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.vuphu.newlaundry.Order.Adapter; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import com.example.vuphu.newlaundry.Order.OBOrderDetail; import com.example.vuphu.newlaundry.R; import com.robertlevonyan.views.chip.Chip; public class ListClothesViewHolder extends ViewHolder { TextView title; TextView price; Chip serviceName; TextView count; //Number Picker FrameLayout badge; /* EditText value; Button decrement, increment;*/ public ListClothesViewHolder(View itemView) { super(itemView); title = itemView.findViewById(R.id.item_prepare_order_txt_title); price = itemView.findViewById(R.id.item_prepare_order_txt_price); count = itemView.findViewById(R.id.item_prepare_order_count); badge = itemView.findViewById(R.id.badge); serviceName = itemView.findViewById(R.id.chip_service_name_final); } }
UTF-8
Java
1,047
java
ListClothesViewHolder.java
Java
[ { "context": "import com.example.vuphu.newlaundry.R;\nimport com.robertlevonyan.views.chip.Chip;\n\npublic class ListClothesViewHol", "end": 358, "score": 0.7185244560241699, "start": 344, "tag": "USERNAME", "value": "robertlevonyan" } ]
null
[]
package com.example.vuphu.newlaundry.Order.Adapter; import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import com.example.vuphu.newlaundry.Order.OBOrderDetail; import com.example.vuphu.newlaundry.R; import com.robertlevonyan.views.chip.Chip; public class ListClothesViewHolder extends ViewHolder { TextView title; TextView price; Chip serviceName; TextView count; //Number Picker FrameLayout badge; /* EditText value; Button decrement, increment;*/ public ListClothesViewHolder(View itemView) { super(itemView); title = itemView.findViewById(R.id.item_prepare_order_txt_title); price = itemView.findViewById(R.id.item_prepare_order_txt_price); count = itemView.findViewById(R.id.item_prepare_order_count); badge = itemView.findViewById(R.id.badge); serviceName = itemView.findViewById(R.id.chip_service_name_final); } }
1,047
0.74212
0.741165
32
31.71875
23.247627
74
false
false
0
0
0
0
0
0
0.71875
false
false
3
73e9f25e353c4834b041cc7dafde3567f82761b7
27,728,308,927,360
4ddf0512874b6833c1d39d954a90e83b235a1ac1
/common/src/main/java/com/common/constants/ToolStatusEnum.java
b167a43b96fffb8006fc893f5e40e7aaec5b5cd9
[]
no_license
looooogan/icomp-4gb-api
https://github.com/looooogan/icomp-4gb-api
a6a77882408077e6c65212f7b077c55ab83d49ab
4fd701c5ca694abecb05a13f2e32ab890cad3269
refs/heads/master
2020-03-17T20:11:58.057000
2018-06-28T09:02:26
2018-06-28T09:02:26
133,897,691
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.common.constants; /** * Created by logan on 2018/5/27. */ public enum ToolStatusEnum { SynthesisCuttingTool_Init("1","合成刀初始化","SynthesisCuttingTool_Init",OperationEnum.SynthesisCuttingTool_Init.getKey()+""), SynthesisCuttingTool_ToExchnage("2","待换装","SynthesisCuttingTool_ToExchnage",OperationEnum.SynthesisCuttingTool_UnInstall.getKey()+""), SynthesisCuttingTool_ToConfig("3","待组装","SynthesisCuttingTool_ToConfig",OperationEnum.SynthesisCuttingTool_UnConfig.getKey()+""), SynthesisCuttingTool_ToInstall("4","待安上","SynthesisCuttingTool_ToInstall",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_Config.getKey()), SynthesisCuttingTool_ToUnInstall("5","待卸下","SynthesisCuttingTool_ToUnInstall",OperationEnum.SynthesisCuttingTool_Install.getKey()+""), CuttingTool_ToConfig("6","待安上","CuttingTool_ToConfig",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_Config.getKey()), CuttingTool_ToUnConfig("7","待卸下","CuttingTool_ToUnConfig",OperationEnum.SynthesisCuttingTool_Install.getKey()+""), CuttingTool_ToExchange("8","待换装","CuttingTool_ToExchange",OperationEnum.SynthesisCuttingTool_UnInstall.getKey()+""), CuttingTool_ToInsideGrinding("9","待厂内刃磨","CuttingTool_ToInsideGrinding",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_UnConfig.getKey()), CuttingTool_ToOutsideGrinding("10","待厂外刃磨","CuttingTool_ToOutsideGrinding",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_UnConfig.getKey()), CuttingTool_ToBack("11","待回厂","CuttingTool_ToBack",OperationEnum.Cutting_tool_Inside.getKey()+","+OperationEnum.Cutting_tool_OutSide.getKey()+","+OperationEnum.Cutting_tool_Inside_Coating.getKey()); /** * asdf * @param key * @param name * @param identify * @param operationKey */ ToolStatusEnum(String key, String name, String identify, String operationKey) { this.key = key; this.name = name; this.identify = identify; this.operationKey = operationKey; } public static ToolStatusEnum getToolStatusEnumByOperationKey(String operationKey){ for (ToolStatusEnum toolStatusEnum : values()) { if (toolStatusEnum.getOperationKey().indexOf(operationKey)>=0){ return toolStatusEnum; } } return null; } private String key; private String name; private String identify; private String operationKey; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIdentify() { return identify; } public void setIdentify(String identify) { this.identify = identify; } public String getOperationKey() { return operationKey; } public void setOperationKey(String operationKey) { this.operationKey = operationKey; } }
UTF-8
Java
3,242
java
ToolStatusEnum.java
Java
[ { "context": "package com.common.constants;\n\n\n/**\n * Created by logan on 2018/5/27.\n */\npublic enum ToolStatusEnum {\n ", "end": 55, "score": 0.9992271065711975, "start": 50, "tag": "USERNAME", "value": "logan" } ]
null
[]
package com.common.constants; /** * Created by logan on 2018/5/27. */ public enum ToolStatusEnum { SynthesisCuttingTool_Init("1","合成刀初始化","SynthesisCuttingTool_Init",OperationEnum.SynthesisCuttingTool_Init.getKey()+""), SynthesisCuttingTool_ToExchnage("2","待换装","SynthesisCuttingTool_ToExchnage",OperationEnum.SynthesisCuttingTool_UnInstall.getKey()+""), SynthesisCuttingTool_ToConfig("3","待组装","SynthesisCuttingTool_ToConfig",OperationEnum.SynthesisCuttingTool_UnConfig.getKey()+""), SynthesisCuttingTool_ToInstall("4","待安上","SynthesisCuttingTool_ToInstall",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_Config.getKey()), SynthesisCuttingTool_ToUnInstall("5","待卸下","SynthesisCuttingTool_ToUnInstall",OperationEnum.SynthesisCuttingTool_Install.getKey()+""), CuttingTool_ToConfig("6","待安上","CuttingTool_ToConfig",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_Config.getKey()), CuttingTool_ToUnConfig("7","待卸下","CuttingTool_ToUnConfig",OperationEnum.SynthesisCuttingTool_Install.getKey()+""), CuttingTool_ToExchange("8","待换装","CuttingTool_ToExchange",OperationEnum.SynthesisCuttingTool_UnInstall.getKey()+""), CuttingTool_ToInsideGrinding("9","待厂内刃磨","CuttingTool_ToInsideGrinding",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_UnConfig.getKey()), CuttingTool_ToOutsideGrinding("10","待厂外刃磨","CuttingTool_ToOutsideGrinding",OperationEnum.SynthesisCuttingTool_Exchange.getKey()+","+OperationEnum.SynthesisCuttingTool_UnConfig.getKey()), CuttingTool_ToBack("11","待回厂","CuttingTool_ToBack",OperationEnum.Cutting_tool_Inside.getKey()+","+OperationEnum.Cutting_tool_OutSide.getKey()+","+OperationEnum.Cutting_tool_Inside_Coating.getKey()); /** * asdf * @param key * @param name * @param identify * @param operationKey */ ToolStatusEnum(String key, String name, String identify, String operationKey) { this.key = key; this.name = name; this.identify = identify; this.operationKey = operationKey; } public static ToolStatusEnum getToolStatusEnumByOperationKey(String operationKey){ for (ToolStatusEnum toolStatusEnum : values()) { if (toolStatusEnum.getOperationKey().indexOf(operationKey)>=0){ return toolStatusEnum; } } return null; } private String key; private String name; private String identify; private String operationKey; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIdentify() { return identify; } public void setIdentify(String identify) { this.identify = identify; } public String getOperationKey() { return operationKey; } public void setOperationKey(String operationKey) { this.operationKey = operationKey; } }
3,242
0.707464
0.700822
80
38.525002
51.274502
202
false
false
0
0
0
0
0
0
0.9
false
false
3
686669615c674843262ed083c38080fcbb323499
34,170,759,857,960
f7bbf3ec53cbe7cdcb5cec571738aad0b6dea075
/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/utils/ElasticSearchUtilTest.java
f2c73f59f5841657a2592795828f1d8ababfab9f
[ "Apache-2.0" ]
permissive
infosiftr/sdc
https://github.com/infosiftr/sdc
450d65c6f03bf153bbd09975460651250227e443
a1f23ec5e7cd191b76271b5f33c237bad38c61c6
refs/heads/master
2020-04-15T19:43:14.670000
2018-11-28T09:49:51
2019-01-08T15:37:03
164,961,555
0
0
NOASSERTION
true
2019-01-10T00:43:14
2019-01-10T00:43:13
2019-01-08T15:37:29
2019-01-09T14:49:07
184,141
0
0
0
null
false
null
package org.openecomp.sdc.be.dao.utils; import org.elasticsearch.action.search.SearchResponse; import org.junit.Assert; import org.junit.Test; public class ElasticSearchUtilTest { @Test public void testIsResponseEmpty() throws Exception { SearchResponse searchResponse = null; boolean result; // test 1 searchResponse = null; result = ElasticSearchUtil.isResponseEmpty(searchResponse); Assert.assertEquals(true, result); } }
UTF-8
Java
443
java
ElasticSearchUtilTest.java
Java
[]
null
[]
package org.openecomp.sdc.be.dao.utils; import org.elasticsearch.action.search.SearchResponse; import org.junit.Assert; import org.junit.Test; public class ElasticSearchUtilTest { @Test public void testIsResponseEmpty() throws Exception { SearchResponse searchResponse = null; boolean result; // test 1 searchResponse = null; result = ElasticSearchUtil.isResponseEmpty(searchResponse); Assert.assertEquals(true, result); } }
443
0.781038
0.778781
19
22.368422
20.079344
61
false
false
0
0
0
0
0
0
1.315789
false
false
3
0d860a6c068e689877fdfe778dcf8e10ff913c68
37,065,567,792,135
ba97ecc7ee256ce2c84f4c7f8d63d0ce3125158e
/Ejercicios/13EjemploLambda/src/pkg13ejemplolambda/Main.java
1fb0a2eb357be766e2cc0f217edd0a9a788b4012
[]
no_license
maguilar18/prueba-MA
https://github.com/maguilar18/prueba-MA
6c05246f5caf9d67a732e635e8c9667669ee3878
67a609bff79c726990f1fb3f77c80611af41a3ef
refs/heads/master
2021-01-01T19:16:49.121000
2017-02-08T22:38:34
2017-02-08T22:38:34
78,476,882
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pkg13ejemplolambda; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import pkg13ejemplolambda.Operadores.Operador; /** * * @author mp.aguilar */ public class Main { /** * @param args the command line arguments */ static List<Operador> lista = Arrays.asList( new Operador("Juan",324,true), new Operador("Jose",322,false), new Operador("Karina",334,true), new Operador("Maria",353,true), new Operador("Luis",355,false)); public static void main(String[] args) { long tiempoInicio = System.currentTimeMillis(); filtroNuevo(); //filtroAntiguo(); long tiempoFinal = System.currentTimeMillis(); System.out.println(tiempoFinal - tiempoInicio); } public static void filtroNuevo() { List<Operador> operadores = lista.stream() .filter(op->op.isStatus()) //filtro con expresion lambda .collect(Collectors.toList()); //se vuelve a agrupar la informacion como una lista para regresarla imprimirNuevo(operadores); } public static void filtroAntiguo(){ List<Operador> operadores = new ArrayList<Operador>(); for(Operador op: lista){ if (op.isStatus()) { operadores.add(op); } } imprimir(operadores); } public static void imprimir(List<Operador> operadores) { System.out.println("---- Lista filtrada ----"); for(Operador op: operadores) { System.out.println(op); } } public static void imprimirNuevo(List<Operador> operadores) { System.out.println("---- Lista filtrada 'Nuevo' ----"); operadores.forEach(op-> System.out.println(op)); //operacion que le pasamos } }
UTF-8
Java
2,133
java
Main.java
Java
[ { "context": "mplolambda.Operadores.Operador;\n\n/**\n *\n * @author mp.aguilar\n */\npublic class Main {\n\n /**\n * @param ar", "end": 402, "score": 0.9811693429946899, "start": 392, "tag": "USERNAME", "value": "mp.aguilar" }, { "context": "dor> lista = Arrays.asList(\n new Operador(\"Juan\",324,true),\n new Operador(\"Jose\",322,false", "end": 570, "score": 0.9996695518493652, "start": 566, "tag": "NAME", "value": "Juan" }, { "context": " Operador(\"Juan\",324,true),\n new Operador(\"Jose\",322,false),\n new Operador(\"Karina\",334,tr", "end": 609, "score": 0.9997110366821289, "start": 605, "tag": "NAME", "value": "Jose" }, { "context": "Operador(\"Jose\",322,false),\n new Operador(\"Karina\",334,true),\n new Operador(\"Maria\",353,true", "end": 651, "score": 0.9997220039367676, "start": 645, "tag": "NAME", "value": "Karina" }, { "context": "perador(\"Karina\",334,true),\n new Operador(\"Maria\",353,true),\n new Operador(\"Luis\",355,false", "end": 691, "score": 0.999738872051239, "start": 686, "tag": "NAME", "value": "Maria" }, { "context": "Operador(\"Maria\",353,true),\n new Operador(\"Luis\",355,false));\n \n public static void mai", "end": 730, "score": 0.9995374083518982, "start": 726, "tag": "NAME", "value": "Luis" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pkg13ejemplolambda; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import pkg13ejemplolambda.Operadores.Operador; /** * * @author mp.aguilar */ public class Main { /** * @param args the command line arguments */ static List<Operador> lista = Arrays.asList( new Operador("Juan",324,true), new Operador("Jose",322,false), new Operador("Karina",334,true), new Operador("Maria",353,true), new Operador("Luis",355,false)); public static void main(String[] args) { long tiempoInicio = System.currentTimeMillis(); filtroNuevo(); //filtroAntiguo(); long tiempoFinal = System.currentTimeMillis(); System.out.println(tiempoFinal - tiempoInicio); } public static void filtroNuevo() { List<Operador> operadores = lista.stream() .filter(op->op.isStatus()) //filtro con expresion lambda .collect(Collectors.toList()); //se vuelve a agrupar la informacion como una lista para regresarla imprimirNuevo(operadores); } public static void filtroAntiguo(){ List<Operador> operadores = new ArrayList<Operador>(); for(Operador op: lista){ if (op.isStatus()) { operadores.add(op); } } imprimir(operadores); } public static void imprimir(List<Operador> operadores) { System.out.println("---- Lista filtrada ----"); for(Operador op: operadores) { System.out.println(op); } } public static void imprimirNuevo(List<Operador> operadores) { System.out.println("---- Lista filtrada 'Nuevo' ----"); operadores.forEach(op-> System.out.println(op)); //operacion que le pasamos } }
2,133
0.596812
0.587904
72
28.625
25.23745
122
false
false
0
0
0
0
0
0
0.527778
false
false
3
15ff024c291b841268d120689a402119d7f1ea9f
4,793,183,569,268
97efc730b44eec9ae283d7068e9ee90fe2e8771e
/standalone/src/test/java/com/example/standalone/_1部署Test.java
cfb30077e83a4a292c571c3559ebcd6f45ab553c
[]
no_license
yaodwwy/flowable-demo
https://github.com/yaodwwy/flowable-demo
ddb1fc1c7e4d6dc044531b19aba3a0fb9127ba63
82d7fc6fcb477947ab697eadb882369ebed532e4
refs/heads/master
2023-04-28T07:37:55.030000
2021-05-07T03:20:05
2021-05-07T03:20:05
358,802,911
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//package com.example.standalone; // //import lombok.extern.slf4j.Slf4j; //import org.flowable.bpmn.BpmnAutoLayout; //import org.flowable.bpmn.model.Process; //import org.flowable.bpmn.model.*; //import org.flowable.engine.repository.Deployment; //import org.flowable.engine.repository.ProcessDefinition; //import org.junit.jupiter.api.Test; //import org.springframework.util.Assert; // //import java.io.IOException; // ///** // * 流程文件部署 // * addClasspathResource // * addInputStream // * addString // * addZipInputStream // * addBpmnModel // * addBytes // * deploy // * <p> // * 流程定义的删除行为: // * 1. 不管是否指定级联,都会删除部署相关的身份数据、流程定义数据、流程资源与部署数据。 // * 2. 如果设置为级联删除,则会将运行的流程实例、流程任务以及流程实例的历史数据删除。 // * 3. 如果不级联删除,但是存在运行时数据,例如还有流程实例,就会删除失败。 // */ //@Slf4j //public class _1部署Test extends _0BaseTests{ // // @Test // public void 部署流程文件() throws IOException { // ProcessDefinition deploy = flowable.deploy("processes/_1部署流程.bpmn20.xml", "_1部署流程"); // Assert.notNull(deploy, "null?"); // log.info("version: {}", deploy.getVersion()); // } // // // @Test // public void 动态部署() throws Exception { // // 1. 创建一个空的BpmnModel和Process对象 // BpmnModel model = new BpmnModel(); // Process process = new Process(); // model.addProcess(process); // process.setId("my-process"); // // // 创建Flow元素(所有的事件、任务都被认为是Flow) // process.addFlowElement(createStartEvent()); // process.addFlowElement(createUserTask("task1", "First task", "fred")); // process.addFlowElement(createUserTask("task2", "Second task", "john")); // process.addFlowElement(createEndEvent()); // // process.addFlowElement(createSequenceFlow("start", "task1")); // process.addFlowElement(createSequenceFlow("task1", "task2")); // process.addFlowElement(createSequenceFlow("task2", "end")); // // // 2. 流程图自动布局(位于activiti-bpmn-layout模块) // new BpmnAutoLayout(model).execute(); // // // 3. 把BpmnModel对象部署到引擎 // Deployment deploy = flowable.buildBpmn("dynamic-model", model, "my-process", true); // log.info(deploy.getId() + ", " + deploy.getName()); // // } // // // 创建用户任务 // protected UserTask createUserTask(String id, String name, String assignee) { // UserTask userTask = new UserTask(); // userTask.setName(name); // userTask.setId(id); // userTask.setAssignee(assignee); // return userTask; // } // // // 添加流程顺序 // protected SequenceFlow createSequenceFlow(String from, String to) { // SequenceFlow flow = new SequenceFlow(); // flow.setSourceRef(from); // flow.setTargetRef(to); // return flow; // } // // // 创建开始事件 // protected StartEvent createStartEvent() { // StartEvent startEvent = new StartEvent(); // startEvent.setId("start"); // return startEvent; // } // // // 创建结束事件 // protected EndEvent createEndEvent() { // EndEvent endEvent = new EndEvent(); // endEvent.setId("end"); // return endEvent; // } //}
UTF-8
Java
3,507
java
_1部署Test.java
Java
[ { "context": "lowElement(createUserTask(\"task1\", \"First task\", \"fred\"));\n// process.addFlowElement(createUserTa", "end": 1498, "score": 0.9995255470275879, "start": 1494, "tag": "NAME", "value": "fred" }, { "context": "owElement(createUserTask(\"task2\", \"Second task\", \"john\"));\n// process.addFlowElement(createEndEve", "end": 1580, "score": 0.9998340606689453, "start": 1576, "tag": "NAME", "value": "john" } ]
null
[]
//package com.example.standalone; // //import lombok.extern.slf4j.Slf4j; //import org.flowable.bpmn.BpmnAutoLayout; //import org.flowable.bpmn.model.Process; //import org.flowable.bpmn.model.*; //import org.flowable.engine.repository.Deployment; //import org.flowable.engine.repository.ProcessDefinition; //import org.junit.jupiter.api.Test; //import org.springframework.util.Assert; // //import java.io.IOException; // ///** // * 流程文件部署 // * addClasspathResource // * addInputStream // * addString // * addZipInputStream // * addBpmnModel // * addBytes // * deploy // * <p> // * 流程定义的删除行为: // * 1. 不管是否指定级联,都会删除部署相关的身份数据、流程定义数据、流程资源与部署数据。 // * 2. 如果设置为级联删除,则会将运行的流程实例、流程任务以及流程实例的历史数据删除。 // * 3. 如果不级联删除,但是存在运行时数据,例如还有流程实例,就会删除失败。 // */ //@Slf4j //public class _1部署Test extends _0BaseTests{ // // @Test // public void 部署流程文件() throws IOException { // ProcessDefinition deploy = flowable.deploy("processes/_1部署流程.bpmn20.xml", "_1部署流程"); // Assert.notNull(deploy, "null?"); // log.info("version: {}", deploy.getVersion()); // } // // // @Test // public void 动态部署() throws Exception { // // 1. 创建一个空的BpmnModel和Process对象 // BpmnModel model = new BpmnModel(); // Process process = new Process(); // model.addProcess(process); // process.setId("my-process"); // // // 创建Flow元素(所有的事件、任务都被认为是Flow) // process.addFlowElement(createStartEvent()); // process.addFlowElement(createUserTask("task1", "First task", "fred")); // process.addFlowElement(createUserTask("task2", "Second task", "john")); // process.addFlowElement(createEndEvent()); // // process.addFlowElement(createSequenceFlow("start", "task1")); // process.addFlowElement(createSequenceFlow("task1", "task2")); // process.addFlowElement(createSequenceFlow("task2", "end")); // // // 2. 流程图自动布局(位于activiti-bpmn-layout模块) // new BpmnAutoLayout(model).execute(); // // // 3. 把BpmnModel对象部署到引擎 // Deployment deploy = flowable.buildBpmn("dynamic-model", model, "my-process", true); // log.info(deploy.getId() + ", " + deploy.getName()); // // } // // // 创建用户任务 // protected UserTask createUserTask(String id, String name, String assignee) { // UserTask userTask = new UserTask(); // userTask.setName(name); // userTask.setId(id); // userTask.setAssignee(assignee); // return userTask; // } // // // 添加流程顺序 // protected SequenceFlow createSequenceFlow(String from, String to) { // SequenceFlow flow = new SequenceFlow(); // flow.setSourceRef(from); // flow.setTargetRef(to); // return flow; // } // // // 创建开始事件 // protected StartEvent createStartEvent() { // StartEvent startEvent = new StartEvent(); // startEvent.setId("start"); // return startEvent; // } // // // 创建结束事件 // protected EndEvent createEndEvent() { // EndEvent endEvent = new EndEvent(); // endEvent.setId("end"); // return endEvent; // } //}
3,507
0.625857
0.619001
97
30.57732
23.385975
94
false
false
0
0
0
0
0
0
0.608247
false
false
3
95ecc96ebbe74976e4e4eb565be3709d053d1d43
3,418,794,026,766
d8f7a5a810357d888ba7738dd23c03c901c353bd
/celestial-world/EternalMeek/src/main/java/com/celestial/leetcode/_0004mediansortedarrays/TestSolution.java
576158c61883c1853986fe77b3555f018de94d9d
[]
no_license
shiinoMafuyu/Celestial
https://github.com/shiinoMafuyu/Celestial
0bca055e509688d5b44099bef69cd5f30ce10115
6f46a879811109abc7b0e6ee5f3de0ab5a71b6b0
refs/heads/master
2022-12-23T08:00:06.308000
2020-03-21T02:26:28
2020-03-21T02:26:28
89,136,496
0
0
null
false
2022-12-16T04:33:19
2017-04-23T11:22:09
2020-03-21T02:27:05
2022-12-16T04:33:17
31,727
0
0
8
Java
false
false
/****************************************************************** * TestSolution.java * Copyright 2017 by WZG. All Rights Reserved. * CreateDate:2017年10月16日 * Author:wangzg * Version:1.0.0 ******************************************************************/ package com.celestial.leetcode._0004mediansortedarrays; import org.junit.Test; /** * <b>修改记录:</b> * <p> * <li> * * ---- wangzg 2017年10月16日 * </li> * </p> * * <b>类说明:</b> * <p> * * </p> */ public class TestSolution { static Solution s = new Solution(); @Test public void _01_(){ double v=s.findMedianSortedArrays(new int[]{1,3}, new int[]{2}); System.out.println(v); } @Test public void _02_(){ double v=s.findMedianSortedArrays(new int[]{1,2}, new int[]{3,4}); System.out.println(v); } }
UTF-8
Java
850
java
TestSolution.java
Java
[ { "context": "hts Reserved.\n * CreateDate:2017年10月16日\n * Author:wangzg\n * Version:1.0.0\n *******************************", "end": 178, "score": 0.9996381998062134, "start": 172, "tag": "USERNAME", "value": "wangzg" }, { "context": "\n * <p>\n * <li>\n * \n * ---- wangzg 2017年10月16日\n * </li>\n * </p>\n * \n * <b>类说明:</b>\n ", "end": 424, "score": 0.8763192296028137, "start": 418, "tag": "USERNAME", "value": "wangzg" } ]
null
[]
/****************************************************************** * TestSolution.java * Copyright 2017 by WZG. All Rights Reserved. * CreateDate:2017年10月16日 * Author:wangzg * Version:1.0.0 ******************************************************************/ package com.celestial.leetcode._0004mediansortedarrays; import org.junit.Test; /** * <b>修改记录:</b> * <p> * <li> * * ---- wangzg 2017年10月16日 * </li> * </p> * * <b>类说明:</b> * <p> * * </p> */ public class TestSolution { static Solution s = new Solution(); @Test public void _01_(){ double v=s.findMedianSortedArrays(new int[]{1,3}, new int[]{2}); System.out.println(v); } @Test public void _02_(){ double v=s.findMedianSortedArrays(new int[]{1,2}, new int[]{3,4}); System.out.println(v); } }
850
0.495086
0.448403
40
19.35
20.935078
68
false
false
0
0
0
0
0
0
0.7
false
false
3
e2ce127d298f9beb3c87d8630fb310f0cceb17cc
12,575,664,289,537
324ef77bf642b52e7376fce4161901c31d2963ae
/src/com/wushang/backoffice/service/impl/ItemsServiceImpl.java
37d6f97b2805fde5d43de89debbfe510a422e379
[]
no_license
walt1012/webSSM
https://github.com/walt1012/webSSM
c54e0202b7e58dc4d0e04de1f397df99fcad25a4
4514d668c1879909b56b8b2ac236a3818ab2fd85
refs/heads/master
2020-07-16T03:05:00.934000
2019-09-02T10:36:23
2019-09-02T10:36:23
205,705,283
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wushang.backoffice.service.impl; import com.wushang.backoffice.mapper.ItemsMapper; import com.wushang.backoffice.model.Items; import com.wushang.backoffice.service.IItemsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @ClassName ItemsServiceImpl * @Description TODO * @Author wushang * @Date 2019-08-31 22:13 */ @Transactional(rollbackFor = Exception.class) @Service("itemsService") public class ItemsServiceImpl implements IItemsService { @Autowired private ItemsMapper itemsMapper; @Override public List<Items> findAllItems() { return itemsMapper.findAllItems(); } @Override public Items findById(Integer id) { return itemsMapper.selectByPrimaryKey(id); } @Override public void saveOrUpdate(Items items) { if (items.getId() == null) { itemsMapper.insert(items); //int i = 10 / 0; } else { itemsMapper.updateByPrimaryKeySelective(items); } } @Override public void deleteById(Integer id) { itemsMapper.deleteByPrimaryKey(id); } }
UTF-8
Java
1,158
java
ItemsServiceImpl.java
Java
[ { "context": "e ItemsServiceImpl\n * @Description TODO\n * @Author wushang\n * @Date 2019-08-31 22:13\n */\n\n@Transactional(rol", "end": 466, "score": 0.9981026649475098, "start": 459, "tag": "USERNAME", "value": "wushang" } ]
null
[]
package com.wushang.backoffice.service.impl; import com.wushang.backoffice.mapper.ItemsMapper; import com.wushang.backoffice.model.Items; import com.wushang.backoffice.service.IItemsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; /** * @ClassName ItemsServiceImpl * @Description TODO * @Author wushang * @Date 2019-08-31 22:13 */ @Transactional(rollbackFor = Exception.class) @Service("itemsService") public class ItemsServiceImpl implements IItemsService { @Autowired private ItemsMapper itemsMapper; @Override public List<Items> findAllItems() { return itemsMapper.findAllItems(); } @Override public Items findById(Integer id) { return itemsMapper.selectByPrimaryKey(id); } @Override public void saveOrUpdate(Items items) { if (items.getId() == null) { itemsMapper.insert(items); //int i = 10 / 0; } else { itemsMapper.updateByPrimaryKeySelective(items); } } @Override public void deleteById(Integer id) { itemsMapper.deleteByPrimaryKey(id); } }
1,158
0.765112
0.752159
51
21.705883
19.753674
64
false
false
0
0
0
0
0
0
1
false
false
3
54f8a073efe34006f508a5207cbb87b736127250
8,967,891,757,729
3777716ffc22604581cf0c39fea5b52e3da8afdb
/src/grammar/StupidSimpleListener.java
1b2c94f36bd8ec46bbe25a6044e4c0d3f6f4fb4d
[]
no_license
fridajac/StupidSimpleLanguage
https://github.com/fridajac/StupidSimpleLanguage
72c7f1f3207215163fbb92f8fcd4fbde8d3c1b41
becf7ec6f1c859e5f0970b81afe4618f77591ed3
refs/heads/main
2023-08-20T19:44:31.404000
2021-10-27T20:45:09
2021-10-27T20:45:09
407,539,861
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Generated from /Users/fridajacobsson/Documents/Systemutvecklare/Systemprogramvara/StupidSimpleLanguage/src/grammar/StupidSimple.g4 by ANTLR 4.9.1 package grammar; import org.antlr.v4.runtime.tree.ParseTreeListener; /** * This interface defines a complete listener for a parse tree produced by * {@link StupidSimpleParser}. */ public interface StupidSimpleListener extends ParseTreeListener { /** * Enter a parse tree produced by {@link StupidSimpleParser#file}. * @param ctx the parse tree */ void enterFile(StupidSimpleParser.FileContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#file}. * @param ctx the parse tree */ void exitFile(StupidSimpleParser.FileContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#statement}. * @param ctx the parse tree */ void enterStatement(StupidSimpleParser.StatementContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#statement}. * @param ctx the parse tree */ void exitStatement(StupidSimpleParser.StatementContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#declare}. * @param ctx the parse tree */ void enterDeclare(StupidSimpleParser.DeclareContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#declare}. * @param ctx the parse tree */ void exitDeclare(StupidSimpleParser.DeclareContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#assign}. * @param ctx the parse tree */ void enterAssign(StupidSimpleParser.AssignContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#assign}. * @param ctx the parse tree */ void exitAssign(StupidSimpleParser.AssignContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#expression}. * @param ctx the parse tree */ void enterExpression(StupidSimpleParser.ExpressionContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#expression}. * @param ctx the parse tree */ void exitExpression(StupidSimpleParser.ExpressionContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#print}. * @param ctx the parse tree */ void enterPrint(StupidSimpleParser.PrintContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#print}. * @param ctx the parse tree */ void exitPrint(StupidSimpleParser.PrintContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#addExpression}. * @param ctx the parse tree */ void enterAddExpression(StupidSimpleParser.AddExpressionContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#addExpression}. * @param ctx the parse tree */ void exitAddExpression(StupidSimpleParser.AddExpressionContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#unaryExpression}. * @param ctx the parse tree */ void enterUnaryExpression(StupidSimpleParser.UnaryExpressionContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#unaryExpression}. * @param ctx the parse tree */ void exitUnaryExpression(StupidSimpleParser.UnaryExpressionContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#loop}. * @param ctx the parse tree */ void enterLoop(StupidSimpleParser.LoopContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#loop}. * @param ctx the parse tree */ void exitLoop(StupidSimpleParser.LoopContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#cond}. * @param ctx the parse tree */ void enterCond(StupidSimpleParser.CondContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#cond}. * @param ctx the parse tree */ void exitCond(StupidSimpleParser.CondContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#startloop}. * @param ctx the parse tree */ void enterStartloop(StupidSimpleParser.StartloopContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#startloop}. * @param ctx the parse tree */ void exitStartloop(StupidSimpleParser.StartloopContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#loopbody}. * @param ctx the parse tree */ void enterLoopbody(StupidSimpleParser.LoopbodyContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#loopbody}. * @param ctx the parse tree */ void exitLoopbody(StupidSimpleParser.LoopbodyContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#endloop}. * @param ctx the parse tree */ void enterEndloop(StupidSimpleParser.EndloopContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#endloop}. * @param ctx the parse tree */ void exitEndloop(StupidSimpleParser.EndloopContext ctx); }
UTF-8
Java
4,854
java
StupidSimpleListener.java
Java
[ { "context": "// Generated from /Users/fridajacobsson/Documents/Systemutvecklare/Systemprogramvara/Stup", "end": 39, "score": 0.9981681108474731, "start": 25, "tag": "USERNAME", "value": "fridajacobsson" } ]
null
[]
// Generated from /Users/fridajacobsson/Documents/Systemutvecklare/Systemprogramvara/StupidSimpleLanguage/src/grammar/StupidSimple.g4 by ANTLR 4.9.1 package grammar; import org.antlr.v4.runtime.tree.ParseTreeListener; /** * This interface defines a complete listener for a parse tree produced by * {@link StupidSimpleParser}. */ public interface StupidSimpleListener extends ParseTreeListener { /** * Enter a parse tree produced by {@link StupidSimpleParser#file}. * @param ctx the parse tree */ void enterFile(StupidSimpleParser.FileContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#file}. * @param ctx the parse tree */ void exitFile(StupidSimpleParser.FileContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#statement}. * @param ctx the parse tree */ void enterStatement(StupidSimpleParser.StatementContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#statement}. * @param ctx the parse tree */ void exitStatement(StupidSimpleParser.StatementContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#declare}. * @param ctx the parse tree */ void enterDeclare(StupidSimpleParser.DeclareContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#declare}. * @param ctx the parse tree */ void exitDeclare(StupidSimpleParser.DeclareContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#assign}. * @param ctx the parse tree */ void enterAssign(StupidSimpleParser.AssignContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#assign}. * @param ctx the parse tree */ void exitAssign(StupidSimpleParser.AssignContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#expression}. * @param ctx the parse tree */ void enterExpression(StupidSimpleParser.ExpressionContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#expression}. * @param ctx the parse tree */ void exitExpression(StupidSimpleParser.ExpressionContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#print}. * @param ctx the parse tree */ void enterPrint(StupidSimpleParser.PrintContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#print}. * @param ctx the parse tree */ void exitPrint(StupidSimpleParser.PrintContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#addExpression}. * @param ctx the parse tree */ void enterAddExpression(StupidSimpleParser.AddExpressionContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#addExpression}. * @param ctx the parse tree */ void exitAddExpression(StupidSimpleParser.AddExpressionContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#unaryExpression}. * @param ctx the parse tree */ void enterUnaryExpression(StupidSimpleParser.UnaryExpressionContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#unaryExpression}. * @param ctx the parse tree */ void exitUnaryExpression(StupidSimpleParser.UnaryExpressionContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#loop}. * @param ctx the parse tree */ void enterLoop(StupidSimpleParser.LoopContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#loop}. * @param ctx the parse tree */ void exitLoop(StupidSimpleParser.LoopContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#cond}. * @param ctx the parse tree */ void enterCond(StupidSimpleParser.CondContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#cond}. * @param ctx the parse tree */ void exitCond(StupidSimpleParser.CondContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#startloop}. * @param ctx the parse tree */ void enterStartloop(StupidSimpleParser.StartloopContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#startloop}. * @param ctx the parse tree */ void exitStartloop(StupidSimpleParser.StartloopContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#loopbody}. * @param ctx the parse tree */ void enterLoopbody(StupidSimpleParser.LoopbodyContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#loopbody}. * @param ctx the parse tree */ void exitLoopbody(StupidSimpleParser.LoopbodyContext ctx); /** * Enter a parse tree produced by {@link StupidSimpleParser#endloop}. * @param ctx the parse tree */ void enterEndloop(StupidSimpleParser.EndloopContext ctx); /** * Exit a parse tree produced by {@link StupidSimpleParser#endloop}. * @param ctx the parse tree */ void exitEndloop(StupidSimpleParser.EndloopContext ctx); }
4,854
0.743923
0.742892
140
33.67857
29.243624
148
false
false
0
0
0
0
112
0.023074
1.128571
false
false
3
2edaecccd412752734d74055e99403ae2c322bf4
22,539,988,417,365
08bfbe45eb20377202d362153c5e9182f229721e
/src/main/java/com/ch00/demo/first/Seller.java
4584bb3806b1e6ac205ce88dd093ddb1a737508a
[ "Apache-2.0" ]
permissive
XueYat/demo
https://github.com/XueYat/demo
611c53818ed3eac7f2c1d6c2e9a7169e4e497560
82c1ed249e483ab0822fe147f787cac123074dc7
refs/heads/master
2021-06-24T20:03:45.682000
2019-11-13T23:52:11
2019-11-13T23:52:11
221,368,961
0
0
Apache-2.0
false
2021-03-31T21:44:41
2019-11-13T03:58:58
2019-11-13T23:52:28
2021-03-31T21:44:40
428
0
0
2
Java
false
false
package com.ch00.demo.first; public class Seller { private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } public void sell(Excelle car){ this.name=name; } public void sell(Regal car){ this.name=name; } public void sell(Excelle car,int num){ this.name=name; } }
UTF-8
Java
438
java
Seller.java
Java
[]
null
[]
package com.ch00.demo.first; public class Seller { private String name; public void setName(String name) { this.name = name; } public String getName() { return name; } public void sell(Excelle car){ this.name=name; } public void sell(Regal car){ this.name=name; } public void sell(Excelle car,int num){ this.name=name; } }
438
0.541096
0.53653
25
15.52
13.778592
42
false
false
0
0
0
0
0
0
0.32
false
false
3
c3d183487606a6755059cd578b7fb92efb6db7c6
10,849,087,445,407
aaba5757aac5d1122e295d837cd3846748907c06
/usg-server/src/main/java/com/accure/finance/dto/LedgerCategory.java
69191fbed8d1fc010782d269c6b576d1d108fa7b
[]
no_license
usgInfo/UsgServerProject
https://github.com/usgInfo/UsgServerProject
3845ef95595d9cd24285ac25c9164fc435494ad5
a81df8ec3ef2b298acd0627e414825ddc71fc43b
refs/heads/master
2021-05-15T00:35:02.159000
2018-03-21T13:17:26
2018-03-21T13:17:26
103,244,787
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.accure.finance.dto; import com.accure.usg.common.dto.Common; /** * * @author deepak2310 */ public class LedgerCategory extends Common { private String parentLedger; private String parentLedgerName; private String ledgerCategory; private String orderLevel; private String ledgerDetail; public String getParentLedger() { return parentLedger; } public void setParentLedger(String parentLedger) { this.parentLedger = parentLedger; } public String getLedgerCategory() { return ledgerCategory; } public void setLedgerCategory(String ledgerCategory) { this.ledgerCategory = ledgerCategory; } public String getOrderLevel() { return orderLevel; } public void setOrderLevel(String orderLevel) { this.orderLevel = orderLevel; } public String getLedgerDetail() { return ledgerDetail; } public void setLedgerDetail(String ledgerDetail) { this.ledgerDetail = ledgerDetail; } public String getParentLedgerName() { return parentLedgerName; } public void setParentLedgerName(String parentLedgerName) { this.parentLedgerName = parentLedgerName; } }
UTF-8
Java
1,425
java
LedgerCategory.java
Java
[ { "context": "m.accure.usg.common.dto.Common;\n\n/**\n *\n * @author deepak2310\n */\npublic class LedgerCategory extends Common {\n", "end": 288, "score": 0.9994196891784668, "start": 278, "tag": "USERNAME", "value": "deepak2310" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.accure.finance.dto; import com.accure.usg.common.dto.Common; /** * * @author deepak2310 */ public class LedgerCategory extends Common { private String parentLedger; private String parentLedgerName; private String ledgerCategory; private String orderLevel; private String ledgerDetail; public String getParentLedger() { return parentLedger; } public void setParentLedger(String parentLedger) { this.parentLedger = parentLedger; } public String getLedgerCategory() { return ledgerCategory; } public void setLedgerCategory(String ledgerCategory) { this.ledgerCategory = ledgerCategory; } public String getOrderLevel() { return orderLevel; } public void setOrderLevel(String orderLevel) { this.orderLevel = orderLevel; } public String getLedgerDetail() { return ledgerDetail; } public void setLedgerDetail(String ledgerDetail) { this.ledgerDetail = ledgerDetail; } public String getParentLedgerName() { return parentLedgerName; } public void setParentLedgerName(String parentLedgerName) { this.parentLedgerName = parentLedgerName; } }
1,425
0.689825
0.687018
62
21.983871
21.137409
79
false
false
0
0
0
0
0
0
0.322581
false
false
3
ef8539fbe925395b2a2be8ad0bc69891dad664bf
10,849,087,446,199
502f48d4ad7312344165feddd77954cc0b1702b0
/java/webrtc-hello-world/src/main/java/com/bandwidth/webrtc/examples/helloworld/config/AccountProperties.java
d167cd05b9636ab28abd651d1bf8b9ac40e792bf
[]
no_license
erw1nd/examples
https://github.com/erw1nd/examples
42cfcf70424d80c80dccd2b2e68d663e000db75e
01bd21156369567cd9e5cf86c544043f1f633eda
refs/heads/master
2023-01-06T15:18:15.620000
2020-10-27T16:56:25
2020-10-27T16:56:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bandwidth.webrtc.examples.helloworld.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConstructorBinding; @ConstructorBinding @ConfigurationProperties("account") public class AccountProperties { private final String id; private final String username; private final String password; public AccountProperties(String id, String username, String password) { this.id = id; this.username = username; this.password = password; } public String getId() { return id; } public String getUsername() { return username; } public String getPassword() { return password; } }
UTF-8
Java
755
java
AccountProperties.java
Java
[ { "context": "d) {\n this.id = id;\n this.username = username;\n this.password = password;\n }\n\n pub", "end": 525, "score": 0.995598554611206, "start": 517, "tag": "USERNAME", "value": "username" }, { "context": " this.username = username;\n this.password = password;\n }\n\n public String getId() {\n retur", "end": 559, "score": 0.9911638498306274, "start": 551, "tag": "PASSWORD", "value": "password" }, { "context": "\n\n public String getUsername() {\n return username;\n }\n\n public String getPassword() {\n ", "end": 679, "score": 0.9666399955749512, "start": 671, "tag": "USERNAME", "value": "username" }, { "context": "\n\n public String getPassword() {\n return password;\n }\n}\n", "end": 745, "score": 0.6120808720588684, "start": 737, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.bandwidth.webrtc.examples.helloworld.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConstructorBinding; @ConstructorBinding @ConfigurationProperties("account") public class AccountProperties { private final String id; private final String username; private final String password; public AccountProperties(String id, String username, String password) { this.id = id; this.username = username; this.password = <PASSWORD>; } public String getId() { return id; } public String getUsername() { return username; } public String getPassword() { return <PASSWORD>; } }
759
0.707285
0.707285
30
24.166666
22.040997
75
false
false
0
0
0
0
0
0
0.466667
false
false
3
fa48024bd51faf0afc530057607b0b0c9b6a7b9f
15,899,968,976,979
ecedd66101879a6c1fdd354f4c3f2b9af4e708ef
/src/main/java/com/weishengming/service/QQService.java
ca118bacc304e200c6d47bcb9c8b4b660da16121
[]
no_license
weishengming/web
https://github.com/weishengming/web
10a98c38c4b4391eed4d4bfd8851afec5e116a57
b6d51eeaf7b3bd6c9907c39951155a8cba028440
refs/heads/master
2021-01-21T04:59:30.246000
2018-08-23T06:40:12
2018-08-23T06:40:12
48,091,647
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.weishengming.service; import java.util.List; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.weishengming.common.validate.ValidationService; import com.weishengming.dao.entity.QQDO; import com.weishengming.dao.mapper.QQMapper; import com.weishengming.dao.param.QQParam; import com.weishengming.dao.query.QQQuery; import com.weishengming.dao.query.ResultPage; @Service public class QQService { @Resource private QQMapper mapper; @Resource private ValidationService validationService; public ResultPage<QQDO> findPage(QQQuery query) { validationService.validate(query); QQParam param = new QQParam(); BeanUtils.copyProperties(query, param); List<QQDO> list = mapper.findList(param); return new ResultPage<QQDO>(list, query); } public List<QQDO> findAll() { return mapper.findAll(); } public QQDO findOne(Long id) { return mapper.findOne(id); } public QQDO findOpenID(String openID){ return mapper.findOpenID(openID).get(0); } public void create(QQDO entity) { validationService.validate(entity); mapper.insert(entity); } public void update(QQDO entity) { validationService.validate(entity); QQDO oldEntity=mapper.findOne(entity.getId()); mergeEntity(entity,oldEntity); mapper.update(oldEntity); } public void delete(Long id) { mapper.delete(id); } private void mergeEntity(QQDO source,QQDO target){ //TODO } }
UTF-8
Java
1,693
java
QQService.java
Java
[]
null
[]
package com.weishengming.service; import java.util.List; import javax.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import com.weishengming.common.validate.ValidationService; import com.weishengming.dao.entity.QQDO; import com.weishengming.dao.mapper.QQMapper; import com.weishengming.dao.param.QQParam; import com.weishengming.dao.query.QQQuery; import com.weishengming.dao.query.ResultPage; @Service public class QQService { @Resource private QQMapper mapper; @Resource private ValidationService validationService; public ResultPage<QQDO> findPage(QQQuery query) { validationService.validate(query); QQParam param = new QQParam(); BeanUtils.copyProperties(query, param); List<QQDO> list = mapper.findList(param); return new ResultPage<QQDO>(list, query); } public List<QQDO> findAll() { return mapper.findAll(); } public QQDO findOne(Long id) { return mapper.findOne(id); } public QQDO findOpenID(String openID){ return mapper.findOpenID(openID).get(0); } public void create(QQDO entity) { validationService.validate(entity); mapper.insert(entity); } public void update(QQDO entity) { validationService.validate(entity); QQDO oldEntity=mapper.findOne(entity.getId()); mergeEntity(entity,oldEntity); mapper.update(oldEntity); } public void delete(Long id) { mapper.delete(id); } private void mergeEntity(QQDO source,QQDO target){ //TODO } }
1,693
0.666864
0.666273
64
24.453125
19.343061
58
false
false
0
0
0
0
0
0
0.53125
false
false
3
0ba8d385ac171bf8503b774476fffd9eb64519d4
4,784,593,634,120
e5530af34274152fb6cdf7ae89a0b288da01a182
/app/src/main/java/com/marktony/zhuanlan/ui/GlobalFragment.java
9ed7eb2ab129dc8e66903fab9400e0540f9736ce
[ "Apache-2.0" ]
permissive
zhangshaocong258/zhuanlan
https://github.com/zhangshaocong258/zhuanlan
bb2c96e457aaba3cbc049ca8c083ef6cb6b6aa53
7d423e0c8add3c54b266b852fadfd82179fdce8a
refs/heads/master
2020-06-17T04:55:49.879000
2016-11-22T11:07:54
2016-11-22T11:07:54
75,039,176
0
1
null
true
2016-11-29T03:27:06
2016-11-29T03:27:06
2016-11-29T01:45:36
2016-11-22T11:08:01
2,615
0
0
0
null
null
null
package com.marktony.zhuanlan.ui; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.google.gson.Gson; import com.marktony.zhuanlan.R; import com.marktony.zhuanlan.adapter.ZhuanlanAdapter; import com.marktony.zhuanlan.app.VolleySingleton; import com.marktony.zhuanlan.bean.Zhuanlan; import com.marktony.zhuanlan.interfaze.OnRecyclerViewOnClickListener; import com.marktony.zhuanlan.utils.API; import java.util.ArrayList; /** * Created by Lizhaotailang on 2016/10/3. */ public class GlobalFragment extends Fragment { private int type; private RecyclerView recyclerView; private SwipeRefreshLayout refreshLayout; private String[] ids; private ZhuanlanAdapter adapter; private ArrayList<Zhuanlan> list = new ArrayList<>(); private Gson gson = new Gson(); public static final int TYPE_PRODUCT = 0; public static final int TYPE_MUSIC = 1; public static final int TYPE_LIFE = 2; public static final int TYPE_EMOTION = 3; public static final int TYPE_FINANCE = 4; public static final int TYPE_ZHIHU = 5; public int getType() { return type; } public void setType(int type) { this.type = type; } public GlobalFragment() { } public static GlobalFragment newInstance() { return new GlobalFragment(); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_universal,container,false); initViews(view); refreshLayout.post(new Runnable() { @Override public void run() { refreshLayout.setRefreshing(true); } }); switch (type){ default: case TYPE_PRODUCT: ids = getActivity().getResources().getStringArray(R.array.product); break; case TYPE_MUSIC: ids = getActivity().getResources().getStringArray(R.array.music); break; case TYPE_LIFE: ids = getActivity().getResources().getStringArray(R.array.life); break; case TYPE_EMOTION: ids = getActivity().getResources().getStringArray(R.array.emotion); break; case TYPE_FINANCE: ids = getActivity().getResources().getStringArray(R.array.profession); break; case TYPE_ZHIHU: ids = getActivity().getResources().getStringArray(R.array.zhihu); break; } requestData(); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { requestData(); } }); return view; } @Override public void onPause() { super.onPause(); refreshLayout.setRefreshing(false); VolleySingleton.getVolleySingleton(getContext()).getRequestQueue().cancelAll(type); } private void initViews(View view) { recyclerView = (RecyclerView) view.findViewById(R.id.rv_main); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh); //设置下拉刷新的按钮的颜色 refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); //设置手指在屏幕上下拉多少距离开始刷新 refreshLayout.setDistanceToTriggerSync(300); //设置下拉刷新按钮的背景颜色 refreshLayout.setProgressBackgroundColorSchemeColor(Color.WHITE); //设置下拉刷新按钮的大小 refreshLayout.setSize(SwipeRefreshLayout.DEFAULT); } private void requestData() { if (list.size() != 0) { list.clear(); } for (int i = 0;i < ids.length; i++){ final int finalI = i; StringRequest request = new StringRequest(Request.Method.GET, API.BASE_URL + ids[i], new Response.Listener<String>() { @Override public void onResponse(String s) { Zhuanlan z = gson.fromJson(s, Zhuanlan.class); list.add(z); if (finalI == (ids.length - 1)){ if (adapter == null) { adapter = new ZhuanlanAdapter(getActivity(),list); recyclerView.setAdapter(adapter); adapter.setItemClickListener(new OnRecyclerViewOnClickListener() { @Override public void OnClick(View v, int position) { Intent intent = new Intent(getContext(),PostsListActivity.class); intent.putExtra("slug",list.get(position).getSlug()); intent.putExtra("title",list.get(position).getName()); intent.putExtra("post_count", list.get(position).getPostsCount()); startActivity(intent); } }); } else { adapter.notifyDataSetChanged(); } refreshLayout.post(new Runnable() { @Override public void run() { refreshLayout.setRefreshing(false); } }); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { } }); request.setTag(type); VolleySingleton.getVolleySingleton(getActivity()).addToRequestQueue(request); } } }
UTF-8
Java
6,948
java
GlobalFragment.java
Java
[ { "context": "I;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Lizhaotailang on 2016/10/3.\n */\n\npublic class Globa", "end": 1007, "score": 0.598358154296875, "start": 1006, "tag": "USERNAME", "value": "L" }, { "context": "\n\nimport java.util.ArrayList;\n\n/**\n * Created by Lizhaotailang on 2016/10/3.\n */\n\npublic class GlobalFra", "end": 1011, "score": 0.510339617729187, "start": 1007, "tag": "NAME", "value": "izha" }, { "context": "port java.util.ArrayList;\n\n/**\n * Created by Lizhaotailang on 2016/10/3.\n */\n\npublic class GlobalFragm", "end": 1013, "score": 0.5295398235321045, "start": 1011, "tag": "USERNAME", "value": "ot" }, { "context": "rt java.util.ArrayList;\n\n/**\n * Created by Lizhaotailang on 2016/10/3.\n */\n\npublic class GlobalFragment ex", "end": 1019, "score": 0.8261163234710693, "start": 1013, "tag": "NAME", "value": "ailang" } ]
null
[]
package com.marktony.zhuanlan.ui; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.google.gson.Gson; import com.marktony.zhuanlan.R; import com.marktony.zhuanlan.adapter.ZhuanlanAdapter; import com.marktony.zhuanlan.app.VolleySingleton; import com.marktony.zhuanlan.bean.Zhuanlan; import com.marktony.zhuanlan.interfaze.OnRecyclerViewOnClickListener; import com.marktony.zhuanlan.utils.API; import java.util.ArrayList; /** * Created by Lizhaotailang on 2016/10/3. */ public class GlobalFragment extends Fragment { private int type; private RecyclerView recyclerView; private SwipeRefreshLayout refreshLayout; private String[] ids; private ZhuanlanAdapter adapter; private ArrayList<Zhuanlan> list = new ArrayList<>(); private Gson gson = new Gson(); public static final int TYPE_PRODUCT = 0; public static final int TYPE_MUSIC = 1; public static final int TYPE_LIFE = 2; public static final int TYPE_EMOTION = 3; public static final int TYPE_FINANCE = 4; public static final int TYPE_ZHIHU = 5; public int getType() { return type; } public void setType(int type) { this.type = type; } public GlobalFragment() { } public static GlobalFragment newInstance() { return new GlobalFragment(); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_universal,container,false); initViews(view); refreshLayout.post(new Runnable() { @Override public void run() { refreshLayout.setRefreshing(true); } }); switch (type){ default: case TYPE_PRODUCT: ids = getActivity().getResources().getStringArray(R.array.product); break; case TYPE_MUSIC: ids = getActivity().getResources().getStringArray(R.array.music); break; case TYPE_LIFE: ids = getActivity().getResources().getStringArray(R.array.life); break; case TYPE_EMOTION: ids = getActivity().getResources().getStringArray(R.array.emotion); break; case TYPE_FINANCE: ids = getActivity().getResources().getStringArray(R.array.profession); break; case TYPE_ZHIHU: ids = getActivity().getResources().getStringArray(R.array.zhihu); break; } requestData(); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { requestData(); } }); return view; } @Override public void onPause() { super.onPause(); refreshLayout.setRefreshing(false); VolleySingleton.getVolleySingleton(getContext()).getRequestQueue().cancelAll(type); } private void initViews(View view) { recyclerView = (RecyclerView) view.findViewById(R.id.rv_main); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh); //设置下拉刷新的按钮的颜色 refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); //设置手指在屏幕上下拉多少距离开始刷新 refreshLayout.setDistanceToTriggerSync(300); //设置下拉刷新按钮的背景颜色 refreshLayout.setProgressBackgroundColorSchemeColor(Color.WHITE); //设置下拉刷新按钮的大小 refreshLayout.setSize(SwipeRefreshLayout.DEFAULT); } private void requestData() { if (list.size() != 0) { list.clear(); } for (int i = 0;i < ids.length; i++){ final int finalI = i; StringRequest request = new StringRequest(Request.Method.GET, API.BASE_URL + ids[i], new Response.Listener<String>() { @Override public void onResponse(String s) { Zhuanlan z = gson.fromJson(s, Zhuanlan.class); list.add(z); if (finalI == (ids.length - 1)){ if (adapter == null) { adapter = new ZhuanlanAdapter(getActivity(),list); recyclerView.setAdapter(adapter); adapter.setItemClickListener(new OnRecyclerViewOnClickListener() { @Override public void OnClick(View v, int position) { Intent intent = new Intent(getContext(),PostsListActivity.class); intent.putExtra("slug",list.get(position).getSlug()); intent.putExtra("title",list.get(position).getName()); intent.putExtra("post_count", list.get(position).getPostsCount()); startActivity(intent); } }); } else { adapter.notifyDataSetChanged(); } refreshLayout.post(new Runnable() { @Override public void run() { refreshLayout.setRefreshing(false); } }); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { } }); request.setTag(type); VolleySingleton.getVolleySingleton(getActivity()).addToRequestQueue(request); } } }
6,948
0.582602
0.57924
210
31.571428
27.47756
130
false
false
0
0
0
0
0
0
0.52381
false
false
9
56cfc8e6e6b469f5f23d8d03bfae9dc78f03ddbf
26,362,509,330,427
94c1edf8166042994071e1fab527215326341e14
/app/src/main/java/com/apaza/moises/sucreapp/ui/places/PlacesFragment.java
b061174b331529ca9f7f05ffa3f5236e662622dc
[]
no_license
moisesaq/SucreApp
https://github.com/moisesaq/SucreApp
cc06274d52cc9737d4ba53a3845cf57f8eda4273
1c88b581cb2d58b9729669acc391653059553953
refs/heads/master
2021-01-24T02:18:16.169000
2018-01-06T01:28:36
2018-01-06T01:28:36
72,607,779
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.apaza.moises.sucreapp.ui.places; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.apaza.moises.sucreapp.R; import com.apaza.moises.sucreapp.data.Place; import java.util.List; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import dagger.android.support.AndroidSupportInjection; public class PlacesFragment extends Fragment implements PlacesContract.FragmentView, PlacesAdapter.PlaceItemListener{ private static final String TAG = PlacesFragment.class.getSimpleName(); private static final int REQUEST_ADD_PLACE = 1; @Inject PlacesContract.FragmentPresenter mFragmentPresenter; @Inject PlacesAdapter mPlacesAdapter; @BindView(R.id.refresh_layout) SwipeRefreshLayout swipeRefreshLayout; @BindView(R.id.places_list) RecyclerView recyclerView; @BindView(R.id.fab) FloatingActionButton fab; @Override public void onAttach(Context context) { super.onAttach(context); AndroidSupportInjection.inject(this); mPlacesAdapter.setPlaceItemListener(this); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //PlacesServiceApiImpl placesServiceApi = new PlacesServiceApiImpl(); //mPlacesAdapter = new PlacesAdapter(new ArrayList<Place>(), this); //mPresenter = new PlacesPresenter(this, Injection.providePlacesRepository()); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_places, container, false); ButterKnife.bind(this, root); setUp(); return root; } private void setUp(){ recyclerView.setAdapter(mPlacesAdapter); int numColumns = getContext().getResources().getInteger(R.integer.num_places_columns); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new GridLayoutManager(getContext(), numColumns)); fab.setImageResource(R.drawable.ic_add); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mFragmentPresenter.addNewPlace(); } }); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mFragmentPresenter.loadPlaces(true); //Utils.showToast("Refresh"); } }); } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true); } @Override public void onStart(){ super.onStart(); mFragmentPresenter.onFragmentStarted(); } @Override public void onResume() { super.onResume(); mFragmentPresenter.loadPlaces(false); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d("PLACESS", "request code " + requestCode); if (PlacesActivity.REQUEST_ADD_PLACE == requestCode && Activity.RESULT_OK == resultCode) { Snackbar.make(getView(), getString(R.string.successfully_saved_place_message), Snackbar.LENGTH_SHORT).show(); } } /*LISTENER*/ @Override public void setProgressIndicator(final boolean active) { if(getView() == null) return; swipeRefreshLayout.post(new Runnable() { @Override public void run() { swipeRefreshLayout.setRefreshing(active); } }); } @Override public void showPlaces(List<Place> places) { //mPlacesAdapter.addItems(places); mPlacesAdapter.replaceData(places); } @Override public Fragment getFragment() { return this; } /*LISTENER ADAPTER*/ @Override public void onPlaceClick(Place place) { mFragmentPresenter.openPlaceDetail(place); } }
UTF-8
Java
4,731
java
PlacesFragment.java
Java
[]
null
[]
package com.apaza.moises.sucreapp.ui.places; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.apaza.moises.sucreapp.R; import com.apaza.moises.sucreapp.data.Place; import java.util.List; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import dagger.android.support.AndroidSupportInjection; public class PlacesFragment extends Fragment implements PlacesContract.FragmentView, PlacesAdapter.PlaceItemListener{ private static final String TAG = PlacesFragment.class.getSimpleName(); private static final int REQUEST_ADD_PLACE = 1; @Inject PlacesContract.FragmentPresenter mFragmentPresenter; @Inject PlacesAdapter mPlacesAdapter; @BindView(R.id.refresh_layout) SwipeRefreshLayout swipeRefreshLayout; @BindView(R.id.places_list) RecyclerView recyclerView; @BindView(R.id.fab) FloatingActionButton fab; @Override public void onAttach(Context context) { super.onAttach(context); AndroidSupportInjection.inject(this); mPlacesAdapter.setPlaceItemListener(this); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //PlacesServiceApiImpl placesServiceApi = new PlacesServiceApiImpl(); //mPlacesAdapter = new PlacesAdapter(new ArrayList<Place>(), this); //mPresenter = new PlacesPresenter(this, Injection.providePlacesRepository()); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_places, container, false); ButterKnife.bind(this, root); setUp(); return root; } private void setUp(){ recyclerView.setAdapter(mPlacesAdapter); int numColumns = getContext().getResources().getInteger(R.integer.num_places_columns); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new GridLayoutManager(getContext(), numColumns)); fab.setImageResource(R.drawable.ic_add); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mFragmentPresenter.addNewPlace(); } }); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mFragmentPresenter.loadPlaces(true); //Utils.showToast("Refresh"); } }); } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true); } @Override public void onStart(){ super.onStart(); mFragmentPresenter.onFragmentStarted(); } @Override public void onResume() { super.onResume(); mFragmentPresenter.loadPlaces(false); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d("PLACESS", "request code " + requestCode); if (PlacesActivity.REQUEST_ADD_PLACE == requestCode && Activity.RESULT_OK == resultCode) { Snackbar.make(getView(), getString(R.string.successfully_saved_place_message), Snackbar.LENGTH_SHORT).show(); } } /*LISTENER*/ @Override public void setProgressIndicator(final boolean active) { if(getView() == null) return; swipeRefreshLayout.post(new Runnable() { @Override public void run() { swipeRefreshLayout.setRefreshing(active); } }); } @Override public void showPlaces(List<Place> places) { //mPlacesAdapter.addItems(places); mPlacesAdapter.replaceData(places); } @Override public Fragment getFragment() { return this; } /*LISTENER ADAPTER*/ @Override public void onPlaceClick(Place place) { mFragmentPresenter.openPlaceDetail(place); } }
4,731
0.693088
0.692031
147
31.183674
27.786852
123
false
false
0
0
0
0
0
0
0.564626
false
false
9
1bd66d0f67f790f43499c0c35d26215288876760
23,519,240,929,709
0f38e85b97e80556c4591cd688d3084086fb7de8
/src/test/java/com/banshi/service/SessionServiceTest.java
1ba528b094c2e7ceda16e244dc29ee7d909bdd59
[]
no_license
rayminr/demo
https://github.com/rayminr/demo
38b84cf5eceaff0b64da398ea7e23e56c519c9ba
29e5de310ad515c4c11d5627e3e7c51201738ec1
refs/heads/master
2021-01-10T05:04:20.228000
2015-11-01T13:12:10
2015-11-01T13:12:10
45,287,707
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.banshi.service; import com.banshi.model.dto.SessionDTO; import com.banshi.support.XlsDataSetBeanFactory; import com.banshi.utils.AppProperties; import com.banshi.utils.DateUtil; import com.banshi.utils.Logger; import org.junit.Test; import java.util.Date; import static org.junit.Assert.assertTrue; public class SessionServiceTest extends BaseServiceTest { @Test public void testTime() throws Exception { Long expireTime = Long.parseLong(AppProperties.getKVStr(SessionService.SESSION_EXPIRE_INTERVAL_MS)); Long maxExpireTime = Long.parseLong(AppProperties.getKVStr(SessionService.SESSION_MAX_EXPIRE_INTERVAL_MS)); // ticket中第二部分为session产生时间,判断是否已过最大期有效时间 Date currentTime = new Date(System.currentTimeMillis()); Date oldTime = new Date(1446374902876l); Date newTime = new Date(1446374902876l + expireTime); Date newTime2 = new Date(1446374902876l + maxExpireTime); Logger.debug(this, String.format("expireTime(mis) = %s", expireTime / 60 / 1000)); Logger.debug(this, String.format("oldTime = %s", DateUtil.formatDate(oldTime, DateUtil.YYYY_MM_DD_HH_MI_SS))); Logger.debug(this, String.format("newTime = %s", DateUtil.formatDate(newTime, DateUtil.YYYY_MM_DD_HH_MI_SS))); Logger.debug(this, String.format("newTime2 = %s", DateUtil.formatDate(newTime2, DateUtil.YYYY_MM_DD_HH_MI_SS))); Logger.debug(this, String.format("currentTime = %s", DateUtil.formatDate(currentTime, DateUtil.YYYY_MM_DD_HH_MI_SS))); assertTrue(currentTime.after(newTime)); //assertTrue(currentTime.after(newTime2)); } @Test public void createSessionTicket() throws Exception { SessionDTO input_session = XlsDataSetBeanFactory.createBean("/testdata/service/SessionServiceTest/createSessionTicket_input.xls", "T_SESSION", SessionDTO.class, SessionDTO.class); String ticketId = sessionService.createSessionTicket(input_session); boolean keepSuccess = sessionService.keepSessionTicket(ticketId); assertTrue(keepSuccess); boolean isValid = sessionService.validateSessionTicket(ticketId); assertTrue(isValid); } }
UTF-8
Java
2,235
java
SessionServiceTest.java
Java
[]
null
[]
package com.banshi.service; import com.banshi.model.dto.SessionDTO; import com.banshi.support.XlsDataSetBeanFactory; import com.banshi.utils.AppProperties; import com.banshi.utils.DateUtil; import com.banshi.utils.Logger; import org.junit.Test; import java.util.Date; import static org.junit.Assert.assertTrue; public class SessionServiceTest extends BaseServiceTest { @Test public void testTime() throws Exception { Long expireTime = Long.parseLong(AppProperties.getKVStr(SessionService.SESSION_EXPIRE_INTERVAL_MS)); Long maxExpireTime = Long.parseLong(AppProperties.getKVStr(SessionService.SESSION_MAX_EXPIRE_INTERVAL_MS)); // ticket中第二部分为session产生时间,判断是否已过最大期有效时间 Date currentTime = new Date(System.currentTimeMillis()); Date oldTime = new Date(1446374902876l); Date newTime = new Date(1446374902876l + expireTime); Date newTime2 = new Date(1446374902876l + maxExpireTime); Logger.debug(this, String.format("expireTime(mis) = %s", expireTime / 60 / 1000)); Logger.debug(this, String.format("oldTime = %s", DateUtil.formatDate(oldTime, DateUtil.YYYY_MM_DD_HH_MI_SS))); Logger.debug(this, String.format("newTime = %s", DateUtil.formatDate(newTime, DateUtil.YYYY_MM_DD_HH_MI_SS))); Logger.debug(this, String.format("newTime2 = %s", DateUtil.formatDate(newTime2, DateUtil.YYYY_MM_DD_HH_MI_SS))); Logger.debug(this, String.format("currentTime = %s", DateUtil.formatDate(currentTime, DateUtil.YYYY_MM_DD_HH_MI_SS))); assertTrue(currentTime.after(newTime)); //assertTrue(currentTime.after(newTime2)); } @Test public void createSessionTicket() throws Exception { SessionDTO input_session = XlsDataSetBeanFactory.createBean("/testdata/service/SessionServiceTest/createSessionTicket_input.xls", "T_SESSION", SessionDTO.class, SessionDTO.class); String ticketId = sessionService.createSessionTicket(input_session); boolean keepSuccess = sessionService.keepSessionTicket(ticketId); assertTrue(keepSuccess); boolean isValid = sessionService.validateSessionTicket(ticketId); assertTrue(isValid); } }
2,235
0.72931
0.706904
51
41.882355
43.301338
187
false
false
0
0
0
0
0
0
0.882353
false
false
9
ef297f4314fec62eaba56f21ceaaa55565f90059
25,924,422,656,672
998c2c640f757bf4007b8db94a824cf45475fb19
/app/src/main/java/com/inspur/playwork/model/common/SocketEvent.java
f21535ad69f283e5d8cfffc3bb4cf0cc4b5f8182
[]
no_license
jishuo1213/PlayWork
https://github.com/jishuo1213/PlayWork
b09e8e1f8d4ddeeb6d1d8bd1ca306640f4ada6ca
8e26f04b5d8054c1d198c86099820d2296a367a6
refs/heads/master
2021-01-11T12:36:44.276000
2017-02-19T13:14:24
2017-02-19T13:14:24
78,948,393
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.inspur.playwork.model.common; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.NonNull; /** * Created by fan on 16-8-2. */ public class SocketEvent implements Parcelable, Comparable<SocketEvent> { private static final String TAG = "SocketEvent"; public String fbId; public int eventCode; public String eventInfo; public boolean isServerDelete; public boolean isClientProcess; public long reciveTime; protected SocketEvent(Parcel in) { fbId = in.readString(); eventCode = in.readInt(); eventInfo = in.readString(); isServerDelete = in.readByte() != 0; isClientProcess = in.readByte() != 0; reciveTime = in.readLong(); } public SocketEvent(String fbId, int eventCode, String eventInfo) { this.fbId = fbId; this.eventCode = eventCode; this.eventInfo = eventInfo; isServerDelete = false; isClientProcess = false; reciveTime = 0; } public static final Creator<SocketEvent> CREATOR = new Creator<SocketEvent>() { @Override public SocketEvent createFromParcel(Parcel in) { return new SocketEvent(in); } @Override public SocketEvent[] newArray(int size) { return new SocketEvent[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(fbId); dest.writeInt(eventCode); dest.writeString(eventInfo); dest.writeByte((byte) (isServerDelete ? 1 : 0)); dest.writeByte((byte) (isClientProcess ? 1 : 0)); dest.writeLong(reciveTime); } @Override public int compareTo(@NonNull SocketEvent another) { if (another.reciveTime > this.reciveTime) { return -1; } else if (another.reciveTime == this.reciveTime) { return 0; } else { return 1; } } @Override public boolean equals(Object o) { if (o instanceof SocketEvent) return ((SocketEvent) o).fbId.equals(this.fbId); else return o instanceof String && o.equals(this.fbId); } @Override public String toString() { return "SocketEvent{" + "fbId='" + fbId + '\'' + ", eventCode=" + eventCode + ", eventInfo='" + eventInfo + '\'' + ", isServerDelete=" + isServerDelete + ", isClientProcess=" + isClientProcess + '}'; } }
UTF-8
Java
2,647
java
SocketEvent.java
Java
[ { "context": "oid.support.annotation.NonNull;\n\n/**\n * Created by fan on 16-8-2.\n */\npublic class SocketEvent implement", "end": 164, "score": 0.9733456373214722, "start": 161, "tag": "USERNAME", "value": "fan" } ]
null
[]
package com.inspur.playwork.model.common; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.NonNull; /** * Created by fan on 16-8-2. */ public class SocketEvent implements Parcelable, Comparable<SocketEvent> { private static final String TAG = "SocketEvent"; public String fbId; public int eventCode; public String eventInfo; public boolean isServerDelete; public boolean isClientProcess; public long reciveTime; protected SocketEvent(Parcel in) { fbId = in.readString(); eventCode = in.readInt(); eventInfo = in.readString(); isServerDelete = in.readByte() != 0; isClientProcess = in.readByte() != 0; reciveTime = in.readLong(); } public SocketEvent(String fbId, int eventCode, String eventInfo) { this.fbId = fbId; this.eventCode = eventCode; this.eventInfo = eventInfo; isServerDelete = false; isClientProcess = false; reciveTime = 0; } public static final Creator<SocketEvent> CREATOR = new Creator<SocketEvent>() { @Override public SocketEvent createFromParcel(Parcel in) { return new SocketEvent(in); } @Override public SocketEvent[] newArray(int size) { return new SocketEvent[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(fbId); dest.writeInt(eventCode); dest.writeString(eventInfo); dest.writeByte((byte) (isServerDelete ? 1 : 0)); dest.writeByte((byte) (isClientProcess ? 1 : 0)); dest.writeLong(reciveTime); } @Override public int compareTo(@NonNull SocketEvent another) { if (another.reciveTime > this.reciveTime) { return -1; } else if (another.reciveTime == this.reciveTime) { return 0; } else { return 1; } } @Override public boolean equals(Object o) { if (o instanceof SocketEvent) return ((SocketEvent) o).fbId.equals(this.fbId); else return o instanceof String && o.equals(this.fbId); } @Override public String toString() { return "SocketEvent{" + "fbId='" + fbId + '\'' + ", eventCode=" + eventCode + ", eventInfo='" + eventInfo + '\'' + ", isServerDelete=" + isServerDelete + ", isClientProcess=" + isClientProcess + '}'; } }
2,647
0.585946
0.58028
94
27.159575
20.274868
83
false
false
0
0
0
0
0
0
0.5
false
false
9
467991104e2fe526bc57250492b36d06daee2b07
26,431,228,751,041
9e8026279ec332f3242227a17f3018e1dc60adb8
/Arry.java
3420eeefe1fb2dc9094fe9cd738a6762be8b3f93
[]
no_license
sydtinki/Java
https://github.com/sydtinki/Java
016c13b5ec53af70619f8f0e7e6d22ac31c1fd78
76731963b78745794f4ab5c7b4d2402c36248072
refs/heads/master
2020-06-05T19:41:23.727000
2019-06-19T11:34:47
2019-06-19T11:34:47
192,528,213
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Arry { public static void main(String args[]) { int []numbs=new int[10]; for(int i=0; i<10; i++){ numbs[i]=i+1; } for(int i=0; i<numbs.length; i++){ System.out.println(numbs[i]); } } }
UTF-8
Java
213
java
Arry.java
Java
[]
null
[]
class Arry { public static void main(String args[]) { int []numbs=new int[10]; for(int i=0; i<10; i++){ numbs[i]=i+1; } for(int i=0; i<numbs.length; i++){ System.out.println(numbs[i]); } } }
213
0.553991
0.521127
15
12.2
14.143079
40
false
false
0
0
0
0
0
0
0.466667
false
false
9
6a87085474cf0a80512b161307dc0aafdb7a1814
31,653,908,983,027
9d9673a082be6695d7a6d46ce186b0614d3bd100
/src/main/java/com/github/wp/system/web/bind/method/JsonUtil.java
dc23adcbb86177c36d69b34f4f314bc07152bcb7
[]
no_license
15955102017/wp_purity_v1.7
https://github.com/15955102017/wp_purity_v1.7
713507e5ece038740c31337719130a07b3ac3a83
6decb4583fd4a6457f253704ff9052e921bbda04
refs/heads/master
2016-09-01T16:41:44.993000
2016-02-26T05:02:41
2016-02-26T05:02:41
52,579,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.wp.system.web.bind.method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.github.wp.system.pojo.SysDatadic; import com.github.wp.system.pojo.SysOrganization; import com.github.wp.system.pojo.SysResource; import com.github.wp.system.pojo.SysRole; public class JsonUtil { /** * 获取菜单资源树 * * @param id * @param menus * @return * @author wangping */ public static List<Map<String, Object>> getResourceMenu(Long id, List<?> menus) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : menus) { SysResource resource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); if ((resource.getSysResource() == null && id == null) || (resource.getSysResource() != null && resource .getSysResource().getId() == id)) { map.put("menuid", resource.getId()); map.put("menuname", resource.getName()); map.put("icon", resource.getIcon()); map.put("url", resource.getUrl()); List<Map<String, Object>> mapChild = getResourceMenu( resource.getId(), menus); if (mapChild.size() > 0) { map.put("menus", mapChild); } li.add(map); } } return li; } /** * 获取资源树treegrid * * @param id * @param roleResources * @param resources * @return * @author wangping */ public static List<Map<String, Object>> getResourceTG(Long id, List<?> roleResources, List<?> resources) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : resources) { SysResource resource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); // 如果id为null表示资源为根节点 if ((resource.getSysResource() == null && id == null) || (resource.getSysResource() != null && resource .getSysResource().getId() == id)) { map.put("id", resource.getId()); map.put("name", resource.getName()); map.put("url", resource.getUrl()); map.put("permission", resource.getPermission()); if (roleResources != null && roleResources.contains(resource)) { map.put("isChecked", true); } else { map.put("isChecked", false); } List<Map<String, Object>> mapChild = getResourceTG( resource.getId(), roleResources, resources); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 获取资源的cobotree * * @param id * @param resources * @return * @author wangping */ public static List<Map<String, Object>> getResrouceCT(Long id, List<?> resources) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : resources) { SysResource resource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); // 如果id为null表示资源为根节点 if ((resource.getSysResource() == null && id == null) || (resource.getSysResource() != null && resource .getSysResource().getId() == id)) { map.put("id", resource.getId()); map.put("text", resource.getName()); List<Map<String, Object>> mapChild = getResrouceCT( resource.getId(), resources); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 获取异步资源tree * * @param resources * @return * @author wangping */ public static List<Map<String, Object>> getAsynResTree(List<?> resources) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : resources) { SysResource sysResource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", sysResource.getId()); map.put("text", sysResource.getName()); map.put("iconCls", sysResource.getIcon()); if (sysResource.getSysResource() == null) { List<Map<String, Object>> mapChild = getAsynResTree(sysResource .getSysResources()); if (mapChild.size() > 0) { map.put("children", mapChild); } else map.put("state", "closed"); } else if (sysResource.getSysResources() != null && sysResource.getSysResources().size() > 0) { map.put("state", "closed"); } li.add(map); } return li; } /** * 获取角色tree * * @param id * 角色根节点 * @param userRoles * 选中的角色对象 * @param roles * 所有的角色对象 * @return * @author wangping */ public static List<Map<String, Object>> getRoleTree(Long id, List<?> userRoles, List<?> roles) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : roles) { SysRole role = (SysRole) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", role.getId()); map.put("text", role.getDescription()); if (userRoles != null && userRoles.contains(role)) { map.put("checked", true); } li.add(map); } return li; } /** * 获取组织机构树 * * @param id * 机构根节点id * @param organizations * 所有的机构对象 * @return * @author wangping */ public static List<Map<String, Object>> getOrgTree(Long id, List<?> organizations) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : organizations) { SysOrganization organization = (SysOrganization) obj; Map<String, Object> map = new HashMap<String, Object>(); if ((organization.getSysOrganization() == null && id == null) || (organization.getSysOrganization() != null && organization .getSysOrganization().getId() == id)) { map.put("id", organization.getId()); map.put("text", organization.getName()); List<Map<String, Object>> mapChild = getOrgTree( organization.getId(), organization.getSysOrganizations()); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 获取机构的异步树 * * @param organizations * 用户选则的一个节点的机构对象集合 * @return * @author wangping */ public static List<Map<String, Object>> getAsynOrgTree(List<?> organizations) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : organizations) { SysOrganization organization = (SysOrganization) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", organization.getId()); map.put("text", organization.getName()); if (organization.getSysOrganization() == null) { List<Map<String, Object>> mapChild = getAsynOrgTree(organization .getSysOrganizations()); if (mapChild.size() > 0) { map.put("children", mapChild); } else map.put("state", "closed"); } else if (organization.getSysOrganizations() != null && organization.getSysOrganizations().size() > 0) { map.put("state", "closed"); } li.add(map); } return li; } /** * 获取组织机构的treegrid * * @param id * 组织机构根节点id * @param specifyOrgs * 选中的机构对象 * @param orgs * 所有的机构对象 * @return * @author wangping */ public static List<Map<String, Object>> getOrgTreegrid(Long id, List<?> specifyOrgs, List<?> orgs) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : orgs) { SysOrganization org = (SysOrganization) obj; Map<String, Object> map = new HashMap<String, Object>(); if ((org.getSysOrganization() == null && id == null) || (org.getSysOrganization() != null && org .getSysOrganization().getId() == id)) { map.put("id", org.getId()); map.put("name", org.getName()); if (specifyOrgs != null && specifyOrgs.contains(org)) { map.put("isChecked", true); } else { map.put("isChecked", false); } List<Map<String, Object>> mapChild = getOrgTreegrid( org.getId(), specifyOrgs, orgs); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 异步获取数据字典树 * @param codingname * @param organizations * @return * @author wangping */ public static List<Map<String, Object>> getAsynDatadicTree( String codingname, List<?> organizations) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : organizations) { SysDatadic datadic = (SysDatadic) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", datadic.getCodingname()); map.put("text", datadic.getCnname()); if (codingname == null) { List<Map<String, Object>> mapChild = getAsynDatadicTree( datadic.getCodingname(), datadic.getSysDatadics()); if (mapChild.size() > 0) { map.put("children", mapChild); } else map.put("state", "closed"); } else { List<?> dics = datadic.getSysDatadics(); if (dics.size() > 0) { map.put("state", "closed"); } } li.add(map); } return li; } }
UTF-8
Java
9,170
java
JsonUtil.java
Java
[ { "context": "@param id\n\t * @param menus\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 441, "score": 0.9944260716438293, "start": 433, "tag": "USERNAME", "value": "wangping" }, { "context": "urces\n\t * @param resources\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 1382, "score": 0.9932753443717957, "start": 1374, "tag": "USERNAME", "value": "wangping" }, { "context": "am id\n\t * @param resources\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>>", "end": 2530, "score": 0.7705363035202026, "start": 2526, "tag": "NAME", "value": "wang" }, { "context": "\n\t * @param resources\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 2534, "score": 0.6338361501693726, "start": 2530, "tag": "USERNAME", "value": "ping" }, { "context": "\n\t * \n\t * @param resources\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 3380, "score": 0.9916545748710632, "start": 3372, "tag": "USERNAME", "value": "wangping" }, { "context": "les\n\t * 所有的角色对象\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 4415, "score": 0.9926932454109192, "start": 4407, "tag": "USERNAME", "value": "wangping" }, { "context": "ons\n\t * 所有的机构对象\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 5057, "score": 0.8953981399536133, "start": 5049, "tag": "USERNAME", "value": "wangping" }, { "context": " 用户选则的一个节点的机构对象集合\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 5994, "score": 0.8429527282714844, "start": 5986, "tag": "USERNAME", "value": "wangping" }, { "context": "rgs\n\t * 所有的机构对象\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>> get", "end": 7034, "score": 0.9935882091522217, "start": 7026, "tag": "USERNAME", "value": "wangping" }, { "context": "e\n\t * @param organizations\n\t * @return\n\t * @author wangping\n\t */\n\tpublic static List<Map<String, Object>>", "end": 8028, "score": 0.9936442375183105, "start": 8024, "tag": "USERNAME", "value": "wang" } ]
null
[]
package com.github.wp.system.web.bind.method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.github.wp.system.pojo.SysDatadic; import com.github.wp.system.pojo.SysOrganization; import com.github.wp.system.pojo.SysResource; import com.github.wp.system.pojo.SysRole; public class JsonUtil { /** * 获取菜单资源树 * * @param id * @param menus * @return * @author wangping */ public static List<Map<String, Object>> getResourceMenu(Long id, List<?> menus) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : menus) { SysResource resource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); if ((resource.getSysResource() == null && id == null) || (resource.getSysResource() != null && resource .getSysResource().getId() == id)) { map.put("menuid", resource.getId()); map.put("menuname", resource.getName()); map.put("icon", resource.getIcon()); map.put("url", resource.getUrl()); List<Map<String, Object>> mapChild = getResourceMenu( resource.getId(), menus); if (mapChild.size() > 0) { map.put("menus", mapChild); } li.add(map); } } return li; } /** * 获取资源树treegrid * * @param id * @param roleResources * @param resources * @return * @author wangping */ public static List<Map<String, Object>> getResourceTG(Long id, List<?> roleResources, List<?> resources) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : resources) { SysResource resource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); // 如果id为null表示资源为根节点 if ((resource.getSysResource() == null && id == null) || (resource.getSysResource() != null && resource .getSysResource().getId() == id)) { map.put("id", resource.getId()); map.put("name", resource.getName()); map.put("url", resource.getUrl()); map.put("permission", resource.getPermission()); if (roleResources != null && roleResources.contains(resource)) { map.put("isChecked", true); } else { map.put("isChecked", false); } List<Map<String, Object>> mapChild = getResourceTG( resource.getId(), roleResources, resources); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 获取资源的cobotree * * @param id * @param resources * @return * @author wangping */ public static List<Map<String, Object>> getResrouceCT(Long id, List<?> resources) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : resources) { SysResource resource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); // 如果id为null表示资源为根节点 if ((resource.getSysResource() == null && id == null) || (resource.getSysResource() != null && resource .getSysResource().getId() == id)) { map.put("id", resource.getId()); map.put("text", resource.getName()); List<Map<String, Object>> mapChild = getResrouceCT( resource.getId(), resources); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 获取异步资源tree * * @param resources * @return * @author wangping */ public static List<Map<String, Object>> getAsynResTree(List<?> resources) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : resources) { SysResource sysResource = (SysResource) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", sysResource.getId()); map.put("text", sysResource.getName()); map.put("iconCls", sysResource.getIcon()); if (sysResource.getSysResource() == null) { List<Map<String, Object>> mapChild = getAsynResTree(sysResource .getSysResources()); if (mapChild.size() > 0) { map.put("children", mapChild); } else map.put("state", "closed"); } else if (sysResource.getSysResources() != null && sysResource.getSysResources().size() > 0) { map.put("state", "closed"); } li.add(map); } return li; } /** * 获取角色tree * * @param id * 角色根节点 * @param userRoles * 选中的角色对象 * @param roles * 所有的角色对象 * @return * @author wangping */ public static List<Map<String, Object>> getRoleTree(Long id, List<?> userRoles, List<?> roles) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : roles) { SysRole role = (SysRole) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", role.getId()); map.put("text", role.getDescription()); if (userRoles != null && userRoles.contains(role)) { map.put("checked", true); } li.add(map); } return li; } /** * 获取组织机构树 * * @param id * 机构根节点id * @param organizations * 所有的机构对象 * @return * @author wangping */ public static List<Map<String, Object>> getOrgTree(Long id, List<?> organizations) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : organizations) { SysOrganization organization = (SysOrganization) obj; Map<String, Object> map = new HashMap<String, Object>(); if ((organization.getSysOrganization() == null && id == null) || (organization.getSysOrganization() != null && organization .getSysOrganization().getId() == id)) { map.put("id", organization.getId()); map.put("text", organization.getName()); List<Map<String, Object>> mapChild = getOrgTree( organization.getId(), organization.getSysOrganizations()); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 获取机构的异步树 * * @param organizations * 用户选则的一个节点的机构对象集合 * @return * @author wangping */ public static List<Map<String, Object>> getAsynOrgTree(List<?> organizations) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : organizations) { SysOrganization organization = (SysOrganization) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", organization.getId()); map.put("text", organization.getName()); if (organization.getSysOrganization() == null) { List<Map<String, Object>> mapChild = getAsynOrgTree(organization .getSysOrganizations()); if (mapChild.size() > 0) { map.put("children", mapChild); } else map.put("state", "closed"); } else if (organization.getSysOrganizations() != null && organization.getSysOrganizations().size() > 0) { map.put("state", "closed"); } li.add(map); } return li; } /** * 获取组织机构的treegrid * * @param id * 组织机构根节点id * @param specifyOrgs * 选中的机构对象 * @param orgs * 所有的机构对象 * @return * @author wangping */ public static List<Map<String, Object>> getOrgTreegrid(Long id, List<?> specifyOrgs, List<?> orgs) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : orgs) { SysOrganization org = (SysOrganization) obj; Map<String, Object> map = new HashMap<String, Object>(); if ((org.getSysOrganization() == null && id == null) || (org.getSysOrganization() != null && org .getSysOrganization().getId() == id)) { map.put("id", org.getId()); map.put("name", org.getName()); if (specifyOrgs != null && specifyOrgs.contains(org)) { map.put("isChecked", true); } else { map.put("isChecked", false); } List<Map<String, Object>> mapChild = getOrgTreegrid( org.getId(), specifyOrgs, orgs); if (mapChild.size() > 0) { map.put("children", mapChild); } li.add(map); } } return li; } /** * 异步获取数据字典树 * @param codingname * @param organizations * @return * @author wangping */ public static List<Map<String, Object>> getAsynDatadicTree( String codingname, List<?> organizations) { List<Map<String, Object>> li = new ArrayList<Map<String, Object>>(); for (Object obj : organizations) { SysDatadic datadic = (SysDatadic) obj; Map<String, Object> map = new HashMap<String, Object>(); map.put("id", datadic.getCodingname()); map.put("text", datadic.getCnname()); if (codingname == null) { List<Map<String, Object>> mapChild = getAsynDatadicTree( datadic.getCodingname(), datadic.getSysDatadics()); if (mapChild.size() > 0) { map.put("children", mapChild); } else map.put("state", "closed"); } else { List<?> dics = datadic.getSysDatadics(); if (dics.size() > 0) { map.put("state", "closed"); } } li.add(map); } return li; } }
9,170
0.615619
0.614379
319
26.818182
20.754835
80
false
false
0
0
0
0
0
0
3.244514
false
false
9
ebfe1b2289570be0fb71e9728c03599d2d5ec8df
27,238,682,626,357
fc629c519b5ffcd8012eddb382d67838ef6845b9
/src/file_menu/FileMenu.java
e29470a64a984180bffe5bc11018a8c2d4331d65
[]
no_license
TobySalusky/Java-Art-Program
https://github.com/TobySalusky/Java-Art-Program
d7348f2c6f012018305f69dd90dd39c62949ad3b
e7cbb080992f141aa11212d9fc64c9d13ebc33ca
refs/heads/master
2023-08-18T21:27:42.305000
2021-10-03T01:19:26
2021-10-03T01:19:26
242,803,005
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package file_menu; import general.Program; import java.awt.Graphics; import java.awt.Rectangle; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Objects; public class FileMenu { String folderPath; boolean folderRead = false; private List<FileTab> fileTabs = new ArrayList<>(); private Rectangle bound; private int tabSize = 150; private int oldTabSize = tabSize; private int tabWidth = tabSize; private int tabHeight = tabSize; private int firstTabX; private int tabsPerRow; private int tabSpacing = 20; protected float scroll = 0; private int folderCount; private Program program; private static final boolean readSubFolders = false; // note, make dynamic value class with .value/ .getValue() + incorporates sliders, text fields, check boxes, etc... private FullPath clickPath; public FileMenu(Program program, String folderPath, Rectangle boundaries) { this.program = program; setFolderPath(folderPath); this.bound = boundaries; } public void test(String test) { setFolderPath(test); } private void setFolderPath(String folderPath) { this.folderPath = folderPath; clickPath = new FullPath(program, folderPath); if (folderPath.endsWith("\\")) { Program.setFilePath(folderPath); } else { Program.setFilePath(folderPath + "\\"); } } public void resetTo(String newFolderPath) { setFolderPath(newFolderPath); clearTabs(); readFolder(); setTabPositions(); } public void fixWidthAndHeight() { tabWidth = tabSize; tabHeight = tabSize; } public void defineBoundaries() { tabsPerRow = 0; firstTabX = bound.x + tabWidth / 2; int thisX = firstTabX; while (thisX + tabWidth / 2 <= bound.x + bound.width) { tabsPerRow++; thisX += tabSpacing + tabWidth; } thisX -= tabSpacing + tabWidth; int adjust = (bound.x + bound.width) - (thisX + tabWidth / 2); firstTabX += adjust / 2; } public void setUp() { defineBoundaries(); readFolder(); setTabPositions(); } public void readFolder() { final File folder = new File(folderPath); readFolder(folder); } public void clearTabs() { fileTabs = new ArrayList<>(); folderCount = 0; } public void readFolder(File folder) { File[] fileList = folder.listFiles(); if (fileList != null) { for (final File file : fileList) { if (file == null) { continue; } if (file.isDirectory()) { fileTabs.add(folderCount, new FolderTab(program, file)); folderCount++; } else { /*if (readSubFolders && file.isDirectory()) { readFolder(file); }*/ if (hasExtension(file, "png") || hasExtension(file, "art")) { fileTabs.add(new ImageTab(program, file)); } } } } folderRead = true; } public void setTabPositions() { int tabCount = 0; int row = 0; for (FileTab fileTab : fileTabs) { if (tabCount >= tabsPerRow) { tabCount = 0; row++; } fileTab.setDimensions(firstTabX + ((tabWidth + tabSpacing) * tabCount), bound.y + tabHeight / 2F + (row * (tabHeight + tabSpacing)), tabWidth, tabHeight); tabCount++; } } public String getExtension(File file) { String name = file.getName(); String extension = ""; if (name.indexOf('.') != -1) { extension = name.substring(name.indexOf('.') + 1); } return extension; } public boolean hasExtension(File file, String extension) { return (getExtension(file).equalsIgnoreCase(extension)); // perhaps add trim? } public void checkClicks(float mouseX, float mouseY, boolean rightClick) { for (FileTab tab : fileTabs) { tab.checkClick(mouseX, mouseY, rightClick); } clickPath.checkClicks(mouseX, mouseY, rightClick); } public void draw(Graphics g) { if (tabSize != oldTabSize) { oldTabSize = tabSize; fixWidthAndHeight(); defineBoundaries(); } // limits scroll int scrollDivide = 5; if (scroll < 0) { scroll -= scroll / scrollDivide; } if (fileTabs.size() > 0) { FileTab lastTab = fileTabs.get(fileTabs.size() - 1); float upperLimit = lastTab.getToY() - tabHeight / 2F - tabSpacing / 2F; if (scroll > upperLimit) { scroll += (upperLimit - scroll) / scrollDivide; } for (FileTab tab : fileTabs) { tab.tick(scroll); tab.draw(g); } } clickPath.scroll(scroll); clickPath.draw(g); } public void checkHovers(float mouseX, float mouseY) { for (FileTab tab : fileTabs) { tab.ifHover(mouseX, mouseY); } clickPath.checkHovers(mouseX, mouseY); } public int getTabSize() { return tabSize; } public void setTabSize(int tabSize) { this.tabSize = tabSize; } public boolean isFolderRead() { return folderRead; } public void addScroll(float scroll) { this.scroll += scroll; } }
UTF-8
Java
5,771
java
FileMenu.java
Java
[]
null
[]
package file_menu; import general.Program; import java.awt.Graphics; import java.awt.Rectangle; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Objects; public class FileMenu { String folderPath; boolean folderRead = false; private List<FileTab> fileTabs = new ArrayList<>(); private Rectangle bound; private int tabSize = 150; private int oldTabSize = tabSize; private int tabWidth = tabSize; private int tabHeight = tabSize; private int firstTabX; private int tabsPerRow; private int tabSpacing = 20; protected float scroll = 0; private int folderCount; private Program program; private static final boolean readSubFolders = false; // note, make dynamic value class with .value/ .getValue() + incorporates sliders, text fields, check boxes, etc... private FullPath clickPath; public FileMenu(Program program, String folderPath, Rectangle boundaries) { this.program = program; setFolderPath(folderPath); this.bound = boundaries; } public void test(String test) { setFolderPath(test); } private void setFolderPath(String folderPath) { this.folderPath = folderPath; clickPath = new FullPath(program, folderPath); if (folderPath.endsWith("\\")) { Program.setFilePath(folderPath); } else { Program.setFilePath(folderPath + "\\"); } } public void resetTo(String newFolderPath) { setFolderPath(newFolderPath); clearTabs(); readFolder(); setTabPositions(); } public void fixWidthAndHeight() { tabWidth = tabSize; tabHeight = tabSize; } public void defineBoundaries() { tabsPerRow = 0; firstTabX = bound.x + tabWidth / 2; int thisX = firstTabX; while (thisX + tabWidth / 2 <= bound.x + bound.width) { tabsPerRow++; thisX += tabSpacing + tabWidth; } thisX -= tabSpacing + tabWidth; int adjust = (bound.x + bound.width) - (thisX + tabWidth / 2); firstTabX += adjust / 2; } public void setUp() { defineBoundaries(); readFolder(); setTabPositions(); } public void readFolder() { final File folder = new File(folderPath); readFolder(folder); } public void clearTabs() { fileTabs = new ArrayList<>(); folderCount = 0; } public void readFolder(File folder) { File[] fileList = folder.listFiles(); if (fileList != null) { for (final File file : fileList) { if (file == null) { continue; } if (file.isDirectory()) { fileTabs.add(folderCount, new FolderTab(program, file)); folderCount++; } else { /*if (readSubFolders && file.isDirectory()) { readFolder(file); }*/ if (hasExtension(file, "png") || hasExtension(file, "art")) { fileTabs.add(new ImageTab(program, file)); } } } } folderRead = true; } public void setTabPositions() { int tabCount = 0; int row = 0; for (FileTab fileTab : fileTabs) { if (tabCount >= tabsPerRow) { tabCount = 0; row++; } fileTab.setDimensions(firstTabX + ((tabWidth + tabSpacing) * tabCount), bound.y + tabHeight / 2F + (row * (tabHeight + tabSpacing)), tabWidth, tabHeight); tabCount++; } } public String getExtension(File file) { String name = file.getName(); String extension = ""; if (name.indexOf('.') != -1) { extension = name.substring(name.indexOf('.') + 1); } return extension; } public boolean hasExtension(File file, String extension) { return (getExtension(file).equalsIgnoreCase(extension)); // perhaps add trim? } public void checkClicks(float mouseX, float mouseY, boolean rightClick) { for (FileTab tab : fileTabs) { tab.checkClick(mouseX, mouseY, rightClick); } clickPath.checkClicks(mouseX, mouseY, rightClick); } public void draw(Graphics g) { if (tabSize != oldTabSize) { oldTabSize = tabSize; fixWidthAndHeight(); defineBoundaries(); } // limits scroll int scrollDivide = 5; if (scroll < 0) { scroll -= scroll / scrollDivide; } if (fileTabs.size() > 0) { FileTab lastTab = fileTabs.get(fileTabs.size() - 1); float upperLimit = lastTab.getToY() - tabHeight / 2F - tabSpacing / 2F; if (scroll > upperLimit) { scroll += (upperLimit - scroll) / scrollDivide; } for (FileTab tab : fileTabs) { tab.tick(scroll); tab.draw(g); } } clickPath.scroll(scroll); clickPath.draw(g); } public void checkHovers(float mouseX, float mouseY) { for (FileTab tab : fileTabs) { tab.ifHover(mouseX, mouseY); } clickPath.checkHovers(mouseX, mouseY); } public int getTabSize() { return tabSize; } public void setTabSize(int tabSize) { this.tabSize = tabSize; } public boolean isFolderRead() { return folderRead; } public void addScroll(float scroll) { this.scroll += scroll; } }
5,771
0.546699
0.54254
276
19.90942
22.976416
166
false
false
0
0
0
0
0
0
0.427536
false
false
9
825597fdc6af1a4786395a43d92f1a774377ad85
22,806,276,365,351
a37e75c5138eec880850caaa0d1fa548f08d4e31
/org.kevoree.extra.chart2d/src/main/java/info/monitorenter/gui/chart/traces/Trace2DSorted.java
a0bf4714796152bf0ddd793837db350f834ed699
[]
no_license
dukeboard/kevoree-extra
https://github.com/dukeboard/kevoree-extra
c88806d50d23d2dcdd0d5d64d75b5e6358cdabcf
f8308f812d54d7a8ba4ae8fd2972d6fed3bc3503
refs/heads/master
2022-12-22T17:09:51.828000
2014-05-27T14:43:16
2014-05-27T14:43:16
2,067,252
4
7
null
false
2022-12-13T19:14:06
2011-07-18T16:15:37
2018-02-05T19:19:03
2022-12-13T19:14:04
134,923
10
4
21
Java
false
false
/* * Trace2DSorted, a TreeSet- based implementation of a ITrace2D that performs * insertion- sort of TracePoint2D - instances by their x- value. * Copyright (c) 2004 - 2011 Achim Westermann, Achim.Westermann@gmx.de * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * If you modify or optimize the code in a useful way please let me know. * Achim.Westermann@gmx.de */ package info.monitorenter.gui.chart.traces; import info.monitorenter.gui.chart.ITrace2D; import info.monitorenter.gui.chart.ITracePoint2D; import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; /** * Has the behavior of <code>Trace2DReplacing</code> and additional features. * <p> * <ul> * <li>All traceoints added whose x- values are not already contained are added * to the internal Tree ordered by growing x-values. Therefore it is guaranteed * that the tracepoints will be sorted in ascending order of x- values at any * time.</li> * </ul> * <p> * * Because sorted insertion of a List causes n! index- operations ( * <code>get(int i)</code>) additional to the comparisons this class does not * extend <code>Trace2DSimple</code> which uses a List. Instead a * <code>TreeSet </code> is used. * <p> * * @author <a href='mailto:Achim.Westermann@gmx.de'>Achim Westermann </a> * * @version $Revision: 1.15 $ */ public class Trace2DSorted extends ATrace2D implements ITrace2D { /** Generated <code>serialVersionUID</code>. */ private static final long serialVersionUID = -3518797764292132652L; /** The sorted set of points. */ protected SortedSet<ITracePoint2D> m_points = new TreeSet<ITracePoint2D>(); /** * Defcon. * <p> */ public Trace2DSorted() { // nop } /** * In case p has an x- value already contained, the old tracepoint with that * value will be replaced by the new one. Else the new tracepoint will be * added at an index in order to keep the ascending order of tracepoints with * a higher x- value are contained. * <p> * * @param p * the point to add. * * @return true if the given point was successfully added. */ @Override protected boolean addPointInternal(final ITracePoint2D p) { // remove eventually contained to allow adding of new one this.removePoint(p); return this.m_points.add(p); } /** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (this.getClass() != obj.getClass()) { return false; } final Trace2DSorted other = (Trace2DSorted) obj; if (this.m_points == null) { if (other.m_points != null) { return false; } } else if (!this.m_points.equals(other.m_points)) { return false; } return true; } /** * @see info.monitorenter.gui.chart.ITrace2D#getMaxSize() */ public int getMaxSize() { return Integer.MAX_VALUE; } /** * @see info.monitorenter.gui.chart.ITrace2D#getSize() */ public int getSize() { return this.m_points.size(); } /** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((this.m_points == null) ? 0 : this.m_points.hashCode()); return result; } /** * @see info.monitorenter.gui.chart.ITrace2D#isEmpty() */ public boolean isEmpty() { return this.m_points.size() == 0; } /** * @see info.monitorenter.gui.chart.ITrace2D#iterator() */ public Iterator<ITracePoint2D> iterator() { return this.m_points.iterator(); } /** * @see ATrace2D#addPointInternal(info.monitorenter.gui.chart.ITracePoint2D) */ @Override protected void removeAllPointsInternal() { this.m_points.clear(); } /** * @see ATrace2D#removePointInternal(info.monitorenter.gui.chart.ITracePoint2D) */ @Override protected ITracePoint2D removePointInternal(final ITracePoint2D point) { ITracePoint2D result = null; if (this.m_points.remove(point)) { result = point; } return result; } }
UTF-8
Java
4,901
java
Trace2DSorted.java
Java
[ { "context": "s by their x- value.\n * Copyright (c) 2004 - 2011 Achim Westermann, Achim.Westermann@gmx.de\n *\n * This library is f", "end": 195, "score": 0.999882161617279, "start": 179, "tag": "NAME", "value": "Achim Westermann" }, { "context": "e.\n * Copyright (c) 2004 - 2011 Achim Westermann, Achim.Westermann@gmx.de\n *\n * This library is free software; you can red", "end": 220, "score": 0.9999300837516785, "start": 197, "tag": "EMAIL", "value": "Achim.Westermann@gmx.de" }, { "context": "e the code in a useful way please let me know.\n * Achim.Westermann@gmx.de\n */\n\npackage info.monitorenter.gui.chart.traces;\n", "end": 1079, "score": 0.9999049305915833, "start": 1056, "tag": "EMAIL", "value": "Achim.Westermann@gmx.de" }, { "context": "e> is used.\n * <p>\n * \n * @author <a href='mailto:Achim.Westermann@gmx.de'>Achim Westermann </a>\n * \n * @version $Revision:", "end": 1984, "score": 0.9999126195907593, "start": 1961, "tag": "EMAIL", "value": "Achim.Westermann@gmx.de" }, { "context": " @author <a href='mailto:Achim.Westermann@gmx.de'>Achim Westermann </a>\n * \n * @version $Revision: 1.15 $\n */\npublic", "end": 2002, "score": 0.999839186668396, "start": 1986, "tag": "NAME", "value": "Achim Westermann" } ]
null
[]
/* * Trace2DSorted, a TreeSet- based implementation of a ITrace2D that performs * insertion- sort of TracePoint2D - instances by their x- value. * Copyright (c) 2004 - 2011 <NAME>, <EMAIL> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * If you modify or optimize the code in a useful way please let me know. * <EMAIL> */ package info.monitorenter.gui.chart.traces; import info.monitorenter.gui.chart.ITrace2D; import info.monitorenter.gui.chart.ITracePoint2D; import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; /** * Has the behavior of <code>Trace2DReplacing</code> and additional features. * <p> * <ul> * <li>All traceoints added whose x- values are not already contained are added * to the internal Tree ordered by growing x-values. Therefore it is guaranteed * that the tracepoints will be sorted in ascending order of x- values at any * time.</li> * </ul> * <p> * * Because sorted insertion of a List causes n! index- operations ( * <code>get(int i)</code>) additional to the comparisons this class does not * extend <code>Trace2DSimple</code> which uses a List. Instead a * <code>TreeSet </code> is used. * <p> * * @author <a href='mailto:<EMAIL>'><NAME> </a> * * @version $Revision: 1.15 $ */ public class Trace2DSorted extends ATrace2D implements ITrace2D { /** Generated <code>serialVersionUID</code>. */ private static final long serialVersionUID = -3518797764292132652L; /** The sorted set of points. */ protected SortedSet<ITracePoint2D> m_points = new TreeSet<ITracePoint2D>(); /** * Defcon. * <p> */ public Trace2DSorted() { // nop } /** * In case p has an x- value already contained, the old tracepoint with that * value will be replaced by the new one. Else the new tracepoint will be * added at an index in order to keep the ascending order of tracepoints with * a higher x- value are contained. * <p> * * @param p * the point to add. * * @return true if the given point was successfully added. */ @Override protected boolean addPointInternal(final ITracePoint2D p) { // remove eventually contained to allow adding of new one this.removePoint(p); return this.m_points.add(p); } /** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (this.getClass() != obj.getClass()) { return false; } final Trace2DSorted other = (Trace2DSorted) obj; if (this.m_points == null) { if (other.m_points != null) { return false; } } else if (!this.m_points.equals(other.m_points)) { return false; } return true; } /** * @see info.monitorenter.gui.chart.ITrace2D#getMaxSize() */ public int getMaxSize() { return Integer.MAX_VALUE; } /** * @see info.monitorenter.gui.chart.ITrace2D#getSize() */ public int getSize() { return this.m_points.size(); } /** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((this.m_points == null) ? 0 : this.m_points.hashCode()); return result; } /** * @see info.monitorenter.gui.chart.ITrace2D#isEmpty() */ public boolean isEmpty() { return this.m_points.size() == 0; } /** * @see info.monitorenter.gui.chart.ITrace2D#iterator() */ public Iterator<ITracePoint2D> iterator() { return this.m_points.iterator(); } /** * @see ATrace2D#addPointInternal(info.monitorenter.gui.chart.ITracePoint2D) */ @Override protected void removeAllPointsInternal() { this.m_points.clear(); } /** * @see ATrace2D#removePointInternal(info.monitorenter.gui.chart.ITracePoint2D) */ @Override protected ITracePoint2D removePointInternal(final ITracePoint2D point) { ITracePoint2D result = null; if (this.m_points.remove(point)) { result = point; } return result; } }
4,833
0.671496
0.656193
172
27.494186
26.928307
87
false
false
0
0
0
0
0
0
0.255814
false
false
9
b4fee4648a6b01b163f35cf17ca80c57ba57b11b
24,455,543,844,107
554249bbfc8cfe51092a30e09ab59e4af363fcee
/JavaExamples/FirstJavaProject/src/com/Week3_Day1/Example2.java
70d0eba1bd25e33f92d96f78b992ab678c240968
[]
no_license
pksingh2612/Java-HCL-Training
https://github.com/pksingh2612/Java-HCL-Training
b65a1dc17d0d617c4744d557bd65f56dcc0f7bca
652322891fff781aa93d90b8097b77ad749ccba9
refs/heads/main
2023-04-09T05:42:10.877000
2021-04-24T10:57:36
2021-04-24T10:57:36
345,544,667
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.Week3_Day1; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; public class Example2 { public static void main(String[] args) { List<String> l = new ArrayList<>(); l.add("Ram"); l.add("Babu"); l.add("Condy"); l.add("Sam"); l.add("Babu"); Stream<String> st = l.stream(); //created stream Stream<String> st1=st.distinct(); //intermediate operation long count = st1.count(); //terminal operation System.out.println(count); //4 long count1 = l.stream().distinct().count(); System.out.println(count1); boolean b1 = l.stream().distinct().anyMatch((s2)->s2.startsWith("Ra")); System.out.println(b1); List<Student> l1 = new ArrayList<>(); l1.add(new Student("PK",23)); l1.add(new Student("KK",26)); l1.add(new Student("MK",23)); l1.add(new Student("SK",21)); l1.add(new Student("RK",40)); l1.add(new Student("BK",30)); l1.add(new Student("DK",80)); Stream<Student> st2=l1.stream().filter(s->s.getAge()>25); st2.forEach(System.out::println); boolean b2 = l1.stream().allMatch(s->s.getName().contains("K")); System.out.println(b2); boolean b3=l1.stream().anyMatch(s->s.getName().contains("B")); System.out.println(b3); boolean b4=l1.stream().noneMatch(s->s.getName().contains("A")); System.out.println(b4); } }
UTF-8
Java
1,342
java
Example2.java
Java
[ { "context": " {\n\t\tList<String> l = new ArrayList<>();\n\t\tl.add(\"Ram\");\n\t\tl.add(\"Babu\");\n\t\tl.add(\"Condy\");\n\t\tl.add(\"Sa", "end": 226, "score": 0.9998181462287903, "start": 223, "tag": "NAME", "value": "Ram" }, { "context": "> l = new ArrayList<>();\n\t\tl.add(\"Ram\");\n\t\tl.add(\"Babu\");\n\t\tl.add(\"Condy\");\n\t\tl.add(\"Sam\");\n\t\tl.add(\"Bab", "end": 243, "score": 0.9996338486671448, "start": 239, "tag": "NAME", "value": "Babu" }, { "context": "st<>();\n\t\tl.add(\"Ram\");\n\t\tl.add(\"Babu\");\n\t\tl.add(\"Condy\");\n\t\tl.add(\"Sam\");\n\t\tl.add(\"Babu\");\n\t\t\n\t\tStream<S", "end": 261, "score": 0.9994561672210693, "start": 256, "tag": "NAME", "value": "Condy" }, { "context": "am\");\n\t\tl.add(\"Babu\");\n\t\tl.add(\"Condy\");\n\t\tl.add(\"Sam\");\n\t\tl.add(\"Babu\");\n\t\t\n\t\tStream<String> st = l.st", "end": 277, "score": 0.999792218208313, "start": 274, "tag": "NAME", "value": "Sam" }, { "context": "abu\");\n\t\tl.add(\"Condy\");\n\t\tl.add(\"Sam\");\n\t\tl.add(\"Babu\");\n\t\t\n\t\tStream<String> st = l.stream(); //created", "end": 294, "score": 0.9996223449707031, "start": 290, "tag": "NAME", "value": "Babu" } ]
null
[]
package com.Week3_Day1; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; public class Example2 { public static void main(String[] args) { List<String> l = new ArrayList<>(); l.add("Ram"); l.add("Babu"); l.add("Condy"); l.add("Sam"); l.add("Babu"); Stream<String> st = l.stream(); //created stream Stream<String> st1=st.distinct(); //intermediate operation long count = st1.count(); //terminal operation System.out.println(count); //4 long count1 = l.stream().distinct().count(); System.out.println(count1); boolean b1 = l.stream().distinct().anyMatch((s2)->s2.startsWith("Ra")); System.out.println(b1); List<Student> l1 = new ArrayList<>(); l1.add(new Student("PK",23)); l1.add(new Student("KK",26)); l1.add(new Student("MK",23)); l1.add(new Student("SK",21)); l1.add(new Student("RK",40)); l1.add(new Student("BK",30)); l1.add(new Student("DK",80)); Stream<Student> st2=l1.stream().filter(s->s.getAge()>25); st2.forEach(System.out::println); boolean b2 = l1.stream().allMatch(s->s.getName().contains("K")); System.out.println(b2); boolean b3=l1.stream().anyMatch(s->s.getName().contains("B")); System.out.println(b3); boolean b4=l1.stream().noneMatch(s->s.getName().contains("A")); System.out.println(b4); } }
1,342
0.640089
0.604322
53
24.320755
20.40789
73
false
false
0
0
0
0
0
0
2.320755
false
false
9
2c69b165b8ecfd2bdc90327831d2fbb7695a1080
32,530,082,324,386
85a432e02e62e1b96e64040976615e3580de0c3a
/miniProject_yunha/src/member/bean/AddrDTO.java
9498923820c82be36741f2b9a4576c7f572ae788
[]
no_license
dbsgk/JAVA-EE
https://github.com/dbsgk/JAVA-EE
711ee1cc4443e9993507c80c083b458444eca357
bae23b36627d1029df96e0b9073ae9e254bdb889
refs/heads/master
2020-12-19T01:15:00.513000
2020-03-24T10:19:44
2020-03-24T10:19:44
235,574,077
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package member.bean; import lombok.Data; @Data public class AddrDTO { private String zipcode; private String sido; private String sigungu; private String yubmyundong; private String ri; private String roadname; private String buildingname; public AddrDTO(String zipcode, String sido, String sigungu, String yubmyundong, String ri, String roadname, String buildingname) { super(); this.zipcode = zipcode; this.sido = sido; this.sigungu = sigungu; this.yubmyundong = yubmyundong; this.ri = ri; this.roadname = roadname; this.buildingname = buildingname; } }
UTF-8
Java
590
java
AddrDTO.java
Java
[]
null
[]
package member.bean; import lombok.Data; @Data public class AddrDTO { private String zipcode; private String sido; private String sigungu; private String yubmyundong; private String ri; private String roadname; private String buildingname; public AddrDTO(String zipcode, String sido, String sigungu, String yubmyundong, String ri, String roadname, String buildingname) { super(); this.zipcode = zipcode; this.sido = sido; this.sigungu = sigungu; this.yubmyundong = yubmyundong; this.ri = ri; this.roadname = roadname; this.buildingname = buildingname; } }
590
0.742373
0.742373
28
20.071428
20.237745
108
false
false
0
0
0
0
0
0
1.857143
false
false
9
e6dd8574f43cfc6a8c43327c1cbc2c666732f805
33,131,377,755,857
402e1347dbe14fe9c4431f02d62b6d9d85a61974
/src/main/java/com/aoji/mapper/CommissionStudentMapper.java
db9556711ef85a097c8d928224cd6ca8c27e9ac7
[]
no_license
bellmit/copy_visa
https://github.com/bellmit/copy_visa
12f09230c7bb09a2ed2b0699bc23993713ebcb95
5f0b54f656788420d0ba0601b51457d06769183b
refs/heads/master
2022-03-18T21:47:05.146000
2019-03-29T06:52:39
2019-03-29T06:52:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aoji.mapper; import com.aoji.model.CommissionStudent; import com.aoji.vo.CommissionManageSaveVO; import com.aoji.vo.CommissionManageVO; import org.apache.ibatis.annotations.Param; import tk.mybatis.mapper.common.Mapper; import java.util.List; public interface CommissionStudentMapper extends Mapper<CommissionStudent> { List<CommissionManageVO> getCommissionManageList( @Param("commissionManageVO") CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus, @Param("agentType")String agentType ); List<CommissionManageVO> getCommissionManageExcelList(@Param("commissionManageVO") CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus, @Param("pageStart") Integer pageStart, @Param("pageEnd") Integer pageEnd ); List<CommissionManageSaveVO> getCommissionManageVOList(String studentNo); /** * 从文签系统中获取该学生对应的学校申请的附件 */ List<String> getOfferFiles(String studentNo); /** * 从文签系统中获取该学生对应的coe的附件申请 */ List<String> getCoeFiles(String studentNo); List<String> getSendOperator(String studentNo); /** * 已作废,关联关系使用id关联 * @return */ // int updateByStudentNoSelective(CommissionStudent commissionStudent); List<String> getStudentNo(); int getCountCommissionManageExcelList( @Param("commissionManageVO") CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus ); int getCountCommissionOverseasExcelList( @Param("commissionManageVO")CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus, @Param("agentType")String agentType ); List<CommissionManageVO> getCommissionOverseasExcelList(@Param("commissionManageVO")CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus")Integer roleStatus, @Param("pageStart") Integer pageStart, @Param("pageEnd") Integer pageEnd, @Param("agentType")String agentType); }
UTF-8
Java
3,562
java
CommissionStudentMapper.java
Java
[]
null
[]
package com.aoji.mapper; import com.aoji.model.CommissionStudent; import com.aoji.vo.CommissionManageSaveVO; import com.aoji.vo.CommissionManageVO; import org.apache.ibatis.annotations.Param; import tk.mybatis.mapper.common.Mapper; import java.util.List; public interface CommissionStudentMapper extends Mapper<CommissionStudent> { List<CommissionManageVO> getCommissionManageList( @Param("commissionManageVO") CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus, @Param("agentType")String agentType ); List<CommissionManageVO> getCommissionManageExcelList(@Param("commissionManageVO") CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus, @Param("pageStart") Integer pageStart, @Param("pageEnd") Integer pageEnd ); List<CommissionManageSaveVO> getCommissionManageVOList(String studentNo); /** * 从文签系统中获取该学生对应的学校申请的附件 */ List<String> getOfferFiles(String studentNo); /** * 从文签系统中获取该学生对应的coe的附件申请 */ List<String> getCoeFiles(String studentNo); List<String> getSendOperator(String studentNo); /** * 已作废,关联关系使用id关联 * @return */ // int updateByStudentNoSelective(CommissionStudent commissionStudent); List<String> getStudentNo(); int getCountCommissionManageExcelList( @Param("commissionManageVO") CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus ); int getCountCommissionOverseasExcelList( @Param("commissionManageVO")CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus") Integer roleStatus, @Param("agentType")String agentType ); List<CommissionManageVO> getCommissionOverseasExcelList(@Param("commissionManageVO")CommissionManageVO commissionManageVO, @Param("ausNationId") Integer [] ausNationId, @Param("usaNationId") Integer [] usaNationId, @Param("roleStatus")Integer roleStatus, @Param("pageStart") Integer pageStart, @Param("pageEnd") Integer pageEnd, @Param("agentType")String agentType); }
3,562
0.527183
0.527183
76
44.513157
39.921467
126
false
false
0
0
0
0
0
0
0.526316
false
false
9
41f32ade97ddbce0af2a02bf341536601a617122
2,723,009,322,251
d52d734524c9a7cb6b7ba32d0ae30db59a53d855
/src/main/java/com/cds/crud/entity/Doctor.java
7c3570455f9a9259a7f4e960b22177a15196a056
[]
no_license
Pedroascen/EjemplosAjax
https://github.com/Pedroascen/EjemplosAjax
9dbc8ef91e6f3565c8d865eaa468e9bb062abf01
17eb23542bb0de36d951c938d6a04aec8b8f5f9e
refs/heads/master
2020-08-28T20:17:02.365000
2019-10-27T05:47:01
2019-10-27T05:47:01
217,810,049
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cds.crud.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Table; import javax.persistence.Id; @Entity @Table(name="doctores") public class Doctor { //campos de la tabla @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id_doctor; private String nombre; private String direccion; private Integer telefono; private String especialidad; //constructores public Doctor () { } public Doctor(Integer id_doctor, String nombre, String direccion, Integer telefono, String especialidad) { super(); this.id_doctor = id_doctor; this.nombre = nombre; this.direccion = direccion; this.telefono = telefono; this.especialidad = especialidad; } //Getters and Setters public Integer getId_doctor() { return id_doctor; } public void setId_doctor(Integer id_doctor) { this.id_doctor = id_doctor; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public Integer getTelefono() { return telefono; } public void setTelefono(Integer telefono) { this.telefono = telefono; } public String getEspecialidad() { return especialidad; } public void setEspecialidad(String especialidad) { this.especialidad = especialidad; } }
UTF-8
Java
1,484
java
Doctor.java
Java
[]
null
[]
package com.cds.crud.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Table; import javax.persistence.Id; @Entity @Table(name="doctores") public class Doctor { //campos de la tabla @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id_doctor; private String nombre; private String direccion; private Integer telefono; private String especialidad; //constructores public Doctor () { } public Doctor(Integer id_doctor, String nombre, String direccion, Integer telefono, String especialidad) { super(); this.id_doctor = id_doctor; this.nombre = nombre; this.direccion = direccion; this.telefono = telefono; this.especialidad = especialidad; } //Getters and Setters public Integer getId_doctor() { return id_doctor; } public void setId_doctor(Integer id_doctor) { this.id_doctor = id_doctor; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public Integer getTelefono() { return telefono; } public void setTelefono(Integer telefono) { this.telefono = telefono; } public String getEspecialidad() { return especialidad; } public void setEspecialidad(String especialidad) { this.especialidad = especialidad; } }
1,484
0.745957
0.745957
64
22.1875
18.019846
107
false
false
0
0
0
0
0
0
1.546875
false
false
9
3de65573a4ba74b9e4ad4c89022e073a3ef4937f
27,659,589,400,454
2d687c865bd7855db63897219823a1de5ad844ee
/client/Murray-Chat-V0-1/src/main/java/com/murray/utils/GridBagUtil.java
c83ccc815df2fb6cdb1bd815e635a705cadd1020
[]
no_license
MuweiLaw/MurrayChat
https://github.com/MuweiLaw/MurrayChat
dfdcb4fae5b5ccacec079804862745264173b746
b10b77596c009b5c3621422a03a6439134e98b5b
refs/heads/master
2023-03-12T12:47:00.812000
2021-03-04T16:09:41
2021-03-04T16:09:41
344,515,632
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.murray.utils; import java.awt.*; /** * @author Murray Law * @describe 布格袋布局工具包 * @createTime 2020/12/12 */ public class GridBagUtil { private static final GridBagConstraints wrap = new GridBagConstraints(); private static final GridBagConstraints wrapBoth = new GridBagConstraints(); private static final GridBagConstraints msgWrap = new GridBagConstraints(); private static final GridBagLayout gridBagLayout = new GridBagLayout(); private static final Insets insets = new Insets(10, 0, 10, 0); public static GridBagConstraints wrap() { //布格袋布局换行 wrap.gridwidth = GridBagConstraints.REMAINDER; wrap.fill = GridBagConstraints.NONE; return wrap; } public static GridBagConstraints wrapBoth() { //布格袋布局换行 wrapBoth.gridwidth = GridBagConstraints.REMAINDER; wrapBoth.fill = GridBagConstraints.BOTH; return wrapBoth; } public static GridBagConstraints msgWrap() { msgWrap.insets = insets; //布格袋布局换行 msgWrap.gridwidth = GridBagConstraints.REMAINDER; msgWrap.fill = GridBagConstraints.NONE; return msgWrap; } public static GridBagLayout getGridBagLayout() { return gridBagLayout; } }
UTF-8
Java
1,318
java
GridBagUtil.java
Java
[ { "context": ".murray.utils;\n\nimport java.awt.*;\n\n/**\n * @author Murray Law\n * @describe 布格袋布局工具包\n * @createTime 2020/12/12\n ", "end": 72, "score": 0.9997424483299255, "start": 62, "tag": "NAME", "value": "Murray Law" } ]
null
[]
package com.murray.utils; import java.awt.*; /** * @author <NAME> * @describe 布格袋布局工具包 * @createTime 2020/12/12 */ public class GridBagUtil { private static final GridBagConstraints wrap = new GridBagConstraints(); private static final GridBagConstraints wrapBoth = new GridBagConstraints(); private static final GridBagConstraints msgWrap = new GridBagConstraints(); private static final GridBagLayout gridBagLayout = new GridBagLayout(); private static final Insets insets = new Insets(10, 0, 10, 0); public static GridBagConstraints wrap() { //布格袋布局换行 wrap.gridwidth = GridBagConstraints.REMAINDER; wrap.fill = GridBagConstraints.NONE; return wrap; } public static GridBagConstraints wrapBoth() { //布格袋布局换行 wrapBoth.gridwidth = GridBagConstraints.REMAINDER; wrapBoth.fill = GridBagConstraints.BOTH; return wrapBoth; } public static GridBagConstraints msgWrap() { msgWrap.insets = insets; //布格袋布局换行 msgWrap.gridwidth = GridBagConstraints.REMAINDER; msgWrap.fill = GridBagConstraints.NONE; return msgWrap; } public static GridBagLayout getGridBagLayout() { return gridBagLayout; } }
1,314
0.690476
0.679365
40
30.5
24.539764
80
false
false
0
0
0
0
0
0
0.525
false
false
9
bcbfa36ddaa1e5286c7aee0b23c7ae45e5241782
27,659,589,402,868
d7b7df86a6cafd4c4d5f111dc4f625defb56b51a
/src/main/java/com/juanmaperez/architecturehexagonal/infrastructure/domain/ProductData.java
a046549ff6a84b5704b49a5a9a660a7e70e8783b
[]
no_license
jordanacortesm/ArchitectureHexagonalJava
https://github.com/jordanacortesm/ArchitectureHexagonalJava
34d9891769971d29adf4311e71b4ba4a94f8b136
8075318bfa2240ad35daafa393dc477822389fdf
refs/heads/master
2023-06-15T04:24:47.881000
2021-07-02T20:49:13
2021-07-02T20:49:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.juanmaperez.architecturehexagonal.infrastructure.domain; import lombok.*; @Getter @Setter @Builder public class ProductData { private String name; private double price; private String company; }
UTF-8
Java
221
java
ProductData.java
Java
[]
null
[]
package com.juanmaperez.architecturehexagonal.infrastructure.domain; import lombok.*; @Getter @Setter @Builder public class ProductData { private String name; private double price; private String company; }
221
0.769231
0.769231
12
17.416666
18.277756
68
false
false
0
0
0
0
0
0
0.416667
false
false
9
bc6ea07c26a70b7c74126168cfb033cc2f7cb47e
223,338,314,412
56986ca6edab051057c7d11176eb64f0a2d412f0
/app/src/main/java/com/markantoni/gofinandroid/patterns/structural/flyweight/FlyweightModel.java
5507f5cdb5d1e3f65350c07abfacbe8276935d69
[ "MIT" ]
permissive
dobrowins/Hands_on_GoF
https://github.com/dobrowins/Hands_on_GoF
9f7d8d5826b7df2f7d985f0ab9a26d57aa1db8f8
40b97c61e9611a0504b8d51c01533e888b286a64
refs/heads/master
2020-12-25T18:43:35.484000
2017-08-25T17:12:18
2017-08-25T17:12:18
93,986,742
0
0
null
true
2017-06-11T06:42:56
2017-06-11T06:42:56
2017-06-11T06:40:55
2016-11-22T08:47:10
142
0
0
0
null
null
null
package com.markantoni.gofinandroid.patterns.structural.flyweight; import com.markantoni.gofinandroid.R; import com.markantoni.gofinandroid.interfaces.IPatternModel; /** * Created by mark on 11/18/16. */ public class FlyweightModel implements IPatternModel { @Override public String getLinkToDiagram() { return "http://www.dofactory.com/images/diagrams/net/flyweight.gif"; } @Override public String getDescription() { return "Use sharing to support large numbers of fine-grained objects efficiently"; } @Override public String getCodeSample() { return "public static class FlyweightObject {\n" + " private int mValue;\n" + "\n" + " private FlyweightObject(int value) {\n" + " mValue = value;\n" + " }\n" + "\n" + " public int getValue() {\n" + " return mValue;\n" + " }\n" + "}\n" + "\n" + "public static class FlyweightObjectsFactory {\n" + " private Map<Integer, FlyweightObject> mMap = new TreeMap<>();\n" + "\n" + " FlyweightObject create(int value) {\n" + " //checks whether needed element exists already, if yes, returns it\n" + " if (!mMap.containsKey(value)) {\n" + " FlyweightObject object = new FlyweightObject(value);\n" + " mMap.put(value, object);\n" + " return object;\n" + " }\n" + " return mMap.get(value);\n" + " }\n" + "}\n"; } @Override public int getTitleRes() { return R.string.flyweight; } }
UTF-8
Java
1,886
java
FlyweightModel.java
Java
[]
null
[]
package com.markantoni.gofinandroid.patterns.structural.flyweight; import com.markantoni.gofinandroid.R; import com.markantoni.gofinandroid.interfaces.IPatternModel; /** * Created by mark on 11/18/16. */ public class FlyweightModel implements IPatternModel { @Override public String getLinkToDiagram() { return "http://www.dofactory.com/images/diagrams/net/flyweight.gif"; } @Override public String getDescription() { return "Use sharing to support large numbers of fine-grained objects efficiently"; } @Override public String getCodeSample() { return "public static class FlyweightObject {\n" + " private int mValue;\n" + "\n" + " private FlyweightObject(int value) {\n" + " mValue = value;\n" + " }\n" + "\n" + " public int getValue() {\n" + " return mValue;\n" + " }\n" + "}\n" + "\n" + "public static class FlyweightObjectsFactory {\n" + " private Map<Integer, FlyweightObject> mMap = new TreeMap<>();\n" + "\n" + " FlyweightObject create(int value) {\n" + " //checks whether needed element exists already, if yes, returns it\n" + " if (!mMap.containsKey(value)) {\n" + " FlyweightObject object = new FlyweightObject(value);\n" + " mMap.put(value, object);\n" + " return object;\n" + " }\n" + " return mMap.get(value);\n" + " }\n" + "}\n"; } @Override public int getTitleRes() { return R.string.flyweight; } }
1,886
0.487805
0.484624
55
33.290909
26.703539
96
false
false
0
0
0
0
0
0
0.345455
false
false
9
d2b496ffc6190671587e2a6afaa66d72b44d855d
21,569,325,765,011
fe4cc2c5c7686418021d01991b419f44057aca11
/discord-support/src/main/java/com/gmo/discord/support/message/DiscordMessage.java
17b38aace4cd8cab90e22a765fb94147e1767fe9
[]
no_license
enemyghost/hanyu-discord-bot
https://github.com/enemyghost/hanyu-discord-bot
ebe05f16bf9d29d5bfd41f9b9cf9e594d9106490
b02ddcc8cf051eb48270dfd29071aa5cf7b6eaa2
refs/heads/master
2021-06-12T04:39:59.691000
2019-11-16T21:21:44
2019-11-16T21:21:44
142,775,980
0
0
null
false
2020-10-12T22:51:22
2018-07-29T16:16:17
2019-11-16T21:21:48
2020-10-12T22:51:20
68
0
0
1
Java
false
false
package com.gmo.discord.support.message; import java.util.Collections; import java.util.Optional; import sx.blah.discord.api.internal.json.objects.EmbedObject; import sx.blah.discord.handle.obj.IUser; /** * @author tedelen */ public class DiscordMessage { private final String text; private final EmbedObject embedObject; private final byte[] content; private final boolean replacePrevious; private final IUser directRecipient; private DiscordMessage(final Builder builder) { embedObject = builder.embedObject; text = embedObject == null ? builder.text : null; replacePrevious = builder.replacePrevious; directRecipient = builder.directRecipient; content = builder.content; } public static Builder newBuilder() { return new Builder(); } public Optional<String> getText() { return Optional.ofNullable(text); } public Optional<EmbedObject> getEmbedObject() { return Optional.ofNullable(embedObject); } public Optional<IUser> getDirectRecipient() { return Optional.ofNullable(directRecipient); } public Optional<byte[]> getContent() { return Optional.ofNullable(content); } public boolean isReplacePrevious() { return replacePrevious; } public static Builder newBuilder(final DiscordMessage copy) { return DiscordMessage.newBuilder() .withText(copy.text) .withReplacePrevious(copy.replacePrevious) .withEmbedObject(copy.embedObject); } public Iterable<DiscordMessage> singleton() { return Collections.singleton(this); } public static final class Builder { private String text; private EmbedObject embedObject; private boolean replacePrevious; private IUser directRecipient; private byte[] content; private Builder() { replacePrevious = false; } public Builder withText(final String text) { this.text = text; return this; } public Builder appendText(final String text) { this.text = this.text == null ? text : (this.text + text); return this; } public Builder withEmbedObject(final EmbedObject embedObject) { this.embedObject = embedObject; return this; } public Builder withReplacePrevious(final boolean replacePrevious) { this.replacePrevious = replacePrevious; return this; } public Builder withDirectRecipient(final IUser user) { this.directRecipient = user; return this; } public Builder withContent(final byte[] content) { this.content = content; return this; } public DiscordMessage build() { return new DiscordMessage(this); } } }
UTF-8
Java
2,946
java
DiscordMessage.java
Java
[ { "context": " sx.blah.discord.handle.obj.IUser;\n\n/**\n * @author tedelen\n */\npublic class DiscordMessage {\n private fin", "end": 226, "score": 0.9997085928916931, "start": 219, "tag": "USERNAME", "value": "tedelen" } ]
null
[]
package com.gmo.discord.support.message; import java.util.Collections; import java.util.Optional; import sx.blah.discord.api.internal.json.objects.EmbedObject; import sx.blah.discord.handle.obj.IUser; /** * @author tedelen */ public class DiscordMessage { private final String text; private final EmbedObject embedObject; private final byte[] content; private final boolean replacePrevious; private final IUser directRecipient; private DiscordMessage(final Builder builder) { embedObject = builder.embedObject; text = embedObject == null ? builder.text : null; replacePrevious = builder.replacePrevious; directRecipient = builder.directRecipient; content = builder.content; } public static Builder newBuilder() { return new Builder(); } public Optional<String> getText() { return Optional.ofNullable(text); } public Optional<EmbedObject> getEmbedObject() { return Optional.ofNullable(embedObject); } public Optional<IUser> getDirectRecipient() { return Optional.ofNullable(directRecipient); } public Optional<byte[]> getContent() { return Optional.ofNullable(content); } public boolean isReplacePrevious() { return replacePrevious; } public static Builder newBuilder(final DiscordMessage copy) { return DiscordMessage.newBuilder() .withText(copy.text) .withReplacePrevious(copy.replacePrevious) .withEmbedObject(copy.embedObject); } public Iterable<DiscordMessage> singleton() { return Collections.singleton(this); } public static final class Builder { private String text; private EmbedObject embedObject; private boolean replacePrevious; private IUser directRecipient; private byte[] content; private Builder() { replacePrevious = false; } public Builder withText(final String text) { this.text = text; return this; } public Builder appendText(final String text) { this.text = this.text == null ? text : (this.text + text); return this; } public Builder withEmbedObject(final EmbedObject embedObject) { this.embedObject = embedObject; return this; } public Builder withReplacePrevious(final boolean replacePrevious) { this.replacePrevious = replacePrevious; return this; } public Builder withDirectRecipient(final IUser user) { this.directRecipient = user; return this; } public Builder withContent(final byte[] content) { this.content = content; return this; } public DiscordMessage build() { return new DiscordMessage(this); } } }
2,946
0.630686
0.630686
107
26.532711
21.367422
75
false
false
0
0
0
0
0
0
0.392523
false
false
9
7c33fecf670960e8c82e7dfe21eeb1df5cc2b6d0
12,661,563,604,491
168b74d983ab8850f51fa4a62f80066a9bfbd9a9
/Web Application/src/test/java/toolkit/unit/domain/ContiguousReadTests.java
92e9960f718d9702d6412be7a43ffe5ff757ac03
[]
no_license
coderGhast/Metagenome-Assembly-Quality-Analysis-Toolkit
https://github.com/coderGhast/Metagenome-Assembly-Quality-Analysis-Toolkit
b51c8c46285ce3d964fadd0cc2460e254bba632a
93ba216bee6b367b67ee045c5271c5f5f04ac4dc
refs/heads/master
2020-04-11T09:58:25.140000
2016-05-03T15:12:07
2016-05-03T15:12:07
50,368,412
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package toolkit.unit.domain; import org.junit.Before; import org.junit.Test; import toolkit.domain.ContiguousRead; import static junit.framework.TestCase.assertEquals; /** * Created by James Euesden on 18/04/2016. */ public class ContiguousReadTests { private ContiguousRead _sut; @Before public void setup(){ _sut = new ContiguousRead(); } @Test public void WhenTheContextOfTheContigIsSetTheNumberOfNShouldBeCalculated(){ _sut.setContigContext("ATGNNNGNTNGCNAGG"); assertEquals(6, _sut.getNumberOfN()); } @Test public void WhenTheContextOfTheContigIsSetThePercentageOfNShouldBeCalculated(){ _sut.setContigContext("GGGGGGGGGNNNNNNNNN"); assertEquals(50.0, _sut.getPercentageOfN()); } }
UTF-8
Java
774
java
ContiguousReadTests.java
Java
[ { "context": "ramework.TestCase.assertEquals;\n\n/**\n * Created by James Euesden on 18/04/2016.\n */\npublic class ContiguousReadTes", "end": 202, "score": 0.9998475909233093, "start": 189, "tag": "NAME", "value": "James Euesden" } ]
null
[]
package toolkit.unit.domain; import org.junit.Before; import org.junit.Test; import toolkit.domain.ContiguousRead; import static junit.framework.TestCase.assertEquals; /** * Created by <NAME> on 18/04/2016. */ public class ContiguousReadTests { private ContiguousRead _sut; @Before public void setup(){ _sut = new ContiguousRead(); } @Test public void WhenTheContextOfTheContigIsSetTheNumberOfNShouldBeCalculated(){ _sut.setContigContext("ATGNNNGNTNGCNAGG"); assertEquals(6, _sut.getNumberOfN()); } @Test public void WhenTheContextOfTheContigIsSetThePercentageOfNShouldBeCalculated(){ _sut.setContigContext("GGGGGGGGGNNNNNNNNN"); assertEquals(50.0, _sut.getPercentageOfN()); } }
767
0.71447
0.698966
31
23.967741
23.667706
83
false
false
0
0
0
0
64
0.082687
0.419355
false
false
9
15b7502cee65ad91ddf11f506a175711d5459d4a
21,869,973,517,771
d5c2d22e812dbca528967cb47d37379b2a9063e1
/src/test/java/com/labs/dm/sudoku/solver/alg/fish/XYZWingTest.java
8daaeb181631a13671fb73e06bf4d6437e8a854b
[]
no_license
danielmroczka/sudoku-solver
https://github.com/danielmroczka/sudoku-solver
e799cc52182c8b34a0c451b3542eb3bb3299e170
fdac3705a2e9949c542c11270551f9ef2eb587f1
refs/heads/master
2021-01-21T04:36:16.318000
2020-10-07T13:24:25
2020-10-07T13:24:25
13,908,919
0
0
null
false
2020-10-13T08:52:35
2013-10-27T19:39:48
2020-10-07T13:24:28
2020-10-13T08:52:33
457
0
0
1
Java
false
false
package com.labs.dm.sudoku.solver.alg.fish; import com.labs.dm.sudoku.solver.core.IMatrix; import com.labs.dm.sudoku.solver.core.Matrix; import org.junit.Test; import java.util.Arrays; import static org.junit.Assert.assertEquals; /** * Created by Daniel Mroczka on 24-Feb-16. */ public class XYZWingTest { private final XYZWing wing = new XYZWing(); @Test public void simpleTest() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 1, new Integer[]{1, 2, 3}); matrix.addCandidates(0, 4, new Integer[]{2, 3}); matrix.addCandidates(1, 2, new Integer[]{1, 3}); matrix.addCandidates(0, 0, new Integer[]{3}); matrix.addCandidates(0, 2, new Integer[]{3}); fill(matrix, 3); //WHEN int cnt = matrix.getCandidatesCount(); wing.execute(matrix); //THEN assertEquals(0, matrix.getCandidates(0, 0).size()); assertEquals(0, matrix.getCandidates(0, 2).size()); assertEquals(cnt - 5, matrix.getCandidatesCount()); } @Test public void theSameBlock() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 0, new Integer[]{1, 2, 3}); matrix.addCandidates(2, 1, new Integer[]{1, 3}); matrix.addCandidates(1, 2, new Integer[]{2, 3}); fill(matrix, 3); //WHEN int cnt = matrix.getCandidatesCount(); wing.execute(matrix); //THEN assertEquals(cnt - 6, matrix.getCandidatesCount()); assertEquals(0, matrix.getCandidates(1, 1).size()); assertEquals(0, matrix.getCandidates(2, 2).size()); } @Test public void testTheSameRowBlock() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 0, new Integer[]{1, 2, 3}); matrix.addCandidates(0, 4, new Integer[]{2, 3}); fill(matrix, 3); matrix.setCandidates(2, 1, Arrays.asList(1, 3)); //WHEN int candidates = matrix.getCandidatesCount(); wing.execute(matrix); //THEN assertEquals(candidates - 5, matrix.getCandidatesCount()); } @Test public void testTheSameRow() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 0, new Integer[]{1, 2, 3}); matrix.addCandidates(0, 2, new Integer[]{2, 3}); fill(matrix, 3); matrix.setCandidates(0, 4, Arrays.asList(1, 3)); int candidates = matrix.getCandidatesCount(); //WHEN wing.execute(matrix); //THEN assertEquals(candidates - 6, matrix.getCandidatesCount()); } private void fill(IMatrix matrix, int value) { for (int row = 0; row < Matrix.SIZE; row++) { for (int col = 0; col < Matrix.SIZE; col++) { matrix.addCandidates(row, col, new Integer[]{value}); } } } }
UTF-8
Java
2,900
java
XYZWingTest.java
Java
[ { "context": " org.junit.Assert.assertEquals;\n\n/**\n * Created by Daniel Mroczka on 24-Feb-16.\n */\npublic class XYZWingTest {\n\n ", "end": 266, "score": 0.9998079538345337, "start": 252, "tag": "NAME", "value": "Daniel Mroczka" } ]
null
[]
package com.labs.dm.sudoku.solver.alg.fish; import com.labs.dm.sudoku.solver.core.IMatrix; import com.labs.dm.sudoku.solver.core.Matrix; import org.junit.Test; import java.util.Arrays; import static org.junit.Assert.assertEquals; /** * Created by <NAME> on 24-Feb-16. */ public class XYZWingTest { private final XYZWing wing = new XYZWing(); @Test public void simpleTest() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 1, new Integer[]{1, 2, 3}); matrix.addCandidates(0, 4, new Integer[]{2, 3}); matrix.addCandidates(1, 2, new Integer[]{1, 3}); matrix.addCandidates(0, 0, new Integer[]{3}); matrix.addCandidates(0, 2, new Integer[]{3}); fill(matrix, 3); //WHEN int cnt = matrix.getCandidatesCount(); wing.execute(matrix); //THEN assertEquals(0, matrix.getCandidates(0, 0).size()); assertEquals(0, matrix.getCandidates(0, 2).size()); assertEquals(cnt - 5, matrix.getCandidatesCount()); } @Test public void theSameBlock() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 0, new Integer[]{1, 2, 3}); matrix.addCandidates(2, 1, new Integer[]{1, 3}); matrix.addCandidates(1, 2, new Integer[]{2, 3}); fill(matrix, 3); //WHEN int cnt = matrix.getCandidatesCount(); wing.execute(matrix); //THEN assertEquals(cnt - 6, matrix.getCandidatesCount()); assertEquals(0, matrix.getCandidates(1, 1).size()); assertEquals(0, matrix.getCandidates(2, 2).size()); } @Test public void testTheSameRowBlock() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 0, new Integer[]{1, 2, 3}); matrix.addCandidates(0, 4, new Integer[]{2, 3}); fill(matrix, 3); matrix.setCandidates(2, 1, Arrays.asList(1, 3)); //WHEN int candidates = matrix.getCandidatesCount(); wing.execute(matrix); //THEN assertEquals(candidates - 5, matrix.getCandidatesCount()); } @Test public void testTheSameRow() { //GIVEN IMatrix matrix = new Matrix(); matrix.addCandidates(0, 0, new Integer[]{1, 2, 3}); matrix.addCandidates(0, 2, new Integer[]{2, 3}); fill(matrix, 3); matrix.setCandidates(0, 4, Arrays.asList(1, 3)); int candidates = matrix.getCandidatesCount(); //WHEN wing.execute(matrix); //THEN assertEquals(candidates - 6, matrix.getCandidatesCount()); } private void fill(IMatrix matrix, int value) { for (int row = 0; row < Matrix.SIZE; row++) { for (int col = 0; col < Matrix.SIZE; col++) { matrix.addCandidates(row, col, new Integer[]{value}); } } } }
2,892
0.583103
0.554138
98
28.602041
22.608351
69
false
false
0
0
0
0
0
0
1.153061
false
false
9
898e5b2ca4854616115424ade28fcbce11828f29
26,800,595,952,083
351e2b46af2e601efb3691160f41f9d5fd6f4513
/AccountManagement-DesignPatternsProject/src/com/ssa/project/ConcreteFactory2.java
e12c4c4f3874e0a60281c355c6dd9468a4165f0c
[]
no_license
Ypalav/Design-Patterns
https://github.com/Ypalav/Design-Patterns
0a0c0439bc8c684115884e381eacf62b4db7547d
057dfc1f00a7f3ee3a50b23f6abb16d54136a267
refs/heads/master
2020-05-30T08:02:35.503000
2017-04-12T19:29:26
2017-04-12T19:29:26
49,754,845
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ssa.project; public class ConcreteFactory2 extends AbstractFactory { public DataStoreForAccount2 getData() { DataStoreForAccount2 dataStoreForAccount2 = new DataStoreForAccount2(); return dataStoreForAccount2; } public ActionStoreData getStoreData() { ActionStoreData2 actionStoreData2 = new ActionStoreData2(); return actionStoreData2; } public ActionDisplayBalance getDisplayBalance() { ActionDisplayBalance2 actionDisplayBalance2 = new ActionDisplayBalance2(); return actionDisplayBalance2; } public ActionDisplayMenu getDisplayMenu() { ActionDisplayMenu2 actionDisplayMenu2 = new ActionDisplayMenu2(); return actionDisplayMenu2; } public ActionIncorrectIDMessage getIncorrectIDMessage() { // TODO Auto-generated method stub ActionIncorrectIDMessage2 actionIncorrectIDMessage2 = new ActionIncorrectIDMessage2(); return actionIncorrectIDMessage2; } public ActionIncorrectLockMsg getIncorrectLockMsg() { // TODO Auto-generated method stub ActionIncorrectLockMsg2 actionIncorrectLockMsg2 = new ActionIncorrectLockMsg2(); return actionIncorrectLockMsg2; } public ActionIncorrectPinMsg getIncorrectPinMsg() { // TODO Auto-generated method stub ActionIncorrectPinMsg2 actionIncorrectPinMsg2 = new ActionIncorrectPinMsg2(); return actionIncorrectPinMsg2; } public ActionIncorrectUnlockMsg getIncorrectUnlockMsg() { // TODO Auto-generated method stub ActionIncorrectUnlockMsg2 actionIncorrectUnlockMsg2 = new ActionIncorrectUnlockMsg2(); return actionIncorrectUnlockMsg2; } public ActionMakeDeposit getMakeDeposit() { ActionMakeDeposit2 actionMakeDeposit2 = new ActionMakeDeposit2(); return actionMakeDeposit2; } public ActionMakeWithdraw getMakeWithdraw() { // TODO Auto-generated method stub ActionMakeWithdraw2 actionMakeWithdraw2 = new ActionMakeWithdraw2(); return actionMakeWithdraw2; } public ActionNoFundsMsg getNoFundsMsg() { ActionNoFundsMsg2 actionNoFundsMsg2 = new ActionNoFundsMsg2(); return actionNoFundsMsg2; } public Actionpenalty getpenalty() { // TODO Auto-generated method stub return null; } public ActionPromptForPin getPromptForPin() { // TODO Auto-generated method stub ActionPromptForPin1 actionPromptForPin2 = new ActionPromptForPin1(); return actionPromptForPin2; } public ActionTooManyAttemptsMsg getTooManyAttemptsMsg() { // TODO Auto-generated method stub ActionTooManyAttemptsMsg2 actionTooManyAttemptsMsg2 = new ActionTooManyAttemptsMsg2(); return actionTooManyAttemptsMsg2; } }
UTF-8
Java
2,516
java
ConcreteFactory2.java
Java
[]
null
[]
package com.ssa.project; public class ConcreteFactory2 extends AbstractFactory { public DataStoreForAccount2 getData() { DataStoreForAccount2 dataStoreForAccount2 = new DataStoreForAccount2(); return dataStoreForAccount2; } public ActionStoreData getStoreData() { ActionStoreData2 actionStoreData2 = new ActionStoreData2(); return actionStoreData2; } public ActionDisplayBalance getDisplayBalance() { ActionDisplayBalance2 actionDisplayBalance2 = new ActionDisplayBalance2(); return actionDisplayBalance2; } public ActionDisplayMenu getDisplayMenu() { ActionDisplayMenu2 actionDisplayMenu2 = new ActionDisplayMenu2(); return actionDisplayMenu2; } public ActionIncorrectIDMessage getIncorrectIDMessage() { // TODO Auto-generated method stub ActionIncorrectIDMessage2 actionIncorrectIDMessage2 = new ActionIncorrectIDMessage2(); return actionIncorrectIDMessage2; } public ActionIncorrectLockMsg getIncorrectLockMsg() { // TODO Auto-generated method stub ActionIncorrectLockMsg2 actionIncorrectLockMsg2 = new ActionIncorrectLockMsg2(); return actionIncorrectLockMsg2; } public ActionIncorrectPinMsg getIncorrectPinMsg() { // TODO Auto-generated method stub ActionIncorrectPinMsg2 actionIncorrectPinMsg2 = new ActionIncorrectPinMsg2(); return actionIncorrectPinMsg2; } public ActionIncorrectUnlockMsg getIncorrectUnlockMsg() { // TODO Auto-generated method stub ActionIncorrectUnlockMsg2 actionIncorrectUnlockMsg2 = new ActionIncorrectUnlockMsg2(); return actionIncorrectUnlockMsg2; } public ActionMakeDeposit getMakeDeposit() { ActionMakeDeposit2 actionMakeDeposit2 = new ActionMakeDeposit2(); return actionMakeDeposit2; } public ActionMakeWithdraw getMakeWithdraw() { // TODO Auto-generated method stub ActionMakeWithdraw2 actionMakeWithdraw2 = new ActionMakeWithdraw2(); return actionMakeWithdraw2; } public ActionNoFundsMsg getNoFundsMsg() { ActionNoFundsMsg2 actionNoFundsMsg2 = new ActionNoFundsMsg2(); return actionNoFundsMsg2; } public Actionpenalty getpenalty() { // TODO Auto-generated method stub return null; } public ActionPromptForPin getPromptForPin() { // TODO Auto-generated method stub ActionPromptForPin1 actionPromptForPin2 = new ActionPromptForPin1(); return actionPromptForPin2; } public ActionTooManyAttemptsMsg getTooManyAttemptsMsg() { // TODO Auto-generated method stub ActionTooManyAttemptsMsg2 actionTooManyAttemptsMsg2 = new ActionTooManyAttemptsMsg2(); return actionTooManyAttemptsMsg2; } }
2,516
0.816375
0.794913
67
36.552238
25.475351
88
false
false
0
0
0
0
0
0
1.880597
false
false
9
a806e44aa215f2b95ce46ba167d877e76680da28
22,969,485,133,286
0f204b32165928a4c736a542dacb58e8507dc04b
/DOD/Map.java
4a16e533279eb5c017eb9a876a17bfdf1ad6bd62
[]
no_license
lc2232/ChatServer
https://github.com/lc2232/ChatServer
61c79f98c34f1e6a6f71929088462dc122640e67
001c68d760eccaea00e8a8d9dcc406da31d6a5d6
refs/heads/main
2023-03-18T18:16:58.377000
2021-03-17T22:24:32
2021-03-17T22:24:32
348,862,767
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package DOD; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; /** * * Reads and contains in memory the map of the game along side its properties * such as gold required to win, name and the amount of rows, columns of the map. * */ public class Map { /* Representation of the map */ private char[][] map; /* Map name */ private String mapName; /* Gold required for the human player to win */ private int goldRequired; /* Number of rows in the map */ private int row; /* Number of columns in the map */ private int column; private Socket server; public Map(Socket server) { mapName = "Very small Labyrinth of Doom"; goldRequired = 2; row = 9; column=20; map = new char[][]{ {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','G','.','.','.','.','.','.','.','.','.','E','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','E','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','G','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'} }; this.server = server; } /** * reads through the file and finds how many lines there are in total. * * @param fileName : the file-path of the file that is being accessed * @return rows : the number of lines present in the file * @throws Exception : NullPointerException being thrown in case the file-path is invalid */ protected int countRow(String fileName)throws Exception{ BufferedReader reader = new BufferedReader(new FileReader(fileName)); int rows = 0; while (reader.readLine() != null) rows++; reader.close(); //closing input stream return rows; } /** * Reads the first two lines, to skip over them then finds the length of the first * row of # in the map. * * @param fileName : the file-path of the file that is being accessed * @return col : the number of columns present in the map section of the file (length of the map) * @throws Exception : NullPointerException being thrown in case the file-path is invalid */ protected int countColumn(String fileName)throws Exception{ BufferedReader reader = new BufferedReader(new FileReader(fileName)); reader.readLine(); reader.readLine(); String line = reader.readLine(); int col = line.length(); //find length of first line of '#' on the map. reader.close(); return(col); } /** * Prints the maps name, gold required to win and the size of the map. */ public void printMapStats() { sendToServer("Dungeon Name: "+ mapName); sendToServer("Gold Required: "+ goldRequired); sendToServer("Map Size: "+ row+"x"+column); } /** * spawns the player in random location on the map, as long as nothing * is already present at that point on the map. * * @param item : a character that should be spawned on the map. */ protected void Spawn(char item){ boolean validPosition = false; while(validPosition == false){ //keeps generating random numbers until a valid position is found int randomRow = (int)(Math.random()*(((row-1)-1)+1))+1; //random number from 1 to max row number int randomColumn = (int)(Math.random()*(((column-1)-1)+1))+1;//random number from 1 to max column number char tile = map[randomRow][randomColumn]; if(tile == '.' || tile == 'E'||tile=='P'||tile=='B'){ map[randomRow][randomColumn] = item; validPosition = true; } } } /** * finds first location of the given char on the map when read from left to right, * one row at a time. This is used for characters that only occur once, such as * 'P' and 'B'. * * @param letter : the character that we are looking for the location of * @return location : returns an array of integers of length 2, the first integer is the * first 2D array value and the second in the second 2D array value. */ protected int[] find(char letter){ int [] location = {0,0}; //iterates through the map, until it reaches the searched for letter. for(int y = 0; y<row;y++){ for(int x =0; x<column;x++){ if(map[y][x] == letter){ location[0]= y; location[1]= x; return location; } } } return location; } /** * @return : Gold required to exit the current map. */ protected int getGoldRequired() { return goldRequired; } /** * @return map : The map as stored in memory. */ protected char[][] getMap() { return map; } /** * sets the instance of Map called with this to a new/updated form of the map. * @param newMap : an updated 2D character representation of the map */ public void setMap(char[][] newMap) { this.map = newMap; } /** * @return row : the number of lines in the text file. */ protected int getRow(){ return row; } /** * @return column : the length of one line of the map. */ protected int getColumn(){ return column; } protected synchronized void sendToServer(String message) { try { PrintWriter serverOut = new PrintWriter(server.getOutputStream(), true); serverOut.println(message); } catch (IOException e) { System.out.println("Issues "); e.printStackTrace(); } } }
UTF-8
Java
5,953
java
Map.java
Java
[]
null
[]
package DOD; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; /** * * Reads and contains in memory the map of the game along side its properties * such as gold required to win, name and the amount of rows, columns of the map. * */ public class Map { /* Representation of the map */ private char[][] map; /* Map name */ private String mapName; /* Gold required for the human player to win */ private int goldRequired; /* Number of rows in the map */ private int row; /* Number of columns in the map */ private int column; private Socket server; public Map(Socket server) { mapName = "Very small Labyrinth of Doom"; goldRequired = 2; row = 9; column=20; map = new char[][]{ {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','G','.','.','.','.','.','.','.','.','.','E','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','E','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','G','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','#'}, {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#'} }; this.server = server; } /** * reads through the file and finds how many lines there are in total. * * @param fileName : the file-path of the file that is being accessed * @return rows : the number of lines present in the file * @throws Exception : NullPointerException being thrown in case the file-path is invalid */ protected int countRow(String fileName)throws Exception{ BufferedReader reader = new BufferedReader(new FileReader(fileName)); int rows = 0; while (reader.readLine() != null) rows++; reader.close(); //closing input stream return rows; } /** * Reads the first two lines, to skip over them then finds the length of the first * row of # in the map. * * @param fileName : the file-path of the file that is being accessed * @return col : the number of columns present in the map section of the file (length of the map) * @throws Exception : NullPointerException being thrown in case the file-path is invalid */ protected int countColumn(String fileName)throws Exception{ BufferedReader reader = new BufferedReader(new FileReader(fileName)); reader.readLine(); reader.readLine(); String line = reader.readLine(); int col = line.length(); //find length of first line of '#' on the map. reader.close(); return(col); } /** * Prints the maps name, gold required to win and the size of the map. */ public void printMapStats() { sendToServer("Dungeon Name: "+ mapName); sendToServer("Gold Required: "+ goldRequired); sendToServer("Map Size: "+ row+"x"+column); } /** * spawns the player in random location on the map, as long as nothing * is already present at that point on the map. * * @param item : a character that should be spawned on the map. */ protected void Spawn(char item){ boolean validPosition = false; while(validPosition == false){ //keeps generating random numbers until a valid position is found int randomRow = (int)(Math.random()*(((row-1)-1)+1))+1; //random number from 1 to max row number int randomColumn = (int)(Math.random()*(((column-1)-1)+1))+1;//random number from 1 to max column number char tile = map[randomRow][randomColumn]; if(tile == '.' || tile == 'E'||tile=='P'||tile=='B'){ map[randomRow][randomColumn] = item; validPosition = true; } } } /** * finds first location of the given char on the map when read from left to right, * one row at a time. This is used for characters that only occur once, such as * 'P' and 'B'. * * @param letter : the character that we are looking for the location of * @return location : returns an array of integers of length 2, the first integer is the * first 2D array value and the second in the second 2D array value. */ protected int[] find(char letter){ int [] location = {0,0}; //iterates through the map, until it reaches the searched for letter. for(int y = 0; y<row;y++){ for(int x =0; x<column;x++){ if(map[y][x] == letter){ location[0]= y; location[1]= x; return location; } } } return location; } /** * @return : Gold required to exit the current map. */ protected int getGoldRequired() { return goldRequired; } /** * @return map : The map as stored in memory. */ protected char[][] getMap() { return map; } /** * sets the instance of Map called with this to a new/updated form of the map. * @param newMap : an updated 2D character representation of the map */ public void setMap(char[][] newMap) { this.map = newMap; } /** * @return row : the number of lines in the text file. */ protected int getRow(){ return row; } /** * @return column : the length of one line of the map. */ protected int getColumn(){ return column; } protected synchronized void sendToServer(String message) { try { PrintWriter serverOut = new PrintWriter(server.getOutputStream(), true); serverOut.println(message); } catch (IOException e) { System.out.println("Issues "); e.printStackTrace(); } } }
5,953
0.545271
0.541072
181
31.889503
30.137053
113
false
false
0
0
0
0
0
0
2.132597
false
false
9
890831a4b0b41101a1089cebc49377adbc318f3b
16,243,566,316,667
63fd71941e03d1e25c27e8af55a0a8b1b6ecbee5
/brave-core/src/main/java/com/github/kristofa/brave/internal/InternalSpan.java
ccf8063a324d6599714790e6e95ed4b7177a3bed
[ "Apache-2.0" ]
permissive
Hawkcraft-HeatoN/brave
https://github.com/Hawkcraft-HeatoN/brave
8e6d56629cadbaaae5b8585b6c7410c820a4753b
2fe67e9941e1843b94dfa6ddc48ff77f2265835f
refs/heads/master
2017-12-09T19:51:13.750000
2017-01-17T08:44:40
2017-01-17T08:44:40
79,216,455
2
0
null
true
2017-01-17T10:30:57
2017-01-17T10:30:57
2017-01-17T10:14:32
2017-01-17T08:44:43
2,659
0
0
0
null
null
null
package com.github.kristofa.brave.internal; import com.github.kristofa.brave.SpanId; import com.twitter.zipkin.gen.Span; /** * Allows internal classes outside the package {@code com.twitter.zipkin.gen} to use non-public * methods. This allows us access internal methods while also making obvious the hooks are not for * public use. The only implementation of this interface is in {@link com.twitter.zipkin.gen.Span}. * * <p>Originally designed by OkHttp team, derived from {@code okhttp3.internal.Internal} */ public abstract class InternalSpan { public static void initializeInstanceForTests() { // Needed in tests to ensure that the instance is actually pointing to something. new Span(); } public abstract Span toSpan(SpanId context); /** * In normal course, this returns the context of a span created by one of the tracers. This can * return null when an invalid span was set externally via a custom thread binder or span state. */ public abstract @Nullable SpanId context(Span span); public static InternalSpan instance; }
UTF-8
Java
1,069
java
InternalSpan.java
Java
[ { "context": "package com.github.kristofa.brave.internal;\n\nimport com.github.kristofa.brave", "end": 27, "score": 0.8065540790557861, "start": 19, "tag": "USERNAME", "value": "kristofa" }, { "context": "thub.kristofa.brave.internal;\n\nimport com.github.kristofa.brave.SpanId;\nimport com.twitter.zipkin.gen.Span;", "end": 71, "score": 0.6839565634727478, "start": 64, "tag": "USERNAME", "value": "ristofa" } ]
null
[]
package com.github.kristofa.brave.internal; import com.github.kristofa.brave.SpanId; import com.twitter.zipkin.gen.Span; /** * Allows internal classes outside the package {@code com.twitter.zipkin.gen} to use non-public * methods. This allows us access internal methods while also making obvious the hooks are not for * public use. The only implementation of this interface is in {@link com.twitter.zipkin.gen.Span}. * * <p>Originally designed by OkHttp team, derived from {@code okhttp3.internal.Internal} */ public abstract class InternalSpan { public static void initializeInstanceForTests() { // Needed in tests to ensure that the instance is actually pointing to something. new Span(); } public abstract Span toSpan(SpanId context); /** * In normal course, this returns the context of a span created by one of the tracers. This can * return null when an invalid span was set externally via a custom thread binder or span state. */ public abstract @Nullable SpanId context(Span span); public static InternalSpan instance; }
1,069
0.75304
0.752105
29
35.862068
37.356369
99
false
false
0
0
0
0
0
0
0.310345
false
false
9
60c3df126ba1dae991b3c5bf037d16d5c53b00e7
17,832,704,280,805
f21e2990547a37e087bf866c2659f8ed4f70ca84
/apphub-service/apphub-service-notebook/src/main/java/com/github/saphyra/apphub/service/notebook/dao/list_item/ListItemEntity.java
b6976d1f4b8db72160297af92bd92014acebfde8
[]
no_license
Saphyra/apphub
https://github.com/Saphyra/apphub
207b8e049ca3d8f88c15213656cf596663e2850b
13d01c18ff4568edc693da102b7822781de83fa3
refs/heads/master
2023-09-04T05:31:41.969000
2023-09-02T19:29:17
2023-09-02T19:29:17
250,788,236
0
2
null
false
2023-09-09T20:23:43
2020-03-28T12:22:39
2022-01-09T14:53:32
2023-09-09T20:23:43
16,536
0
2
2
Java
false
false
package com.github.saphyra.apphub.service.notebook.dao.list_item; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; import jakarta.persistence.Id; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Table(schema = "notebook", name = "list_item") @Data @AllArgsConstructor @Builder @NoArgsConstructor class ListItemEntity { @Id private String listItemId; private String userId; private String parent; @Enumerated(EnumType.STRING) private ListItemType type; private String title; private String pinned; private String archived; }
UTF-8
Java
733
java
ListItemEntity.java
Java
[ { "context": "package com.github.saphyra.apphub.service.notebook.dao.list_item;\n\nimport ja", "end": 26, "score": 0.9923086166381836, "start": 19, "tag": "USERNAME", "value": "saphyra" } ]
null
[]
package com.github.saphyra.apphub.service.notebook.dao.list_item; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; import jakarta.persistence.Id; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Table(schema = "notebook", name = "list_item") @Data @AllArgsConstructor @Builder @NoArgsConstructor class ListItemEntity { @Id private String listItemId; private String userId; private String parent; @Enumerated(EnumType.STRING) private ListItemType type; private String title; private String pinned; private String archived; }
733
0.777626
0.777626
34
20.558823
15.834049
65
false
false
0
0
0
0
0
0
0.529412
false
false
9
26027a50856e7dc623c147eb4f117cb0488c12b5
12,386,685,685,061
c2c3d8f4214307b758a5de01f634bbe0a7927671
/Recursion/NestedRecursion.java
00cf4cc43083f4daa0460fbd0fc4a6a9dd8195a8
[]
no_license
rahuldas-hits/DataStructure
https://github.com/rahuldas-hits/DataStructure
236cb4de2d0cf69802d27f67ce9510ace72652fb
f0f3189a535336844e7133cff3327462bbf8efad
refs/heads/master
2023-06-02T02:46:37.080000
2021-06-15T17:51:02
2021-06-15T17:51:02
364,246,582
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Recursion; public class NestedRecursion { public static int Rec(int n){ if(n>100) return n-10; else return Rec(Rec(n+11)); } public static void main(String[] args) { int result = Rec(99); System.out.println(result); } }
UTF-8
Java
313
java
NestedRecursion.java
Java
[]
null
[]
package Recursion; public class NestedRecursion { public static int Rec(int n){ if(n>100) return n-10; else return Rec(Rec(n+11)); } public static void main(String[] args) { int result = Rec(99); System.out.println(result); } }
313
0.523962
0.495208
16
18.5625
14.190528
44
false
false
0
0
0
0
0
0
0.3125
false
false
9
31341e4da56b150765a0187dd3caf762e23f0c79
29,377,576,330,253
edc809d969c0045b13ff2ea545e80f91b174956d
/src/com/company/ArmorFactory.java
9d851a9d44d07f722e6bbd3444766bd121dbaeae
[]
no_license
revenant20/TheGame
https://github.com/revenant20/TheGame
14cdaa5e8fa1fc49476e6292180d891ac0385c9d
112d8e6f3bf6aa377fd41e2538c770ea596a91ff
refs/heads/master
2020-05-17T05:06:35.037000
2015-07-14T17:22:01
2015-07-14T17:22:01
34,456,748
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; /** * Created by Администратор on 20.05.2015. */ public class ArmorFactory { public static Armor get (String name) { switch (name) { case Armor.HELMET: Armor helmet = new Armor(9,1); helmet.description = Armor.HELMET; helmet.gold = 5; return helmet; case Armor.MAIL: Armor mail= new Armor(20,1); mail.description = Armor.MAIL; mail.gold = 5; case Armor.BOOTS: Armor boots = new Armor(3,1); boots.description = Armor.BOOTS; boots.gold = 5; return boots; case Armor.GLOVES: Armor gloves = new Armor(5,1); gloves.description = Armor.GLOVES; gloves.gold = 5; return gloves; case Armor.LEGGINGS: Armor leggings = new Armor(4,1); leggings.description = Armor.LEGGINGS; leggings.gold = 5; } throw new IllegalArgumentException("unknown armor"); } }
WINDOWS-1251
Java
1,158
java
ArmorFactory.java
Java
[ { "context": "package com.company;\n\n/**\n * Created by Администратор on 20.05.2015.\n */\npublic class ArmorFactory {\n ", "end": 53, "score": 0.9992683529853821, "start": 40, "tag": "NAME", "value": "Администратор" } ]
null
[]
package com.company; /** * Created by Администратор on 20.05.2015. */ public class ArmorFactory { public static Armor get (String name) { switch (name) { case Armor.HELMET: Armor helmet = new Armor(9,1); helmet.description = Armor.HELMET; helmet.gold = 5; return helmet; case Armor.MAIL: Armor mail= new Armor(20,1); mail.description = Armor.MAIL; mail.gold = 5; case Armor.BOOTS: Armor boots = new Armor(3,1); boots.description = Armor.BOOTS; boots.gold = 5; return boots; case Armor.GLOVES: Armor gloves = new Armor(5,1); gloves.description = Armor.GLOVES; gloves.gold = 5; return gloves; case Armor.LEGGINGS: Armor leggings = new Armor(4,1); leggings.description = Armor.LEGGINGS; leggings.gold = 5; } throw new IllegalArgumentException("unknown armor"); } }
1,158
0.49083
0.469869
35
31.714285
15.839501
60
false
false
0
0
0
0
0
0
0.714286
false
false
9
b602e161fc4ec2f32fa425da6ce2e363cd8eaac4
2,723,009,329,095
a2364f4f952af091319535b17d0ad6212aa4e989
/src/main/groovy/com/blackducksoftware/integration/hub/service/HubServicesFactory.java
5603230deeea14d59588b608b190d009ab91ed93
[ "Apache-2.0" ]
permissive
valancej/hub-common
https://github.com/valancej/hub-common
7728389afac31d41f928be048751be80146c9bba
229779781f61380f995412ff01f1d208b17f3511
refs/heads/master
2021-01-02T08:45:17.077000
2017-07-27T23:22:32
2017-07-27T23:22:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Hub Common * * Copyright (C) 2017 Black Duck Software, Inc. * http://www.blackducksoftware.com/ * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.blackducksoftware.integration.hub.service; import java.io.File; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.builder.RecursiveToStringStyle; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.blackducksoftware.integration.exception.IntegrationException; import com.blackducksoftware.integration.hub.HubSupportHelper; import com.blackducksoftware.integration.hub.api.aggregate.bom.AggregateBomRequestService; import com.blackducksoftware.integration.hub.api.bom.BomComponentIssueRequestService; import com.blackducksoftware.integration.hub.api.bom.BomImportRequestService; import com.blackducksoftware.integration.hub.api.codelocation.CodeLocationRequestService; import com.blackducksoftware.integration.hub.api.component.ComponentRequestService; import com.blackducksoftware.integration.hub.api.extension.ExtensionConfigRequestService; import com.blackducksoftware.integration.hub.api.extension.ExtensionUserOptionRequestService; import com.blackducksoftware.integration.hub.api.item.MetaService; import com.blackducksoftware.integration.hub.api.nonpublic.HubRegistrationRequestService; import com.blackducksoftware.integration.hub.api.nonpublic.HubVersionRequestService; import com.blackducksoftware.integration.hub.api.notification.NotificationRequestService; import com.blackducksoftware.integration.hub.api.policy.PolicyRequestService; import com.blackducksoftware.integration.hub.api.project.ProjectRequestService; import com.blackducksoftware.integration.hub.api.project.version.ProjectVersionRequestService; import com.blackducksoftware.integration.hub.api.report.ReportRequestService; import com.blackducksoftware.integration.hub.api.scan.DryRunUploadRequestService; import com.blackducksoftware.integration.hub.api.scan.ScanSummaryRequestService; import com.blackducksoftware.integration.hub.api.user.UserRequestService; import com.blackducksoftware.integration.hub.api.vulnerability.VulnerabilityRequestService; import com.blackducksoftware.integration.hub.api.vulnerablebomcomponent.VulnerableBomComponentRequestService; import com.blackducksoftware.integration.hub.cli.CLIDownloadService; import com.blackducksoftware.integration.hub.cli.SimpleScanService; import com.blackducksoftware.integration.hub.dataservice.cli.CLIDataService; import com.blackducksoftware.integration.hub.dataservice.component.ComponentDataService; import com.blackducksoftware.integration.hub.dataservice.extension.ExtensionConfigDataService; import com.blackducksoftware.integration.hub.dataservice.license.LicenseDataService; import com.blackducksoftware.integration.hub.dataservice.notification.NotificationDataService; import com.blackducksoftware.integration.hub.dataservice.notification.model.PolicyNotificationFilter; import com.blackducksoftware.integration.hub.dataservice.phonehome.PhoneHomeDataService; import com.blackducksoftware.integration.hub.dataservice.policystatus.PolicyStatusDataService; import com.blackducksoftware.integration.hub.dataservice.project.ProjectDataService; import com.blackducksoftware.integration.hub.dataservice.report.RiskReportDataService; import com.blackducksoftware.integration.hub.dataservice.scan.ScanStatusDataService; import com.blackducksoftware.integration.hub.dataservice.vulnerability.VulnerabilityDataService; import com.blackducksoftware.integration.hub.global.HubServerConfig; import com.blackducksoftware.integration.hub.rest.RestConnection; import com.blackducksoftware.integration.hub.scan.HubScanConfig; import com.blackducksoftware.integration.log.IntLogger; import com.blackducksoftware.integration.util.CIEnvironmentVariables; public class HubServicesFactory { private final CIEnvironmentVariables ciEnvironmentVariables; private final RestConnection restConnection; public HubServicesFactory(final RestConnection restConnection) { this.ciEnvironmentVariables = new CIEnvironmentVariables(); ciEnvironmentVariables.putAll(System.getenv()); this.restConnection = restConnection; } public void addEnvironmentVariable(final String key, final String value) { ciEnvironmentVariables.put(key, value); } public void addEnvironmentVariables(final Map<String, String> environmentVariables) { ciEnvironmentVariables.putAll(environmentVariables); } public CLIDataService createCLIDataService(final IntLogger logger) { return createCLIDataService(logger, 120000l); } public CLIDataService createCLIDataService(final IntLogger logger, final long timeoutInMilliseconds) { return new CLIDataService(logger, restConnection.gson, ciEnvironmentVariables, createHubVersionRequestService(), createCliDownloadService(logger), createPhoneHomeDataService(logger), createProjectRequestService(logger), createProjectVersionRequestService(logger), createCodeLocationRequestService(logger), createScanSummaryRequestService(), createScanStatusDataService(logger, timeoutInMilliseconds), createMetaService(logger)); } public PhoneHomeDataService createPhoneHomeDataService(final IntLogger logger) { return new PhoneHomeDataService(logger, restConnection, createHubRegistrationRequestService(), createHubVersionRequestService()); } public RiskReportDataService createRiskReportDataService(final IntLogger logger, final long timeoutInMilliseconds) throws IntegrationException { return new RiskReportDataService(logger, restConnection, createProjectRequestService(logger), createProjectVersionRequestService(logger), createReportRequestService(logger, timeoutInMilliseconds), createAggregateBomRequestService(logger), createMetaService(logger), createCheckedHubSupport(logger)); } public PolicyStatusDataService createPolicyStatusDataService(final IntLogger logger) { return new PolicyStatusDataService(restConnection, createProjectRequestService(logger), createProjectVersionRequestService(logger), createMetaService(logger)); } public ScanStatusDataService createScanStatusDataService(final IntLogger logger, final long timeoutInMilliseconds) { return new ScanStatusDataService(logger, createProjectRequestService(logger), createProjectVersionRequestService(logger), createCodeLocationRequestService(logger), createScanSummaryRequestService(), createMetaService(logger), timeoutInMilliseconds); } public NotificationDataService createNotificationDataService(final IntLogger logger) { return new NotificationDataService(logger, createHubResponseService(), createNotificationRequestService(logger), createProjectVersionRequestService(logger), createPolicyRequestService(), createMetaService(logger)); } public NotificationDataService createNotificationDataService(final IntLogger logger, final PolicyNotificationFilter policyNotificationFilter) { return new NotificationDataService(logger, createHubResponseService(), createNotificationRequestService(logger), createProjectVersionRequestService(logger), createPolicyRequestService(), policyNotificationFilter, createMetaService(logger)); } public ExtensionConfigDataService createExtensionConfigDataService(final IntLogger logger) { return new ExtensionConfigDataService(logger, restConnection, createUserRequestService(), createExtensionConfigRequestService(), createExtensionUserOptionRequestService(), createMetaService(logger)); } public VulnerabilityDataService createVulnerabilityDataService(final IntLogger logger) { return new VulnerabilityDataService(restConnection, createComponentRequestService(), createVulnerabilityRequestService(), createMetaService(logger)); } public LicenseDataService createLicenseDataService() { return new LicenseDataService(createComponentRequestService()); } public BomImportRequestService createBomImportRequestService() { return new BomImportRequestService(restConnection); } public DryRunUploadRequestService createDryRunUploadRequestService() { return new DryRunUploadRequestService(restConnection); } public CodeLocationRequestService createCodeLocationRequestService(final IntLogger logger) { return new CodeLocationRequestService(restConnection, createMetaService(logger)); } public ComponentRequestService createComponentRequestService() { return new ComponentRequestService(restConnection); } public HubVersionRequestService createHubVersionRequestService() { return new HubVersionRequestService(restConnection); } public NotificationRequestService createNotificationRequestService(final IntLogger logger) { return new NotificationRequestService(logger, restConnection, createMetaService(logger)); } public PolicyRequestService createPolicyRequestService() { return new PolicyRequestService(restConnection); } public ProjectRequestService createProjectRequestService(final IntLogger logger) { return new ProjectRequestService(restConnection, createMetaService(logger)); } public ProjectVersionRequestService createProjectVersionRequestService(final IntLogger logger) { return new ProjectVersionRequestService(restConnection, createMetaService(logger)); } public ScanSummaryRequestService createScanSummaryRequestService() { return new ScanSummaryRequestService(restConnection); } public UserRequestService createUserRequestService() { return new UserRequestService(restConnection); } public VulnerabilityRequestService createVulnerabilityRequestService() { return new VulnerabilityRequestService(restConnection); } public ExtensionConfigRequestService createExtensionConfigRequestService() { return new ExtensionConfigRequestService(restConnection); } public ExtensionUserOptionRequestService createExtensionUserOptionRequestService() { return new ExtensionUserOptionRequestService(restConnection); } public VulnerableBomComponentRequestService createVulnerableBomComponentRequestService() { return new VulnerableBomComponentRequestService(restConnection); } public CLIDownloadService createCliDownloadService(final IntLogger logger) { return new CLIDownloadService(logger, restConnection); } /** * @deprecated You should create HubScanConfig, rather than pass in each field */ @Deprecated public SimpleScanService createSimpleScanService(final IntLogger logger, final RestConnection restConnection, final HubServerConfig hubServerConfig, final HubSupportHelper hubSupportHelper, final File directoryToInstallTo, final int scanMemory, final boolean dryRun, final String project, final String version, final Set<String> scanTargetPaths, final File workingDirectory, final String[] excludePatterns) { return new SimpleScanService(logger, restConnection.gson, hubServerConfig, hubSupportHelper, ciEnvironmentVariables, directoryToInstallTo, scanMemory, dryRun, project, version, scanTargetPaths, workingDirectory, excludePatterns); } public SimpleScanService createSimpleScanService(final IntLogger logger, final RestConnection restConnection, final HubServerConfig hubServerConfig, final HubSupportHelper hubSupportHelper, final HubScanConfig hubScanConfig, final String projectName, final String versionName) { return new SimpleScanService(logger, restConnection.gson, hubServerConfig, hubSupportHelper, ciEnvironmentVariables, hubScanConfig, projectName, versionName); } public HubRegistrationRequestService createHubRegistrationRequestService() { return new HubRegistrationRequestService(restConnection); } public ReportRequestService createReportRequestService(final IntLogger logger, final long timeoutInMilliseconds) { return new ReportRequestService(restConnection, logger, createMetaService(logger), timeoutInMilliseconds); } public AggregateBomRequestService createAggregateBomRequestService(final IntLogger logger) { return new AggregateBomRequestService(restConnection, createMetaService(logger)); } public MetaService createMetaService(final IntLogger logger) { return new MetaService(logger); } public HubResponseService createHubResponseService() { return new HubResponseService(restConnection); } public RestConnection getRestConnection() { return restConnection; } public HubSupportHelper createCheckedHubSupport(final IntLogger logger) throws IntegrationException { final HubSupportHelper supportHelper = new HubSupportHelper(); supportHelper.checkHubSupport(createHubVersionRequestService(), logger); return supportHelper; } public ComponentDataService createComponentDataService(final IntLogger logger) { return new ComponentDataService(logger, createComponentRequestService(), createMetaService(logger)); } public BomComponentIssueRequestService createBomComponentIssueRequestService(final IntLogger logger) { return new BomComponentIssueRequestService(restConnection, createMetaService(logger)); } public ProjectDataService createProjectDataService(final IntLogger logger) { return new ProjectDataService(createProjectRequestService(logger), createProjectVersionRequestService(logger)); } @Override public String toString() { return ReflectionToStringBuilder.toString(this, RecursiveToStringStyle.JSON_STYLE); } }
UTF-8
Java
14,513
java
HubServicesFactory.java
Java
[]
null
[]
/** * Hub Common * * Copyright (C) 2017 Black Duck Software, Inc. * http://www.blackducksoftware.com/ * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.blackducksoftware.integration.hub.service; import java.io.File; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.builder.RecursiveToStringStyle; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import com.blackducksoftware.integration.exception.IntegrationException; import com.blackducksoftware.integration.hub.HubSupportHelper; import com.blackducksoftware.integration.hub.api.aggregate.bom.AggregateBomRequestService; import com.blackducksoftware.integration.hub.api.bom.BomComponentIssueRequestService; import com.blackducksoftware.integration.hub.api.bom.BomImportRequestService; import com.blackducksoftware.integration.hub.api.codelocation.CodeLocationRequestService; import com.blackducksoftware.integration.hub.api.component.ComponentRequestService; import com.blackducksoftware.integration.hub.api.extension.ExtensionConfigRequestService; import com.blackducksoftware.integration.hub.api.extension.ExtensionUserOptionRequestService; import com.blackducksoftware.integration.hub.api.item.MetaService; import com.blackducksoftware.integration.hub.api.nonpublic.HubRegistrationRequestService; import com.blackducksoftware.integration.hub.api.nonpublic.HubVersionRequestService; import com.blackducksoftware.integration.hub.api.notification.NotificationRequestService; import com.blackducksoftware.integration.hub.api.policy.PolicyRequestService; import com.blackducksoftware.integration.hub.api.project.ProjectRequestService; import com.blackducksoftware.integration.hub.api.project.version.ProjectVersionRequestService; import com.blackducksoftware.integration.hub.api.report.ReportRequestService; import com.blackducksoftware.integration.hub.api.scan.DryRunUploadRequestService; import com.blackducksoftware.integration.hub.api.scan.ScanSummaryRequestService; import com.blackducksoftware.integration.hub.api.user.UserRequestService; import com.blackducksoftware.integration.hub.api.vulnerability.VulnerabilityRequestService; import com.blackducksoftware.integration.hub.api.vulnerablebomcomponent.VulnerableBomComponentRequestService; import com.blackducksoftware.integration.hub.cli.CLIDownloadService; import com.blackducksoftware.integration.hub.cli.SimpleScanService; import com.blackducksoftware.integration.hub.dataservice.cli.CLIDataService; import com.blackducksoftware.integration.hub.dataservice.component.ComponentDataService; import com.blackducksoftware.integration.hub.dataservice.extension.ExtensionConfigDataService; import com.blackducksoftware.integration.hub.dataservice.license.LicenseDataService; import com.blackducksoftware.integration.hub.dataservice.notification.NotificationDataService; import com.blackducksoftware.integration.hub.dataservice.notification.model.PolicyNotificationFilter; import com.blackducksoftware.integration.hub.dataservice.phonehome.PhoneHomeDataService; import com.blackducksoftware.integration.hub.dataservice.policystatus.PolicyStatusDataService; import com.blackducksoftware.integration.hub.dataservice.project.ProjectDataService; import com.blackducksoftware.integration.hub.dataservice.report.RiskReportDataService; import com.blackducksoftware.integration.hub.dataservice.scan.ScanStatusDataService; import com.blackducksoftware.integration.hub.dataservice.vulnerability.VulnerabilityDataService; import com.blackducksoftware.integration.hub.global.HubServerConfig; import com.blackducksoftware.integration.hub.rest.RestConnection; import com.blackducksoftware.integration.hub.scan.HubScanConfig; import com.blackducksoftware.integration.log.IntLogger; import com.blackducksoftware.integration.util.CIEnvironmentVariables; public class HubServicesFactory { private final CIEnvironmentVariables ciEnvironmentVariables; private final RestConnection restConnection; public HubServicesFactory(final RestConnection restConnection) { this.ciEnvironmentVariables = new CIEnvironmentVariables(); ciEnvironmentVariables.putAll(System.getenv()); this.restConnection = restConnection; } public void addEnvironmentVariable(final String key, final String value) { ciEnvironmentVariables.put(key, value); } public void addEnvironmentVariables(final Map<String, String> environmentVariables) { ciEnvironmentVariables.putAll(environmentVariables); } public CLIDataService createCLIDataService(final IntLogger logger) { return createCLIDataService(logger, 120000l); } public CLIDataService createCLIDataService(final IntLogger logger, final long timeoutInMilliseconds) { return new CLIDataService(logger, restConnection.gson, ciEnvironmentVariables, createHubVersionRequestService(), createCliDownloadService(logger), createPhoneHomeDataService(logger), createProjectRequestService(logger), createProjectVersionRequestService(logger), createCodeLocationRequestService(logger), createScanSummaryRequestService(), createScanStatusDataService(logger, timeoutInMilliseconds), createMetaService(logger)); } public PhoneHomeDataService createPhoneHomeDataService(final IntLogger logger) { return new PhoneHomeDataService(logger, restConnection, createHubRegistrationRequestService(), createHubVersionRequestService()); } public RiskReportDataService createRiskReportDataService(final IntLogger logger, final long timeoutInMilliseconds) throws IntegrationException { return new RiskReportDataService(logger, restConnection, createProjectRequestService(logger), createProjectVersionRequestService(logger), createReportRequestService(logger, timeoutInMilliseconds), createAggregateBomRequestService(logger), createMetaService(logger), createCheckedHubSupport(logger)); } public PolicyStatusDataService createPolicyStatusDataService(final IntLogger logger) { return new PolicyStatusDataService(restConnection, createProjectRequestService(logger), createProjectVersionRequestService(logger), createMetaService(logger)); } public ScanStatusDataService createScanStatusDataService(final IntLogger logger, final long timeoutInMilliseconds) { return new ScanStatusDataService(logger, createProjectRequestService(logger), createProjectVersionRequestService(logger), createCodeLocationRequestService(logger), createScanSummaryRequestService(), createMetaService(logger), timeoutInMilliseconds); } public NotificationDataService createNotificationDataService(final IntLogger logger) { return new NotificationDataService(logger, createHubResponseService(), createNotificationRequestService(logger), createProjectVersionRequestService(logger), createPolicyRequestService(), createMetaService(logger)); } public NotificationDataService createNotificationDataService(final IntLogger logger, final PolicyNotificationFilter policyNotificationFilter) { return new NotificationDataService(logger, createHubResponseService(), createNotificationRequestService(logger), createProjectVersionRequestService(logger), createPolicyRequestService(), policyNotificationFilter, createMetaService(logger)); } public ExtensionConfigDataService createExtensionConfigDataService(final IntLogger logger) { return new ExtensionConfigDataService(logger, restConnection, createUserRequestService(), createExtensionConfigRequestService(), createExtensionUserOptionRequestService(), createMetaService(logger)); } public VulnerabilityDataService createVulnerabilityDataService(final IntLogger logger) { return new VulnerabilityDataService(restConnection, createComponentRequestService(), createVulnerabilityRequestService(), createMetaService(logger)); } public LicenseDataService createLicenseDataService() { return new LicenseDataService(createComponentRequestService()); } public BomImportRequestService createBomImportRequestService() { return new BomImportRequestService(restConnection); } public DryRunUploadRequestService createDryRunUploadRequestService() { return new DryRunUploadRequestService(restConnection); } public CodeLocationRequestService createCodeLocationRequestService(final IntLogger logger) { return new CodeLocationRequestService(restConnection, createMetaService(logger)); } public ComponentRequestService createComponentRequestService() { return new ComponentRequestService(restConnection); } public HubVersionRequestService createHubVersionRequestService() { return new HubVersionRequestService(restConnection); } public NotificationRequestService createNotificationRequestService(final IntLogger logger) { return new NotificationRequestService(logger, restConnection, createMetaService(logger)); } public PolicyRequestService createPolicyRequestService() { return new PolicyRequestService(restConnection); } public ProjectRequestService createProjectRequestService(final IntLogger logger) { return new ProjectRequestService(restConnection, createMetaService(logger)); } public ProjectVersionRequestService createProjectVersionRequestService(final IntLogger logger) { return new ProjectVersionRequestService(restConnection, createMetaService(logger)); } public ScanSummaryRequestService createScanSummaryRequestService() { return new ScanSummaryRequestService(restConnection); } public UserRequestService createUserRequestService() { return new UserRequestService(restConnection); } public VulnerabilityRequestService createVulnerabilityRequestService() { return new VulnerabilityRequestService(restConnection); } public ExtensionConfigRequestService createExtensionConfigRequestService() { return new ExtensionConfigRequestService(restConnection); } public ExtensionUserOptionRequestService createExtensionUserOptionRequestService() { return new ExtensionUserOptionRequestService(restConnection); } public VulnerableBomComponentRequestService createVulnerableBomComponentRequestService() { return new VulnerableBomComponentRequestService(restConnection); } public CLIDownloadService createCliDownloadService(final IntLogger logger) { return new CLIDownloadService(logger, restConnection); } /** * @deprecated You should create HubScanConfig, rather than pass in each field */ @Deprecated public SimpleScanService createSimpleScanService(final IntLogger logger, final RestConnection restConnection, final HubServerConfig hubServerConfig, final HubSupportHelper hubSupportHelper, final File directoryToInstallTo, final int scanMemory, final boolean dryRun, final String project, final String version, final Set<String> scanTargetPaths, final File workingDirectory, final String[] excludePatterns) { return new SimpleScanService(logger, restConnection.gson, hubServerConfig, hubSupportHelper, ciEnvironmentVariables, directoryToInstallTo, scanMemory, dryRun, project, version, scanTargetPaths, workingDirectory, excludePatterns); } public SimpleScanService createSimpleScanService(final IntLogger logger, final RestConnection restConnection, final HubServerConfig hubServerConfig, final HubSupportHelper hubSupportHelper, final HubScanConfig hubScanConfig, final String projectName, final String versionName) { return new SimpleScanService(logger, restConnection.gson, hubServerConfig, hubSupportHelper, ciEnvironmentVariables, hubScanConfig, projectName, versionName); } public HubRegistrationRequestService createHubRegistrationRequestService() { return new HubRegistrationRequestService(restConnection); } public ReportRequestService createReportRequestService(final IntLogger logger, final long timeoutInMilliseconds) { return new ReportRequestService(restConnection, logger, createMetaService(logger), timeoutInMilliseconds); } public AggregateBomRequestService createAggregateBomRequestService(final IntLogger logger) { return new AggregateBomRequestService(restConnection, createMetaService(logger)); } public MetaService createMetaService(final IntLogger logger) { return new MetaService(logger); } public HubResponseService createHubResponseService() { return new HubResponseService(restConnection); } public RestConnection getRestConnection() { return restConnection; } public HubSupportHelper createCheckedHubSupport(final IntLogger logger) throws IntegrationException { final HubSupportHelper supportHelper = new HubSupportHelper(); supportHelper.checkHubSupport(createHubVersionRequestService(), logger); return supportHelper; } public ComponentDataService createComponentDataService(final IntLogger logger) { return new ComponentDataService(logger, createComponentRequestService(), createMetaService(logger)); } public BomComponentIssueRequestService createBomComponentIssueRequestService(final IntLogger logger) { return new BomComponentIssueRequestService(restConnection, createMetaService(logger)); } public ProjectDataService createProjectDataService(final IntLogger logger) { return new ProjectDataService(createProjectRequestService(logger), createProjectVersionRequestService(logger)); } @Override public String toString() { return ReflectionToStringBuilder.toString(this, RecursiveToStringStyle.JSON_STYLE); } }
14,513
0.815682
0.81458
268
53.152985
53.241871
237
false
false
0
0
0
0
0
0
0.802239
false
false
9
8d86a06cc6da6d6a07d73f5590ca6d99c583437e
27,805,618,316,800
846a7668ac964632bdb6db639ab381be11c13b77
/android/tools/tradefederation/core/prod-tests/src/com/android/performance/tests/EmmcPerformanceTest.java
81eebc267fff6dc073a0ab25a4958b064077135f
[]
no_license
BPI-SINOVOIP/BPI-A64-Android8
https://github.com/BPI-SINOVOIP/BPI-A64-Android8
f2900965e96fd6f2a28ced68af668a858b15ebe1
744c72c133b9bf5d2e9efe0ab33e01e6e51d5743
refs/heads/master
2023-05-21T08:02:23.364000
2020-07-15T11:27:51
2020-07-15T11:27:51
143,945,191
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2016 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.performance.tests; import com.android.ddmlib.testrunner.TestIdentifier; import com.android.tradefed.config.Option; import com.android.tradefed.config.Option.Importance; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.device.ITestDevice; import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.result.ITestInvocationListener; import com.android.tradefed.testtype.IDeviceTest; import com.android.tradefed.testtype.IRemoteTest; import com.android.tradefed.util.AbiFormatter; import com.android.tradefed.util.SimplePerfResult; import com.android.tradefed.util.SimplePerfUtil; import com.android.tradefed.util.SimplePerfUtil.SimplePerfType; import com.android.tradefed.util.SimpleStats; import org.junit.Assert; import java.text.NumberFormat; import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This test is targeting eMMC performance on read/ write. */ public class EmmcPerformanceTest implements IDeviceTest, IRemoteTest { private enum TestType { DD, RANDOM; } private static final String RUN_KEY = "emmc_performance_tests"; private static final String SEQUENTIAL_READ_KEY = "sequential_read"; private static final String SEQUENTIAL_WRITE_KEY = "sequential_write"; private static final String RANDOM_READ_KEY = "random_read"; private static final String RANDOM_WRITE_KEY = "random_write"; private static final String PERF_RANDOM = "/data/local/tmp/rand_emmc_perf|#ABI32#|"; private static final Pattern DD_PATTERN = Pattern.compile( "\\d+ bytes transferred in \\d+\\.\\d+ secs \\((\\d+) bytes/sec\\)"); private static final Pattern EMMC_RANDOM_PATTERN = Pattern.compile( "(\\d+) (\\d+)byte iops/sec"); private static final int BLOCK_SIZE = 1048576; private static final int SEQ_COUNT = 200; @Option(name = "cpufreq", description = "The path to the cpufreq directory on the DUT.") private String mCpufreq = "/sys/devices/system/cpu/cpu0/cpufreq"; @Option(name = "auto-discover-cache-info", description = "Indicate if test should attempt auto discover cache path and partition size " + "from the test device. Default to be false, ie. manually set " + "cache-device and cache-partition-size, or use default." + " If fail to discover, it will fallback to what is set in " + "cache-device") private boolean mAutoDiscoverCacheInfo = false; @Option(name = "cache-device", description = "The path to the cache block device on the DUT." + " Nakasi: /dev/block/platform/sdhci-tegra.3/by-name/CAC\n" + " Prime: /dev/block/platform/omap/omap_hsmmc.0/by-name/cache\n" + " Stingray: /dev/block/platform/sdhci-tegra.3/by-name/cache\n" + " Crespo: /dev/block/platform/s3c-sdhci.0/by-name/userdata\n", importance = Importance.IF_UNSET) private String mCache = null; @Option(name = "iterations", description = "The number of iterations to run") private int mIterations = 100; @Option(name = AbiFormatter.FORCE_ABI_STRING, description = AbiFormatter.FORCE_ABI_DESCRIPTION, importance = Importance.IF_UNSET) private String mForceAbi = null; @Option(name = "cache-partition-size", description = "Cache partiton size in MB") private static int mCachePartitionSize = 100; @Option(name = "simpleperf-mode", description = "Whether use simpleperf to get low level metrics") private boolean mSimpleperfMode = false; @Option(name = "simpleperf-argu", description = "simpleperf arguments") private List<String> mSimpleperfArgu = new ArrayList<String>(); ITestDevice mTestDevice = null; SimplePerfUtil mSpUtil = null; /** * {@inheritDoc} */ @Override public void run(ITestInvocationListener listener) throws DeviceNotAvailableException { try { setUp(); listener.testRunStarted(RUN_KEY, 5); long beginTime = System.currentTimeMillis(); Map<String, String> metrics = new HashMap<String, String>(); runSequentialRead(mIterations, listener, metrics); runSequentialWrite(mIterations, listener, metrics); // FIXME: Figure out cache issues with random read and reenable test. // runRandomRead(mIterations, listener, metrics); runRandomWrite(mIterations, listener, metrics); CLog.d("Metrics: %s", metrics.toString()); listener.testRunEnded((System.currentTimeMillis() - beginTime), metrics); } finally { cleanUp(); } } /** * Run the sequential read test. */ private void runSequentialRead(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("dd if=%s of=/dev/null bs=%d count=%d", mCache, BLOCK_SIZE, SEQ_COUNT); runTest(SEQUENTIAL_READ_KEY, command, TestType.DD, true, iterations, listener, metrics); } /** * Run the sequential write test. */ private void runSequentialWrite(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("dd if=/dev/zero of=%s bs=%d count=%d", mCache, BLOCK_SIZE, SEQ_COUNT); runTest(SEQUENTIAL_WRITE_KEY, command, TestType.DD, false, iterations, listener, metrics); } /** * Run the random read test. */ @SuppressWarnings("unused") private void runRandomRead(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("%s -r %d %s", AbiFormatter.formatCmdForAbi(PERF_RANDOM, mForceAbi), mCachePartitionSize, mCache); runTest(RANDOM_READ_KEY, command, TestType.RANDOM, true, iterations, listener, metrics); } /** * Run the random write test with OSYNC disabled. */ private void runRandomWrite(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("%s -w %d %s", AbiFormatter.formatCmdForAbi(PERF_RANDOM, mForceAbi), mCachePartitionSize, mCache); runTest(RANDOM_WRITE_KEY, command, TestType.RANDOM, false, iterations, listener, metrics); } /** * Run a test for a number of iterations. * * @param testKey the key used to report metrics. * @param command the command to be run on the device. * @param type the {@link TestType}, which determines how each iteration should be run. * @param dropCache whether to drop the cache before starting each iteration. * @param iterations the number of iterations to run. * @param listener the {@link ITestInvocationListener}. * @param metrics the map to store metrics of. * @throws DeviceNotAvailableException If the device was not available. */ private void runTest(String testKey, String command, TestType type, boolean dropCache, int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { CLog.i("Starting test %s", testKey); TestIdentifier id = new TestIdentifier(RUN_KEY, testKey); listener.testStarted(id); Map<String, SimpleStats> simpleperfMetricsMap = new HashMap<String, SimpleStats>(); SimpleStats stats = new SimpleStats(); for (int i = 0; i < iterations; i++) { if (dropCache) { dropCache(); } Double kbps = null; switch (type) { case DD: kbps = runDdIteration(command, simpleperfMetricsMap); break; case RANDOM: kbps = runRandomIteration(command, simpleperfMetricsMap); break; } if (kbps != null) { CLog.i("Result for %s, iteration %d: %f KBps", testKey, i + 1, kbps); stats.add(kbps); } else { CLog.w("Skipping %s, iteration %d", testKey, i + 1); } } if (stats.mean() != null) { metrics.put(testKey, Double.toString(stats.median())); for (Map.Entry<String, SimpleStats> entry : simpleperfMetricsMap.entrySet()) { metrics.put(String.format("%s_%s", testKey, entry.getKey()), Double.toString(entry.getValue().median())); } } else { listener.testFailed(id, "No metrics to report (see log)"); } CLog.i("Test %s finished: mean=%f, stdev=%f, samples=%d", testKey, stats.mean(), stats.stdev(), stats.size()); Map<String, String> emptyMap = Collections.emptyMap(); listener.testEnded(id, emptyMap); } /** * Run a single iteration of the dd (sequential) test. * * @param command the command to run on the device. * @param simpleperfMetricsMap the map contain simpleperf metrics aggregated results * @return The speed of the test in KBps or null if there was an error running or parsing the * test. * @throws DeviceNotAvailableException If the device was not available. */ private Double runDdIteration(String command, Map<String, SimpleStats> simpleperfMetricsMap) throws DeviceNotAvailableException { String[] output; SimplePerfResult spResult = null; if (mSimpleperfMode) { spResult = mSpUtil.executeCommand(command); output = spResult.getCommandRawOutput().split("\n"); } else { output = mTestDevice.executeShellCommand(command).split("\n"); } String line = output[output.length - 1].trim(); Matcher m = DD_PATTERN.matcher(line); if (m.matches()) { simpleperfResultAggregation(spResult, simpleperfMetricsMap); return convertBpsToKBps(Double.parseDouble(m.group(1))); } else { CLog.w("Line \"%s\" did not match expected output, ignoring", line); return null; } } /** * Run a single iteration of the random test. * * @param command the command to run on the device. * @param simpleperfMetricsMap the map contain simpleperf metrics aggregated results * @return The speed of the test in KBps or null if there was an error running or parsing the * test. * @throws DeviceNotAvailableException If the device was not available. */ private Double runRandomIteration(String command, Map<String, SimpleStats> simpleperfMetricsMap) throws DeviceNotAvailableException { String output; SimplePerfResult spResult = null; if (mSimpleperfMode) { spResult = mSpUtil.executeCommand(command); output = spResult.getCommandRawOutput(); } else { output = mTestDevice.executeShellCommand(command); } Matcher m = EMMC_RANDOM_PATTERN.matcher(output.trim()); if (m.matches()) { simpleperfResultAggregation(spResult, simpleperfMetricsMap); return convertIopsToKBps(Double.parseDouble(m.group(1))); } else { CLog.w("Line \"%s\" did not match expected output, ignoring", output); return null; } } /** * Helper function to aggregate simpleperf results * * @param spResult object that holds simpleperf results * @param simpleperfMetricsMap map holds aggregated simpleperf results */ private void simpleperfResultAggregation(SimplePerfResult spResult, Map<String, SimpleStats> simpleperfMetricsMap) { if (mSimpleperfMode) { Assert.assertNotNull("simpleperf result is null object", spResult); for (Map.Entry<String, String> entry : spResult.getBenchmarkMetrics().entrySet()) { try { Double metricValue = NumberFormat.getNumberInstance(Locale.US) .parse(entry.getValue()).doubleValue(); if (!simpleperfMetricsMap.containsKey(entry.getKey())) { SimpleStats newStat = new SimpleStats(); simpleperfMetricsMap.put(entry.getKey(), newStat); } simpleperfMetricsMap.get(entry.getKey()).add(metricValue); } catch (ParseException e) { CLog.e("Simpleperf metrics parse failure: " + e.toString()); } } } } /** * Drop the disk cache on the device. */ private void dropCache() throws DeviceNotAvailableException { mTestDevice.executeShellCommand("echo 3 > /proc/sys/vm/drop_caches"); } /** * Convert bytes / sec reported by the dd tests into KBps. */ private double convertBpsToKBps(double bps) { return bps / 1024; } /** * Convert the iops reported by the random tests into KBps. * <p> * The iops is number of 4kB block reads/writes per sec. This makes the conversion factor 4. * </p> */ private double convertIopsToKBps(double iops) { return 4 * iops; } /** * Setup the device for tests by unmounting partitions and maxing the cpu speed. */ private void setUp() throws DeviceNotAvailableException { mTestDevice.executeShellCommand("umount /sdcard"); mTestDevice.executeShellCommand("umount /data"); mTestDevice.executeShellCommand("umount /cache"); mTestDevice.executeShellCommand( String.format("cat %s/cpuinfo_max_freq > %s/scaling_max_freq", mCpufreq, mCpufreq)); mTestDevice.executeShellCommand( String.format("cat %s/cpuinfo_max_freq > %s/scaling_min_freq", mCpufreq, mCpufreq)); if (mSimpleperfMode) { mSpUtil = SimplePerfUtil.newInstance(mTestDevice, SimplePerfType.STAT); if (mSimpleperfArgu.size() == 0) { mSimpleperfArgu.add("-e cpu-cycles:k,cpu-cycles:u"); } mSpUtil.setArgumentList(mSimpleperfArgu); } if (mAutoDiscoverCacheInfo) { // Attempt to detect cache path automatically // Expected output look similar to the following: // // > ... vdc dump | grep cache // 0 4123 /dev/block/platform/soc/7824900.sdhci/by-name/cache /cache ext4 rw, \ // seclabel,nosuid,nodev,noatime,discard,data=ordered 0 0 if (mTestDevice.enableAdbRoot()) { String output = mTestDevice.executeShellCommand("vdc dump | grep cache"); CLog.d("Output from shell command 'vdc dump | grep cache': %s", output); String[] segments = output.split("\\s+"); if (segments.length >= 3) { mCache = segments[2]; } else { CLog.w("Fail to detect cache path. Fall back to use '%s'", mCache); } } else { CLog.d("Cannot get cache path because device %s is not rooted.", mTestDevice.getSerialNumber()); } // Attempt to detect cache partition size automatically // Expected output looks similar to the following: // // > ... df cache // Filesystem 1K-blocks Used Available Use% Mounted on // /dev/block/mmcblk0p34 60400 56 60344 1% /cache String output = mTestDevice.executeShellCommand("df cache"); CLog.d(String.format("Output from shell command 'df cache':\n%s", output)); String[] lines = output.split("\r?\n"); if (lines.length >= 2) { String[] segments = lines[1].split("\\s+"); if (segments.length >= 2) { if (lines[0].toLowerCase().contains("1k-blocks")) { mCachePartitionSize = Integer.parseInt(segments[1]) / 1024; } else { throw new IllegalArgumentException("Unknown unit for the cache size."); } } } CLog.d("cache-device is set to %s ...", mCache); CLog.d("cache-partition-size is set to %d ...", mCachePartitionSize); } } /** * Clean up the device by formatting a new cache partition. */ private void cleanUp() throws DeviceNotAvailableException { mTestDevice.executeShellCommand(String.format("make_ext4fs %s", mCache)); } /** * {@inheritDoc} */ @Override public void setDevice(ITestDevice device) { mTestDevice = device; } /** * {@inheritDoc} */ @Override public ITestDevice getDevice() { return mTestDevice; } }
UTF-8
Java
18,083
java
EmmcPerformanceTest.java
Java
[ { "context": " }\n\n private static final String RUN_KEY = \"emmc_performance_tests\";\n\n private static final String SEQUENTIAL_REA", "end": 1961, "score": 0.9440383911132812, "start": 1939, "tag": "KEY", "value": "emmc_performance_tests" }, { "context": "rivate static final String SEQUENTIAL_READ_KEY = \"sequential_read\";\n private static final String SEQUENTIAL_WRIT", "end": 2035, "score": 0.6877553462982178, "start": 2020, "tag": "KEY", "value": "sequential_read" }, { "context": "ivate static final String SEQUENTIAL_WRITE_KEY = \"sequential_write\";\n private static final String RANDOM_READ_KEY", "end": 2110, "score": 0.8212687373161316, "start": 2094, "tag": "KEY", "value": "sequential_write" }, { "context": " private static final String RANDOM_READ_KEY = \"random_read\";\n private static final String RANDOM_WRITE_KE", "end": 2175, "score": 0.675581693649292, "start": 2164, "tag": "KEY", "value": "random_read" }, { "context": " private static final String RANDOM_WRITE_KEY = \"random_write\";\n private static final String PERF_RANDOM = \"", "end": 2242, "score": 0.9630336761474609, "start": 2230, "tag": "KEY", "value": "random_write" } ]
null
[]
/* * Copyright (C) 2016 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.performance.tests; import com.android.ddmlib.testrunner.TestIdentifier; import com.android.tradefed.config.Option; import com.android.tradefed.config.Option.Importance; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.device.ITestDevice; import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.result.ITestInvocationListener; import com.android.tradefed.testtype.IDeviceTest; import com.android.tradefed.testtype.IRemoteTest; import com.android.tradefed.util.AbiFormatter; import com.android.tradefed.util.SimplePerfResult; import com.android.tradefed.util.SimplePerfUtil; import com.android.tradefed.util.SimplePerfUtil.SimplePerfType; import com.android.tradefed.util.SimpleStats; import org.junit.Assert; import java.text.NumberFormat; import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * This test is targeting eMMC performance on read/ write. */ public class EmmcPerformanceTest implements IDeviceTest, IRemoteTest { private enum TestType { DD, RANDOM; } private static final String RUN_KEY = "emmc_performance_tests"; private static final String SEQUENTIAL_READ_KEY = "sequential_read"; private static final String SEQUENTIAL_WRITE_KEY = "sequential_write"; private static final String RANDOM_READ_KEY = "random_read"; private static final String RANDOM_WRITE_KEY = "random_write"; private static final String PERF_RANDOM = "/data/local/tmp/rand_emmc_perf|#ABI32#|"; private static final Pattern DD_PATTERN = Pattern.compile( "\\d+ bytes transferred in \\d+\\.\\d+ secs \\((\\d+) bytes/sec\\)"); private static final Pattern EMMC_RANDOM_PATTERN = Pattern.compile( "(\\d+) (\\d+)byte iops/sec"); private static final int BLOCK_SIZE = 1048576; private static final int SEQ_COUNT = 200; @Option(name = "cpufreq", description = "The path to the cpufreq directory on the DUT.") private String mCpufreq = "/sys/devices/system/cpu/cpu0/cpufreq"; @Option(name = "auto-discover-cache-info", description = "Indicate if test should attempt auto discover cache path and partition size " + "from the test device. Default to be false, ie. manually set " + "cache-device and cache-partition-size, or use default." + " If fail to discover, it will fallback to what is set in " + "cache-device") private boolean mAutoDiscoverCacheInfo = false; @Option(name = "cache-device", description = "The path to the cache block device on the DUT." + " Nakasi: /dev/block/platform/sdhci-tegra.3/by-name/CAC\n" + " Prime: /dev/block/platform/omap/omap_hsmmc.0/by-name/cache\n" + " Stingray: /dev/block/platform/sdhci-tegra.3/by-name/cache\n" + " Crespo: /dev/block/platform/s3c-sdhci.0/by-name/userdata\n", importance = Importance.IF_UNSET) private String mCache = null; @Option(name = "iterations", description = "The number of iterations to run") private int mIterations = 100; @Option(name = AbiFormatter.FORCE_ABI_STRING, description = AbiFormatter.FORCE_ABI_DESCRIPTION, importance = Importance.IF_UNSET) private String mForceAbi = null; @Option(name = "cache-partition-size", description = "Cache partiton size in MB") private static int mCachePartitionSize = 100; @Option(name = "simpleperf-mode", description = "Whether use simpleperf to get low level metrics") private boolean mSimpleperfMode = false; @Option(name = "simpleperf-argu", description = "simpleperf arguments") private List<String> mSimpleperfArgu = new ArrayList<String>(); ITestDevice mTestDevice = null; SimplePerfUtil mSpUtil = null; /** * {@inheritDoc} */ @Override public void run(ITestInvocationListener listener) throws DeviceNotAvailableException { try { setUp(); listener.testRunStarted(RUN_KEY, 5); long beginTime = System.currentTimeMillis(); Map<String, String> metrics = new HashMap<String, String>(); runSequentialRead(mIterations, listener, metrics); runSequentialWrite(mIterations, listener, metrics); // FIXME: Figure out cache issues with random read and reenable test. // runRandomRead(mIterations, listener, metrics); runRandomWrite(mIterations, listener, metrics); CLog.d("Metrics: %s", metrics.toString()); listener.testRunEnded((System.currentTimeMillis() - beginTime), metrics); } finally { cleanUp(); } } /** * Run the sequential read test. */ private void runSequentialRead(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("dd if=%s of=/dev/null bs=%d count=%d", mCache, BLOCK_SIZE, SEQ_COUNT); runTest(SEQUENTIAL_READ_KEY, command, TestType.DD, true, iterations, listener, metrics); } /** * Run the sequential write test. */ private void runSequentialWrite(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("dd if=/dev/zero of=%s bs=%d count=%d", mCache, BLOCK_SIZE, SEQ_COUNT); runTest(SEQUENTIAL_WRITE_KEY, command, TestType.DD, false, iterations, listener, metrics); } /** * Run the random read test. */ @SuppressWarnings("unused") private void runRandomRead(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("%s -r %d %s", AbiFormatter.formatCmdForAbi(PERF_RANDOM, mForceAbi), mCachePartitionSize, mCache); runTest(RANDOM_READ_KEY, command, TestType.RANDOM, true, iterations, listener, metrics); } /** * Run the random write test with OSYNC disabled. */ private void runRandomWrite(int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { String command = String.format("%s -w %d %s", AbiFormatter.formatCmdForAbi(PERF_RANDOM, mForceAbi), mCachePartitionSize, mCache); runTest(RANDOM_WRITE_KEY, command, TestType.RANDOM, false, iterations, listener, metrics); } /** * Run a test for a number of iterations. * * @param testKey the key used to report metrics. * @param command the command to be run on the device. * @param type the {@link TestType}, which determines how each iteration should be run. * @param dropCache whether to drop the cache before starting each iteration. * @param iterations the number of iterations to run. * @param listener the {@link ITestInvocationListener}. * @param metrics the map to store metrics of. * @throws DeviceNotAvailableException If the device was not available. */ private void runTest(String testKey, String command, TestType type, boolean dropCache, int iterations, ITestInvocationListener listener, Map<String, String> metrics) throws DeviceNotAvailableException { CLog.i("Starting test %s", testKey); TestIdentifier id = new TestIdentifier(RUN_KEY, testKey); listener.testStarted(id); Map<String, SimpleStats> simpleperfMetricsMap = new HashMap<String, SimpleStats>(); SimpleStats stats = new SimpleStats(); for (int i = 0; i < iterations; i++) { if (dropCache) { dropCache(); } Double kbps = null; switch (type) { case DD: kbps = runDdIteration(command, simpleperfMetricsMap); break; case RANDOM: kbps = runRandomIteration(command, simpleperfMetricsMap); break; } if (kbps != null) { CLog.i("Result for %s, iteration %d: %f KBps", testKey, i + 1, kbps); stats.add(kbps); } else { CLog.w("Skipping %s, iteration %d", testKey, i + 1); } } if (stats.mean() != null) { metrics.put(testKey, Double.toString(stats.median())); for (Map.Entry<String, SimpleStats> entry : simpleperfMetricsMap.entrySet()) { metrics.put(String.format("%s_%s", testKey, entry.getKey()), Double.toString(entry.getValue().median())); } } else { listener.testFailed(id, "No metrics to report (see log)"); } CLog.i("Test %s finished: mean=%f, stdev=%f, samples=%d", testKey, stats.mean(), stats.stdev(), stats.size()); Map<String, String> emptyMap = Collections.emptyMap(); listener.testEnded(id, emptyMap); } /** * Run a single iteration of the dd (sequential) test. * * @param command the command to run on the device. * @param simpleperfMetricsMap the map contain simpleperf metrics aggregated results * @return The speed of the test in KBps or null if there was an error running or parsing the * test. * @throws DeviceNotAvailableException If the device was not available. */ private Double runDdIteration(String command, Map<String, SimpleStats> simpleperfMetricsMap) throws DeviceNotAvailableException { String[] output; SimplePerfResult spResult = null; if (mSimpleperfMode) { spResult = mSpUtil.executeCommand(command); output = spResult.getCommandRawOutput().split("\n"); } else { output = mTestDevice.executeShellCommand(command).split("\n"); } String line = output[output.length - 1].trim(); Matcher m = DD_PATTERN.matcher(line); if (m.matches()) { simpleperfResultAggregation(spResult, simpleperfMetricsMap); return convertBpsToKBps(Double.parseDouble(m.group(1))); } else { CLog.w("Line \"%s\" did not match expected output, ignoring", line); return null; } } /** * Run a single iteration of the random test. * * @param command the command to run on the device. * @param simpleperfMetricsMap the map contain simpleperf metrics aggregated results * @return The speed of the test in KBps or null if there was an error running or parsing the * test. * @throws DeviceNotAvailableException If the device was not available. */ private Double runRandomIteration(String command, Map<String, SimpleStats> simpleperfMetricsMap) throws DeviceNotAvailableException { String output; SimplePerfResult spResult = null; if (mSimpleperfMode) { spResult = mSpUtil.executeCommand(command); output = spResult.getCommandRawOutput(); } else { output = mTestDevice.executeShellCommand(command); } Matcher m = EMMC_RANDOM_PATTERN.matcher(output.trim()); if (m.matches()) { simpleperfResultAggregation(spResult, simpleperfMetricsMap); return convertIopsToKBps(Double.parseDouble(m.group(1))); } else { CLog.w("Line \"%s\" did not match expected output, ignoring", output); return null; } } /** * Helper function to aggregate simpleperf results * * @param spResult object that holds simpleperf results * @param simpleperfMetricsMap map holds aggregated simpleperf results */ private void simpleperfResultAggregation(SimplePerfResult spResult, Map<String, SimpleStats> simpleperfMetricsMap) { if (mSimpleperfMode) { Assert.assertNotNull("simpleperf result is null object", spResult); for (Map.Entry<String, String> entry : spResult.getBenchmarkMetrics().entrySet()) { try { Double metricValue = NumberFormat.getNumberInstance(Locale.US) .parse(entry.getValue()).doubleValue(); if (!simpleperfMetricsMap.containsKey(entry.getKey())) { SimpleStats newStat = new SimpleStats(); simpleperfMetricsMap.put(entry.getKey(), newStat); } simpleperfMetricsMap.get(entry.getKey()).add(metricValue); } catch (ParseException e) { CLog.e("Simpleperf metrics parse failure: " + e.toString()); } } } } /** * Drop the disk cache on the device. */ private void dropCache() throws DeviceNotAvailableException { mTestDevice.executeShellCommand("echo 3 > /proc/sys/vm/drop_caches"); } /** * Convert bytes / sec reported by the dd tests into KBps. */ private double convertBpsToKBps(double bps) { return bps / 1024; } /** * Convert the iops reported by the random tests into KBps. * <p> * The iops is number of 4kB block reads/writes per sec. This makes the conversion factor 4. * </p> */ private double convertIopsToKBps(double iops) { return 4 * iops; } /** * Setup the device for tests by unmounting partitions and maxing the cpu speed. */ private void setUp() throws DeviceNotAvailableException { mTestDevice.executeShellCommand("umount /sdcard"); mTestDevice.executeShellCommand("umount /data"); mTestDevice.executeShellCommand("umount /cache"); mTestDevice.executeShellCommand( String.format("cat %s/cpuinfo_max_freq > %s/scaling_max_freq", mCpufreq, mCpufreq)); mTestDevice.executeShellCommand( String.format("cat %s/cpuinfo_max_freq > %s/scaling_min_freq", mCpufreq, mCpufreq)); if (mSimpleperfMode) { mSpUtil = SimplePerfUtil.newInstance(mTestDevice, SimplePerfType.STAT); if (mSimpleperfArgu.size() == 0) { mSimpleperfArgu.add("-e cpu-cycles:k,cpu-cycles:u"); } mSpUtil.setArgumentList(mSimpleperfArgu); } if (mAutoDiscoverCacheInfo) { // Attempt to detect cache path automatically // Expected output look similar to the following: // // > ... vdc dump | grep cache // 0 4123 /dev/block/platform/soc/7824900.sdhci/by-name/cache /cache ext4 rw, \ // seclabel,nosuid,nodev,noatime,discard,data=ordered 0 0 if (mTestDevice.enableAdbRoot()) { String output = mTestDevice.executeShellCommand("vdc dump | grep cache"); CLog.d("Output from shell command 'vdc dump | grep cache': %s", output); String[] segments = output.split("\\s+"); if (segments.length >= 3) { mCache = segments[2]; } else { CLog.w("Fail to detect cache path. Fall back to use '%s'", mCache); } } else { CLog.d("Cannot get cache path because device %s is not rooted.", mTestDevice.getSerialNumber()); } // Attempt to detect cache partition size automatically // Expected output looks similar to the following: // // > ... df cache // Filesystem 1K-blocks Used Available Use% Mounted on // /dev/block/mmcblk0p34 60400 56 60344 1% /cache String output = mTestDevice.executeShellCommand("df cache"); CLog.d(String.format("Output from shell command 'df cache':\n%s", output)); String[] lines = output.split("\r?\n"); if (lines.length >= 2) { String[] segments = lines[1].split("\\s+"); if (segments.length >= 2) { if (lines[0].toLowerCase().contains("1k-blocks")) { mCachePartitionSize = Integer.parseInt(segments[1]) / 1024; } else { throw new IllegalArgumentException("Unknown unit for the cache size."); } } } CLog.d("cache-device is set to %s ...", mCache); CLog.d("cache-partition-size is set to %d ...", mCachePartitionSize); } } /** * Clean up the device by formatting a new cache partition. */ private void cleanUp() throws DeviceNotAvailableException { mTestDevice.executeShellCommand(String.format("make_ext4fs %s", mCache)); } /** * {@inheritDoc} */ @Override public void setDevice(ITestDevice device) { mTestDevice = device; } /** * {@inheritDoc} */ @Override public ITestDevice getDevice() { return mTestDevice; } }
18,083
0.621965
0.616822
437
40.377575
30.822987
100
false
false
0
0
0
0
0
0
0.686499
false
false
9
48fa3498b639cf7213a5e300a33f95a0a19000ff
23,716,809,479,750
fcf12fbbbfbd743889fcfa5b1de5456e497f6644
/Day4/src/main/java/com/demoaut/newtours/RegistrationPage.java
820583b7461168d77737cd978964c64099656546
[]
no_license
ThiliniCH/AutomationCourse
https://github.com/ThiliniCH/AutomationCourse
0596bda3fd911ad1cc49f84f9d6996d004874894
5730402396bd832321d2ec6f50f9861abf930c8d
refs/heads/master
2020-03-26T06:24:51.618000
2018-08-13T16:15:49
2018-08-13T16:15:49
144,603,839
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.demoaut.newtours; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import utils.PropertyFileReader; import utils.TestApp; public class RegistrationPage { @FindBy(name = "firstName") private WebElement first_name; @FindBy(name = "lastName") private WebElement last_name; @FindBy(id = "email") private WebElement user_name; @FindBy(name = "password") private WebElement password_element; @FindBy(name = "confirmPassword") private WebElement confirm_Password; @FindBy(name = "register") private WebElement submit; public RegistrationPage setFirstName(String firstName){ first_name.sendKeys(firstName); return this; } public RegistrationPage setLastName(String lastName){ last_name.sendKeys(lastName); return this; } public RegistrationPage setUserName(String userName){ user_name.sendKeys(userName); return this; } public RegistrationPage setPassword(String password){ password_element.sendKeys(password); return this; } public RegistrationPage setConfirmPassword(String confirmPassword){ confirm_Password.sendKeys(confirmPassword); return this; } public RegistrationPage submit(){ submit.click(); return this; } }
UTF-8
Java
1,359
java
RegistrationPage.java
Java
[ { "context": " }\n\n public RegistrationPage setUserName(String userName){\n user_name.sendKeys(userName);\n r", "end": 920, "score": 0.9803872108459473, "start": 912, "tag": "USERNAME", "value": "userName" }, { "context": "Name(String userName){\n user_name.sendKeys(userName);\n return this;\n\n }\n\n public Registr", "end": 958, "score": 0.9939454793930054, "start": 950, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.demoaut.newtours; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import utils.PropertyFileReader; import utils.TestApp; public class RegistrationPage { @FindBy(name = "firstName") private WebElement first_name; @FindBy(name = "lastName") private WebElement last_name; @FindBy(id = "email") private WebElement user_name; @FindBy(name = "password") private WebElement password_element; @FindBy(name = "confirmPassword") private WebElement confirm_Password; @FindBy(name = "register") private WebElement submit; public RegistrationPage setFirstName(String firstName){ first_name.sendKeys(firstName); return this; } public RegistrationPage setLastName(String lastName){ last_name.sendKeys(lastName); return this; } public RegistrationPage setUserName(String userName){ user_name.sendKeys(userName); return this; } public RegistrationPage setPassword(String password){ password_element.sendKeys(password); return this; } public RegistrationPage setConfirmPassword(String confirmPassword){ confirm_Password.sendKeys(confirmPassword); return this; } public RegistrationPage submit(){ submit.click(); return this; } }
1,359
0.706402
0.706402
52
25.134615
23.642391
74
false
false
0
0
0
0
0
0
0.461538
false
false
9
e2d3099d355f863f41125a742910895b120671c1
6,210,522,737,596
0dfe245b79e26b1234e73ea9cdeef46575805d9c
/seam/MyDirectedEdge.java
3fcdcac33abba7dd5e5766dd80beb22d042f9363
[]
no_license
hunglun/algs2
https://github.com/hunglun/algs2
825ab8f34812816469c3559c00717f93261edddc
f2e8f18de2a0a1fb6a1fd42bfbd9cdd90be5aff5
refs/heads/master
2021-05-06T02:47:59.658000
2018-01-07T23:10:54
2018-01-07T23:10:54
114,628,152
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import edu.princeton.cs.algs4.StdOut; public class MyDirectedEdge { private final Pair v; private final Pair w; /** * Initializes a directed edge from vertex {@code v} to vertex {@code w} with * the given {@code weight}. * @param v the tail vertex * @param w the head vertex * @param weight the weight of the directed edge * @throws IllegalArgumentException if either {@code v} or {@code w} * is a negative integer * @throws IllegalArgumentException if {@code weight} is {@code NaN} */ public MyDirectedEdge(Pair v, Pair w, double weight) { if (v.x() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (w.x() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (v.y() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (w.y() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (Double.isNaN(weight)) throw new IllegalArgumentException("Weight is NaN"); this.v = new Pair(v.x(),v.y()); this.w = new Pair(w.x(),w.y()); } /** * Returns the tail vertex of the directed edge. * @return the tail vertex of the directed edge */ public Pair from() { return v; } /** * Returns the head vertex of the directed edge. * @return the head vertex of the directed edge */ public Pair to() { return w; } /** * Returns a string representation of the directed edge. * @return a string representation of the directed edge */ public String toString() { return v + "->" + w; } /** * Unit tests the {@code MyDirectedEdge} data type. * * @param args the command-line arguments */ public static void main(String[] args) { MyDirectedEdge e = new MyDirectedEdge(new Pair(12, 34), new Pair(0,90), 5.67); StdOut.println(e); } }
UTF-8
Java
2,047
java
MyDirectedEdge.java
Java
[]
null
[]
import edu.princeton.cs.algs4.StdOut; public class MyDirectedEdge { private final Pair v; private final Pair w; /** * Initializes a directed edge from vertex {@code v} to vertex {@code w} with * the given {@code weight}. * @param v the tail vertex * @param w the head vertex * @param weight the weight of the directed edge * @throws IllegalArgumentException if either {@code v} or {@code w} * is a negative integer * @throws IllegalArgumentException if {@code weight} is {@code NaN} */ public MyDirectedEdge(Pair v, Pair w, double weight) { if (v.x() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (w.x() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (v.y() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (w.y() < 0) throw new IllegalArgumentException("Vertex names must be nonnegative integers"); if (Double.isNaN(weight)) throw new IllegalArgumentException("Weight is NaN"); this.v = new Pair(v.x(),v.y()); this.w = new Pair(w.x(),w.y()); } /** * Returns the tail vertex of the directed edge. * @return the tail vertex of the directed edge */ public Pair from() { return v; } /** * Returns the head vertex of the directed edge. * @return the head vertex of the directed edge */ public Pair to() { return w; } /** * Returns a string representation of the directed edge. * @return a string representation of the directed edge */ public String toString() { return v + "->" + w; } /** * Unit tests the {@code MyDirectedEdge} data type. * * @param args the command-line arguments */ public static void main(String[] args) { MyDirectedEdge e = new MyDirectedEdge(new Pair(12, 34), new Pair(0,90), 5.67); StdOut.println(e); } }
2,047
0.615046
0.607719
63
31.492064
30.239191
103
false
false
0
0
0
0
0
0
0.365079
false
false
9
42621dd02149436189bbc4865348fb4bffa257ad
15,547,781,644,337
c5e6eac602e3c4cd8daf832289a5833e1b946d78
/ejercicio_libreria/src/main/java/ar/edu/untref/aydoo/Libreria.java
dc77287ace65c9512efc08187b5b47a9d63bceb0
[]
no_license
WaldoGaspari/Aydoo2017
https://github.com/WaldoGaspari/Aydoo2017
b5fdca0f1622cae0ec6fd24b3aee262aefd715a0
d187310f0a37fcf1a112dea7638de7703ea96291
refs/heads/master
2021-01-22T20:49:18.093000
2017-05-27T19:19:56
2017-05-27T19:19:56
85,361,237
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ar.edu.untref.aydoo; import java.util.Iterator; import java.util.List; /** * La Libreria es un servicio ya que no presenta entidades ni objetos de valor. Solo se encarga de la logica de cierta funcionalidad * del dominio. */ public class Libreria { public static double calcularMontoACobrar(String mes, Cliente cliente){ double resultado = 0; if(cliente.obtenerListaDeProductos(mes).isEmpty()){ return resultado; } else{ List<Producto> productos = cliente.obtenerListaDeProductos(mes); Iterator<Producto> iterador = productos.iterator(); while(iterador.hasNext()){ Producto producto = iterador.next(); resultado = resultado + producto.obtenerPrecio(); } return resultado; } } }
UTF-8
Java
735
java
Libreria.java
Java
[]
null
[]
package ar.edu.untref.aydoo; import java.util.Iterator; import java.util.List; /** * La Libreria es un servicio ya que no presenta entidades ni objetos de valor. Solo se encarga de la logica de cierta funcionalidad * del dominio. */ public class Libreria { public static double calcularMontoACobrar(String mes, Cliente cliente){ double resultado = 0; if(cliente.obtenerListaDeProductos(mes).isEmpty()){ return resultado; } else{ List<Producto> productos = cliente.obtenerListaDeProductos(mes); Iterator<Producto> iterador = productos.iterator(); while(iterador.hasNext()){ Producto producto = iterador.next(); resultado = resultado + producto.obtenerPrecio(); } return resultado; } } }
735
0.72517
0.72381
28
25.25
29.513466
132
false
false
0
0
0
0
0
0
1.857143
false
false
9
38a3810d4c17b2b2f52fbedd439961a2e9732eb0
25,890,062,895,180
76420d17fec6fc7b2d6f0b772409abdd0fb5bd7d
/src/main/java/com/tangp/soa/configBean/Protocol.java
9d00bc94a2da046c15d2d859a2224a204ad9496a
[]
no_license
birdTang/tangp-soa
https://github.com/birdTang/tangp-soa
42a235e427f4e607389ec4a8ab27588a0b03faf1
7ba148c7cd10b97f6e7a00c7de6f4f0eff82d08d
refs/heads/master
2020-03-07T17:32:08.028000
2018-04-29T07:08:57
2018-04-29T07:08:57
127,613,988
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tangp.soa.configBean; import java.io.Serializable; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import com.tangp.soa.netty.NettyUtil; import com.tangp.soa.rmi.RmiUtil; /** * 通信协议实体类 * * @author tangpeng * */ public class Protocol extends BaseConfigBean implements Serializable, InitializingBean, ApplicationListener<ContextRefreshedEvent> { private static final long serialVersionUID = -4440572489780264395L; private String name; private String host; private String port; private String contextpath; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } public String getContextpath() { return contextpath; } public void setContextpath(String contextpath) { this.contextpath = contextpath; } @Override public void afterPropertiesSet() throws Exception { if (name.equalsIgnoreCase("rmi")) { RmiUtil.startRmiServer(host, port, "tangpsoarmi"); } } /** * 监听ContextRefreshedEvent事件 ContextRefreshedEvent事件是在spring加载完后触发的事件 */ @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (!ContextRefreshedEvent.class.getName().equals(event.getClass().getName())) { return; } if (!"netty".equalsIgnoreCase(name)) { return; } /** * 在spring加载完毕后,另启动一个线程来启动netty服务。 防止与netty启动连接后一直阻塞在等待客户端消息处,导致tomcat启动不成功。 */ new Thread(new Runnable() { @Override public void run() { try { NettyUtil.startServer(port); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }).start(); } }
UTF-8
Java
2,299
java
Protocol.java
Java
[ { "context": "a.rmi.RmiUtil;\r\n\r\n/**\r\n * 通信协议实体类\r\n * \r\n * @author tangpeng\r\n *\r\n */\r\npublic class Protocol extends BaseConfi", "end": 370, "score": 0.9991178512573242, "start": 362, "tag": "USERNAME", "value": "tangpeng" } ]
null
[]
package com.tangp.soa.configBean; import java.io.Serializable; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import com.tangp.soa.netty.NettyUtil; import com.tangp.soa.rmi.RmiUtil; /** * 通信协议实体类 * * @author tangpeng * */ public class Protocol extends BaseConfigBean implements Serializable, InitializingBean, ApplicationListener<ContextRefreshedEvent> { private static final long serialVersionUID = -4440572489780264395L; private String name; private String host; private String port; private String contextpath; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } public String getContextpath() { return contextpath; } public void setContextpath(String contextpath) { this.contextpath = contextpath; } @Override public void afterPropertiesSet() throws Exception { if (name.equalsIgnoreCase("rmi")) { RmiUtil.startRmiServer(host, port, "tangpsoarmi"); } } /** * 监听ContextRefreshedEvent事件 ContextRefreshedEvent事件是在spring加载完后触发的事件 */ @Override public void onApplicationEvent(ContextRefreshedEvent event) { if (!ContextRefreshedEvent.class.getName().equals(event.getClass().getName())) { return; } if (!"netty".equalsIgnoreCase(name)) { return; } /** * 在spring加载完毕后,另启动一个线程来启动netty服务。 防止与netty启动连接后一直阻塞在等待客户端消息处,导致tomcat启动不成功。 */ new Thread(new Runnable() { @Override public void run() { try { NettyUtil.startServer(port); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }).start(); } }
2,299
0.687122
0.678289
100
19.51
21.630762
89
false
false
0
0
0
0
0
0
1.6
false
false
9
e47c978187d98a268e31ad2436a42d08fba21f66
15,556,371,593,223
df07ec62c3c9f112e0f1a91f0b03ba05d7dd35f2
/src/com/triolabs/radio_uaa_android/SplashActivity.java
412e6eacc9bacdef2f657c8aea0b40d779f649da
[]
no_license
Rhadammanthis/RadioUAA
https://github.com/Rhadammanthis/RadioUAA
89b1e0b3f934deb26e34450ae07b39793bcac7dd
047800c262e7583756e8ea3b67929c30a297771c
refs/heads/master
2021-03-24T12:09:38.438000
2015-09-28T16:01:29
2015-09-28T16:01:29
43,310,947
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.triolabs.radio_uaa_android; import com.triolabs.fragment.SplashFragment; import com.triolabs.radio_uaa_android.R; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.KeyEvent; import android.view.Window; import android.view.WindowManager; /** * Esta clase es el splash de la aplicacion de la aplicacion aqui se agrega el fragment de splash, * @author Triolabs * @Developer Raul Quintero Esparza * @Designer Ivan Padilla * @version 1.0 */ public class SplashActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // remove title requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); //if the instance is null, add splash fragment if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new SplashFragment(),"SplashView").addToBackStack(null).commit(); } } @Override public void onBackPressed() { // TODO Auto-generated method stub } @Override public boolean onKeyDown(int keyCode, KeyEvent event){ if (keyCode == KeyEvent.KEYCODE_MENU){ return true; }else{ return super.onKeyDown(keyCode, event); } } }
UTF-8
Java
1,470
java
SplashActivity.java
Java
[ { "context": "gment de splash,\n * @author Triolabs\n * @Developer Raul Quintero Esparza\n * @Designer Ivan Padilla\n * @version 1.0\n */\npub", "end": 455, "score": 0.9999004602432251, "start": 434, "tag": "NAME", "value": "Raul Quintero Esparza" }, { "context": "s\n * @Developer Raul Quintero Esparza\n * @Designer Ivan Padilla\n * @version 1.0\n */\npublic class SplashActivity e", "end": 481, "score": 0.9998922348022461, "start": 469, "tag": "NAME", "value": "Ivan Padilla" } ]
null
[]
package com.triolabs.radio_uaa_android; import com.triolabs.fragment.SplashFragment; import com.triolabs.radio_uaa_android.R; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.KeyEvent; import android.view.Window; import android.view.WindowManager; /** * Esta clase es el splash de la aplicacion de la aplicacion aqui se agrega el fragment de splash, * @author Triolabs * @Developer <NAME> * @Designer <NAME> * @version 1.0 */ public class SplashActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // remove title requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_splash); //if the instance is null, add splash fragment if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new SplashFragment(),"SplashView").addToBackStack(null).commit(); } } @Override public void onBackPressed() { // TODO Auto-generated method stub } @Override public boolean onKeyDown(int keyCode, KeyEvent event){ if (keyCode == KeyEvent.KEYCODE_MENU){ return true; }else{ return super.onKeyDown(keyCode, event); } } }
1,449
0.734014
0.731973
52
27.26923
23.905355
98
false
false
0
0
0
0
0
0
1.153846
false
false
9
c8da7e0a4953e854602bc8ff0eaa70221ae1efc0
31,069,793,425,315
de5eb9537d9237c139669873432b925cde696ea5
/src/main/java/com/codeferm/services/jaxrs/BaseDto.java
b42b187771cf431c0b6a21bfacb2737a9377dea1
[]
no_license
sgjava/my-jaxrs-test
https://github.com/sgjava/my-jaxrs-test
e8018aa2cbc4de7fd7e9bf817b3041f604a36fc9
d09479eac28f7946d1c584413d5bac85dde3e5cd
refs/heads/master
2016-09-15T08:31:29.471000
2016-03-09T20:50:33
2016-03-09T20:50:33
40,744,458
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.codeferm.services.jaxrs; import java.beans.ConstructorProperties; import java.io.Serializable; import javax.validation.constraints.NotNull; /** * @author sgoldsmith */ public class BaseDto implements Serializable { private static final long serialVersionUID = 3077868741267353369L; @NotNull private Integer id; public BaseDto() { } @ConstructorProperties({"id"}) public BaseDto(final Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(final Integer id) { this.id = id; } }
UTF-8
Java
602
java
BaseDto.java
Java
[ { "context": "ax.validation.constraints.NotNull;\n\n/**\n * @author sgoldsmith\n */\npublic class BaseDto implements Serializable ", "end": 179, "score": 0.9995894432067871, "start": 169, "tag": "USERNAME", "value": "sgoldsmith" } ]
null
[]
package com.codeferm.services.jaxrs; import java.beans.ConstructorProperties; import java.io.Serializable; import javax.validation.constraints.NotNull; /** * @author sgoldsmith */ public class BaseDto implements Serializable { private static final long serialVersionUID = 3077868741267353369L; @NotNull private Integer id; public BaseDto() { } @ConstructorProperties({"id"}) public BaseDto(final Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(final Integer id) { this.id = id; } }
602
0.666113
0.634551
32
17.8125
18.085625
70
false
false
0
0
0
0
0
0
0.28125
false
false
9
be4b889dc9576ecd182e5234df5848d708a7323b
36,404,142,804,594
1906c14bbcc6806032297ef755ffd2c4561c1ea4
/app/src/main/java/com/sterix/sterixmobile/Monitoring.java
86179140226a7210c180de7f5ab9071d1d01e8ad
[]
no_license
ivancheesecake/SterixMobile
https://github.com/ivancheesecake/SterixMobile
c50e0b1dcc20677e5d5b0c6b5accad1da4316e01
d10a0e359c6740d7b598654e31747a59fda0d31a
refs/heads/master
2021-06-11T17:10:01.708000
2020-01-18T09:47:11
2020-01-18T09:47:11
99,741,653
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sterix.sterixmobile; import android.os.Parcel; import android.os.Parcelable; /** * Created by Admin on 8/9/2017. * Thanks to http://www.parcelabler.com/ for easy parcelable implementation */ public class Monitoring implements Parcelable { private String id; //Create 2 ids, 1pk and 1fk private String location; private String monitoringTask; private String status; private String service_order_id; private String location_area_id; public Monitoring(){ } // public Monitoring(String id, String location,String monitoringTasks,String status){ // // this.id = id; // this.location = location; // this.monitoringTask = monitoringTasks; // this.status = status; // // } public Monitoring(String id, String location,String monitoringTasks,String status, String location_area_id,String service_order_id){ this.id = id; this.location = location; this.monitoringTask = monitoringTasks; this.status = status; this.location_area_id = location_area_id; this.service_order_id = service_order_id; } public String getLocation_area_id() { return this.location_area_id; } public void setLocation_area_id(String location_area_id) { this.location_area_id = location_area_id; } public String getId() { return this.id; } public void setId(String id) { this.id = id; } public String getLocation() { return this.location; } public void setLocation(String location) { this.location = location; } public String getMonitoringTask() { return this.monitoringTask; } public void setMonitoringTask(String monitoringTasks) { this.monitoringTask = monitoringTasks; } public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } public String getService_order_id() { return this.service_order_id; } public void setService_order_id(String service_order_id) { this.service_order_id = service_order_id; } protected Monitoring(Parcel in) { id = in.readString(); location = in.readString(); monitoringTask = in.readString(); status = in.readString(); location_area_id = in.readString(); service_order_id = in.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(location); dest.writeString(monitoringTask); dest.writeString(status); dest.writeString(location_area_id); dest.writeString(service_order_id); } @SuppressWarnings("unused") public static final Parcelable.Creator<Monitoring> CREATOR = new Parcelable.Creator<Monitoring>() { @Override public Monitoring createFromParcel(Parcel in) { return new Monitoring(in); } @Override public Monitoring[] newArray(int size) { return new Monitoring[size]; } }; }
UTF-8
Java
3,219
java
Monitoring.java
Java
[ { "context": ";\nimport android.os.Parcelable;\n\n/**\n * Created by Admin on 8/9/2017.\n * Thanks to http://www.parcelabler.", "end": 114, "score": 0.8067432045936584, "start": 109, "tag": "NAME", "value": "Admin" } ]
null
[]
package com.sterix.sterixmobile; import android.os.Parcel; import android.os.Parcelable; /** * Created by Admin on 8/9/2017. * Thanks to http://www.parcelabler.com/ for easy parcelable implementation */ public class Monitoring implements Parcelable { private String id; //Create 2 ids, 1pk and 1fk private String location; private String monitoringTask; private String status; private String service_order_id; private String location_area_id; public Monitoring(){ } // public Monitoring(String id, String location,String monitoringTasks,String status){ // // this.id = id; // this.location = location; // this.monitoringTask = monitoringTasks; // this.status = status; // // } public Monitoring(String id, String location,String monitoringTasks,String status, String location_area_id,String service_order_id){ this.id = id; this.location = location; this.monitoringTask = monitoringTasks; this.status = status; this.location_area_id = location_area_id; this.service_order_id = service_order_id; } public String getLocation_area_id() { return this.location_area_id; } public void setLocation_area_id(String location_area_id) { this.location_area_id = location_area_id; } public String getId() { return this.id; } public void setId(String id) { this.id = id; } public String getLocation() { return this.location; } public void setLocation(String location) { this.location = location; } public String getMonitoringTask() { return this.monitoringTask; } public void setMonitoringTask(String monitoringTasks) { this.monitoringTask = monitoringTasks; } public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } public String getService_order_id() { return this.service_order_id; } public void setService_order_id(String service_order_id) { this.service_order_id = service_order_id; } protected Monitoring(Parcel in) { id = in.readString(); location = in.readString(); monitoringTask = in.readString(); status = in.readString(); location_area_id = in.readString(); service_order_id = in.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(location); dest.writeString(monitoringTask); dest.writeString(status); dest.writeString(location_area_id); dest.writeString(service_order_id); } @SuppressWarnings("unused") public static final Parcelable.Creator<Monitoring> CREATOR = new Parcelable.Creator<Monitoring>() { @Override public Monitoring createFromParcel(Parcel in) { return new Monitoring(in); } @Override public Monitoring[] newArray(int size) { return new Monitoring[size]; } }; }
3,219
0.631873
0.628767
127
24.322834
23.304855
136
false
false
0
0
0
0
0
0
0.448819
false
false
9
2f0a7bb3653dbd29bffdc8d0d05baad33db83bca
12,154,757,507,445
1a4e98c072ee96e0343752a2ceefd14d4c40eb87
/distances.java
588d7a78392f439d82d7461c0dd27b948ce373c7
[]
no_license
davidlirving/horrible-cycles-thing
https://github.com/davidlirving/horrible-cycles-thing
0ac77919f8413a30c92c295feb918b9ac7a67c4f
8f4de8f191be7e4259f87200d83a67c94ca08d7f
refs/heads/master
2016-08-11T12:56:17.772000
2015-10-03T06:02:18
2015-10-03T06:02:18
43,339,144
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Author: David Irving * * Attempts to brute force a circuit. * * Note: I think I mentioned this was 9^2^2^2^2..(etc) iterations somewhere but * I meant was 9^9 iterations. * * Unlike my notes suggest, I've actually completed it and it will finish quickly. * No more quantum computer or RAM necessary. * * A limitation is that it'll only use each node once, but it will find the smallest * circuit as description suggests. */ import java.util.LinkedList; class connectDist { int distance; LinkedList<Distance> cities; public connectDist(LinkedList<Distance> allCities) { cities = (LinkedList<Distance>) allCities.clone(); distance = 0; } public void calculate() { distance = 0; for (int i=0; i<cities.size(); i++) distance += cities.get(i).distance; } public int getDistance() { return distance; } public String list() { String export = ""; for (int i=0; i<cities.size(); i++) export = export + cities.get(i).cityTo.name+"->"+cities.get(i).cityFrom.name+"\n"; return export; } } // More specifically, it's a circuit class Path { LinkedList<City> cities; City startingCity; connectDist shortestPath; public Path(City startCity, LinkedList<City> allCities) { cities = (LinkedList<City>) allCities.clone(); // Need to calculate it against other nodes cities.remove(startCity); startingCity=startCity; shortestPath = null; } public String list() { if (shortestPath == null) return "Path not calculated"; return shortestPath.list()+" \n"+shortestPath.getDistance()+" (miles)"; } public void find() { connectDist lowest = null; int lowestDist = 99999999; LinkedList<connectDist> alldistances = new LinkedList<connectDist>(); int iterations = 0; for (int a=0; a<cities.size(); a++) { for (int b=0; b<cities.size(); b++) { for (int c=0; c<cities.size(); c++) { for (int d=0; d<cities.size(); d++) { for (int e=0; e<cities.size(); e++) { for (int f=0; f<cities.size(); f++) { for (int g=0; g<cities.size(); g++) { for (int h=0; h<cities.size(); h++) { Distance tmp = null; for (int x=0; x<cities.get(h).cities.size(); x++) { if (cities.get(h).cities.get(x).cityFrom == startingCity) { // Flip the front nodes around tmp = new Distance(startingCity, cities.get(h), cities.get(h).cities.get(x).distance); break; } } if (tmp == null) throw new RuntimeException("City doesn't exist"); LinkedList<Distance> thisDist = new LinkedList<Distance>(); thisDist.add(tmp); thisDist.add(cities.get(a).cities.get(b)); thisDist.add(cities.get(b).cities.get(c)); thisDist.add(cities.get(c).cities.get(d)); thisDist.add(cities.get(d).cities.get(e)); thisDist.add(cities.get(e).cities.get(f)); thisDist.add(cities.get(f).cities.get(g)); thisDist.add(cities.get(g).cities.get(h)); //Distance tmp = null; tmp = null; for (int x=0; x<cities.get(h).cities.size(); x++) { if (cities.get(h).cities.get(x).cityFrom == startingCity) { tmp = cities.get(h).cities.get(x); break; } } if (tmp == null) throw new RuntimeException("City doesn't exist"); // Add in last node because it's a circuit thisDist.add(tmp); // Check all nodes connect to each other (forced limitation) boolean invalid = false; for (int x=1; x<thisDist.size(); x++) { if (thisDist.get(x).cityTo != thisDist.get(x-1).cityFrom) { invalid = true; break; } } if (invalid) continue; // Check minus the first and last nodes that each node traveled to is 'unique' for (int x=0; x<thisDist.size()-1; x++) { for (int y=0; y<thisDist.size()-1; y++) { if (invalid || x==y) continue; if (thisDist.get(x).cityTo == thisDist.get(y).cityTo) invalid = true; } } if (invalid) continue; connectDist totalDist = new connectDist(thisDist); totalDist.calculate(); if (totalDist.distance < lowestDist) { lowestDist = totalDist.distance; lowest = totalDist; } } } } } } } } } shortestPath = lowest; } } class City { public String name; public LinkedList<Distance> cities; public City(String newName) { name = newName; cities = new LinkedList<Distance>(); } public void connect(City targetCity, int distance) { this.cities.add(new Distance(this, targetCity, distance)); targetCity.cities.add(new Distance(targetCity, this, distance)); } } class Distance { City cityFrom; City cityTo; public int distance; public Distance(City nCityTo, City nCityFrom, int dist) { cityTo=nCityTo; cityFrom=nCityFrom; distance=dist; } } public class distances { public static void main(String[] args) { City seattle = new City("Seattle"); City newyork = new City("New York"); City omaha = new City("Omaha"); City boston = new City("Boston"); City sandiego = new City("San Diego"); City lasvegas = new City("Las Vegas"); City cleveland = new City("Cleveland"); City atlanta = new City("Atlanta"); City albany = new City("Albany"); LinkedList<City> allCities = new LinkedList<City>(); allCities.add(seattle); allCities.add(newyork); allCities.add(omaha); allCities.add(boston); allCities.add(sandiego); allCities.add(lasvegas); allCities.add(cleveland); allCities.add(atlanta); allCities.add(albany); seattle.connect(newyork, 2890); seattle.connect(omaha, 1724); seattle.connect(boston, 3065); seattle.connect(sandiego, 1265); seattle.connect(lasvegas, 1122); seattle.connect(cleveland, 2421); seattle.connect(atlanta, 2675); seattle.connect(albany, 2899); newyork.connect(omaha, 1265); newyork.connect(boston, 211); newyork.connect(sandiego, 2836); newyork.connect(lasvegas, 2551); newyork.connect(cleveland, 483); newyork.connect(atlanta, 896); newyork.connect(albany, 153); omaha.connect(boston, 1440); omaha.connect(sandiego, 1619); omaha.connect(lasvegas, 1286); omaha.connect(cleveland, 496); omaha.connect(atlanta, 1000); omaha.connect(albany, 1274); boston.connect(sandiego, 3064); boston.connect(lasvegas, 2726); boston.connect(cleveland, 644); boston.connect(atlanta, 1000); boston.connect(albany, 166); sandiego.connect(lasvegas, 335); sandiego.connect(cleveland, 2423); sandiego.connect(atlanta, 2154); sandiego.connect(albany, 2898); lasvegas.connect(cleveland, 2085); lasvegas.connect(atlanta, 1982); lasvegas.connect(albany, 2560); cleveland.connect(atlanta, 715); cleveland.connect(albany, 478); atlanta.connect(albany, 998); Path path = new Path(newyork, allCities); path.find(); System.out.println(path.list()); } }
UTF-8
Java
10,497
java
distances.java
Java
[ { "context": "\n/**\n * Author: David Irving\n *\n * Attempts to brute force a circuit.\n *\n * No", "end": 28, "score": 0.9998671412467957, "start": 16, "tag": "NAME", "value": "David Irving" } ]
null
[]
/** * Author: <NAME> * * Attempts to brute force a circuit. * * Note: I think I mentioned this was 9^2^2^2^2..(etc) iterations somewhere but * I meant was 9^9 iterations. * * Unlike my notes suggest, I've actually completed it and it will finish quickly. * No more quantum computer or RAM necessary. * * A limitation is that it'll only use each node once, but it will find the smallest * circuit as description suggests. */ import java.util.LinkedList; class connectDist { int distance; LinkedList<Distance> cities; public connectDist(LinkedList<Distance> allCities) { cities = (LinkedList<Distance>) allCities.clone(); distance = 0; } public void calculate() { distance = 0; for (int i=0; i<cities.size(); i++) distance += cities.get(i).distance; } public int getDistance() { return distance; } public String list() { String export = ""; for (int i=0; i<cities.size(); i++) export = export + cities.get(i).cityTo.name+"->"+cities.get(i).cityFrom.name+"\n"; return export; } } // More specifically, it's a circuit class Path { LinkedList<City> cities; City startingCity; connectDist shortestPath; public Path(City startCity, LinkedList<City> allCities) { cities = (LinkedList<City>) allCities.clone(); // Need to calculate it against other nodes cities.remove(startCity); startingCity=startCity; shortestPath = null; } public String list() { if (shortestPath == null) return "Path not calculated"; return shortestPath.list()+" \n"+shortestPath.getDistance()+" (miles)"; } public void find() { connectDist lowest = null; int lowestDist = 99999999; LinkedList<connectDist> alldistances = new LinkedList<connectDist>(); int iterations = 0; for (int a=0; a<cities.size(); a++) { for (int b=0; b<cities.size(); b++) { for (int c=0; c<cities.size(); c++) { for (int d=0; d<cities.size(); d++) { for (int e=0; e<cities.size(); e++) { for (int f=0; f<cities.size(); f++) { for (int g=0; g<cities.size(); g++) { for (int h=0; h<cities.size(); h++) { Distance tmp = null; for (int x=0; x<cities.get(h).cities.size(); x++) { if (cities.get(h).cities.get(x).cityFrom == startingCity) { // Flip the front nodes around tmp = new Distance(startingCity, cities.get(h), cities.get(h).cities.get(x).distance); break; } } if (tmp == null) throw new RuntimeException("City doesn't exist"); LinkedList<Distance> thisDist = new LinkedList<Distance>(); thisDist.add(tmp); thisDist.add(cities.get(a).cities.get(b)); thisDist.add(cities.get(b).cities.get(c)); thisDist.add(cities.get(c).cities.get(d)); thisDist.add(cities.get(d).cities.get(e)); thisDist.add(cities.get(e).cities.get(f)); thisDist.add(cities.get(f).cities.get(g)); thisDist.add(cities.get(g).cities.get(h)); //Distance tmp = null; tmp = null; for (int x=0; x<cities.get(h).cities.size(); x++) { if (cities.get(h).cities.get(x).cityFrom == startingCity) { tmp = cities.get(h).cities.get(x); break; } } if (tmp == null) throw new RuntimeException("City doesn't exist"); // Add in last node because it's a circuit thisDist.add(tmp); // Check all nodes connect to each other (forced limitation) boolean invalid = false; for (int x=1; x<thisDist.size(); x++) { if (thisDist.get(x).cityTo != thisDist.get(x-1).cityFrom) { invalid = true; break; } } if (invalid) continue; // Check minus the first and last nodes that each node traveled to is 'unique' for (int x=0; x<thisDist.size()-1; x++) { for (int y=0; y<thisDist.size()-1; y++) { if (invalid || x==y) continue; if (thisDist.get(x).cityTo == thisDist.get(y).cityTo) invalid = true; } } if (invalid) continue; connectDist totalDist = new connectDist(thisDist); totalDist.calculate(); if (totalDist.distance < lowestDist) { lowestDist = totalDist.distance; lowest = totalDist; } } } } } } } } } shortestPath = lowest; } } class City { public String name; public LinkedList<Distance> cities; public City(String newName) { name = newName; cities = new LinkedList<Distance>(); } public void connect(City targetCity, int distance) { this.cities.add(new Distance(this, targetCity, distance)); targetCity.cities.add(new Distance(targetCity, this, distance)); } } class Distance { City cityFrom; City cityTo; public int distance; public Distance(City nCityTo, City nCityFrom, int dist) { cityTo=nCityTo; cityFrom=nCityFrom; distance=dist; } } public class distances { public static void main(String[] args) { City seattle = new City("Seattle"); City newyork = new City("New York"); City omaha = new City("Omaha"); City boston = new City("Boston"); City sandiego = new City("San Diego"); City lasvegas = new City("Las Vegas"); City cleveland = new City("Cleveland"); City atlanta = new City("Atlanta"); City albany = new City("Albany"); LinkedList<City> allCities = new LinkedList<City>(); allCities.add(seattle); allCities.add(newyork); allCities.add(omaha); allCities.add(boston); allCities.add(sandiego); allCities.add(lasvegas); allCities.add(cleveland); allCities.add(atlanta); allCities.add(albany); seattle.connect(newyork, 2890); seattle.connect(omaha, 1724); seattle.connect(boston, 3065); seattle.connect(sandiego, 1265); seattle.connect(lasvegas, 1122); seattle.connect(cleveland, 2421); seattle.connect(atlanta, 2675); seattle.connect(albany, 2899); newyork.connect(omaha, 1265); newyork.connect(boston, 211); newyork.connect(sandiego, 2836); newyork.connect(lasvegas, 2551); newyork.connect(cleveland, 483); newyork.connect(atlanta, 896); newyork.connect(albany, 153); omaha.connect(boston, 1440); omaha.connect(sandiego, 1619); omaha.connect(lasvegas, 1286); omaha.connect(cleveland, 496); omaha.connect(atlanta, 1000); omaha.connect(albany, 1274); boston.connect(sandiego, 3064); boston.connect(lasvegas, 2726); boston.connect(cleveland, 644); boston.connect(atlanta, 1000); boston.connect(albany, 166); sandiego.connect(lasvegas, 335); sandiego.connect(cleveland, 2423); sandiego.connect(atlanta, 2154); sandiego.connect(albany, 2898); lasvegas.connect(cleveland, 2085); lasvegas.connect(atlanta, 1982); lasvegas.connect(albany, 2560); cleveland.connect(atlanta, 715); cleveland.connect(albany, 478); atlanta.connect(albany, 998); Path path = new Path(newyork, allCities); path.find(); System.out.println(path.list()); } }
10,491
0.421073
0.404973
299
34.10368
27.887602
134
false
false
0
0
0
0
0
0
0.692308
false
false
9
6d2d1dc24de5e8f02ec0c0101ff801c489760123
9,766,755,697,091
e77f03c27c93d5e13e1cb80bc8612aeff5634b5c
/src/br/unicap/p3/View/AreaVendedor.java
a6fdaeb4916e25b85ffc2cee2968b5a15a653065
[]
no_license
ViniLopes87/Projeto-Lojinha
https://github.com/ViniLopes87/Projeto-Lojinha
32644b6a4a88871bf41cc1c4ed7d322601d28cd4
f1019718e55f0b68f0053e1a4735908f6d1269ad
refs/heads/main
2023-01-31T08:48:28.534000
2020-12-11T11:30:03
2020-12-11T11:30:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.unicap.p3.View; import br.unicap.p3.Controle.FachadaControle; import br.unicap.p3.Controle.Funcionario; import br.unicap.p3.Controle.GerenciarProdutos; import br.unicap.p3.Exceptions.ProdutosException; import br.unicap.p3.Exceptions.SenhaCPFException; import java.util.Scanner; public class AreaVendedor { private FachadaControle FC = FachadaControle.getObjeto(); public void Login() throws ProdutosException { Scanner input = new Scanner(System.in); int Opcao; do { Menus.MenuLoginVendedor(); Opcao = input.nextInt(); switch (Opcao) { case 1: try { FC.LoginFuncionario(); } catch (SenhaCPFException e) { e.printStackTrace(); } AreadoVendedor(); break; case 0: break; default: System.out.println("Valor inv�lido!"); } } while (Opcao != 0); } public void AreadoVendedor() throws ProdutosException { Scanner input = new Scanner(System.in); int Opcao; do { Menus.MenuVendedor(); Opcao = input.nextInt(); switch (Opcao) { case 1: FC.CadastrarProduto(); break; case 2: FC.RemoverProduto(); break; case 3: FC.AlterarProduto(); break; case 0: break; default: System.out.println("Valor inv�lido!"); } } while (Opcao != 0); } }
UTF-8
Java
1,690
java
AreaVendedor.java
Java
[]
null
[]
package br.unicap.p3.View; import br.unicap.p3.Controle.FachadaControle; import br.unicap.p3.Controle.Funcionario; import br.unicap.p3.Controle.GerenciarProdutos; import br.unicap.p3.Exceptions.ProdutosException; import br.unicap.p3.Exceptions.SenhaCPFException; import java.util.Scanner; public class AreaVendedor { private FachadaControle FC = FachadaControle.getObjeto(); public void Login() throws ProdutosException { Scanner input = new Scanner(System.in); int Opcao; do { Menus.MenuLoginVendedor(); Opcao = input.nextInt(); switch (Opcao) { case 1: try { FC.LoginFuncionario(); } catch (SenhaCPFException e) { e.printStackTrace(); } AreadoVendedor(); break; case 0: break; default: System.out.println("Valor inv�lido!"); } } while (Opcao != 0); } public void AreadoVendedor() throws ProdutosException { Scanner input = new Scanner(System.in); int Opcao; do { Menus.MenuVendedor(); Opcao = input.nextInt(); switch (Opcao) { case 1: FC.CadastrarProduto(); break; case 2: FC.RemoverProduto(); break; case 3: FC.AlterarProduto(); break; case 0: break; default: System.out.println("Valor inv�lido!"); } } while (Opcao != 0); } }
1,690
0.504152
0.495848
60
27.116667
15.96464
59
false
false
0
0
0
0
0
0
1
false
false
9
1b518a53d41d079d6e4ef005c059944fed47b0a7
1,632,087,622,193
08f0279918553c3a43354bee22531023288cfe3c
/src/main/java/com/aplanatraining/homework2/exercise5/SweetFactory.java
ccd25dbe6841663ca87f325576d95675d1094949
[]
no_license
grizzlitank/homework
https://github.com/grizzlitank/homework
eccbc64f8015aa7498b241ecf34ec3b220e1e704
69a132e1e954c8ca28fcecf08fff23cbc89a03c2
refs/heads/master
2020-03-14T05:28:53.851000
2018-05-01T21:15:50
2018-05-01T21:15:50
131,464,815
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aplanatraining.homework2.exercise5; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class SweetFactory { public static List<Sweet> sweetList = Arrays.asList( new Sweet("Сникерс", 50, 60, 30), new Candy("Коровка", 10, 10, 5), new Jellybean("Коричневый", 5, 5, "сопли") ); public static void main(String[] args) { SweetFactory sweetFactory = new SweetFactory(); sweetFactory.printWeight(); sweetFactory.printPrice(); sweetFactory.printSweetList(); } /** * @author Ilya Arkhipov * The method print sum weight of sweetList */ public void printWeight(){ System.out.println("Weight of sweetList:"); int weight = 0; for(Sweet sweet : sweetList){ weight+= sweet.getWeight(); } System.out.println(weight); } /** * @author Ilya Arkhipov * The method print sum price of sweetList */ public void printPrice(){ System.out.println("Price of sweetList:"); int price = 0; for(Sweet sweet : sweetList){ price+= sweet.getPrice(); } System.out.println(price); } /** * @author Ilya Arkhipov * The method print sweetList */ public void printSweetList(){ System.out.println(sweetList); } }
UTF-8
Java
1,417
java
SweetFactory.java
Java
[ { "context": "weet> sweetList = Arrays.asList(\n new Sweet(\"Сникерс\", 50, 60, 30),\n new Candy(\"Коровка\", 10, 10,", "end": 236, "score": 0.9883314967155457, "start": 229, "tag": "NAME", "value": "Сникерс" }, { "context": "ew Sweet(\"Сникерс\", 50, 60, 30),\n new Candy(\"Коровка\", 10, 10, 5),\n new Jellybean(\"Коричневый\", 5", "end": 276, "score": 0.9730707406997681, "start": 269, "tag": "NAME", "value": "Коровка" }, { "context": "Candy(\"Коровка\", 10, 10, 5),\n new Jellybean(\"Коричневый\", 5, 5, \"сопли\")\n );\n\n public static void m", "end": 322, "score": 0.8200531005859375, "start": 312, "tag": "NAME", "value": "Коричневый" }, { "context": "printSweetList();\n\n\n\n }\n\n /**\n * @author Ilya Arkhipov\n * The method print sum weight of sweetList\n ", "end": 605, "score": 0.9998911619186401, "start": 592, "tag": "NAME", "value": "Ilya Arkhipov" }, { "context": "ut.println(weight);\n }\n\n\n /**\n * @author Ilya Arkhipov\n * The method print sum price of sweetList\n ", "end": 937, "score": 0.9998841881752014, "start": 924, "tag": "NAME", "value": "Ilya Arkhipov" }, { "context": "out.println(price);\n }\n\n\n /**\n * @author Ilya Arkhipov\n * The method print sweetList\n */\n pub", "end": 1262, "score": 0.9998884201049805, "start": 1249, "tag": "NAME", "value": "Ilya Arkhipov" } ]
null
[]
package com.aplanatraining.homework2.exercise5; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class SweetFactory { public static List<Sweet> sweetList = Arrays.asList( new Sweet("Сникерс", 50, 60, 30), new Candy("Коровка", 10, 10, 5), new Jellybean("Коричневый", 5, 5, "сопли") ); public static void main(String[] args) { SweetFactory sweetFactory = new SweetFactory(); sweetFactory.printWeight(); sweetFactory.printPrice(); sweetFactory.printSweetList(); } /** * @author <NAME> * The method print sum weight of sweetList */ public void printWeight(){ System.out.println("Weight of sweetList:"); int weight = 0; for(Sweet sweet : sweetList){ weight+= sweet.getWeight(); } System.out.println(weight); } /** * @author <NAME> * The method print sum price of sweetList */ public void printPrice(){ System.out.println("Price of sweetList:"); int price = 0; for(Sweet sweet : sweetList){ price+= sweet.getPrice(); } System.out.println(price); } /** * @author <NAME> * The method print sweetList */ public void printSweetList(){ System.out.println(sweetList); } }
1,396
0.591499
0.579251
62
21.387096
18.101288
56
false
false
0
0
0
0
0
0
0.467742
false
false
9
c1846b5087916a6bc4074d95953013ef23a57815
34,711,925,695,057
2c52516518934d667301aab21582078c82db8ccc
/lab03/src/main/java/br/com/laboratory/controller/TaskController.java
04295a452546fc11c85fa60e85556b5e72d73d86
[]
no_license
manoelf/si-2016.1
https://github.com/manoelf/si-2016.1
1894f93bffc86ab5222b25be6ef9038f4c402631
fe0f0d4912386e7c28ce6c6d7be59e76541eaac0
refs/heads/master
2020-07-06T03:12:59.225000
2017-02-11T01:38:55
2017-02-11T01:38:55
74,061,954
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.laboratory.controller; import br.com.laboratory.model.banks.TaskBank; import br.com.laboratory.model.tasks.RealTask; import br.com.laboratory.model.tasks.SubTask; import br.com.laboratory.model.tasks.Task; import br.com.laboratory.service.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.management.modelmbean.ModelMBeanOperationInfo; import java.util.ArrayList; import java.util.List; /** * Created by manoelferreira on 2/4/17. */ @Controller @RequestMapping("/task") public class TaskController { @Autowired private TaskService taskService; @RequestMapping(value = "/newTask", method = RequestMethod.GET) public String newTask(Model model) { model.addAttribute("allCategories", taskService.getAllCategory()); model.addAttribute("bankNames", this.taskService.getAllTaskBank()); return "task/taskform"; } @RequestMapping(value = "/check", method = RequestMethod.POST) public String check(boolean isDone, String alltaskdone, RealTask task, Model model) { return "task/taskform"; } private List<SubTask> subTasks = new ArrayList<>(); @RequestMapping(value = "/addTask", method = RequestMethod.POST) public String addTask(@ModelAttribute RealTask task, String subTaskList, String bankName, Model model) { for (String subTaskName: subTaskList.split(",")) { task.addSubTask(new SubTask(subTaskName)); } subTasks.addAll(task.getAllSubTask()); this.taskService.addTask(bankName, task); model.addAttribute(task); model.addAttribute("allSubtask", task.getAllSubTask()); return "redirect:/task/taskList"; } @RequestMapping(value = "/taskList", method = RequestMethod.GET) public String taskList(Model model) { model.addAttribute("taskList", taskService.getAllTasks()); model.addAttribute("allSubtask", subTasks); return "task/tasklist"; } @RequestMapping(value = "newTaskBank", method = RequestMethod.GET) public String newTaskBank(Model model) { return "task/taskbankform"; } @RequestMapping(value = "addTaskBank", method = RequestMethod.POST ) public String addTaskBankForm(@ModelAttribute TaskBank taskBank, Model model) { taskService.addTaskBank(taskBank); return "redirect:/task/taskBankList"; } @RequestMapping(value = "taskBankList", method = RequestMethod.GET) public String taskBankList(Model model) { model.addAttribute("taskBankList", taskService.getAllTaskBank()); return "task/taskbanklist"; } @RequestMapping(value = "newCategory", method = RequestMethod.GET) public String newCategory(Model model) { return "task/categoryform"; } @RequestMapping(value = "addCategory", method = RequestMethod.POST) public String addCategoryForm(String category, Model model) { taskService.addCategory(category); return "redirect:/task/categoryList"; } @RequestMapping(value = "categoryList", method = RequestMethod.GET) public String categoryList(Model model) { model.addAttribute("categoryList", taskService.getAllCategory()); return "task/categorylist"; } @RequestMapping(value = "getCategories", method = RequestMethod.POST) public String getCategories(Model model) { model.addAttribute("allCategories", taskService.getAllCategory()); return "redirect:/task/categoryList"; } private List<RealTask> tasksTemp;// = new ArrayList<>(); @RequestMapping(value = "/categories", method = RequestMethod.GET) public String filterByCategoryForm(Model model) { model.addAttribute("allCategories", taskService.getAllCategory()); return "task/filtercategoryform"; } @RequestMapping(value = "byCategories", method = RequestMethod.POST) public String filterByCategory(String category, Model model) { tasksTemp = taskService.getAllTaskOfCategory(category); return "redirect:/task/showCategories"; } @RequestMapping(value = "/showCategories", method = RequestMethod.GET) public String showCategories(Model model) { model.addAttribute("allCategories", tasksTemp); return "task/allbycategory"; } @RequestMapping(value = "/priorities", method = RequestMethod.GET) public String filterByPriorityForm(Model model) { return "task/allbypriorityform"; } @RequestMapping(value = "/byPriorities", method = RequestMethod.POST) public String filterByPriority(String priority, Model model) { tasksTemp = taskService.getAllTaskOfPriority(priority); return "redirect:/task/prioritySelected"; } @RequestMapping(value = "/prioritySelected", method = RequestMethod.GET) public String showPrioritiesSelected(Model model) { model.addAttribute("allPriorities", tasksTemp); return "task/allbypriorities"; } @RequestMapping(value = "/sortedByName", method = RequestMethod.GET) public String sortedByName(Model model) { model.addAttribute("taskList", this.taskService.showAllTaskSortedByName()); return "task/tasklist"; } @RequestMapping(value = "/sortedByPriority", method = RequestMethod.GET) public String sortedByPriority(Model model) { model.addAttribute("taskList", this.taskService.showAllTaskSortedByPriority()); return "task/tasklist"; } }
UTF-8
Java
5,806
java
TaskController.java
Java
[ { "context": "ayList;\nimport java.util.List;\n\n\n/**\n * Created by manoelferreira on 2/4/17.\n */\n@Controller\n@RequestMapping(\"/task", "end": 811, "score": 0.9977355599403381, "start": 797, "tag": "USERNAME", "value": "manoelferreira" } ]
null
[]
package br.com.laboratory.controller; import br.com.laboratory.model.banks.TaskBank; import br.com.laboratory.model.tasks.RealTask; import br.com.laboratory.model.tasks.SubTask; import br.com.laboratory.model.tasks.Task; import br.com.laboratory.service.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.management.modelmbean.ModelMBeanOperationInfo; import java.util.ArrayList; import java.util.List; /** * Created by manoelferreira on 2/4/17. */ @Controller @RequestMapping("/task") public class TaskController { @Autowired private TaskService taskService; @RequestMapping(value = "/newTask", method = RequestMethod.GET) public String newTask(Model model) { model.addAttribute("allCategories", taskService.getAllCategory()); model.addAttribute("bankNames", this.taskService.getAllTaskBank()); return "task/taskform"; } @RequestMapping(value = "/check", method = RequestMethod.POST) public String check(boolean isDone, String alltaskdone, RealTask task, Model model) { return "task/taskform"; } private List<SubTask> subTasks = new ArrayList<>(); @RequestMapping(value = "/addTask", method = RequestMethod.POST) public String addTask(@ModelAttribute RealTask task, String subTaskList, String bankName, Model model) { for (String subTaskName: subTaskList.split(",")) { task.addSubTask(new SubTask(subTaskName)); } subTasks.addAll(task.getAllSubTask()); this.taskService.addTask(bankName, task); model.addAttribute(task); model.addAttribute("allSubtask", task.getAllSubTask()); return "redirect:/task/taskList"; } @RequestMapping(value = "/taskList", method = RequestMethod.GET) public String taskList(Model model) { model.addAttribute("taskList", taskService.getAllTasks()); model.addAttribute("allSubtask", subTasks); return "task/tasklist"; } @RequestMapping(value = "newTaskBank", method = RequestMethod.GET) public String newTaskBank(Model model) { return "task/taskbankform"; } @RequestMapping(value = "addTaskBank", method = RequestMethod.POST ) public String addTaskBankForm(@ModelAttribute TaskBank taskBank, Model model) { taskService.addTaskBank(taskBank); return "redirect:/task/taskBankList"; } @RequestMapping(value = "taskBankList", method = RequestMethod.GET) public String taskBankList(Model model) { model.addAttribute("taskBankList", taskService.getAllTaskBank()); return "task/taskbanklist"; } @RequestMapping(value = "newCategory", method = RequestMethod.GET) public String newCategory(Model model) { return "task/categoryform"; } @RequestMapping(value = "addCategory", method = RequestMethod.POST) public String addCategoryForm(String category, Model model) { taskService.addCategory(category); return "redirect:/task/categoryList"; } @RequestMapping(value = "categoryList", method = RequestMethod.GET) public String categoryList(Model model) { model.addAttribute("categoryList", taskService.getAllCategory()); return "task/categorylist"; } @RequestMapping(value = "getCategories", method = RequestMethod.POST) public String getCategories(Model model) { model.addAttribute("allCategories", taskService.getAllCategory()); return "redirect:/task/categoryList"; } private List<RealTask> tasksTemp;// = new ArrayList<>(); @RequestMapping(value = "/categories", method = RequestMethod.GET) public String filterByCategoryForm(Model model) { model.addAttribute("allCategories", taskService.getAllCategory()); return "task/filtercategoryform"; } @RequestMapping(value = "byCategories", method = RequestMethod.POST) public String filterByCategory(String category, Model model) { tasksTemp = taskService.getAllTaskOfCategory(category); return "redirect:/task/showCategories"; } @RequestMapping(value = "/showCategories", method = RequestMethod.GET) public String showCategories(Model model) { model.addAttribute("allCategories", tasksTemp); return "task/allbycategory"; } @RequestMapping(value = "/priorities", method = RequestMethod.GET) public String filterByPriorityForm(Model model) { return "task/allbypriorityform"; } @RequestMapping(value = "/byPriorities", method = RequestMethod.POST) public String filterByPriority(String priority, Model model) { tasksTemp = taskService.getAllTaskOfPriority(priority); return "redirect:/task/prioritySelected"; } @RequestMapping(value = "/prioritySelected", method = RequestMethod.GET) public String showPrioritiesSelected(Model model) { model.addAttribute("allPriorities", tasksTemp); return "task/allbypriorities"; } @RequestMapping(value = "/sortedByName", method = RequestMethod.GET) public String sortedByName(Model model) { model.addAttribute("taskList", this.taskService.showAllTaskSortedByName()); return "task/tasklist"; } @RequestMapping(value = "/sortedByPriority", method = RequestMethod.GET) public String sortedByPriority(Model model) { model.addAttribute("taskList", this.taskService.showAllTaskSortedByPriority()); return "task/tasklist"; } }
5,806
0.712194
0.711505
157
35.980892
28.421637
108
false
false
0
0
0
0
0
0
0.66242
false
false
9
a9311754932b70b4f66cc36b78b582c56a3b833f
7,885,559,998,987
f21b12b2a515bfd2723372ff74b67ce9a73599ec
/tcc-api/src/main/java/org/ihtsdo/otf/tcc/api/store/Ts.java
cf44f79b23c3a72adf744d20a5e9eeee9f819cf8
[]
no_license
Apelon-VA/va-ochre
https://github.com/Apelon-VA/va-ochre
44d0ee08a9bb6bb917efb36d8ba9093bad9fb216
677355de5a2a7f25fb59f08182633689075c7b93
refs/heads/develop
2020-12-24T14:00:41.848000
2015-10-01T07:20:00
2015-10-01T07:20:00
33,519,478
2
1
null
false
2015-06-26T14:14:18
2015-04-07T03:18:28
2015-05-08T01:27:12
2015-06-26T14:14:17
4,573
0
1
0
Java
null
null
package org.ihtsdo.otf.tcc.api.store; import org.glassfish.hk2.api.ServiceHandle; import org.ihtsdo.otf.tcc.lookup.Hk2Looker; /** * Ts is short for Terminology termstore... * * @author kec * */ public class Ts { private static TerminologyStoreDI store; //~--- get methods --------------------------------------------------------- public static TerminologyStoreDI get() { if (store == null) { store = Hk2Looker.get().getService(TerminologyStoreDI.class); } return store; } /** * Determine if a TermStore has been constructed - does not construct one if it isn't yet active. * There are currently issues with the TermStore implementation that causes it to not operate in a headless * environment - this method is needed to not hit those errors in certain cases (like building the metadata on the * continuous integration server) */ public static boolean hasActiveTermStore() { ServiceHandle<TerminologyStoreDI> sh = Hk2Looker.get().getServiceHandle(TerminologyStoreDI.class); if (sh == null) { return false; } else { return sh.isActive(); } } }
UTF-8
Java
1,202
java
Ts.java
Java
[ { "context": "s short for Terminology termstore...\n *\n * @author kec\n *\n */\n\npublic class Ts {\n\n\n private static Te", "end": 193, "score": 0.9996036291122437, "start": 190, "tag": "USERNAME", "value": "kec" } ]
null
[]
package org.ihtsdo.otf.tcc.api.store; import org.glassfish.hk2.api.ServiceHandle; import org.ihtsdo.otf.tcc.lookup.Hk2Looker; /** * Ts is short for Terminology termstore... * * @author kec * */ public class Ts { private static TerminologyStoreDI store; //~--- get methods --------------------------------------------------------- public static TerminologyStoreDI get() { if (store == null) { store = Hk2Looker.get().getService(TerminologyStoreDI.class); } return store; } /** * Determine if a TermStore has been constructed - does not construct one if it isn't yet active. * There are currently issues with the TermStore implementation that causes it to not operate in a headless * environment - this method is needed to not hit those errors in certain cases (like building the metadata on the * continuous integration server) */ public static boolean hasActiveTermStore() { ServiceHandle<TerminologyStoreDI> sh = Hk2Looker.get().getServiceHandle(TerminologyStoreDI.class); if (sh == null) { return false; } else { return sh.isActive(); } } }
1,202
0.622296
0.618968
44
26.318182
32.273529
117
false
false
0
0
0
0
0
0
0.204545
false
false
9
4a27a57d26d4db9dd81ad8b248dad2fcd7fb3b13
20,761,871,952,798
e3fa93ce2e64930ae03214edb29c5e69aa342ad4
/app/src/main/java/com/coolweather/android/service/AutoUpdateService.java
17d241267a34597f62ceb094875fe3a0f3c51070
[ "Apache-2.0" ]
permissive
ChenJia-X/coolweather
https://github.com/ChenJia-X/coolweather
4d98bde2b0adacc87872d123f83204e090b2f9f8
73d1815d90649d64779f3e782e2f8b50ce60467d
refs/heads/master
2021-05-12T05:45:40.937000
2018-02-24T12:57:17
2018-02-24T12:57:17
117,202,098
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.coolweather.android.service; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.content.SharedPreferences; import android.os.IBinder; import android.os.SystemClock; import android.preference.PreferenceManager; import android.widget.Toast; import com.coolweather.android.gson.Weather; import com.coolweather.android.util.HttpUtil; import com.coolweather.android.util.Utility; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; import okhttp3.Response; import static com.coolweather.android.WeatherActivity.REQUEST_BING_PIC; import static com.coolweather.android.WeatherActivity.WEATHER_ROOT_NAME; import static com.coolweather.android.WeatherActivity.KEY; public class AutoUpdateService extends Service { public AutoUpdateService() { } @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { updateWeather(); updateBingPic(); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); int hours = 1000 * 3600 * 8;//8 hours long triggerAtTime = SystemClock.elapsedRealtime() + hours; Intent intent1 = new Intent(this, AutoUpdateService.class); PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent1, 0); alarmManager.cancel(pendingIntent);//先取消使用过pendingIntent的alarm,再设置新的alarm alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, pendingIntent); return super.onStartCommand(intent, flags, startId); } private void updateBingPic() { HttpUtil.sendOkHttpRequest(REQUEST_BING_PIC, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); } @Override public void onResponse(Call call, Response response) throws IOException { String bingPic = response.body().string(); SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(AutoUpdateService.this).edit(); editor.putString("bing_pic", bingPic); editor.apply(); } }); } private void updateWeather() { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String weatherString = preferences.getString("weather", null); if (weatherString != null) { Weather lastWeather = Utility.handleWeatherResponse(weatherString); String weatherUrl = WEATHER_ROOT_NAME + lastWeather.basic.weatherId + "&key=" + KEY; HttpUtil.sendOkHttpRequest(weatherUrl, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); Toast.makeText(AutoUpdateService.this, "获取信息失败", Toast.LENGTH_SHORT).show(); } @Override public void onResponse(Call call, Response response) throws IOException { String responseText = response.body().string(); Weather weather= Utility.handleWeatherResponse(responseText); if (weather != null && weather.status.equals("ok")) { SharedPreferences.Editor editor = preferences.edit(); editor.putString("weather", responseText); editor.apply(); } } }); } } }
UTF-8
Java
3,747
java
AutoUpdateService.java
Java
[]
null
[]
package com.coolweather.android.service; import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.content.SharedPreferences; import android.os.IBinder; import android.os.SystemClock; import android.preference.PreferenceManager; import android.widget.Toast; import com.coolweather.android.gson.Weather; import com.coolweather.android.util.HttpUtil; import com.coolweather.android.util.Utility; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.OkHttpClient; import okhttp3.Response; import static com.coolweather.android.WeatherActivity.REQUEST_BING_PIC; import static com.coolweather.android.WeatherActivity.WEATHER_ROOT_NAME; import static com.coolweather.android.WeatherActivity.KEY; public class AutoUpdateService extends Service { public AutoUpdateService() { } @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { updateWeather(); updateBingPic(); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); int hours = 1000 * 3600 * 8;//8 hours long triggerAtTime = SystemClock.elapsedRealtime() + hours; Intent intent1 = new Intent(this, AutoUpdateService.class); PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent1, 0); alarmManager.cancel(pendingIntent);//先取消使用过pendingIntent的alarm,再设置新的alarm alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, pendingIntent); return super.onStartCommand(intent, flags, startId); } private void updateBingPic() { HttpUtil.sendOkHttpRequest(REQUEST_BING_PIC, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); } @Override public void onResponse(Call call, Response response) throws IOException { String bingPic = response.body().string(); SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(AutoUpdateService.this).edit(); editor.putString("bing_pic", bingPic); editor.apply(); } }); } private void updateWeather() { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String weatherString = preferences.getString("weather", null); if (weatherString != null) { Weather lastWeather = Utility.handleWeatherResponse(weatherString); String weatherUrl = WEATHER_ROOT_NAME + lastWeather.basic.weatherId + "&key=" + KEY; HttpUtil.sendOkHttpRequest(weatherUrl, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); Toast.makeText(AutoUpdateService.this, "获取信息失败", Toast.LENGTH_SHORT).show(); } @Override public void onResponse(Call call, Response response) throws IOException { String responseText = response.body().string(); Weather weather= Utility.handleWeatherResponse(responseText); if (weather != null && weather.status.equals("ok")) { SharedPreferences.Editor editor = preferences.edit(); editor.putString("weather", responseText); editor.apply(); } } }); } } }
3,747
0.656966
0.652115
95
38.063156
29.99888
127
false
false
0
0
0
0
0
0
0.757895
false
false
9
5e994fc60c19f03e7822782e90717db7394068a9
18,683,107,796,748
1151cd71c740c2a768fb4c09f7ddf7870545a1e6
/app/src/main/java/com/example/biggernumber/MainActivity.java
11b2557c83b5ebdbe272f4523e840985db1da80e
[]
no_license
prabhjotkaur88/BiggerNumber
https://github.com/prabhjotkaur88/BiggerNumber
8df460d5286726a4b7e05040c44ba09ca9fb5068
7a2cc84261106987b35f0c4c47817e93fb313d46
refs/heads/master
2020-08-26T19:14:15.471000
2019-10-23T17:32:37
2019-10-23T17:32:37
217,115,896
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.biggernumber; import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.TextView; import org.w3c.dom.Text; import java.util.Random; public class MainActivity extends AppCompatActivity { private int num1; private int num2; private int scores; private int maxLives; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); scores = 0; maxLives = 5; pickNumbers(); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void leftButtonClick(View view) { if (num1 > num2) { scores++; TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("Congratulations! You are correct"); } else if (maxLives <=0) { TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLivesID.setText("Game Over!"); } else { TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("You are wrong!"); TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLives--; maxLivesID.setText("Lives:" + maxLives); } pickNumbers(); } public void rightButtonClick(View view) { if (num2 > num1) { scores++; TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("Congratulations! You are correct"); } else if (maxLives<=0) { TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLivesID.setText("Game Over!"); } else { TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("You are wrong!"); TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLives--; maxLivesID.setText("Lives:" + maxLives); } pickNumbers(); } private void pickNumbers() { TextView scoreID = (TextView) findViewById(R.id.scoreID); scoreID.setText("Scores:" + scores); Random randy = new Random(); num1 = randy.nextInt(100); num2 = randy.nextInt(100); Button left = (Button) findViewById(R.id.leftButton); Button right = (Button) findViewById(R.id.rightButton); left.setText(String.valueOf(num1)); right.setText(String.valueOf(num2)); } }
UTF-8
Java
4,187
java
MainActivity.java
Java
[]
null
[]
package com.example.biggernumber; import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.TextView; import org.w3c.dom.Text; import java.util.Random; public class MainActivity extends AppCompatActivity { private int num1; private int num2; private int scores; private int maxLives; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); scores = 0; maxLives = 5; pickNumbers(); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void leftButtonClick(View view) { if (num1 > num2) { scores++; TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("Congratulations! You are correct"); } else if (maxLives <=0) { TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLivesID.setText("Game Over!"); } else { TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("You are wrong!"); TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLives--; maxLivesID.setText("Lives:" + maxLives); } pickNumbers(); } public void rightButtonClick(View view) { if (num2 > num1) { scores++; TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("Congratulations! You are correct"); } else if (maxLives<=0) { TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLivesID.setText("Game Over!"); } else { TextView messageID = (TextView) findViewById(R.id.messageID); messageID.setText("You are wrong!"); TextView maxLivesID = (TextView) findViewById(R.id.maxLivesID); maxLives--; maxLivesID.setText("Lives:" + maxLives); } pickNumbers(); } private void pickNumbers() { TextView scoreID = (TextView) findViewById(R.id.scoreID); scoreID.setText("Scores:" + scores); Random randy = new Random(); num1 = randy.nextInt(100); num2 = randy.nextInt(100); Button left = (Button) findViewById(R.id.leftButton); Button right = (Button) findViewById(R.id.rightButton); left.setText(String.valueOf(num1)); right.setText(String.valueOf(num2)); } }
4,187
0.597086
0.592071
172
23.343023
25.488798
89
false
false
0
0
0
0
0
0
0.401163
false
false
9
926f951c036ba4092c9f469a339efa12f2bc5863
18,683,107,797,676
a5f8d519adebdee1bb49947738e12e3d079722ac
/src/main/java/org/Models/ConnectionPoint.java
04b29db10d0d920c90ac44090e728d6c63b07b64
[]
no_license
moritzwicki/SwissTransportGUI
https://github.com/moritzwicki/SwissTransportGUI
c152b0f8dd9b3e32593e4eb2d61a416c5904a77a
dc57507b28bd88da01d80b35a54f9af76f19130c
refs/heads/main
2023-03-29T13:57:47.587000
2021-04-01T12:50:53
2021-04-01T12:50:53
353,374,432
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.Models; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.LocalDateTime; import java.util.Date; @JsonIgnoreProperties(ignoreUnknown = true) public class ConnectionPoint { @JsonProperty("station") public Station Station; @JsonProperty("arrival") public String Arrival; @JsonProperty("arrivalTimestamp") public String ArrivalTimestamp; @JsonProperty("departure") public String Departure; @JsonProperty("departureTimestamp") public String DepartureTimestamp; @JsonProperty("delay") public int Delay; @JsonProperty("platform") public String Platform; @JsonProperty("realtimeAvailability") public String RealtimeAvailability; }
UTF-8
Java
832
java
ConnectionPoint.java
Java
[]
null
[]
package org.Models; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.LocalDateTime; import java.util.Date; @JsonIgnoreProperties(ignoreUnknown = true) public class ConnectionPoint { @JsonProperty("station") public Station Station; @JsonProperty("arrival") public String Arrival; @JsonProperty("arrivalTimestamp") public String ArrivalTimestamp; @JsonProperty("departure") public String Departure; @JsonProperty("departureTimestamp") public String DepartureTimestamp; @JsonProperty("delay") public int Delay; @JsonProperty("platform") public String Platform; @JsonProperty("realtimeAvailability") public String RealtimeAvailability; }
832
0.716346
0.716346
37
20.486486
17.696573
61
false
false
0
0
0
0
0
0
0.351351
false
false
9
16251156e526b1d57d3053c9d9f985ee3531f7da
18,683,107,795,400
e8db24041fde9bb634582ba2e42270178f5f6327
/src/com/mpc/controls/disk/window/SaveAProgramControls.java
858b07cd12cde8d1e2141289aee5f14a34448795
[]
no_license
izzyreal/vmpc-java
https://github.com/izzyreal/vmpc-java
7bdf40f40fc2bc93fb1315f38af95b38167bf018
87b51bc7fe44edfc397d178ef0fda27bc5f56f20
refs/heads/master
2020-12-02T06:42:42.751000
2017-07-11T11:18:47
2017-07-11T11:18:47
96,884,968
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mpc.controls.disk.window; import com.mpc.Util; import com.mpc.controls.disk.AbstractDiskControls; public class SaveAProgramControls extends AbstractDiskControls { public void turnWheel(int i) { init(); int notch = getNotch(i); if (param.equals("save")) diskGui.setSave(diskGui.getPgmSave() + notch); if (param.equals("replacesamesounds")) diskGui.setSaveReplaceSameSounds(notch > 0); } public void function(int i) { init(); switch (i) { case 3: mainFrame.openScreen("save", "mainpanel"); break; case 4: String fileName = Util.getFileName(nameGui.getName()) + ".PGM"; System.out.println("wanting to save as " + fileName); if (disk.checkExists(fileName)) { nameGui.setName(program.getName()); mainFrame.openScreen("filealreadyexists", "windowpanel"); return; } disk.writeProgram(program, fileName); mainFrame.openScreen("save", "mainpanel"); break; } } }
UTF-8
Java
964
java
SaveAProgramControls.java
Java
[]
null
[]
package com.mpc.controls.disk.window; import com.mpc.Util; import com.mpc.controls.disk.AbstractDiskControls; public class SaveAProgramControls extends AbstractDiskControls { public void turnWheel(int i) { init(); int notch = getNotch(i); if (param.equals("save")) diskGui.setSave(diskGui.getPgmSave() + notch); if (param.equals("replacesamesounds")) diskGui.setSaveReplaceSameSounds(notch > 0); } public void function(int i) { init(); switch (i) { case 3: mainFrame.openScreen("save", "mainpanel"); break; case 4: String fileName = Util.getFileName(nameGui.getName()) + ".PGM"; System.out.println("wanting to save as " + fileName); if (disk.checkExists(fileName)) { nameGui.setName(program.getName()); mainFrame.openScreen("filealreadyexists", "windowpanel"); return; } disk.writeProgram(program, fileName); mainFrame.openScreen("save", "mainpanel"); break; } } }
964
0.676349
0.673236
34
26.352942
24.559511
85
false
false
0
0
0
0
0
0
2.441176
false
false
9
54d2c39be754fc9603df67ef2628954ada1a4fc1
19,370,302,552,791
6d7c2423286d58b5f379ca7a913c74f4dac0cdd5
/src/main/java/com/bisale/po/exchange/InviteRelationPo.java
49ff1bb47975c769fa5575f6d45fd83ed8bb49e3
[]
no_license
yangpeng00/test
https://github.com/yangpeng00/test
fe590bda7035bdb70f1ae82354381737935f44fa
5272f98ace1744c12128a3ff93169c34157f9eaa
HEAD
2018-12-09T23:59:26.047000
2018-09-12T04:03:27
2018-09-12T04:03:27
148,411,490
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bisale.po.exchange; import java.io.Serializable; import java.util.Date; public class InviteRelationPo implements Serializable { private Integer id; private Integer inviterId; private String inviterAccount; private Integer inviteeId; private String inviteeAccount; private Integer level; private String activity; private Date createdAt; private Date updatedAt; private static final long serialVersionUID = 1L; public InviteRelationPo() {} public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getInviterId() { return inviterId; } public void setInviterId(Integer inviterId) { this.inviterId = inviterId; } public String getInviterAccount() { return inviterAccount; } public void setInviterAccount(String inviterAccount) { this.inviterAccount = inviterAccount; } public Integer getInviteeId() { return inviteeId; } public void setInviteeId(Integer inviteeId) { this.inviteeId = inviteeId; } public String getInviteeAccount() { return inviteeAccount; } public void setInviteeAccount(String inviteeAccount) { this.inviteeAccount = inviteeAccount; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public String getActivity() { return activity; } public void setActivity(String activity) { this.activity = activity; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } public static long getSerialVersionUID() { return serialVersionUID; } @Override public String toString() { return "InviteRelationPo{" + "id=" + id + ", inviterId=" + inviterId + ", inviterAccount='" + inviterAccount + '\'' + ", inviteeId=" + inviteeId + ", inviteeAccount='" + inviteeAccount + '\'' + ", level=" + level + ", activity='" + activity + '\'' + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + '}'; } }
UTF-8
Java
2,555
java
InviteRelationPo.java
Java
[]
null
[]
package com.bisale.po.exchange; import java.io.Serializable; import java.util.Date; public class InviteRelationPo implements Serializable { private Integer id; private Integer inviterId; private String inviterAccount; private Integer inviteeId; private String inviteeAccount; private Integer level; private String activity; private Date createdAt; private Date updatedAt; private static final long serialVersionUID = 1L; public InviteRelationPo() {} public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getInviterId() { return inviterId; } public void setInviterId(Integer inviterId) { this.inviterId = inviterId; } public String getInviterAccount() { return inviterAccount; } public void setInviterAccount(String inviterAccount) { this.inviterAccount = inviterAccount; } public Integer getInviteeId() { return inviteeId; } public void setInviteeId(Integer inviteeId) { this.inviteeId = inviteeId; } public String getInviteeAccount() { return inviteeAccount; } public void setInviteeAccount(String inviteeAccount) { this.inviteeAccount = inviteeAccount; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public String getActivity() { return activity; } public void setActivity(String activity) { this.activity = activity; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } public static long getSerialVersionUID() { return serialVersionUID; } @Override public String toString() { return "InviteRelationPo{" + "id=" + id + ", inviterId=" + inviterId + ", inviterAccount='" + inviterAccount + '\'' + ", inviteeId=" + inviteeId + ", inviteeAccount='" + inviteeAccount + '\'' + ", level=" + level + ", activity='" + activity + '\'' + ", createdAt=" + createdAt + ", updatedAt=" + updatedAt + '}'; } }
2,555
0.590998
0.590607
119
20.478992
18.575237
62
false
false
0
0
0
0
0
0
0.344538
false
false
9
bcf40ae57b223a1020c35209841356435114ecd6
10,084,583,277,052
c026127f4ebc2fe14c9072b028bfd1988d8cd85c
/src/main/java/Allservlet/Validatemember.java
572f1bfba6b05bfa72788913ee0187f8cd524711
[]
no_license
yogeshgithup/CGS
https://github.com/yogeshgithup/CGS
f5c97b5c04517ecab934359fa9ccee6d375cf7cf
9d2ba3be84f9ae7a466671df7bda192833285d83
refs/heads/master
2023-05-02T12:30:06.421000
2020-07-24T10:14:49
2020-07-24T10:14:49
152,397,315
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Allservlet; import com.mycompany.loginmodule.Members; import java.io.IOException; import java.io.PrintWriter; import java.util.HashSet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import operations.DataOperation; /** * * @author Shravan */ public class Validatemember extends HttpServlet { ServletContext scx; @Override public void init(ServletConfig sc) throws ServletException { super.init(sc); scx = getServletContext(); try { scx = sc.getServletContext(); } catch (Exception e) { System.out.println(e.getMessage()); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { PrintWriter out = response.getWriter(); HttpSession hs=request.getSession(true); int branchid= Integer.parseInt(hs.getAttribute("branchid").toString()); int gymid=Integer.parseInt(hs.getAttribute("gymid").toString()); DataOperation doo=new DataOperation(scx,gymid); if(request.getParameter("msg").equals("one")) { if (request.getParameter("id") != null) { String id = request.getParameter("id"); doo.sendmessage(id); out.println("message send"); } } else if(request.getParameter("msg").equals("all")) { String branchidi=request.getParameter("id"); System.out.println("---"+branchidi); doo.sendmessage_all(branchidi); out.println("message sent to all"); } else if(request.getParameter("msg").equals("view")) { HashSet<Members> listCatagory=doo.invalidmember(branchid); hs.setAttribute("setvalidmember",listCatagory); if(hs!=null) { response.sendRedirect(scx.getContextPath()+"/gymui/pannel/view_X_members1.jsp"); } } } catch (Exception e) { System.out.println(e.getMessage()); } } }
UTF-8
Java
2,703
java
Validatemember.java
Java
[ { "context": "mport operations.DataOperation;\n\n/**\n *\n * @author Shravan\n */\npublic class Validatemember extends HttpServl", "end": 673, "score": 0.9995713829994202, "start": 666, "tag": "NAME", "value": "Shravan" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Allservlet; import com.mycompany.loginmodule.Members; import java.io.IOException; import java.io.PrintWriter; import java.util.HashSet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import operations.DataOperation; /** * * @author Shravan */ public class Validatemember extends HttpServlet { ServletContext scx; @Override public void init(ServletConfig sc) throws ServletException { super.init(sc); scx = getServletContext(); try { scx = sc.getServletContext(); } catch (Exception e) { System.out.println(e.getMessage()); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { PrintWriter out = response.getWriter(); HttpSession hs=request.getSession(true); int branchid= Integer.parseInt(hs.getAttribute("branchid").toString()); int gymid=Integer.parseInt(hs.getAttribute("gymid").toString()); DataOperation doo=new DataOperation(scx,gymid); if(request.getParameter("msg").equals("one")) { if (request.getParameter("id") != null) { String id = request.getParameter("id"); doo.sendmessage(id); out.println("message send"); } } else if(request.getParameter("msg").equals("all")) { String branchidi=request.getParameter("id"); System.out.println("---"+branchidi); doo.sendmessage_all(branchidi); out.println("message sent to all"); } else if(request.getParameter("msg").equals("view")) { HashSet<Members> listCatagory=doo.invalidmember(branchid); hs.setAttribute("setvalidmember",listCatagory); if(hs!=null) { response.sendRedirect(scx.getContextPath()+"/gymui/pannel/view_X_members1.jsp"); } } } catch (Exception e) { System.out.println(e.getMessage()); } } }
2,703
0.63929
0.63892
89
29.370787
23.960821
94
false
false
0
0
0
0
0
0
0.505618
false
false
9
2f18c31d248c660516ba3b467e49e064490693cf
30,923,764,558,900
5a2a605bca8130a21c100e2073a45dcace6fadc6
/app/src/main/java/cn/hg/kline/MainActivity.java
629c1c733e4559bcbd80b36398b32ea4e8c28124
[]
no_license
YellowDoing/HgKline
https://github.com/YellowDoing/HgKline
ec9f1c8cee97f5e85bada109600c1d3ac7588c74
8db859a392a221c78af86241f0f484e41f65ce50
refs/heads/master
2020-03-29T09:15:51.531000
2018-11-05T03:04:47
2018-11-05T03:04:47
149,749,284
6
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.hg.kline; import android.graphics.Color; import android.graphics.Paint; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import com.github.mikephil.charting.data.CandleEntry; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.util.ArrayList; import java.util.List; import cn.hg.huobikline.KlineView; import cn.hg.huobikline.SubKlineView; public class MainActivity extends AppCompatActivity{ private KlineView mKlineView; //主图 private SubKlineView mSubKlineView; //幅图 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mKlineView = findViewById(R.id.k_line_view); mSubKlineView = findViewById(R.id.sub_view); //生成一组假数据 List<Data> datas = new Gson().fromJson(JsonReader.getJson("data.json", this), new TypeToken<List<Data>>() { }.getType()); final List<CandleEntry> candleEntries = new ArrayList<>(); for (int i = 0; i < datas.size(); i++) { Data data = datas.get(i); candleEntries.add(new CandleEntry(i, data.getHigh(), data.getLow(), data.getOpen(), data.getClose())); } mKlineView.setData(candleEntries); mSubKlineView.setVolData(candleEntries); //分时图 findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mKlineView.setMinuteData(candleEntries); } }); //K线图 findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mKlineView.setData(candleEntries); } }); //vol findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setVolData(candleEntries); } }); //macd findViewById(R.id.button4).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setMacdData(candleEntries); } }); //kdj findViewById(R.id.button5).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setKdjData(candleEntries); } }); //rsi findViewById(R.id.button6).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setRsiData(candleEntries); } }); //wr findViewById(R.id.button7).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setWrData(candleEntries); } }); } }
UTF-8
Java
3,150
java
MainActivity.java
Java
[ { "context": ".Log;\nimport android.view.View;\nimport com.github.mikephil.charting.data.CandleEntry;\nimport com.google.gson", "end": 236, "score": 0.9952957034111023, "start": 228, "tag": "USERNAME", "value": "mikephil" } ]
null
[]
package cn.hg.kline; import android.graphics.Color; import android.graphics.Paint; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import com.github.mikephil.charting.data.CandleEntry; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.util.ArrayList; import java.util.List; import cn.hg.huobikline.KlineView; import cn.hg.huobikline.SubKlineView; public class MainActivity extends AppCompatActivity{ private KlineView mKlineView; //主图 private SubKlineView mSubKlineView; //幅图 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mKlineView = findViewById(R.id.k_line_view); mSubKlineView = findViewById(R.id.sub_view); //生成一组假数据 List<Data> datas = new Gson().fromJson(JsonReader.getJson("data.json", this), new TypeToken<List<Data>>() { }.getType()); final List<CandleEntry> candleEntries = new ArrayList<>(); for (int i = 0; i < datas.size(); i++) { Data data = datas.get(i); candleEntries.add(new CandleEntry(i, data.getHigh(), data.getLow(), data.getOpen(), data.getClose())); } mKlineView.setData(candleEntries); mSubKlineView.setVolData(candleEntries); //分时图 findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mKlineView.setMinuteData(candleEntries); } }); //K线图 findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mKlineView.setData(candleEntries); } }); //vol findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setVolData(candleEntries); } }); //macd findViewById(R.id.button4).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setMacdData(candleEntries); } }); //kdj findViewById(R.id.button5).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setKdjData(candleEntries); } }); //rsi findViewById(R.id.button6).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setRsiData(candleEntries); } }); //wr findViewById(R.id.button7).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSubKlineView.setWrData(candleEntries); } }); } }
3,150
0.608403
0.605516
101
29.871286
26.26697
115
false
false
0
0
0
0
0
0
0.475248
false
false
9
cb5d7ade244fa86c0819e86cb9ab78966dce1e0f
33,543,694,619,528
c948e92c9b7346a38486a6b8e81aad223a490894
/src/com/ansorgit/plugins/bash/lang/psi/impl/refactoring/BashCommandManipulator.java
62eae16c3aa5f705a8f50d45dd0aeec76a1489e6
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
t0r0X/BashSupport
https://github.com/t0r0X/BashSupport
abc4b506434fe4f080c89c95dcf24d3b62637412
b4472d719fd3ec382ce82fae6cc343cfe489dcfb
refs/heads/master
2020-04-02T18:19:48.287000
2018-11-03T16:04:24
2018-11-03T16:04:24
154,660,072
0
0
Apache-2.0
true
2018-10-25T11:32:44
2018-10-25T11:32:44
2018-10-24T02:34:13
2018-10-17T22:43:06
12,553
0
0
0
null
false
null
/* * Copyright (c) Joachim Ansorg, mail@ansorg-it.com * * 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.ansorgit.plugins.bash.lang.psi.impl.refactoring; import com.ansorgit.plugins.bash.lang.psi.api.command.BashCommand; import com.ansorgit.plugins.bash.lang.psi.api.command.BashGenericCommand; import com.ansorgit.plugins.bash.lang.psi.util.BashPsiElementFactory; import com.ansorgit.plugins.bash.lang.psi.util.BashPsiUtils; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.ElementManipulator; import com.intellij.psi.PsiElement; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; /** * Handles element manipulation of Bash function and file references. */ public class BashCommandManipulator implements ElementManipulator<BashCommand> { @Override public BashCommand handleContentChange(@NotNull BashCommand cmd, @NotNull TextRange textRange, String newElementName) throws IncorrectOperationException { if (StringUtil.isEmpty(newElementName)) { throw new IncorrectOperationException("Can not handle empty names"); } PsiElement commandElement = cmd.commandElement(); if (commandElement == null) { throw new IncorrectOperationException("invalid command"); } BashGenericCommand replacement = BashPsiElementFactory.createCommand(cmd.getProject(), newElementName); BashPsiUtils.replaceElement(commandElement, replacement); return cmd; } @Override public BashCommand handleContentChange(@NotNull final BashCommand element, final String newContent) throws IncorrectOperationException { return handleContentChange(element, TextRange.create(0, element.getTextLength()), newContent); } @NotNull @Override public TextRange getRangeInElement(@NotNull BashCommand cmd) { final PsiElement element = cmd.commandElement(); if (element == null) { return TextRange.from(0, cmd.getTextLength()); } return TextRange.from(element.getStartOffsetInParent(), element.getTextLength()); } }
UTF-8
Java
2,688
java
BashCommandManipulator.java
Java
[ { "context": "/*\n * Copyright (c) Joachim Ansorg, mail@ansorg-it.com\n *\n * Licensed under the Apac", "end": 34, "score": 0.9998679757118225, "start": 20, "tag": "NAME", "value": "Joachim Ansorg" }, { "context": "/*\n * Copyright (c) Joachim Ansorg, mail@ansorg-it.com\n *\n * Licensed under the Apache License, Version ", "end": 54, "score": 0.9999294877052307, "start": 36, "tag": "EMAIL", "value": "mail@ansorg-it.com" } ]
null
[]
/* * Copyright (c) <NAME>, <EMAIL> * * 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.ansorgit.plugins.bash.lang.psi.impl.refactoring; import com.ansorgit.plugins.bash.lang.psi.api.command.BashCommand; import com.ansorgit.plugins.bash.lang.psi.api.command.BashGenericCommand; import com.ansorgit.plugins.bash.lang.psi.util.BashPsiElementFactory; import com.ansorgit.plugins.bash.lang.psi.util.BashPsiUtils; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.ElementManipulator; import com.intellij.psi.PsiElement; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; /** * Handles element manipulation of Bash function and file references. */ public class BashCommandManipulator implements ElementManipulator<BashCommand> { @Override public BashCommand handleContentChange(@NotNull BashCommand cmd, @NotNull TextRange textRange, String newElementName) throws IncorrectOperationException { if (StringUtil.isEmpty(newElementName)) { throw new IncorrectOperationException("Can not handle empty names"); } PsiElement commandElement = cmd.commandElement(); if (commandElement == null) { throw new IncorrectOperationException("invalid command"); } BashGenericCommand replacement = BashPsiElementFactory.createCommand(cmd.getProject(), newElementName); BashPsiUtils.replaceElement(commandElement, replacement); return cmd; } @Override public BashCommand handleContentChange(@NotNull final BashCommand element, final String newContent) throws IncorrectOperationException { return handleContentChange(element, TextRange.create(0, element.getTextLength()), newContent); } @NotNull @Override public TextRange getRangeInElement(@NotNull BashCommand cmd) { final PsiElement element = cmd.commandElement(); if (element == null) { return TextRange.from(0, cmd.getTextLength()); } return TextRange.from(element.getStartOffsetInParent(), element.getTextLength()); } }
2,669
0.750744
0.748512
65
40.353848
36.350189
158
false
false
0
0
0
0
0
0
0.569231
false
false
9
8c462ee457d50b1762856ce2c8ac35b881bd0f80
32,212,254,759,779
9b10d68318bc36d2131e9bec2088eb2aeb3ea2ee
/app/src/main/java/com/keco1249/yelpsearch/SearchView.java
5cf5e14107f62aee9db5191c40026b828d84c058
[]
no_license
keco1249/YelpSearch
https://github.com/keco1249/YelpSearch
3cddd2a131f311978007b2bdd495692fde81bd7d
852638cded08abe4eabc40ce56fc868f2e8359c7
refs/heads/master
2021-05-15T10:59:44.717000
2017-11-08T17:14:09
2017-11-08T17:14:09
108,219,199
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.keco1249.yelpsearch; import com.keco1249.yelpsearch.search.SearchResult; import java.util.List; /** * Defines the ui operations needed by the app to separate concerns between the Activity/View/Fragment * the controller and the model. */ public interface SearchView { void displayResults(List<SearchResult> searchResults); void displaySearchHistory(List<String> searchHistoryList); void closeSearchHistoryList(); String getSearchText(); void handleSearchFailure(); }
UTF-8
Java
508
java
SearchView.java
Java
[ { "context": "package com.keco1249.yelpsearch;\n\nimport com.keco1249.yelpsearch.searc", "end": 20, "score": 0.968583345413208, "start": 12, "tag": "USERNAME", "value": "keco1249" }, { "context": "package com.keco1249.yelpsearch;\n\nimport com.keco1249.yelpsearch.search.SearchResult;\n\nimport java.util", "end": 53, "score": 0.9826109409332275, "start": 45, "tag": "USERNAME", "value": "keco1249" } ]
null
[]
package com.keco1249.yelpsearch; import com.keco1249.yelpsearch.search.SearchResult; import java.util.List; /** * Defines the ui operations needed by the app to separate concerns between the Activity/View/Fragment * the controller and the model. */ public interface SearchView { void displayResults(List<SearchResult> searchResults); void displaySearchHistory(List<String> searchHistoryList); void closeSearchHistoryList(); String getSearchText(); void handleSearchFailure(); }
508
0.767717
0.751969
21
23.190475
26.865837
102
false
false
0
0
0
0
0
0
0.380952
false
false
9
1d67455ba4ee9059635a4b0f3dae53d7f4e4512b
12,275,016,556,531
b2d8587ea6a7be0348cb032f4f5438abddfa90c4
/Backend/src/main/java/hr/algebra/dujmovic/confapp/rest/LectureRestController.java
c72a8d006c73f78d2f51742677e9ab6a13440d57
[]
no_license
Abdullah12has/Interoperability_Project
https://github.com/Abdullah12has/Interoperability_Project
26df11c4d5d996f586d91f6d0df10d2c672858a3
cb5f09b6de3915e75307134b7f0b2e5a1b703c3d
refs/heads/main
2023-06-15T03:53:51.710000
2021-07-13T23:09:49
2021-07-13T23:09:49
385,756,424
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hr.algebra.dujmovic.confapp.rest; import hr.algebra.dujmovic.confapp.data.LectureRepository; import hr.algebra.dujmovic.confapp.model.Lecture; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.jms.core.JmsTemplate; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; /** * * @author matij */ @RestController @RequestMapping(path = "/api/lecture", produces = "application/json") @CrossOrigin(origins = "*") public class LectureRestController { private final JmsTemplate jmsTemplate; @Autowired LectureRepository repository; public LectureRestController(JmsTemplate jmsTemplate) { this.jmsTemplate = jmsTemplate; } @GetMapping public Iterable<Lecture> findAll() { jmsTemplate.convertAndSend("The Lecture: " +repository.findAll().toString() + " are Fetched! \n"); return repository.findAll(); } @GetMapping("/{id}") public ResponseEntity<Lecture> findOne(@PathVariable Long id) { Optional<Lecture> lecture = repository.findById(id); if(lecture.isPresent()){ jmsTemplate.convertAndSend("The Lecture: " + lecture.toString() + " is Fetched! \n"); return new ResponseEntity<>(lecture.get(), HttpStatus.OK); } else { return new ResponseEntity<>(null, HttpStatus.NOT_FOUND); } } @ResponseStatus(HttpStatus.CREATED) @PostMapping(consumes = "application/json") public Lecture save(@RequestBody Lecture lecture) { return repository.save(lecture); } @PutMapping("/{id}") public ResponseEntity<Lecture> update(@PathVariable Long id, @RequestBody Lecture lecture) { if (repository.findById(id).isPresent()) { lecture.setId(id); lecture = repository.save(lecture); jmsTemplate.convertAndSend("The Lecture: " + lecture.toString() + " is Updated! \n"); return new ResponseEntity<>(lecture, HttpStatus.OK); } else { return new ResponseEntity<>(null, HttpStatus.NOT_FOUND); } } @ResponseStatus(HttpStatus.NO_CONTENT) @DeleteMapping("/{id}") public void delete(@PathVariable Long id) { jmsTemplate.convertAndSend("The Lecture: " + id + " is Deleted! \n"); repository.deleteById(id); } }
UTF-8
Java
3,189
java
LectureRestController.java
Java
[ { "context": "ind.annotation.RestController;\n\n\n/**\n *\n * @author matij\n */\n@RestController\n@RequestMapping(path = \"/api/", "end": 1203, "score": 0.9550626277923584, "start": 1198, "tag": "USERNAME", "value": "matij" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hr.algebra.dujmovic.confapp.rest; import hr.algebra.dujmovic.confapp.data.LectureRepository; import hr.algebra.dujmovic.confapp.model.Lecture; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.jms.core.JmsTemplate; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; /** * * @author matij */ @RestController @RequestMapping(path = "/api/lecture", produces = "application/json") @CrossOrigin(origins = "*") public class LectureRestController { private final JmsTemplate jmsTemplate; @Autowired LectureRepository repository; public LectureRestController(JmsTemplate jmsTemplate) { this.jmsTemplate = jmsTemplate; } @GetMapping public Iterable<Lecture> findAll() { jmsTemplate.convertAndSend("The Lecture: " +repository.findAll().toString() + " are Fetched! \n"); return repository.findAll(); } @GetMapping("/{id}") public ResponseEntity<Lecture> findOne(@PathVariable Long id) { Optional<Lecture> lecture = repository.findById(id); if(lecture.isPresent()){ jmsTemplate.convertAndSend("The Lecture: " + lecture.toString() + " is Fetched! \n"); return new ResponseEntity<>(lecture.get(), HttpStatus.OK); } else { return new ResponseEntity<>(null, HttpStatus.NOT_FOUND); } } @ResponseStatus(HttpStatus.CREATED) @PostMapping(consumes = "application/json") public Lecture save(@RequestBody Lecture lecture) { return repository.save(lecture); } @PutMapping("/{id}") public ResponseEntity<Lecture> update(@PathVariable Long id, @RequestBody Lecture lecture) { if (repository.findById(id).isPresent()) { lecture.setId(id); lecture = repository.save(lecture); jmsTemplate.convertAndSend("The Lecture: " + lecture.toString() + " is Updated! \n"); return new ResponseEntity<>(lecture, HttpStatus.OK); } else { return new ResponseEntity<>(null, HttpStatus.NOT_FOUND); } } @ResponseStatus(HttpStatus.NO_CONTENT) @DeleteMapping("/{id}") public void delete(@PathVariable Long id) { jmsTemplate.convertAndSend("The Lecture: " + id + " is Deleted! \n"); repository.deleteById(id); } }
3,189
0.712449
0.712449
89
34.831459
28.100636
106
false
false
0
0
0
0
0
0
0.494382
false
false
9
a0048ebeeebc5c009e903e607e0bf560e5584ccf
1,864,015,848,205
c32cda167eed2cf8d5425b5bec6c5f892d8effd9
/src/main/java/com/example/sleepo/MainActivity.java
a0fb803d18f4501289776b59e9fd62d61e67e92c
[]
no_license
shazeen37/Sleepo
https://github.com/shazeen37/Sleepo
8406486d594dfa610dd15ea4b841ccadf235b8ab
11dc3ce6d4114897fdea8d3b601b53d7a5c0df79
refs/heads/main
2023-06-09T15:32:20.018000
2021-06-29T12:57:53
2021-06-29T12:57:53
381,365,018
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.sleepo; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.hanks.passcodeview.PasscodeView; public class MainActivity extends AppCompatActivity { PasscodeView passcodeView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); passcodeView=findViewById(R.id.passcodeView); passcodeView.setPasscodeLength(5) .setLocalPasscode("11223") .setListener(new PasscodeView.PasscodeViewListener() { @Override public void onFail() { Toast.makeText(MainActivity.this, "Wrong passcode", Toast.LENGTH_SHORT).show(); } @Override public void onSuccess(String number) { Intent intent= new Intent(MainActivity.this,MainActivity2.class); startActivity(intent); } }); } }
UTF-8
Java
1,142
java
MainActivity.java
Java
[ { "context": "scodeLength(5)\n .setLocalPasscode(\"11223\")\n .setListener(new PasscodeView.P", "end": 594, "score": 0.9871265292167664, "start": 589, "tag": "PASSWORD", "value": "11223" } ]
null
[]
package com.example.sleepo; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.hanks.passcodeview.PasscodeView; public class MainActivity extends AppCompatActivity { PasscodeView passcodeView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); passcodeView=findViewById(R.id.passcodeView); passcodeView.setPasscodeLength(5) .setLocalPasscode("<PASSWORD>") .setListener(new PasscodeView.PasscodeViewListener() { @Override public void onFail() { Toast.makeText(MainActivity.this, "Wrong passcode", Toast.LENGTH_SHORT).show(); } @Override public void onSuccess(String number) { Intent intent= new Intent(MainActivity.this,MainActivity2.class); startActivity(intent); } }); } }
1,147
0.611208
0.605079
35
31.657143
25.658129
103
false
false
0
0
0
0
0
0
0.485714
false
false
9
6803bb3d472c98b85682c76e74a4f884ba544ac5
16,896,401,393,302
24d254417936515d15c96091f947640b39f46a85
/src/com/zq/service/ResBean.java
f56e5596c270ef54d25747a8a4689c3f01d5ee45
[]
no_license
SG-XM/servlet_demo
https://github.com/SG-XM/servlet_demo
338df764362e35fc79901a191fdba31ac6874f78
6e0a804c8a625a57a4e62dad839047cf3972c5ee
refs/heads/master
2020-08-09T11:06:50.600000
2019-10-10T03:01:30
2019-10-10T03:01:30
214,073,935
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zq.service; import java.io.Serializable; import java.util.Collections; import java.util.List; public class ResBean<T> implements Serializable { public int code; public String msg; public List<T> res = Collections.emptyList(); private ResBean(int code, String msg) { this.code = code; this.msg = msg; } private ResBean(int code, String msg, List<T> res) { this.code = code; this.msg = msg; this.res = res; } public static <E> ResBean succWithRes(List<E> res) { return new ResBean<E>(200, "成功", res); } public static ResBean succ() { return new ResBean(200, "成功"); } public static ResBean err(String msg) { return new ResBean(-1, msg); } @Override public String toString() { return "{\"code\":\"" + code + "\",\"msg\":\"" + msg + "\",\"res\":"+res.toString()+"}"; } }
UTF-8
Java
930
java
ResBean.java
Java
[]
null
[]
package com.zq.service; import java.io.Serializable; import java.util.Collections; import java.util.List; public class ResBean<T> implements Serializable { public int code; public String msg; public List<T> res = Collections.emptyList(); private ResBean(int code, String msg) { this.code = code; this.msg = msg; } private ResBean(int code, String msg, List<T> res) { this.code = code; this.msg = msg; this.res = res; } public static <E> ResBean succWithRes(List<E> res) { return new ResBean<E>(200, "成功", res); } public static ResBean succ() { return new ResBean(200, "成功"); } public static ResBean err(String msg) { return new ResBean(-1, msg); } @Override public String toString() { return "{\"code\":\"" + code + "\",\"msg\":\"" + msg + "\",\"res\":"+res.toString()+"}"; } }
930
0.577007
0.569414
39
22.641026
21.235538
96
false
false
0
0
0
0
0
0
0.641026
false
false
9
d33212209859c49799b464e67c23a9a3a225384d
16,896,401,395,241
2ee88f6afe73fae52586c3127710d01f03506b8d
/src/main/java/com/processexcel/controller/User_reg_logController.java
dd2c2c4ca55ed728c01d68c193383e56b5ad2999
[]
no_license
fardad2105/processexcel
https://github.com/fardad2105/processexcel
007a0a480fde2744881c17fb3af5b9a6083a46af
0e92e7da89e533322166a4ca923f7732cb498cec
refs/heads/master
2020-05-02T21:20:50.123000
2019-03-28T14:13:33
2019-03-28T14:13:33
178,217,539
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.processexcel.controller; import com.processexcel.model.authorities; import com.processexcel.model.users; import com.processexcel.repo.RoleRepo; import com.processexcel.repo.UserRepo; import com.processexcel.utils.CustomErrorType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import java.net.URI; @RestController public class User_reg_logController { public static final Logger logger = LoggerFactory.getLogger(User_reg_logController.class); @Autowired private UserRepo userRepo; @Autowired private RoleRepo roleRepo; @PostMapping(value = "/register/user",produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<?> saveuser(@ModelAttribute users users) { if (users !=null) { userRepo.save(users); authorities authorities = new authorities(); authorities.setUsername(users.getUsername()); if (users.getSystemAdmin()) authorities.setAuthority("ROLE_ADMIN"); else if (users.getCompanyAdmin()) authorities.setAuthority("ROLE_USER"); authorities.setUsers(users); roleRepo.save(authorities); URI location = ServletUriComponentsBuilder .fromCurrentRequest() .path("/{username}") .buildAndExpand(users.getUsername()).toUri(); return ResponseEntity.created(location).build(); } else { logger.info("user not found"); return new ResponseEntity<>(new CustomErrorType("your request is not found"), HttpStatus.NOT_FOUND); } } }
UTF-8
Java
2,138
java
User_reg_logController.java
Java
[]
null
[]
package com.processexcel.controller; import com.processexcel.model.authorities; import com.processexcel.model.users; import com.processexcel.repo.RoleRepo; import com.processexcel.repo.UserRepo; import com.processexcel.utils.CustomErrorType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import java.net.URI; @RestController public class User_reg_logController { public static final Logger logger = LoggerFactory.getLogger(User_reg_logController.class); @Autowired private UserRepo userRepo; @Autowired private RoleRepo roleRepo; @PostMapping(value = "/register/user",produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<?> saveuser(@ModelAttribute users users) { if (users !=null) { userRepo.save(users); authorities authorities = new authorities(); authorities.setUsername(users.getUsername()); if (users.getSystemAdmin()) authorities.setAuthority("ROLE_ADMIN"); else if (users.getCompanyAdmin()) authorities.setAuthority("ROLE_USER"); authorities.setUsers(users); roleRepo.save(authorities); URI location = ServletUriComponentsBuilder .fromCurrentRequest() .path("/{username}") .buildAndExpand(users.getUsername()).toUri(); return ResponseEntity.created(location).build(); } else { logger.info("user not found"); return new ResponseEntity<>(new CustomErrorType("your request is not found"), HttpStatus.NOT_FOUND); } } }
2,138
0.693171
0.692236
70
29.542856
27.035789
113
false
false
0
0
0
0
0
0
0.471429
false
false
9
053559218d4a7499d2bb74103b2b3a7ac44632ee
16,896,401,391,494
0a5c2cf01b84644ae411d2187ca1d71765d975a0
/src/com/tfld/awesomegolf/data/helper/Court_helper.java
d24a2a781ec62716e16df3d1c15191d065db563d
[]
no_license
loreV/awesomegolfapp
https://github.com/loreV/awesomegolfapp
5e274d30824cb2bcd4937416994c9961fcaef9a8
85791694edbf24d9805e35b09c1814bca031313c
refs/heads/master
2016-09-25T22:08:30.254000
2015-11-04T07:28:33
2015-11-04T07:28:33
20,251,244
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tfld.awesomegolf.data.helper; import java.util.ArrayList; import java.util.List; import com.tfld.awesomegolf.data.IDatabaseHelper; import com.tfld.awesomegolf.data.model.IModel; import com.tfld.awesomegolf.data.model.Court_Model; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class Court_helper extends SQLiteOpenHelper implements IDatabaseHelper { private String sql; private static final String TABLE_NAME = "Court"; public Court_helper(Context context) { super(context, TABLE_NAME , null , 1); } /** * Adds a model */ @Override public boolean add(IModel m) { SQLiteDatabase db = this.getWritableDatabase(); Court_Model Court_Model = (Court_Model) m; sql = "INSERT INTO "+TABLE_NAME +" (name, location) VALUES( "+ Court_Model.getName() + ", "+ Court_Model.getLocation()+ ")"; db.execSQL(sql); //TODO finish return false; } /** * Get ID */ @Override public IModel getById(int id) { SQLiteDatabase db = this.getWritableDatabase(); sql = "SELECT * FROM "+ TABLE_NAME+" WHERE id="+id+""; Court_Model court_Model = null; // gets back a cursor from a query Cursor c = db.rawQuery(sql, null); if(c != null) { if(c.moveToFirst()) { do { /** Depends on the properties of the entity **/ int idu = c.getInt(c.getColumnIndex("id")); String name = c.getString(c.getColumnIndex("name")); String location = c.getString(c.getColumnIndex("location")); // the Court_Model is initialized court_Model = new Court_Model(idu, name, location); } while(c.moveToNext()); } } c.close(); //TODO finish return court_Model; } /** * Retrieves all the ata of a particular entity */ @Override public List<IModel> getAll() { SQLiteDatabase db = this.getWritableDatabase(); List<Court_Model> courts = new ArrayList<Court_Model>(); sql = "SELECT * FROM "+ TABLE_NAME; //TODO finish Cursor c = db.rawQuery(sql, null); if(c != null) { if(c.moveToFirst()) { do { /** Depends on the properties of the entity **/ int idu = c.getInt(c.getColumnIndex("id")); String name = c.getString(c.getColumnIndex("name")); String location = c.getString(c.getColumnIndex("location")); // the Court_Model is initialized Court_Model game = new Court_Model(idu,name, location); courts.add(game); } while(c.moveToNext()); } } c.close(); List<IModel> ls = (List<IModel>)(List<?>) courts; return ls; } /** * Updates a model */ @Override public IModel update(IModel updated) { Court_Model Court_Model = (Court_Model) updated; sql = "UPDATE "+TABLE_NAME+" SET name="+Court_Model.getName()+ ", location=" + Court_Model.getLocation() + " WHERE id=" + Court_Model.getId(); SQLiteDatabase db = this.getWritableDatabase(); db.execSQL(sql); return Court_Model; } @Override public IModel delete(IModel modelToBeDestroyed) { SQLiteDatabase db = this.getWritableDatabase(); Court_Model court_Model = (Court_Model) modelToBeDestroyed; // first grab the model and then remove it sql = "DELETE FROM "+TABLE_NAME+" WHERE id="+court_Model.getId(); db.execSQL(sql); return null; } @Override public IModel delete(int idToDelete) { SQLiteDatabase db = this.getWritableDatabase(); sql = "DELETE FROM "+TABLE_NAME+" WHERE id="+idToDelete; db.execSQL(sql); return null; } @Override public void onCreate(SQLiteDatabase db) { this.sql = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, location TEXT);"; System.out.println(sql); db.execSQL(sql); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(db); } @Override public IModel getLastModel() { SQLiteDatabase db = this.getWritableDatabase(); this.sql = "SELECT * FROM "+ TABLE_NAME + " ORDER BY id DESC LIMIT 1"; Cursor c = db.rawQuery(sql, null); Court_Model cm = null; if(c != null) { if(c.moveToFirst()) { do { /** Depends on the properties of the entity **/ int idu = c.getInt(c.getColumnIndex("id")); String name = c.getString(c.getColumnIndex("name")); String location = c.getString(c.getColumnIndex("location")); // the Court_Model is initialized cm = new Court_Model(idu, name, location); } while(c.moveToNext()); } } c.close(); if(cm != null){ return cm; } return null; } }
UTF-8
Java
4,641
java
Court_helper.java
Java
[]
null
[]
package com.tfld.awesomegolf.data.helper; import java.util.ArrayList; import java.util.List; import com.tfld.awesomegolf.data.IDatabaseHelper; import com.tfld.awesomegolf.data.model.IModel; import com.tfld.awesomegolf.data.model.Court_Model; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class Court_helper extends SQLiteOpenHelper implements IDatabaseHelper { private String sql; private static final String TABLE_NAME = "Court"; public Court_helper(Context context) { super(context, TABLE_NAME , null , 1); } /** * Adds a model */ @Override public boolean add(IModel m) { SQLiteDatabase db = this.getWritableDatabase(); Court_Model Court_Model = (Court_Model) m; sql = "INSERT INTO "+TABLE_NAME +" (name, location) VALUES( "+ Court_Model.getName() + ", "+ Court_Model.getLocation()+ ")"; db.execSQL(sql); //TODO finish return false; } /** * Get ID */ @Override public IModel getById(int id) { SQLiteDatabase db = this.getWritableDatabase(); sql = "SELECT * FROM "+ TABLE_NAME+" WHERE id="+id+""; Court_Model court_Model = null; // gets back a cursor from a query Cursor c = db.rawQuery(sql, null); if(c != null) { if(c.moveToFirst()) { do { /** Depends on the properties of the entity **/ int idu = c.getInt(c.getColumnIndex("id")); String name = c.getString(c.getColumnIndex("name")); String location = c.getString(c.getColumnIndex("location")); // the Court_Model is initialized court_Model = new Court_Model(idu, name, location); } while(c.moveToNext()); } } c.close(); //TODO finish return court_Model; } /** * Retrieves all the ata of a particular entity */ @Override public List<IModel> getAll() { SQLiteDatabase db = this.getWritableDatabase(); List<Court_Model> courts = new ArrayList<Court_Model>(); sql = "SELECT * FROM "+ TABLE_NAME; //TODO finish Cursor c = db.rawQuery(sql, null); if(c != null) { if(c.moveToFirst()) { do { /** Depends on the properties of the entity **/ int idu = c.getInt(c.getColumnIndex("id")); String name = c.getString(c.getColumnIndex("name")); String location = c.getString(c.getColumnIndex("location")); // the Court_Model is initialized Court_Model game = new Court_Model(idu,name, location); courts.add(game); } while(c.moveToNext()); } } c.close(); List<IModel> ls = (List<IModel>)(List<?>) courts; return ls; } /** * Updates a model */ @Override public IModel update(IModel updated) { Court_Model Court_Model = (Court_Model) updated; sql = "UPDATE "+TABLE_NAME+" SET name="+Court_Model.getName()+ ", location=" + Court_Model.getLocation() + " WHERE id=" + Court_Model.getId(); SQLiteDatabase db = this.getWritableDatabase(); db.execSQL(sql); return Court_Model; } @Override public IModel delete(IModel modelToBeDestroyed) { SQLiteDatabase db = this.getWritableDatabase(); Court_Model court_Model = (Court_Model) modelToBeDestroyed; // first grab the model and then remove it sql = "DELETE FROM "+TABLE_NAME+" WHERE id="+court_Model.getId(); db.execSQL(sql); return null; } @Override public IModel delete(int idToDelete) { SQLiteDatabase db = this.getWritableDatabase(); sql = "DELETE FROM "+TABLE_NAME+" WHERE id="+idToDelete; db.execSQL(sql); return null; } @Override public void onCreate(SQLiteDatabase db) { this.sql = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, location TEXT);"; System.out.println(sql); db.execSQL(sql); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(db); } @Override public IModel getLastModel() { SQLiteDatabase db = this.getWritableDatabase(); this.sql = "SELECT * FROM "+ TABLE_NAME + " ORDER BY id DESC LIMIT 1"; Cursor c = db.rawQuery(sql, null); Court_Model cm = null; if(c != null) { if(c.moveToFirst()) { do { /** Depends on the properties of the entity **/ int idu = c.getInt(c.getColumnIndex("id")); String name = c.getString(c.getColumnIndex("name")); String location = c.getString(c.getColumnIndex("location")); // the Court_Model is initialized cm = new Court_Model(idu, name, location); } while(c.moveToNext()); } } c.close(); if(cm != null){ return cm; } return null; } }
4,641
0.658694
0.658263
186
23.951612
25.145872
144
false
false
0
0
0
0
0
0
2.473118
false
false
9
18d913545098b2efef9329c22a4b663f910c37fc
15,831,249,474,483
3f2678e38f5ac9f8200624602dbd1e8086acb0d0
/src/main/java/com/pbl/apol/restapiservice/model/Movie.java
a6c96d871f99658d623a699b4c8251f376865197
[]
no_license
lukawitek000/elasticsearch-RESTApiService
https://github.com/lukawitek000/elasticsearch-RESTApiService
8f45a5295a23271ac4cf47b19da733ce5c4c3219
b99bd64cd403323b58dd31b50c31162f09af82bc
refs/heads/main
2023-01-02T08:19:07.967000
2020-10-21T11:14:50
2020-10-21T11:14:50
305,996,449
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pbl.apol.restapiservice.model; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; @Document(indexName = "movies") public class Movie { @Id private String id; @JsonProperty("Name") @Field("Name") private String name; @Field(name = "_score") private float score; @JsonProperty("Directors") @Field("Directors") private String[] directors; @JsonProperty("Writers") @Field("Writers") private String[] writers; @JsonProperty("Genres") @Field("Genres") private String[] genres; @JsonProperty("Year") @Field("Year") private int year; @JsonProperty("Rating") @Field("Rating") private float rating; @JsonProperty("Cast") @Field("Cast") private String[] cast; @JsonProperty("Producers") @Field("Producers") private String[] producesrs; @JsonProperty("Production companies") @Field("Production companies") private String[] productionCompanies; @JsonProperty("Plot outline") @Field("Plot outline") private String plotOutline; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getScore() { return score; } public void setScore(float score) { this.score = score; } public String[] getDirectors() { return directors; } public void setDirectors(String[] directors) { this.directors = directors; } public String[] getWriters() { return writers; } public void setWriters(String[] writers) { this.writers = writers; } public String[] getGenres() { return genres; } public void setGenres(String[] genres) { this.genres = genres; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public float getRating() { return rating; } public void setRating(float rating) { this.rating = rating; } public String[] getCast() { return cast; } public void setCast(String[] cast) { this.cast = cast; } public String[] getProducesrs() { return producesrs; } public void setProducesrs(String[] producesrs) { this.producesrs = producesrs; } public String[] getProductionCompanies() { return productionCompanies; } public void setProductionCompanies(String[] productionCompanies) { this.productionCompanies = productionCompanies; } public String getPlotOutline() { return plotOutline; } public void setPlotOutline(String plotOutline) { this.plotOutline = plotOutline; } }
UTF-8
Java
3,068
java
Movie.java
Java
[]
null
[]
package com.pbl.apol.restapiservice.model; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; @Document(indexName = "movies") public class Movie { @Id private String id; @JsonProperty("Name") @Field("Name") private String name; @Field(name = "_score") private float score; @JsonProperty("Directors") @Field("Directors") private String[] directors; @JsonProperty("Writers") @Field("Writers") private String[] writers; @JsonProperty("Genres") @Field("Genres") private String[] genres; @JsonProperty("Year") @Field("Year") private int year; @JsonProperty("Rating") @Field("Rating") private float rating; @JsonProperty("Cast") @Field("Cast") private String[] cast; @JsonProperty("Producers") @Field("Producers") private String[] producesrs; @JsonProperty("Production companies") @Field("Production companies") private String[] productionCompanies; @JsonProperty("Plot outline") @Field("Plot outline") private String plotOutline; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public float getScore() { return score; } public void setScore(float score) { this.score = score; } public String[] getDirectors() { return directors; } public void setDirectors(String[] directors) { this.directors = directors; } public String[] getWriters() { return writers; } public void setWriters(String[] writers) { this.writers = writers; } public String[] getGenres() { return genres; } public void setGenres(String[] genres) { this.genres = genres; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public float getRating() { return rating; } public void setRating(float rating) { this.rating = rating; } public String[] getCast() { return cast; } public void setCast(String[] cast) { this.cast = cast; } public String[] getProducesrs() { return producesrs; } public void setProducesrs(String[] producesrs) { this.producesrs = producesrs; } public String[] getProductionCompanies() { return productionCompanies; } public void setProductionCompanies(String[] productionCompanies) { this.productionCompanies = productionCompanies; } public String getPlotOutline() { return plotOutline; } public void setPlotOutline(String plotOutline) { this.plotOutline = plotOutline; } }
3,068
0.619622
0.619622
152
19.18421
16.974215
70
false
false
0
0
0
0
0
0
0.269737
false
false
9
d90578842b1e33db2e8c98f3940e5ea0e3f74448
35,442,070,127,819
030ce97d6cfe1400f013dd4bc2841684147b2b52
/sh-external/src/main/java/com/qccr/sh/external/carman/impl/RewardExtImpl.java
10dbc6833dc94e7fffb5a5f47a26aad4b4090290
[]
no_license
witwo/sh
https://github.com/witwo/sh
25ca9f57530652d9aeb591ef6e75af5b39c8b679
b358f73df4c178deef757f483e5b7d37c95039f4
refs/heads/master
2016-09-22T13:55:50.948000
2016-05-31T06:52:42
2016-05-31T06:52:42
60,064,966
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.qccr.sh.external.carman.impl; import com.alibaba.fastjson.JSON; import com.qccr.sh.external.carman.RewardExt; import com.qccr.sh.external.carman.bo.RewardBO; import com.qccr.sh.page.PageQuery; import com.qccr.sh.page.Pagination; import com.qccr.sh.response.Response; import com.qccr.sh.response.ResponseUtil; import com.towell.carman.entity.order.Reward; import com.towell.carman.entity.order.RewardVo; import com.towell.carman.service.order.RewardService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * Created by xianchao.yan on 2015/11/3. */ @Service("rewardExt") public class RewardExtImpl implements RewardExt { Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private RewardService rewardService; @Override public Response<BigDecimal> getHisRewardSums(Integer storeId) { logger.info("查询历史奖励总金额,storeId={}", storeId); try { Double priceSum = rewardService.sumClearDoneByStoreId(storeId); logger.info("查询历史奖励总金额结束,storeId={},response={}", storeId, priceSum); double returnPrice = 0; if (priceSum != null) { returnPrice = priceSum.doubleValue(); } BigDecimal sums = new BigDecimal(Double.toString(returnPrice)); return ResponseUtil.success(sums); } catch (Exception e) { logger.error("查询历史奖励总金额异常,storeId=" + storeId, e); return ResponseUtil.exception(e.getMessage()); } } @Override public Response<BigDecimal> getRewardSums(Integer storeId) { try { logger.info("查询当前奖励金额,storeId={}", storeId); Double priceSum = rewardService.sumUnclearByStoreId(storeId); logger.info("查询当前奖励金额结束,storeId={},response={}", storeId, priceSum); double returnPrice = 0; if (priceSum != null) { returnPrice = priceSum.doubleValue(); } BigDecimal sums = new BigDecimal(Double.toString(returnPrice)); return ResponseUtil.success(sums); } catch (Exception e) { logger.error("查询当前奖励金额异常,storeId=" + storeId, e); return ResponseUtil.exception(e.getMessage()); } } @Override public Response<Pagination<RewardBO>> page(PageQuery<Integer> query) { try { logger.info("查询历史奖励金额,query={}", JSON.toJSONString(query)); RewardVo rewardVo = rewardService.findRewardHistory(query.getParam(), query.getStart(), query.getPageSize()); logger.info("查询历史奖励金额结束,query={},response={}", JSON.toJSONString(query), JSON.toJSONString(rewardVo)); if (rewardVo == null || rewardVo.getRewardList().size() <= 0) { Pagination<RewardBO> pagination = new Pagination<RewardBO>(query.getPageSize(), query.getCurrentPage(), 0); return ResponseUtil.success(pagination); } List<RewardBO> rewardBOList = new ArrayList<RewardBO>(); for (Reward reward : rewardVo.getRewardList()) { RewardBO rewardBO = new RewardBO(); BeanUtils.copyProperties(reward, rewardBO); rewardBOList.add(rewardBO); } Pagination<RewardBO> pagination = new Pagination<RewardBO>(query.getPageSize(), query.getCurrentPage(), rewardVo.getTotal()); pagination.setDataList(rewardBOList); return ResponseUtil.success(pagination); } catch (Exception e) { logger.error("查询历史奖励金额异常,query=" + JSON.toJSONString(query), e); return ResponseUtil.exception(e.getMessage()); } } }
UTF-8
Java
4,072
java
RewardExtImpl.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by xianchao.yan on 2015/11/3.\n */\n@Service(\"rewardExt\")\npublic cl", "end": 793, "score": 0.9828523993492126, "start": 781, "tag": "NAME", "value": "xianchao.yan" } ]
null
[]
package com.qccr.sh.external.carman.impl; import com.alibaba.fastjson.JSON; import com.qccr.sh.external.carman.RewardExt; import com.qccr.sh.external.carman.bo.RewardBO; import com.qccr.sh.page.PageQuery; import com.qccr.sh.page.Pagination; import com.qccr.sh.response.Response; import com.qccr.sh.response.ResponseUtil; import com.towell.carman.entity.order.Reward; import com.towell.carman.entity.order.RewardVo; import com.towell.carman.service.order.RewardService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * Created by xianchao.yan on 2015/11/3. */ @Service("rewardExt") public class RewardExtImpl implements RewardExt { Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private RewardService rewardService; @Override public Response<BigDecimal> getHisRewardSums(Integer storeId) { logger.info("查询历史奖励总金额,storeId={}", storeId); try { Double priceSum = rewardService.sumClearDoneByStoreId(storeId); logger.info("查询历史奖励总金额结束,storeId={},response={}", storeId, priceSum); double returnPrice = 0; if (priceSum != null) { returnPrice = priceSum.doubleValue(); } BigDecimal sums = new BigDecimal(Double.toString(returnPrice)); return ResponseUtil.success(sums); } catch (Exception e) { logger.error("查询历史奖励总金额异常,storeId=" + storeId, e); return ResponseUtil.exception(e.getMessage()); } } @Override public Response<BigDecimal> getRewardSums(Integer storeId) { try { logger.info("查询当前奖励金额,storeId={}", storeId); Double priceSum = rewardService.sumUnclearByStoreId(storeId); logger.info("查询当前奖励金额结束,storeId={},response={}", storeId, priceSum); double returnPrice = 0; if (priceSum != null) { returnPrice = priceSum.doubleValue(); } BigDecimal sums = new BigDecimal(Double.toString(returnPrice)); return ResponseUtil.success(sums); } catch (Exception e) { logger.error("查询当前奖励金额异常,storeId=" + storeId, e); return ResponseUtil.exception(e.getMessage()); } } @Override public Response<Pagination<RewardBO>> page(PageQuery<Integer> query) { try { logger.info("查询历史奖励金额,query={}", JSON.toJSONString(query)); RewardVo rewardVo = rewardService.findRewardHistory(query.getParam(), query.getStart(), query.getPageSize()); logger.info("查询历史奖励金额结束,query={},response={}", JSON.toJSONString(query), JSON.toJSONString(rewardVo)); if (rewardVo == null || rewardVo.getRewardList().size() <= 0) { Pagination<RewardBO> pagination = new Pagination<RewardBO>(query.getPageSize(), query.getCurrentPage(), 0); return ResponseUtil.success(pagination); } List<RewardBO> rewardBOList = new ArrayList<RewardBO>(); for (Reward reward : rewardVo.getRewardList()) { RewardBO rewardBO = new RewardBO(); BeanUtils.copyProperties(reward, rewardBO); rewardBOList.add(rewardBO); } Pagination<RewardBO> pagination = new Pagination<RewardBO>(query.getPageSize(), query.getCurrentPage(), rewardVo.getTotal()); pagination.setDataList(rewardBOList); return ResponseUtil.success(pagination); } catch (Exception e) { logger.error("查询历史奖励金额异常,query=" + JSON.toJSONString(query), e); return ResponseUtil.exception(e.getMessage()); } } }
4,072
0.653669
0.650334
97
39.185566
29.896154
137
true
false
0
0
0
0
0
0
0.886598
false
false
9
662c07f0f5e1946afece9c0bc43f6ec59004bf84
33,380,485,862,975
6165342ed5fef776975bde5340749053bf2084b8
/src/main/java/com/wqm/web/statistic/StatisticsController.java
a2d663800ce3434add5eefd4292c99bbd62389e9
[]
no_license
lucienking/wqm
https://github.com/lucienking/wqm
4ffe76643d5d10f3f258d92b25e195a1845fb5e9
e893bd4da67a1066fceef6982a5973e8d888e113
refs/heads/master
2021-01-10T07:36:45.400000
2016-04-05T00:20:11
2016-04-05T00:20:11
52,774,531
2
4
null
false
2016-04-05T00:20:11
2016-02-29T08:06:51
2016-03-12T09:57:06
2016-04-05T00:20:11
47,339
2
2
0
HTML
null
null
package com.wqm.web.statistic; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.wqm.web.BaseController; /** * 统计Controller * * @author wangxj * */ @Controller @RequestMapping(value = "/statistic") public class StatisticsController extends BaseController{ /** * 主index界面 */ @RequestMapping(method = RequestMethod.GET,value="/example1") public String statistc1(){ return "/statistic/example1"; } @RequestMapping(method = RequestMethod.GET,value="/example2") public String statistc2(){ return "/statistic/example2"; } @RequestMapping(method = RequestMethod.GET,value="/example3") public String statistc3(){ return "/statistic/example3"; } }
UTF-8
Java
815
java
StatisticsController.java
Java
[ { "context": "aseController;\n\n/**\n * 统计Controller\n * \n * @author wangxj\n *\n */\n@Controller\n@RequestMapping(value = \"/stat", "end": 285, "score": 0.9995126724243164, "start": 279, "tag": "USERNAME", "value": "wangxj" } ]
null
[]
package com.wqm.web.statistic; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.wqm.web.BaseController; /** * 统计Controller * * @author wangxj * */ @Controller @RequestMapping(value = "/statistic") public class StatisticsController extends BaseController{ /** * 主index界面 */ @RequestMapping(method = RequestMethod.GET,value="/example1") public String statistc1(){ return "/statistic/example1"; } @RequestMapping(method = RequestMethod.GET,value="/example2") public String statistc2(){ return "/statistic/example2"; } @RequestMapping(method = RequestMethod.GET,value="/example3") public String statistc3(){ return "/statistic/example3"; } }
815
0.755279
0.744099
34
22.67647
22.10499
62
false
false
0
0
0
0
0
0
0.852941
false
false
9