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
ab698cd420ae3d43820a8c1b3e68ba203bd6a1cf
4,990,752,047,600
e536ea232106b4e3d6f8c6acc45f5b3284bee96e
/src/com/class07/Task3.java
85d9f733a06e7689a0b1c19d9f72aecb4ee62f64
[]
no_license
AbdilKarakoc/Selenium
https://github.com/AbdilKarakoc/Selenium
19b8f8f71f949913664ef95c47edcef24c5ce6b8
eacd4c5cdc8e6363c3b8a3d3c1b7b6638cc1b14a
refs/heads/master
2020-12-27T11:37:33.996000
2020-02-03T05:04:42
2020-02-03T05:04:42
237,889,064
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.class07; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.utils.CommonMethods; public class Task3 extends CommonMethods { public static void main(String[] args) throws InterruptedException { setUp("Chrome", "https://the-internet.herokuapp.com/"); driver.findElement(By.linkText("Dynamic Controls")).click(); driver.findElement(By.xpath("//button[@onclick='swapInput()']")).click(); WebDriverWait wait = new WebDriverWait(driver,30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//p[@id='message']"))); driver.findElement(By.xpath("//input[@type='text']")).sendKeys("Hello"); boolean AfterTextEnter = driver.findElement(By.xpath("//input[@type='text']")).isDisplayed(); if(AfterTextEnter) { System.out.println("Good Job!"); }else { System.out.println("Bad Job!"); } Thread.sleep(2000); driver.close(); } }
UTF-8
Java
986
java
Task3.java
Java
[]
null
[]
package com.class07; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import com.utils.CommonMethods; public class Task3 extends CommonMethods { public static void main(String[] args) throws InterruptedException { setUp("Chrome", "https://the-internet.herokuapp.com/"); driver.findElement(By.linkText("Dynamic Controls")).click(); driver.findElement(By.xpath("//button[@onclick='swapInput()']")).click(); WebDriverWait wait = new WebDriverWait(driver,30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//p[@id='message']"))); driver.findElement(By.xpath("//input[@type='text']")).sendKeys("Hello"); boolean AfterTextEnter = driver.findElement(By.xpath("//input[@type='text']")).isDisplayed(); if(AfterTextEnter) { System.out.println("Good Job!"); }else { System.out.println("Bad Job!"); } Thread.sleep(2000); driver.close(); } }
986
0.724138
0.71501
30
31.866667
29.642012
95
false
false
0
0
0
0
0
0
1.8
false
false
1
88571b93708d6a36f5ab021ea95140672afcebde
7,335,804,190,096
5fcd2e6aec535b24e31be0c44b168e12fb0882e0
/src/conversaoStringDate/ConversorStringParaDate.java
222bfdbeb2e3bd7e1fe036dedd03df753203c9f2
[]
no_license
Tuan-Simonetti/home_working_Tipos_Primitivos
https://github.com/Tuan-Simonetti/home_working_Tipos_Primitivos
6e9097b8ef7f061f49050dd7adf6be83bf5f7f4e
eb8e99e811283adeb616e8ff1e4bce1434dd8d15
refs/heads/master
2022-11-28T17:42:10.586000
2020-08-06T18:18:57
2020-08-06T18:18:57
284,167,739
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package conversaoStringDate; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class ConversorStringParaDate { public static void main(String[] args) throws ParseException { String birthday = "19/07/1991"; SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy"); Date dataFormatada = formato.parse(birthday); System.out.println(birthday); // String System.out.println(dataFormatada); // Date } }
UTF-8
Java
510
java
ConversorStringParaDate.java
Java
[]
null
[]
package conversaoStringDate; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class ConversorStringParaDate { public static void main(String[] args) throws ParseException { String birthday = "19/07/1991"; SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy"); Date dataFormatada = formato.parse(birthday); System.out.println(birthday); // String System.out.println(dataFormatada); // Date } }
510
0.701961
0.686275
18
27.333334
24.113159
70
false
false
0
0
0
0
0
0
0.5
false
false
1
77f5248d5fc791a1ddc77d498305780f3b13037a
12,335,146,095,945
db94669bfc9c938df93977a0f04476ff13ab91c6
/web/src/main/java/com/light/springboot/web/controller/CaseInfoController.java
52c8c7001cfaca303af2d6f162c346566f3a9abe
[]
no_license
zhaodongjun/springboot
https://github.com/zhaodongjun/springboot
a88299b6a5f3b455ab976847dc19333fb4f4b8e6
9387408842e6ff1243fa48a9b87a89e77f0deaec
refs/heads/master
2020-03-25T01:19:38.636000
2018-08-02T02:43:41
2018-08-02T02:43:41
143,231,721
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.light.springboot.web.controller; import com.light.springboot.biz.domain.CaseInfoDomain; import com.light.springboot.biz.domain.dto.CaseInfoDTO; import com.light.springboot.biz.service.CaseInfoService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** * Created by zhaodongjun on 2018/7/11 0011. */ @Validated @RestController public class CaseInfoController { @Autowired private CaseInfoService caseInfoService; @RequestMapping(value = "/api/v1.0/add/caseinfo",method = {RequestMethod.GET}) public String test(){ return "test!!!"; } @RequestMapping(value = "/api/v1.0/add/caseinfo",method = {RequestMethod.POST}) public String addCaseInfo(@RequestBody @Valid CaseInfoDTO caseInfoDTO){ CaseInfoDomain caseInfoDomain = new CaseInfoDomain(); BeanUtils.copyProperties(caseInfoDTO,caseInfoDomain); caseInfoService.addCaseInfo(caseInfoDomain); return "保存成功"; } }
UTF-8
Java
1,356
java
CaseInfoController.java
Java
[ { "context": "\nimport javax.validation.Valid;\n\n/**\n * Created by zhaodongjun on 2018/7/11 0011.\n */\n@Validated\n@RestController", "end": 691, "score": 0.9996505975723267, "start": 680, "tag": "USERNAME", "value": "zhaodongjun" } ]
null
[]
package com.light.springboot.web.controller; import com.light.springboot.biz.domain.CaseInfoDomain; import com.light.springboot.biz.domain.dto.CaseInfoDTO; import com.light.springboot.biz.service.CaseInfoService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** * Created by zhaodongjun on 2018/7/11 0011. */ @Validated @RestController public class CaseInfoController { @Autowired private CaseInfoService caseInfoService; @RequestMapping(value = "/api/v1.0/add/caseinfo",method = {RequestMethod.GET}) public String test(){ return "test!!!"; } @RequestMapping(value = "/api/v1.0/add/caseinfo",method = {RequestMethod.POST}) public String addCaseInfo(@RequestBody @Valid CaseInfoDTO caseInfoDTO){ CaseInfoDomain caseInfoDomain = new CaseInfoDomain(); BeanUtils.copyProperties(caseInfoDTO,caseInfoDomain); caseInfoService.addCaseInfo(caseInfoDomain); return "保存成功"; } }
1,356
0.776706
0.765579
38
34.473682
26.894274
83
false
false
0
0
0
0
0
0
0.552632
false
false
1
9724402d30ece0c64e12cce00d17a7a431af52ea
15,350,213,131,870
ba9b60df773482a0d0fe9cdb6ff6f6e2ae140da7
/src/com/yougo/dao/EvaluationDao.java
b4e40c8a8acbbbe32f475b391dfff36e29d4e2be
[ "Apache-2.0" ]
permissive
yshuihan/yougo
https://github.com/yshuihan/yougo
7100222c5dbaba2911242d9126362a69bf2e54cc
eaa305ef0f6c2187ba39e9002c91f5916be054b9
refs/heads/master
2021-01-13T10:28:20.838000
2016-12-13T07:56:51
2016-12-13T07:56:51
76,773,496
1
0
null
true
2016-12-18T09:11:30
2016-12-18T09:11:29
2016-10-25T07:17:24
2016-10-25T07:06:41
0
0
0
0
null
null
null
package com.yougo.dao; import java.util.Collection; import com.yougo.bean.Evaluation; /** * 评论接口 * @author Alpha * */ public interface EvaluationDao { public int addEvaluation(Evaluation evaluation); public int evaluationNum(String sql); public int updateEvaluation(Evaluation evaluation); public int deleteEvaluation(Short id); public Collection<Evaluation> getEvaluation(String str); public Evaluation findEvaluation(Short id); }
UTF-8
Java
461
java
EvaluationDao.java
Java
[ { "context": "com.yougo.bean.Evaluation;\n\n/**\n * 评论接口\n * @author Alpha\n * \n */\npublic interface EvaluationDao {\n\t\n\tpubli", "end": 117, "score": 0.7836169004440308, "start": 112, "tag": "NAME", "value": "Alpha" } ]
null
[]
package com.yougo.dao; import java.util.Collection; import com.yougo.bean.Evaluation; /** * 评论接口 * @author Alpha * */ public interface EvaluationDao { public int addEvaluation(Evaluation evaluation); public int evaluationNum(String sql); public int updateEvaluation(Evaluation evaluation); public int deleteEvaluation(Short id); public Collection<Evaluation> getEvaluation(String str); public Evaluation findEvaluation(Short id); }
461
0.768212
0.768212
25
17.120001
19.639389
57
false
false
0
0
0
0
0
0
0.64
false
false
1
99112c5a75c759823e69f7a9a87ea7d1c87daa1a
15,350,213,131,904
3d4349c88a96505992277c56311e73243130c290
/Preparation/processed-dataset/data-class_4_403/182.java
b3effd4bfca8ea4f384282ea2d199d0c76bce1ae
[]
no_license
D-a-r-e-k/Code-Smells-Detection
https://github.com/D-a-r-e-k/Code-Smells-Detection
5270233badf3fb8c2d6034ac4d780e9ce7a8276e
079a02e5037d909114613aedceba1d5dea81c65d
refs/heads/master
2020-05-20T00:03:08.191000
2019-05-15T11:51:51
2019-05-15T11:51:51
185,272,690
7
4
null
null
null
null
null
null
null
null
null
null
null
null
null
public static Object case306_line1178(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { /* TODO: We should use implicit nil for body, but problem (punt til later)*/ Node body = ((Node) yyVals[-1 + yyTop]); /*$5 == null ? NilImplicitNode.NIL : $5;*/ yyVal = new DefnNode(((Token) yyVals[-5 + yyTop]).getPosition(), new ArgumentNode(((Token) yyVals[-4 + yyTop]).getPosition(), (String) ((Token) yyVals[-4 + yyTop]).getValue()), ((ArgsNode) yyVals[-2 + yyTop]), support.getCurrentScope(), body); support.popCurrentScope(); support.setInDef(false); return yyVal; }
UTF-8
Java
627
java
182.java
Java
[]
null
[]
public static Object case306_line1178(ParserSupport support, RubyYaccLexer lexer, Object yyVal, Object[] yyVals, int yyTop) { /* TODO: We should use implicit nil for body, but problem (punt til later)*/ Node body = ((Node) yyVals[-1 + yyTop]); /*$5 == null ? NilImplicitNode.NIL : $5;*/ yyVal = new DefnNode(((Token) yyVals[-5 + yyTop]).getPosition(), new ArgumentNode(((Token) yyVals[-4 + yyTop]).getPosition(), (String) ((Token) yyVals[-4 + yyTop]).getValue()), ((ArgsNode) yyVals[-2 + yyTop]), support.getCurrentScope(), body); support.popCurrentScope(); support.setInDef(false); return yyVal; }
627
0.673046
0.650718
9
68.666664
71.975304
247
false
false
0
0
0
0
0
0
1.777778
false
false
1
02c2144807a7464925d3dc2a1cf85f90ebcf71d5
2,216,203,186,680
7a411784dccbc6964d6fedef89d89b0f219d8656
/Paint/Carre.java
8e0ff3bd18b695f7952b8577adc1124d5f33a154
[]
no_license
sami-mekhanef/Paint.java
https://github.com/sami-mekhanef/Paint.java
0b806974c95285d296b9031179fc2fec7a903a87
05be26d460e050145ceab9e245c4e1a7f70da81a
refs/heads/master
2022-03-26T22:07:47.497000
2020-01-18T11:40:24
2020-01-18T11:40:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.awt.Graphics; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Carre extends Figure { public Carre() { } public Carre(int x, int y , int w, int h) { this.x1 = x; this.y1 = y; this.x2 = w; this.y2 = w; } }
UTF-8
Java
480
java
Carre.java
Java
[]
null
[]
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.awt.Graphics; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Carre extends Figure { public Carre() { } public Carre(int x, int y , int w, int h) { this.x1 = x; this.y1 = y; this.x2 = w; this.y2 = w; } }
480
0.510417
0.502083
23
18.956522
14.775062
47
false
false
0
0
0
0
0
0
0.652174
false
false
1
307de9a3ff31436685f8dfa8ffe76785ab9c2677
7,705,171,341,154
0bcc028259d40a6a33f41072ab9e7076603519e8
/Learning_Languages/Learning_Java/Absolute_Java_Exercises/AJCh1/LoveNotHate.java
5497b20ad15c6636ec1a309d72a94c4f1dbdb9c1
[]
no_license
ravzac14/Skill_Buildin
https://github.com/ravzac14/Skill_Buildin
f0700b8c6203e5806bdba2892a318a025ea5828a
e473116969df126bcae8c347b26e829513cb83f0
refs/heads/master
2021-01-22T03:25:52.400000
2015-07-06T20:25:32
2015-07-06T20:25:32
25,415,795
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*Zack Raver; ravzac14 * 4/5/14 * * Ch.1 #5 from "Absolute Java" by Walter Savitch * Parse several lines of text, repeat any lines with the word "hate" * Replace each instance of "hate with "love " and output the new lines * ie("I saw you wrote the line: * I replaced it with the line: " */ import java.util.Scanner; import java.util.StringTokenizer; public class LoveNotHate { public static void main(String[] args) { Scanner s = new Scanner(System.in); boolean end = true; String tempLine; System.out.println("Go ahead and write me a poem about love and hate! I will critique it...Write \"end\" when you\'re ready to see my critique"); while (end){ tempLine = s.nextLine(); StringTokenizer punch = new StringTokenizer(tempLine); while (punch.hasMoreTokens()){ if (punch.nextToken().equalsIgnoreCase("hate")){ System.out.println("I saw that you wrote the line: " + tempLine); System.out.println("I've changed that to: "); while (punch.hasMoreTokens()){ if (punch.nextToken().equalsIgnoreCase("hate")){ System.out.print("love "); } else { System.out.print(punch.nextToken() + " "); } continue; } } else if (punch.nextToken().equalsIgnoreCase("end")) { end = false; } else { continue; } } } s.close(); } }
UTF-8
Java
1,386
java
LoveNotHate.java
Java
[ { "context": "/*Zack Raver; ravzac14\r\n * 4/5/14\r\n * \r\n * Ch.1 #5 from \"Absol", "end": 12, "score": 0.9998847246170044, "start": 2, "tag": "NAME", "value": "Zack Raver" }, { "context": "/*Zack Raver; ravzac14\r\n * 4/5/14\r\n * \r\n * Ch.1 #5 from \"Absolute Java\" ", "end": 22, "score": 0.9995534420013428, "start": 14, "tag": "USERNAME", "value": "ravzac14" }, { "context": " * 4/5/14\r\n * \r\n * Ch.1 #5 from \"Absolute Java\" by Walter Savitch\r\n * Parse several lines of text, repeat any lines", "end": 89, "score": 0.9998925924301147, "start": 75, "tag": "NAME", "value": "Walter Savitch" } ]
null
[]
/*<NAME>; ravzac14 * 4/5/14 * * Ch.1 #5 from "Absolute Java" by <NAME> * Parse several lines of text, repeat any lines with the word "hate" * Replace each instance of "hate with "love " and output the new lines * ie("I saw you wrote the line: * I replaced it with the line: " */ import java.util.Scanner; import java.util.StringTokenizer; public class LoveNotHate { public static void main(String[] args) { Scanner s = new Scanner(System.in); boolean end = true; String tempLine; System.out.println("Go ahead and write me a poem about love and hate! I will critique it...Write \"end\" when you\'re ready to see my critique"); while (end){ tempLine = s.nextLine(); StringTokenizer punch = new StringTokenizer(tempLine); while (punch.hasMoreTokens()){ if (punch.nextToken().equalsIgnoreCase("hate")){ System.out.println("I saw that you wrote the line: " + tempLine); System.out.println("I've changed that to: "); while (punch.hasMoreTokens()){ if (punch.nextToken().equalsIgnoreCase("hate")){ System.out.print("love "); } else { System.out.print(punch.nextToken() + " "); } continue; } } else if (punch.nextToken().equalsIgnoreCase("end")) { end = false; } else { continue; } } } s.close(); } }
1,374
0.618326
0.612554
46
28.130434
27.412794
147
false
false
0
0
0
0
0
0
2.891304
false
false
1
e65d21ddcdf71683d68a196b86329f5bf9b6a5d7
22,144,851,440,384
269e3c2b334b6212d2be2d3e4e63be98b5cc6801
/RecyclerViewDemo/app/src/main/java/com/dwh/recyclerviewdemo/base/MyDatabaseHelper.java
ce391ca64731ba082ad3d3cfd1c653f3a2888f14
[]
no_license
sea-yan/Android-Daily-Projects
https://github.com/sea-yan/Android-Daily-Projects
ff400c12e9f82faa2edcc18a8c59f463975b3672
30dee160d6ecce8c4170c5ca0cbb8f1b4319a9c5
refs/heads/main
2022-12-27T19:53:12.137000
2020-10-15T12:22:20
2020-10-15T12:22:20
304,274,697
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//package com.dwh.recyclerviewdemo.base; // //import android.content.Context; //import android.database.sqlite.SQLiteDatabase; //import android.database.sqlite.SQLiteOpenHelper; //import android.widget.Toast; // // //public class MyDatabaseHelper extends SQLiteOpenHelper { // // public static final String CREATE_Fruit = "create table fruit (" // + "id integer primary key autoincrement, " // + "name text)"; // private Context mContext; // // public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { // super(context, name, factory, version); // mContext = context; // } // // @Override // public void onCreate(SQLiteDatabase db) { // db.execSQL(CREATE_Fruit); // Toast.makeText(mContext,"Create succeeded",Toast.LENGTH_SHORT).show(); // } // // @Override // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // // } // // //}
UTF-8
Java
976
java
MyDatabaseHelper.java
Java
[]
null
[]
//package com.dwh.recyclerviewdemo.base; // //import android.content.Context; //import android.database.sqlite.SQLiteDatabase; //import android.database.sqlite.SQLiteOpenHelper; //import android.widget.Toast; // // //public class MyDatabaseHelper extends SQLiteOpenHelper { // // public static final String CREATE_Fruit = "create table fruit (" // + "id integer primary key autoincrement, " // + "name text)"; // private Context mContext; // // public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) { // super(context, name, factory, version); // mContext = context; // } // // @Override // public void onCreate(SQLiteDatabase db) { // db.execSQL(CREATE_Fruit); // Toast.makeText(mContext,"Create succeeded",Toast.LENGTH_SHORT).show(); // } // // @Override // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // // } // // //}
976
0.668033
0.668033
33
28.575758
28.426439
112
false
false
0
0
0
0
0
0
0.666667
false
false
1
d370350b903e9e2a200d73e1cfd6cb87b057957b
26,216,480,436,984
7fa5ddd28f12dd5d6f18cd1dfcdd90b3ecb32c39
/SpiderMan/src/test/Test.java
75bad0d3f40a4df4a90f743f7aaa0157c533c3a3
[]
no_license
zheshanjun/SpiderMan
https://github.com/zheshanjun/SpiderMan
eddae742cb0ff2280a203001928051f68559597c
547230b467f7e04c73669c73d4e6952353f6f13e
refs/heads/master
2021-01-10T01:49:04.790000
2015-12-30T09:36:52
2015-12-30T09:36:52
45,652,070
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import java.io.File; import java.io.IOException; import java.util.*; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; public class Test { public static void main(String[] args) throws JDOMException, IOException { System.out.println("hello world!"); } }
UTF-8
Java
354
java
Test.java
Java
[]
null
[]
package test; import java.io.File; import java.io.IOException; import java.util.*; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; public class Test { public static void main(String[] args) throws JDOMException, IOException { System.out.println("hello world!"); } }
354
0.745763
0.734463
21
15.857142
18.090475
73
false
false
0
0
0
0
0
0
0.904762
false
false
1
b6b6700845f910c636759a89db2c7908f04cbae5
20,761,871,968,833
c58b3e44a8f5001920cb015d0866626649563382
/src/net/minecraft/item/ItemInfoContainer.java
4251dcb9bafcfafdc30b554e23a77535a15c3ac5
[]
no_license
aegistudio/Minecraft_Utopian
https://github.com/aegistudio/Minecraft_Utopian
9766abec34d609fc5b2412754d5a8b2de56b4ff7
86593982634d84998ca79a2f15094a12389a0611
refs/heads/master
2021-01-10T20:17:43.861000
2015-07-05T10:51:20
2015-07-05T10:51:20
28,970,114
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.minecraft.item; public abstract class ItemInfoContainer { private static ItemInfoContainer instance; public static ItemInfoContainer getItemInfoContainer() { return instance; } public abstract Item getItem(int itemid); public abstract void setItem(Item item); public abstract Item[] getRegisteredItems(); public abstract int getMaximumItemId(); public abstract void removeItem(int itemid); }
UTF-8
Java
428
java
ItemInfoContainer.java
Java
[]
null
[]
package net.minecraft.item; public abstract class ItemInfoContainer { private static ItemInfoContainer instance; public static ItemInfoContainer getItemInfoContainer() { return instance; } public abstract Item getItem(int itemid); public abstract void setItem(Item item); public abstract Item[] getRegisteredItems(); public abstract int getMaximumItemId(); public abstract void removeItem(int itemid); }
428
0.778037
0.778037
21
19.380953
20.320002
55
false
false
0
0
0
0
0
0
1.190476
false
false
1
4a4708d8c50d9d4ee2c3311556c183e92ddd4d82
27,608,049,836,182
1ff72f7e23a33a9a3de960789886f7f303f77f76
/src/test/java/steps/LoginSteps.java
039399432378f65bd8f2b636d8b6d40623a01427
[]
no_license
Liliana93/imgur.projectTest
https://github.com/Liliana93/imgur.projectTest
a48c40c558cfea973600c101effcc36ea74c86da
743a98ddf728d2869cfeaac2ffb67ef709d4dd04
refs/heads/master
2020-03-25T12:36:02.441000
2018-09-07T15:51:09
2018-09-07T15:51:09
143,784,070
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package steps; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.testng.Assert; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import pages.LoginPage; import static steps.Stephooks.driver; import static steps.Stephooks.prop; public class LoginSteps { public static Logger log = LogManager.getLogger(APISteps.class.getName()); LoginPage lp; @Given("^user accesses the Login Page$") public void userAccessesTheLoginPage() throws Throwable { driver.get(prop.getProperty("gmailurl")); lp = new LoginPage(driver); log.info("User has accessed the Login Page"); } @When("^user enters \"([^\"]*)\" and \"([^\"]*)\"$") public void userEntersAnd(String arg0, String arg1) throws Throwable { lp.setUserName(prop.getProperty("login")); lp.setPassword(prop.getProperty("password")); log.info("User has entered valid credentials"); } @And("^clicks on submit button$") public void clicksOnSubmitButton() throws Throwable { lp.Login(); log.info("User has clicked on submit button"); } @Then("^user is logged in$") public void chechIfLoggedIn() throws Throwable { driver.get("https://mail.google.com/mail"); Assert.assertTrue(lp.IsLoggedIn(), "User is not logged in"); Thread.sleep(1000); } }
UTF-8
Java
1,466
java
LoginSteps.java
Java
[ { "context": "ogin\"));\n lp.setPassword(prop.getProperty(\"password\"));\n log.info(\"User has entered valid cred", "end": 976, "score": 0.9884594678878784, "start": 968, "tag": "PASSWORD", "value": "password" } ]
null
[]
package steps; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.testng.Assert; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; import pages.LoginPage; import static steps.Stephooks.driver; import static steps.Stephooks.prop; public class LoginSteps { public static Logger log = LogManager.getLogger(APISteps.class.getName()); LoginPage lp; @Given("^user accesses the Login Page$") public void userAccessesTheLoginPage() throws Throwable { driver.get(prop.getProperty("gmailurl")); lp = new LoginPage(driver); log.info("User has accessed the Login Page"); } @When("^user enters \"([^\"]*)\" and \"([^\"]*)\"$") public void userEntersAnd(String arg0, String arg1) throws Throwable { lp.setUserName(prop.getProperty("login")); lp.setPassword(prop.getProperty("<PASSWORD>")); log.info("User has entered valid credentials"); } @And("^clicks on submit button$") public void clicksOnSubmitButton() throws Throwable { lp.Login(); log.info("User has clicked on submit button"); } @Then("^user is logged in$") public void chechIfLoggedIn() throws Throwable { driver.get("https://mail.google.com/mail"); Assert.assertTrue(lp.IsLoggedIn(), "User is not logged in"); Thread.sleep(1000); } }
1,468
0.674625
0.669168
50
28.32
23.36017
78
false
false
0
0
0
0
0
0
0.52
false
false
1
597184c6f9d5fb965ad72d3a7a0b4b8786dc0fca
5,016,521,804,758
c9db3679948b0702bf809d5987e981adaa5d636a
/app/src/main/java/com/songzheng/timemanager/entity/Feedback.java
7eafed667e228cdd8525f21ff24c3a89311e8bd0
[]
no_license
dougsong/TimeManager
https://github.com/dougsong/TimeManager
59350a0bb6f2dfc6718499d7f12405da4fccd607
ae1bcf1334519a2e3c4ceaef2d36624145c19ede
refs/heads/master
2021-09-19T15:58:58.738000
2018-07-28T23:27:51
2018-07-28T23:27:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.songzheng.timemanager.entity; /** * Created by make on 2017/7/4. */ public class Feedback { private String uid; private String content; public Feedback() { } public Feedback(String uid, String content) { this.uid = uid; this.content = content; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } }
UTF-8
Java
581
java
Feedback.java
Java
[ { "context": "m.songzheng.timemanager.entity;\n\n/**\n * Created by make on 2017/7/4.\n */\n\npublic class Feedback {\n\n pr", "end": 65, "score": 0.9902716875076294, "start": 61, "tag": "USERNAME", "value": "make" } ]
null
[]
package com.songzheng.timemanager.entity; /** * Created by make on 2017/7/4. */ public class Feedback { private String uid; private String content; public Feedback() { } public Feedback(String uid, String content) { this.uid = uid; this.content = content; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } }
581
0.581756
0.571429
37
14.702703
15.103006
49
false
false
0
0
0
0
0
0
0.27027
false
false
1
1008f659b5a7d7a2a9cf784590dda75602eeeb84
3,066,606,696,628
51a1371d52c4cb51f8f9c5a7de354110cdab8358
/src/main/java/com/junling/comunity/service/LikeService.java
d02ffbe9e2bb569c23abeec21e8ced4be66b7f6b
[]
no_license
junlingsun/community
https://github.com/junlingsun/community
e843a3eb77797f45b686cb91c099d8bc5e555e6d
55d63cf3598aa1b468a75157f5f08171e631c925
refs/heads/master
2023-02-19T12:00:32.065000
2021-01-17T19:48:22
2021-01-17T19:48:22
329,502,611
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.junling.comunity.service; import java.util.Set; public interface LikeService { long likeCount(int entityType, int entityId); void like(int userId, int entityType, int entityId, int toUserId); int likeStatus(int userId, int entityType, int entityId); int userLikeCount(int userId); }
UTF-8
Java
314
java
LikeService.java
Java
[]
null
[]
package com.junling.comunity.service; import java.util.Set; public interface LikeService { long likeCount(int entityType, int entityId); void like(int userId, int entityType, int entityId, int toUserId); int likeStatus(int userId, int entityType, int entityId); int userLikeCount(int userId); }
314
0.748408
0.748408
11
27.545454
24.388386
70
false
false
0
0
0
0
0
0
1.090909
false
false
1
a4fa67a2a13eb91ea53ec2c4b9dfb3cd193bce32
28,664,611,738,159
2186df44ab45e47d326832e8199b524e7aebbe84
/part3/src/be/abis/exercice03/part3/com/model/InktjetPart3.java
a0b24d9724bd4601369d6fcca10b3230cdb2f8f9
[]
no_license
mvb1966/paternsAbis
https://github.com/mvb1966/paternsAbis
d13c51555b14158d3a3bc5eda69eb76d4beab4c3
6564e1cee430615a22e42c30987879639b0243fc
refs/heads/master
2023-01-02T16:34:27.613000
2020-10-23T12:16:50
2020-10-23T12:16:50
305,972,862
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package be.abis.exercice03.part3.com.model; public class InktjetPart3 implements PrintStrategyPart3 { @Override public void print(PacketPart3 packet) { System.out.println("i am an old inktjet printer don't push me to the limits " + packet.getContents()); } }
UTF-8
Java
281
java
InktjetPart3.java
Java
[]
null
[]
package be.abis.exercice03.part3.com.model; public class InktjetPart3 implements PrintStrategyPart3 { @Override public void print(PacketPart3 packet) { System.out.println("i am an old inktjet printer don't push me to the limits " + packet.getContents()); } }
281
0.72242
0.701068
9
30.222221
34.994534
110
false
false
0
0
0
0
0
0
0.222222
false
false
1
52a29b5a03c020e326747cb7f348c52ac0205c1e
28,664,611,736,565
359394dc03cf162c9f10ff42951c3fd02e6860ba
/src/main/java/pt/up/hs/emotioneditor/client/models/Highlight.java
be9620dc0012e473ba308b6c279121f7110e1831
[ "MIT" ]
permissive
josepaiva94/emotion-editor
https://github.com/josepaiva94/emotion-editor
79e0ee842906d9a36ebfc8183e3b902fa9e6db92
ca15c9aabbd66437d99ceec87aecd66357cfd704
refs/heads/master
2020-04-19T17:12:41.295000
2020-01-19T15:03:53
2020-01-19T15:03:53
168,328,051
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pt.up.hs.emotioneditor.client.models; import com.google.gwt.core.client.JavaScriptObject; /** * Highlight JavaScript Definition * * @author José Carlos Paiva <code>josepaiva94@gmail.com</code> */ public class Highlight extends JavaScriptObject { protected Highlight() { } public final native int getStart() /*-{ return this.start; }-*/; public final native void setStart(int start) /*-{ this.start = start; }-*/; public final native int getSize() /*-{ return this.size; }-*/; public final native void setSize(int size) /*-{ this.size = size; }-*/; public final native void setProps(JsMap props) /*-{ this.props = props; }-*/; public final native JsMap getProps() /*-{ return this.props || {}; }-*/; }
UTF-8
Java
827
java
Highlight.java
Java
[ { "context": "*\n * Highlight JavaScript Definition\n *\n * @author José Carlos Paiva <code>josepaiva94@gmail.com</code>\n */\npublic cla", "end": 170, "score": 0.999879777431488, "start": 153, "tag": "NAME", "value": "José Carlos Paiva" }, { "context": " Definition\n *\n * @author José Carlos Paiva <code>josepaiva94@gmail.com</code>\n */\npublic class Highlight extends JavaScr", "end": 198, "score": 0.9999079704284668, "start": 177, "tag": "EMAIL", "value": "josepaiva94@gmail.com" } ]
null
[]
package pt.up.hs.emotioneditor.client.models; import com.google.gwt.core.client.JavaScriptObject; /** * Highlight JavaScript Definition * * @author <NAME> <code><EMAIL></code> */ public class Highlight extends JavaScriptObject { protected Highlight() { } public final native int getStart() /*-{ return this.start; }-*/; public final native void setStart(int start) /*-{ this.start = start; }-*/; public final native int getSize() /*-{ return this.size; }-*/; public final native void setSize(int size) /*-{ this.size = size; }-*/; public final native void setProps(JsMap props) /*-{ this.props = props; }-*/; public final native JsMap getProps() /*-{ return this.props || {}; }-*/; }
801
0.605327
0.602906
38
20.736841
20.232445
63
false
false
0
0
0
0
0
0
0.421053
false
false
1
6aa7d9493e07769bd65677788a7f3044b11a1eea
6,511,170,488,027
b5aab4dab1e435f455f5c59ddd8d550bdaf7a4c9
/src/com/example/jsonformsample/JavaScriptInterface.java
af0b6ace496107da41f6436ee0f27af81f2fe93b
[]
no_license
Kibnelson/JqueryMobile-android-sdcard
https://github.com/Kibnelson/JqueryMobile-android-sdcard
80e8f278c63e2c149c46ee48b2dcd2d5e215b729
f55bab990cf1f698947977fdcc64b140a06931c7
refs/heads/master
2020-04-02T03:07:15.861000
2012-12-10T20:52:14
2012-12-10T20:52:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.jsonformsample; import java.io.File; import java.io.FileInputStream; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; import org.json.JSONObject; import android.content.Context; import android.os.Environment; import android.widget.Toast; public class JavaScriptInterface { Context mContext; private JSONObject jObject; /** Instantiate the interface and set the context */ JavaScriptInterface(Context c) { mContext = c; } /** Show a toast from the web page */ public String showJson() { return getJsonFile(); } public String getJsonFile(){ String jString = null; try { File dir = Environment.getExternalStorageDirectory(); File yourFile = new File(dir, "form.json"); FileInputStream stream = new FileInputStream(yourFile); try { FileChannel fc = stream.getChannel(); MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); /* Instead of using default, pass in a decoder. */ jString = Charset.defaultCharset().decode(bb).toString(); } finally { stream.close(); } jObject = new JSONObject(jString); } catch (Exception e) {e.printStackTrace();} return jObject.toString(); } }
UTF-8
Java
1,515
java
JavaScriptInterface.java
Java
[]
null
[]
package com.example.jsonformsample; import java.io.File; import java.io.FileInputStream; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; import org.json.JSONObject; import android.content.Context; import android.os.Environment; import android.widget.Toast; public class JavaScriptInterface { Context mContext; private JSONObject jObject; /** Instantiate the interface and set the context */ JavaScriptInterface(Context c) { mContext = c; } /** Show a toast from the web page */ public String showJson() { return getJsonFile(); } public String getJsonFile(){ String jString = null; try { File dir = Environment.getExternalStorageDirectory(); File yourFile = new File(dir, "form.json"); FileInputStream stream = new FileInputStream(yourFile); try { FileChannel fc = stream.getChannel(); MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); /* Instead of using default, pass in a decoder. */ jString = Charset.defaultCharset().decode(bb).toString(); } finally { stream.close(); } jObject = new JSONObject(jString); } catch (Exception e) {e.printStackTrace();} return jObject.toString(); } }
1,515
0.591419
0.590759
61
23.852459
21.911772
90
false
false
0
0
0
0
0
0
0.622951
false
false
1
3b20cbdd7def3c029e393bcf735003f1643e2c85
19,937,238,245,675
d85eb3439291f90aeb4f1d00b9748093adb06d10
/src/main/java/com/angsentech/ssm/controller/SxNoticeTimeController.java
aa4500e543af0a86d07dd0d807462debf254fc73
[]
no_license
FANLIYANG-OPS/netschool
https://github.com/FANLIYANG-OPS/netschool
0c12a1187443c5fb724819581c2e148ee756e65f
1806b21e424f57a3be18991746b2df973fd9a459
refs/heads/master
2020-03-26T18:45:56.707000
2018-08-21T06:51:15
2018-08-21T06:51:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.angsentech.ssm.controller; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.angsentech.ssm.easyui.Json; import com.angsentech.ssm.easyui.PageHelper; import com.angsentech.ssm.entity.JavaBean; import com.angsentech.ssm.entity.SxNoticeTime; import com.angsentech.ssm.service.BasicDataService; import com.angsentech.ssm.service.DateBaseService; import com.angsentech.ssm.service.SxNoticeTimeService; /** * TODO 在此加入类描述 * @copyright {@link shanxiang} * @author shanxiang * @version 2017-10-25 16:23:26 * @see com.angsentech.ssm.controller.SxNoticeTime */ @Controller @RequestMapping(value="/sxnoticetime") public class SxNoticeTimeController { @Resource private DateBaseService dateBaseService; @Resource private SxNoticeTimeService sxNoticeTimeService; @Resource private BasicDataService basicDataService; /** * * @param request * @param modelMap * @param pid 考试类型 * @param pid1 使用状态 * @return */ @RequestMapping(value="/list") public String toList(HttpServletRequest request,ModelMap modelMap){ modelMap.addAttribute("typeList", basicDataService.selectAll(JavaBean.DATE_TYPE)); modelMap.addAttribute("stateList", basicDataService.selectAll(JavaBean.COUPON_STATE)); modelMap.addAttribute("provinceList", dateBaseService.getAllProvince()); return "/notice/sxNoticeTimeList"; } @RequestMapping(value="/edit") public String toEdit(HttpServletRequest request,Model modelMap,Integer id){ modelMap.addAttribute("provinceList", dateBaseService.getAllProvince()); modelMap.addAttribute("typeList", basicDataService.selectAll(JavaBean.DATE_TYPE)); SxNoticeTime sxNoticeTime = sxNoticeTimeService.selectByPrimaryKey(id); modelMap.addAttribute("sxNoticeTime", sxNoticeTime); return "/notice/sxNoticeTimeEdit"; } @ResponseBody @RequestMapping(value = "/save") public Json add(SxNoticeTime sxNoticeTime,Model model,HttpServletRequest request) { Json j = new Json(); try { sxNoticeTimeService.saveOrUpdate(sxNoticeTime); model.addAttribute("sxNoticeTime", sxNoticeTime); j.setMsg("操作成功"); j.setData(sxNoticeTime); } catch (Exception e) { j.setMsg(e.getMessage()); } return j; } @ResponseBody @RequestMapping(value = "/listJson") public Json findAllSxNoticeTime(Model model, int page, int limit,HttpServletRequest request){ Json json = new Json(); HashMap hs=new HashMap(); String type =request.getParameter("type"); String state =request.getParameter("state"); String province=request.getParameter("province"); hs.put("type", type); hs.put("state", state); hs.put("province", province); PageHelper pg = new PageHelper(); pg.setRows(limit); pg.setPage(page); hs.put("start", pg.getRownum()); hs.put("rows", limit); hs.put("ord", "order by id desc"); hs.put("pid", JavaBean.DATE_TYPE); try { List<SxNoticeTime> list = sxNoticeTimeService.selectAllPage(hs); int count = sxNoticeTimeService.findCount(hs); json.setCode(0); json.setMsg(""); json.setCount(count); json.setData(list); } catch (Exception e) { json.setMsg(e.getMessage()); } return json; } @ResponseBody @RequestMapping(value = "/del", method = RequestMethod.POST) public Json deleteUser(Integer id,String state) { Json j = new Json(); SxNoticeTime sxNoticeTime = new SxNoticeTime(); sxNoticeTime.setId(id); sxNoticeTime.setState(state); try { Integer deleteMenuById = sxNoticeTimeService.updateStateById(sxNoticeTime); if (deleteMenuById>0){ j.setMsg("操作成功"); }else{ j.setMsg("操作失败"); } } catch (Exception e) { j.setMsg(e.getMessage()); } return j; } }
UTF-8
Java
4,415
java
SxNoticeTimeController.java
Java
[ { "context": "vice;\n\n\n\n\n/**\n * TODO 在此加入类描述\n * @copyright {@link shanxiang}\n * @author shanxiang\n * @version 2017-10-25 16:", "end": 937, "score": 0.8372100591659546, "start": 928, "tag": "USERNAME", "value": "shanxiang" }, { "context": "在此加入类描述\n * @copyright {@link shanxiang}\n * @author shanxiang\n * @version 2017-10-25 16:23:26\n * @see com.angs", "end": 959, "score": 0.8152005672454834, "start": 950, "tag": "NAME", "value": "shanxiang" } ]
null
[]
package com.angsentech.ssm.controller; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.angsentech.ssm.easyui.Json; import com.angsentech.ssm.easyui.PageHelper; import com.angsentech.ssm.entity.JavaBean; import com.angsentech.ssm.entity.SxNoticeTime; import com.angsentech.ssm.service.BasicDataService; import com.angsentech.ssm.service.DateBaseService; import com.angsentech.ssm.service.SxNoticeTimeService; /** * TODO 在此加入类描述 * @copyright {@link shanxiang} * @author shanxiang * @version 2017-10-25 16:23:26 * @see com.angsentech.ssm.controller.SxNoticeTime */ @Controller @RequestMapping(value="/sxnoticetime") public class SxNoticeTimeController { @Resource private DateBaseService dateBaseService; @Resource private SxNoticeTimeService sxNoticeTimeService; @Resource private BasicDataService basicDataService; /** * * @param request * @param modelMap * @param pid 考试类型 * @param pid1 使用状态 * @return */ @RequestMapping(value="/list") public String toList(HttpServletRequest request,ModelMap modelMap){ modelMap.addAttribute("typeList", basicDataService.selectAll(JavaBean.DATE_TYPE)); modelMap.addAttribute("stateList", basicDataService.selectAll(JavaBean.COUPON_STATE)); modelMap.addAttribute("provinceList", dateBaseService.getAllProvince()); return "/notice/sxNoticeTimeList"; } @RequestMapping(value="/edit") public String toEdit(HttpServletRequest request,Model modelMap,Integer id){ modelMap.addAttribute("provinceList", dateBaseService.getAllProvince()); modelMap.addAttribute("typeList", basicDataService.selectAll(JavaBean.DATE_TYPE)); SxNoticeTime sxNoticeTime = sxNoticeTimeService.selectByPrimaryKey(id); modelMap.addAttribute("sxNoticeTime", sxNoticeTime); return "/notice/sxNoticeTimeEdit"; } @ResponseBody @RequestMapping(value = "/save") public Json add(SxNoticeTime sxNoticeTime,Model model,HttpServletRequest request) { Json j = new Json(); try { sxNoticeTimeService.saveOrUpdate(sxNoticeTime); model.addAttribute("sxNoticeTime", sxNoticeTime); j.setMsg("操作成功"); j.setData(sxNoticeTime); } catch (Exception e) { j.setMsg(e.getMessage()); } return j; } @ResponseBody @RequestMapping(value = "/listJson") public Json findAllSxNoticeTime(Model model, int page, int limit,HttpServletRequest request){ Json json = new Json(); HashMap hs=new HashMap(); String type =request.getParameter("type"); String state =request.getParameter("state"); String province=request.getParameter("province"); hs.put("type", type); hs.put("state", state); hs.put("province", province); PageHelper pg = new PageHelper(); pg.setRows(limit); pg.setPage(page); hs.put("start", pg.getRownum()); hs.put("rows", limit); hs.put("ord", "order by id desc"); hs.put("pid", JavaBean.DATE_TYPE); try { List<SxNoticeTime> list = sxNoticeTimeService.selectAllPage(hs); int count = sxNoticeTimeService.findCount(hs); json.setCode(0); json.setMsg(""); json.setCount(count); json.setData(list); } catch (Exception e) { json.setMsg(e.getMessage()); } return json; } @ResponseBody @RequestMapping(value = "/del", method = RequestMethod.POST) public Json deleteUser(Integer id,String state) { Json j = new Json(); SxNoticeTime sxNoticeTime = new SxNoticeTime(); sxNoticeTime.setId(id); sxNoticeTime.setState(state); try { Integer deleteMenuById = sxNoticeTimeService.updateStateById(sxNoticeTime); if (deleteMenuById>0){ j.setMsg("操作成功"); }else{ j.setMsg("操作失败"); } } catch (Exception e) { j.setMsg(e.getMessage()); } return j; } }
4,415
0.701445
0.697546
149
28.268456
23.217279
94
false
false
0
0
0
0
0
0
1.187919
false
false
1
4a050129e7d48b646889d362fff8e353c1cd3387
274,877,974,150
6ba647a4dbb60f3b72303686f3ff927a9e92dc59
/src/main/java/com/zh/springbootdemo/web/controller/HelloWorldController.java
9201b8a6143ecefc54271f0832e51a7564f7fa45
[]
no_license
zhOrange/springbootdemo
https://github.com/zhOrange/springbootdemo
f56830f5f435b78f5cfbc01e6c35297451b7f0cf
7d7cc8f506ada74307fde3eca5c92c3f702b3a75
refs/heads/master
2022-12-07T02:37:41.644000
2020-08-20T08:57:45
2020-08-20T08:57:45
282,363,120
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zh.springbootdemo.web.controller; import org.json.JSONException; import org.json.JSONObject; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.UUID; @RestController //Controller + responseController public class HelloWorldController { @RequestMapping("/hello") public String getHello(){ return "Hello World."; } @RequestMapping("") public String info(){ return "Infomation"; } @RequestMapping("Time") public String getTime(String time){ switch(time){ case "time": // http://127.0.0.1:8080/Time?time=time SimpleDateFormat tFormat = new SimpleDateFormat("HH:mm:ss"); return "当前时间为: " + tFormat.format(new Date()); case "date": // http://127.0.0.1:8080/Time?time=date SimpleDateFormat dFormat = new SimpleDateFormat("yy-MM-dd"); return "当前日期为: " + dFormat.format(new Date()); default: return ""; } } }
UTF-8
Java
1,661
java
HelloWorldController.java
Java
[ { "context": " case \"date\":\n // http://127.0.0.1:8080/Time?time=date\n SimpleDateFor", "end": 1402, "score": 0.5855318307876587, "start": 1394, "tag": "IP_ADDRESS", "value": "27.0.0.1" } ]
null
[]
package com.zh.springbootdemo.web.controller; import org.json.JSONException; import org.json.JSONObject; import org.springframework.core.io.Resource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import java.util.UUID; @RestController //Controller + responseController public class HelloWorldController { @RequestMapping("/hello") public String getHello(){ return "Hello World."; } @RequestMapping("") public String info(){ return "Infomation"; } @RequestMapping("Time") public String getTime(String time){ switch(time){ case "time": // http://127.0.0.1:8080/Time?time=time SimpleDateFormat tFormat = new SimpleDateFormat("HH:mm:ss"); return "当前时间为: " + tFormat.format(new Date()); case "date": // http://1172.16.31.10:8080/Time?time=date SimpleDateFormat dFormat = new SimpleDateFormat("yy-MM-dd"); return "当前日期为: " + dFormat.format(new Date()); default: return ""; } } }
1,665
0.678681
0.666463
50
31.74
20.251232
76
false
false
0
0
0
0
0
0
0.52
false
false
1
07743ca73d15968b36aabaf7a5a41f00c6d475fa
2,430,951,542,379
d63cfdae2c5209dbcb63afc33cbeedd7f64c3a9d
/ejbModule/com/coupon/process/session/remote/RedemptionRemote.java
8379ae3556ac86f1beade24d783ad18e1424be91
[]
no_license
dasmanoj/CouponsEJB
https://github.com/dasmanoj/CouponsEJB
e36cfb5b254ea92f0e75615c5a201d5c8b2a73b0
59020b024ff230655866a52876b10941930c5110
refs/heads/master
2021-06-08T20:31:07.160000
2017-01-01T15:57:19
2017-01-01T15:57:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.coupon.process.session.remote; import javax.ejb.Remote; import com.coupon.process.message.RedemptionNotificationMessage; import com.coupon.process.message.RedemptionValidationRequestMessage; import com.coupon.process.message.RedemptionValidationResponseMessage; @Remote public interface RedemptionRemote { public static final String NAME = "Redemption"; public static final String MAPPED_NAME = "java:global/CouponsEJB/Redemption"; public RedemptionValidationResponseMessage validateRedemption(RedemptionValidationRequestMessage vrrm); public void notifyRedemption(RedemptionNotificationMessage rnm); }
UTF-8
Java
644
java
RedemptionRemote.java
Java
[]
null
[]
package com.coupon.process.session.remote; import javax.ejb.Remote; import com.coupon.process.message.RedemptionNotificationMessage; import com.coupon.process.message.RedemptionValidationRequestMessage; import com.coupon.process.message.RedemptionValidationResponseMessage; @Remote public interface RedemptionRemote { public static final String NAME = "Redemption"; public static final String MAPPED_NAME = "java:global/CouponsEJB/Redemption"; public RedemptionValidationResponseMessage validateRedemption(RedemptionValidationRequestMessage vrrm); public void notifyRedemption(RedemptionNotificationMessage rnm); }
644
0.82764
0.82764
19
32
33.518257
104
false
false
0
0
0
0
0
0
0.736842
false
false
1
f80eb48ed19937d91367a7a1169ca28ef487088c
27,530,740,427,858
2f5378eebfd2b33e7be951428342045abb0c1b64
/app/src/main/java/ir/tahasystem/music/app/Model/Company.java
7ea88ea08e5efa4682623f593d927108ea9c667f
[]
no_license
bpadashiapp/app
https://github.com/bpadashiapp/app
c56847d214ec9fa0399d0ce820dff1fdef3d7edb
d27868c36ed3a22f29b3d9b7054b1f1177726783
refs/heads/master
2021-01-18T17:09:03.911000
2017-03-31T07:23:23
2017-03-31T07:23:23
86,786,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ir.tahasystem.music.app.Model; import java.io.Serializable; /** * Created by BabakPadashi on 6/9/2016. */ public class Company implements Serializable { static final long serialVersionUID =8996890340799609057L; public double Xposition; public double Yposition; public String companyName; public int companyId; public String address; public String shortDescription; public String fullDescription; public String img; public String phone; public String Mobile; public String messageDay; public int saleType; public boolean showPrice; public int AccessType; public boolean IsManufacture; public int takCatId; public boolean notification; public boolean basket; public boolean chat; public boolean gallery; public boolean mogheyat; public boolean tamasbaMa; public boolean tamasbaSazandeh; public boolean darbareMa; public boolean savabegh; public String msg; }
UTF-8
Java
1,023
java
Company.java
Java
[ { "context": "import java.io.Serializable;\r\n\r\n/**\r\n * Created by BabakPadashi on 6/9/2016.\r\n */\r\npublic class Company implement", "end": 105, "score": 0.9998189806938171, "start": 93, "tag": "NAME", "value": "BabakPadashi" } ]
null
[]
package ir.tahasystem.music.app.Model; import java.io.Serializable; /** * Created by BabakPadashi on 6/9/2016. */ public class Company implements Serializable { static final long serialVersionUID =8996890340799609057L; public double Xposition; public double Yposition; public String companyName; public int companyId; public String address; public String shortDescription; public String fullDescription; public String img; public String phone; public String Mobile; public String messageDay; public int saleType; public boolean showPrice; public int AccessType; public boolean IsManufacture; public int takCatId; public boolean notification; public boolean basket; public boolean chat; public boolean gallery; public boolean mogheyat; public boolean tamasbaMa; public boolean tamasbaSazandeh; public boolean darbareMa; public boolean savabegh; public String msg; }
1,023
0.699902
0.675464
41
22.95122
14.31859
61
false
false
0
0
0
0
0
0
0.707317
false
false
1
80ffe15e30f719a8c0253a4c81642d9c275a30fb
35,098,472,773,080
57cd2749874c726e0be53a00acbfa2f7d7850e05
/src/main/java/nst/projekat/service/SpeakerService.java
9b278ff34d2f39d22a01672af294b19ffc1b6788
[ "Apache-2.0" ]
permissive
primus305/nst-server
https://github.com/primus305/nst-server
19312aa46ee9f109fee823b1b7f8c8f09b45005d
17d9461c05f050fffcaa989cfa0dc5d31ce67751
refs/heads/master
2022-11-21T22:16:28.636000
2020-07-27T16:14:33
2020-07-27T16:14:33
267,325,234
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nst.projekat.service; import nst.projekat.dto.SpeakerDTO; import java.util.List; public interface SpeakerService { List<SpeakerDTO> findAll(); SpeakerDTO save(SpeakerDTO speaker); List<SpeakerDTO> findAllNotOnSession(Long sessionID, Long agendaID); }
UTF-8
Java
275
java
SpeakerService.java
Java
[]
null
[]
package nst.projekat.service; import nst.projekat.dto.SpeakerDTO; import java.util.List; public interface SpeakerService { List<SpeakerDTO> findAll(); SpeakerDTO save(SpeakerDTO speaker); List<SpeakerDTO> findAllNotOnSession(Long sessionID, Long agendaID); }
275
0.770909
0.770909
12
21.916666
21.642775
72
false
false
0
0
0
0
0
0
0.583333
false
false
1
6de53a0e1801a4b197e22bfda54cbc1c9caa665b
36,094,905,180,458
a44ca349e3f0b93b53e169778ec5a92ed520f32d
/PascalTriangle.java
1dab2de4edd13622172e966be46dbd04159d5c90
[]
no_license
swpnsingh/Competitive_Coding-3
https://github.com/swpnsingh/Competitive_Coding-3
1b7e3ff1e0180b422d0027354d98bd2d987a31ea
e518cb764c6d9cc9abd8d56b289aa20437f3fbe2
refs/heads/master
2022-11-10T13:33:01.190000
2020-06-16T02:40:14
2020-06-16T02:40:14
272,592,389
0
0
null
true
2020-06-16T02:36:38
2020-06-16T02:36:38
2019-10-11T20:23:28
2020-06-16T02:18:19
1
0
0
0
null
false
false
class Solution { public List<List<Integer>> generate(int numRows) { List<List<Integer>> pascal = new ArrayList<>(); if(numRows == 0 ) return pascal; //0th row pascal.add(new ArrayList<>()); pascal.get(0).add(1); for(int rowNum = 1 ;rowNum <numRows ;rowNum++){ List<Integer> row = new ArrayList<>(); List<Integer> prevRow = pascal.get(rowNum-1); row.add(1); for(int j = 1;j < rowNum ;j++){ row.add(prevRow.get(j-1) + prevRow.get(j)); } row.add(1); pascal.add(row); } return pascal; } } /* TimeComplexity : O(n*n) SpaceCompelxity:O(n) */
UTF-8
Java
729
java
PascalTriangle.java
Java
[]
null
[]
class Solution { public List<List<Integer>> generate(int numRows) { List<List<Integer>> pascal = new ArrayList<>(); if(numRows == 0 ) return pascal; //0th row pascal.add(new ArrayList<>()); pascal.get(0).add(1); for(int rowNum = 1 ;rowNum <numRows ;rowNum++){ List<Integer> row = new ArrayList<>(); List<Integer> prevRow = pascal.get(rowNum-1); row.add(1); for(int j = 1;j < rowNum ;j++){ row.add(prevRow.get(j-1) + prevRow.get(j)); } row.add(1); pascal.add(row); } return pascal; } } /* TimeComplexity : O(n*n) SpaceCompelxity:O(n) */
729
0.489712
0.475995
26
26.115385
18.786917
57
false
false
0
0
0
0
0
0
0.769231
false
false
1
d6759e2c6c829d4360b575fa48e6ed6dc4c458fc
36,275,293,809,226
48899a06d628695da7310a51dcf7b428d218623a
/src/ja/assess/Player.java
cd6ae59c7287a89df53215233a5fc6b2fe87895d
[]
no_license
mmassey1993/Michael_Massey_JavaAssessment
https://github.com/mmassey1993/Michael_Massey_JavaAssessment
f85a6146857bed77ad5f2f5a28ac8b596d15df21
0bd086b7fe7b2cac71c8841cc54363c1c0710ea6
refs/heads/master
2020-03-21T22:20:43.171000
2018-06-29T14:45:40
2018-06-29T14:45:40
139,120,165
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ja.assess; import java.util.ArrayList; public class Player implements Placeable{ private int pos1; private int pos2; public ArrayList<Integer> posPlayer; public Player(){ this.setPos1((int) Math.random()*5); this.setPos2((int) Math.random()*5); setPos(); } @Override public ArrayList<Integer> setPos() { double posA = Math.random()*5; double posB = Math.random()*5; ArrayList<Integer> posPlayer = new ArrayList<>(); posPlayer.add((int) posA); posPlayer.add((int) posB); this.posPlayer = posPlayer; return this.posPlayer; } public int getPos1() { return pos1; } public void setPos1(int pos1) { this.pos1 = pos1; } public int getPos2() { return pos2; } public void setPos2(int pos2) { this.pos2 = pos2; } }
UTF-8
Java
903
java
Player.java
Java
[]
null
[]
package ja.assess; import java.util.ArrayList; public class Player implements Placeable{ private int pos1; private int pos2; public ArrayList<Integer> posPlayer; public Player(){ this.setPos1((int) Math.random()*5); this.setPos2((int) Math.random()*5); setPos(); } @Override public ArrayList<Integer> setPos() { double posA = Math.random()*5; double posB = Math.random()*5; ArrayList<Integer> posPlayer = new ArrayList<>(); posPlayer.add((int) posA); posPlayer.add((int) posB); this.posPlayer = posPlayer; return this.posPlayer; } public int getPos1() { return pos1; } public void setPos1(int pos1) { this.pos1 = pos1; } public int getPos2() { return pos2; } public void setPos2(int pos2) { this.pos2 = pos2; } }
903
0.574751
0.552602
48
17.8125
16.389347
57
false
false
0
0
0
0
0
0
0.395833
false
false
1
4ce4e098c1c57a1e313a00758ee326a8411537e6
7,232,724,975,034
a63dae5a0e3851c3e60aba6d1993324f797bc4a6
/junit-test/src/test/java/vic/test/junit/LongTimeTest.java
db5226299907f00a360c73368f55e28c42297669
[]
no_license
vicly/test-java
https://github.com/vicly/test-java
1e7a7592eca60c492b5bda6593ce2f06094d9a01
e4e6ef8fbfd1986969e73f703ff7164d6642fa75
refs/heads/master
2021-01-17T10:21:47.528000
2019-08-05T10:26:06
2019-08-05T10:26:06
42,047,037
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vic.test.junit; import org.junit.Test; public class LongTimeTest { // if 800, case fails @Test(timeout=1300) public void testDoBigJobDuration() { LongTime lt = new LongTime(); lt.doBigJob(); } }
UTF-8
Java
216
java
LongTimeTest.java
Java
[]
null
[]
package vic.test.junit; import org.junit.Test; public class LongTimeTest { // if 800, case fails @Test(timeout=1300) public void testDoBigJobDuration() { LongTime lt = new LongTime(); lt.doBigJob(); } }
216
0.694444
0.662037
14
14.428572
12.826949
37
false
false
0
0
0
0
0
0
1
false
false
1
4cbf1c1c57843e9856db8c9a54fcdfa19b8bd3b7
29,429,115,951,394
a75928fa143ba17f6f38ee53132568dd71bbc48d
/app/src/main/java/com/gin/blockly_demo/OnSeekBarValueChangeListener.java
b7e18d7143009fde72ec2633381c468285839e8e
[]
no_license
LegendGin/blockly-demo
https://github.com/LegendGin/blockly-demo
6bf4adba8ddd97dcff875e07156edd772512cecf
c6e86cdbcf6196b740218c875212515ec0692109
refs/heads/master
2020-12-24T10:32:59.180000
2016-11-15T08:30:27
2016-11-15T08:30:27
73,143,369
0
1
null
false
2016-11-16T03:04:49
2016-11-08T02:59:49
2016-11-08T03:18:42
2016-11-16T03:04:49
3,388
0
1
1
JavaScript
null
null
package com.gin.blockly_demo; /** * Created by zhuoying on 2016/11/15. */ public interface OnSeekBarValueChangeListener { void onSeekBarValueChange(float f); }
UTF-8
Java
168
java
OnSeekBarValueChangeListener.java
Java
[ { "context": "package com.gin.blockly_demo;\n\n/**\n * Created by zhuoying on 2016/11/15.\n */\n\npublic interface OnSeekBarVal", "end": 57, "score": 0.9994359016418457, "start": 49, "tag": "USERNAME", "value": "zhuoying" } ]
null
[]
package com.gin.blockly_demo; /** * Created by zhuoying on 2016/11/15. */ public interface OnSeekBarValueChangeListener { void onSeekBarValueChange(float f); }
168
0.738095
0.690476
9
17.666666
18.708286
47
false
false
0
0
0
0
0
0
0.222222
false
false
1
2cad10a94346e81963d1af83841a94e4ba302dc9
12,472,585,066,215
1d9bf427fa97018e5f581174f3628f979f6fe4ca
/demo_java/demo_00/src/runoob/ErrOperateEmp.java
ce913e07e0714acae6ee74008546a332d23fdc8f
[]
no_license
martin2lgsb/demo
https://github.com/martin2lgsb/demo
ba16e9fd0ee1def3f44d49468669cf3a6d559aec
e239a1550a5803e1a7b9c59532f93a046323fd39
refs/heads/master
2023-07-05T00:56:38.957000
2023-06-08T03:40:02
2023-06-08T03:40:02
86,035,305
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package runoob; /** * Created by m2lgsb on 05/03/2018 */ public class ErrOperateEmp { public static void main(String[] args) { try { throw new Exception("fxck Exception"); } catch (Exception e) { System.err.println("Caught err"); System.err.println(e.getMessage()); e.printStackTrace(); } finally { System.out.println("最后了..."); // System.exit(0); } } }
UTF-8
Java
474
java
ErrOperateEmp.java
Java
[ { "context": "package runoob;\n\n/**\n * Created by m2lgsb on 05/03/2018\n */\npublic class ErrOperateEmp {\n ", "end": 41, "score": 0.9995453357696533, "start": 35, "tag": "USERNAME", "value": "m2lgsb" } ]
null
[]
package runoob; /** * Created by m2lgsb on 05/03/2018 */ public class ErrOperateEmp { public static void main(String[] args) { try { throw new Exception("fxck Exception"); } catch (Exception e) { System.err.println("Caught err"); System.err.println(e.getMessage()); e.printStackTrace(); } finally { System.out.println("最后了..."); // System.exit(0); } } }
474
0.523504
0.502137
19
23.631578
16.837336
50
false
false
0
0
0
0
0
0
0.368421
false
false
1
4611773167413832d1b05d4e9ab06a69137f8dba
33,560,874,499,481
b78cd3d47556784b5f979f7d9c669e360bc0da2f
/src/test/java/org/endless/test/locaveiculo/util/repository/UsuarioPermissaoRepositoryTeste.java
c35f7950e50feb6f400a690269da482bcac4a24d
[]
no_license
wiklich/locadora-veiculo-rest
https://github.com/wiklich/locadora-veiculo-rest
5072a2f1051b98c8344cb4c0207766c42c4bad16
477fef82083778638dc7a31a29989ea45082adf6
refs/heads/master
2020-01-27T17:33:18.205000
2018-01-31T00:10:38
2018-01-31T00:10:38
67,846,322
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.endless.test.locaveiculo.util.repository; import java.util.List; import org.apache.log4j.Logger; import org.endless.locaveiculo.model.UsuarioPermissao; import org.endless.locaveiculo.repository.UsuarioPermissaoRepository; import org.endless.test.locaveiculo.util.AbstractTeste; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; public class UsuarioPermissaoRepositoryTeste extends AbstractTeste { private static final Logger LOGGER = Logger.getLogger(UsuarioPermissaoRepositoryTeste.class); @Autowired private UsuarioPermissaoRepository usuarioPermissaoRepository; @Test public void testeBuscarTodos() { List<UsuarioPermissao> usuariosPermissoes = this.usuarioPermissaoRepository.findAll(); LOGGER.info(usuariosPermissoes); } }
UTF-8
Java
796
java
UsuarioPermissaoRepositoryTeste.java
Java
[]
null
[]
package org.endless.test.locaveiculo.util.repository; import java.util.List; import org.apache.log4j.Logger; import org.endless.locaveiculo.model.UsuarioPermissao; import org.endless.locaveiculo.repository.UsuarioPermissaoRepository; import org.endless.test.locaveiculo.util.AbstractTeste; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; public class UsuarioPermissaoRepositoryTeste extends AbstractTeste { private static final Logger LOGGER = Logger.getLogger(UsuarioPermissaoRepositoryTeste.class); @Autowired private UsuarioPermissaoRepository usuarioPermissaoRepository; @Test public void testeBuscarTodos() { List<UsuarioPermissao> usuariosPermissoes = this.usuarioPermissaoRepository.findAll(); LOGGER.info(usuariosPermissoes); } }
796
0.836683
0.835427
25
30.879999
30.439869
94
false
false
0
0
0
0
0
0
1
false
false
1
b0b0189839d7df4571f9bf03a48bcb1e20f399d8
3,908,420,285,439
4eb98a208147c2cc0f1106ac90293117a00a5402
/app/src/main/java/com/example/geek/moviesapp/DataProcess/KeyTags.java
8dbd2f246bd255025ce210e2b3031244fca63ab3
[]
no_license
Mohammedgeek/MoviesApp
https://github.com/Mohammedgeek/MoviesApp
ce87a2903f408c4b9809322c260dbfd38af59ea6
1e14138001baa3902993d3d15a2591674b7a5ae0
refs/heads/master
2020-05-24T23:50:00.626000
2019-08-25T16:24:03
2019-08-25T16:24:03
187,521,865
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.geek.moviesapp.DataProcess; public class KeyTags { public static final String idKey ="id"; public static final String titleKey = "title"; public static final String posterKey = "poster_path"; public static final String overViewKey = "overview"; public static final String voteAverageKey = "vote_average"; public static final String releasDateKey = "release_date"; public static final String rootKey = "results"; }
UTF-8
Java
474
java
KeyTags.java
Java
[]
null
[]
package com.example.geek.moviesapp.DataProcess; public class KeyTags { public static final String idKey ="id"; public static final String titleKey = "title"; public static final String posterKey = "poster_path"; public static final String overViewKey = "overview"; public static final String voteAverageKey = "vote_average"; public static final String releasDateKey = "release_date"; public static final String rootKey = "results"; }
474
0.719409
0.719409
11
42.090908
22.589035
65
false
false
0
0
0
0
0
0
0.727273
false
false
1
93754efc505147f1bb2682ea1393b023a48f5aaa
3,229,815,456,396
1037a315da2448ae0c4b73132e1092a52e471e92
/app/src/main/java/com/example/itc327w_bookah_mobile/Activities/SplashScreens/VerificationSplash.java
ece4bb874603e7a80b2deb5fd9a5d74c428b1682
[]
no_license
Group-P/ITC327W_Bookah
https://github.com/Group-P/ITC327W_Bookah
7806219e122e1c4e09eb9e971ad2d199e31f1387
a1e7585d70035c4249d9d85748dc092df67056ab
refs/heads/master
2023-02-23T15:52:39.926000
2021-01-26T01:09:10
2021-01-26T01:09:10
323,932,010
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.itc327w_bookah_mobile.Activities.SplashScreens; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import com.example.itc327w_bookah_mobile.Activities.Login; import com.example.itc327w_bookah_mobile.R; public class VerificationSplash extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN); setContentView(R.layout.activity_verification_splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent verifySplashIntent = new Intent(VerificationSplash.this, Login.class); startActivity(verifySplashIntent); finish(); } },10000); } }
UTF-8
Java
1,015
java
VerificationSplash.java
Java
[]
null
[]
package com.example.itc327w_bookah_mobile.Activities.SplashScreens; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import com.example.itc327w_bookah_mobile.Activities.Login; import com.example.itc327w_bookah_mobile.R; public class VerificationSplash extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN); setContentView(R.layout.activity_verification_splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent verifySplashIntent = new Intent(VerificationSplash.this, Login.class); startActivity(verifySplashIntent); finish(); } },10000); } }
1,015
0.707389
0.693596
30
32.866665
29.826982
125
false
false
0
0
0
0
0
0
0.6
false
false
1
7896b28b7c003f2039ca4a6856fbb18214975194
30,365,418,794,422
f74f72cfaf48d8e55c101ab66f313fc61c46b1d9
/Composite/src/ComponenteFormulario.java
d1bb2b01248f97e437264226d4f9e27190b7f6e6
[]
no_license
albertomontesg/sc
https://github.com/albertomontesg/sc
794c0b9c956eb91ce66cdf8c2f25cd7afd0ee415
4685a27e5147ab8042bff7b9de026c177b02b42a
refs/heads/master
2021-01-21T18:28:46.712000
2015-05-17T16:46:34
2015-05-17T16:46:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Iterator; public abstract class ComponenteFormulario { public abstract String getValue() ; public abstract String getEtiqueta() ; public abstract void setEtiqueta(String e) ; public abstract void setVerifier(Verifier v) ; public abstract boolean verify() ; public abstract boolean isItOK() ; public abstract void addComponente(ComponenteFormulario c) ; public abstract ComponenteFormulario removeComponente(ComponenteFormulario c) ; @Override public abstract String toString() ; public abstract Iterator createIterator() ; public abstract boolean canAskValue() ; // informa de si para el componente puede preguntarse un valor public abstract void setValue(String val) ; }
UTF-8
Java
706
java
ComponenteFormulario.java
Java
[]
null
[]
import java.util.Iterator; public abstract class ComponenteFormulario { public abstract String getValue() ; public abstract String getEtiqueta() ; public abstract void setEtiqueta(String e) ; public abstract void setVerifier(Verifier v) ; public abstract boolean verify() ; public abstract boolean isItOK() ; public abstract void addComponente(ComponenteFormulario c) ; public abstract ComponenteFormulario removeComponente(ComponenteFormulario c) ; @Override public abstract String toString() ; public abstract Iterator createIterator() ; public abstract boolean canAskValue() ; // informa de si para el componente puede preguntarse un valor public abstract void setValue(String val) ; }
706
0.793201
0.793201
19
36.157894
26.430172
103
false
false
0
0
0
0
0
0
1.421053
false
false
1
ed6afbf77ff38ff7d41859e111a6b0e4edcfee31
30,365,418,796,614
7e94bfdeb29cdf3b50e71bb4eed40ca50674b786
/src/edu/njit/cs/saboc/blu/core/gui/gep/panels/details/tan/band/AggregateBandDetailsPanel.java
ed396db338fe4d974d79f9b4428cd83b1e8e9077
[]
no_license
NJITSABOC/oaf-core-weighted
https://github.com/NJITSABOC/oaf-core-weighted
ee2a3f11e64cdedf943258ddc1248755baf6100b
a604705a0c91b1dbba5015f1c771cf3ac3261c0f
refs/heads/master
2023-01-24T18:18:39.654000
2020-10-30T18:13:50
2020-10-30T18:13:50
308,710,276
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.njit.cs.saboc.blu.core.gui.gep.panels.details.tan.band; import edu.njit.cs.saboc.blu.core.abn.tan.Band; import edu.njit.cs.saboc.blu.core.gui.gep.panels.details.NodeConceptList; import edu.njit.cs.saboc.blu.core.gui.gep.panels.details.NodeDetailsPanel; import edu.njit.cs.saboc.blu.core.gui.gep.panels.details.tan.configuration.TANConfiguration; /** * * @author Chris O */ public class AggregateBandDetailsPanel extends NodeDetailsPanel<Band> { public AggregateBandDetailsPanel(TANConfiguration configuration) { super(new BandSummaryPanel(configuration), configuration.getUIConfiguration().getPartitionedNodeOptionsPanel(), new NodeConceptList(configuration), configuration); } }
UTF-8
Java
788
java
AggregateBandDetailsPanel.java
Java
[ { "context": "iguration.TANConfiguration;\r\n\r\n/**\r\n *\r\n * @author Chris O\r\n */\r\npublic class AggregateBandDetailsPanel extend", "end": 394, "score": 0.9713422656059265, "start": 387, "tag": "NAME", "value": "Chris O" } ]
null
[]
package edu.njit.cs.saboc.blu.core.gui.gep.panels.details.tan.band; import edu.njit.cs.saboc.blu.core.abn.tan.Band; import edu.njit.cs.saboc.blu.core.gui.gep.panels.details.NodeConceptList; import edu.njit.cs.saboc.blu.core.gui.gep.panels.details.NodeDetailsPanel; import edu.njit.cs.saboc.blu.core.gui.gep.panels.details.tan.configuration.TANConfiguration; /** * * @author <NAME> */ public class AggregateBandDetailsPanel extends NodeDetailsPanel<Band> { public AggregateBandDetailsPanel(TANConfiguration configuration) { super(new BandSummaryPanel(configuration), configuration.getUIConfiguration().getPartitionedNodeOptionsPanel(), new NodeConceptList(configuration), configuration); } }
787
0.722081
0.722081
21
35.619049
33.123833
92
false
false
0
0
0
0
0
0
0.428571
false
false
1
265b50d40238520a3f013fce9e658f814f509287
33,500,744,928,825
f4d8b181202a64c1f914a41b074ac7d43f20399e
/src/view/ChessWindow.java
3778582820f33a2f4447fcb8ce627c416aefb191
[]
no_license
PaulFryson/ChessGame
https://github.com/PaulFryson/ChessGame
e36a61d4babc781f407c351a7fcecc97eddeb47f
10537a5e716c7bf1bcf6837524631353289e82dc
refs/heads/master
2019-01-21T12:58:57.511000
2016-04-20T18:30:41
2016-04-20T18:30:41
56,710,400
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package view; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import model.Chessboard; import controller.Chess; import controller.PieceAction; /** * @author Paul * */ public class ChessWindow extends JFrame { private Chess chess; /** * */ private static final long serialVersionUID = 9040978770256604819L; public ChessWindow() { super(); chess = new Chess(); chess.newGame(); build(); } private void build() { setTitle("Chess"); setSize(600,600); setLocationRelativeTo(null); setResizable(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setContentPane(buildContentPane()); } private JPanel buildContentPane(){ JPanel midPanel = new JPanel(); midPanel.setLayout(new GridLayout(Chessboard.RANKS, Chessboard.FILES)); for(int i = 0; i < Chessboard.RANKS ; i++) { for(int j = 0; j < Chessboard.FILES ; j++) { chess.getChessboard().getSquares()[i][j].addActionListener(new PieceAction(this)); midPanel.add(chess.getChessboard().getSquares()[i][j]); } } return midPanel; } /** * @return the chess */ public Chess getChess() { return chess; } /** * @param chess the chess to set */ public void setChess(Chess chess) { this.chess = chess; } }
UTF-8
Java
1,279
java
ChessWindow.java
Java
[ { "context": "ss;\nimport controller.PieceAction;\n\n/**\n * @author Paul\n *\n */\npublic class ChessWindow extends JFrame {\n", "end": 200, "score": 0.9996258616447449, "start": 196, "tag": "NAME", "value": "Paul" } ]
null
[]
package view; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import model.Chessboard; import controller.Chess; import controller.PieceAction; /** * @author Paul * */ public class ChessWindow extends JFrame { private Chess chess; /** * */ private static final long serialVersionUID = 9040978770256604819L; public ChessWindow() { super(); chess = new Chess(); chess.newGame(); build(); } private void build() { setTitle("Chess"); setSize(600,600); setLocationRelativeTo(null); setResizable(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setContentPane(buildContentPane()); } private JPanel buildContentPane(){ JPanel midPanel = new JPanel(); midPanel.setLayout(new GridLayout(Chessboard.RANKS, Chessboard.FILES)); for(int i = 0; i < Chessboard.RANKS ; i++) { for(int j = 0; j < Chessboard.FILES ; j++) { chess.getChessboard().getSquares()[i][j].addActionListener(new PieceAction(this)); midPanel.add(chess.getChessboard().getSquares()[i][j]); } } return midPanel; } /** * @return the chess */ public Chess getChess() { return chess; } /** * @param chess the chess to set */ public void setChess(Chess chess) { this.chess = chess; } }
1,279
0.675528
0.654418
68
17.82353
19.259026
86
false
false
0
0
0
0
0
0
1.617647
false
false
1
20e985ca69e4728182415171e8d4ea1468616bb1
4,810,363,424,664
f25fcf14d19ef21f198eb0c28ce86aea263a3fb3
/src/main/java/com/magenta/ejb/session/StopTaskBean.java
4ef1101fa929e67c426a915dd34ef21d25985504
[]
no_license
alexrix/Worktime-Tracker
https://github.com/alexrix/Worktime-Tracker
0c48eee9f33959f300dc2842619db9ef1749d1fe
0215386e75ab3c5d6ccd5f9a8f7c180ffe93acb8
refs/heads/master
2020-02-06T13:27:56.014000
2015-08-10T07:58:04
2015-08-10T07:58:04
40,189,090
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.magenta.ejb.session; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import static com.magenta.utils.ChangeCurrentTaskId.changeCurrentTaskId; import static com.magenta.utils.RefreshTotalTime.refreshTotalTime; @Stateless public class StopTaskBean { @PersistenceContext(unitName="tackerUnit") private EntityManager entityManager; public boolean stopTask(int taskId,String accessToken){ try{ refreshTotalTime(taskId, entityManager); //change current Task Id in User entity // means that there is no current task changeCurrentTaskId(accessToken, 0, entityManager); return true; }catch (Exception e){ System.out.println(e); } return false; } }
UTF-8
Java
844
java
StopTaskBean.java
Java
[]
null
[]
package com.magenta.ejb.session; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import static com.magenta.utils.ChangeCurrentTaskId.changeCurrentTaskId; import static com.magenta.utils.RefreshTotalTime.refreshTotalTime; @Stateless public class StopTaskBean { @PersistenceContext(unitName="tackerUnit") private EntityManager entityManager; public boolean stopTask(int taskId,String accessToken){ try{ refreshTotalTime(taskId, entityManager); //change current Task Id in User entity // means that there is no current task changeCurrentTaskId(accessToken, 0, entityManager); return true; }catch (Exception e){ System.out.println(e); } return false; } }
844
0.701422
0.700237
31
26.225807
23.066118
72
false
false
0
0
0
0
0
0
0.516129
false
false
1
65b2cc6b85d60fba45fe701f8edfee98cb486b02
21,225,728,397,929
bb2d0c6028f147d212f99d89331d4ec039051249
/src/main/java/com/muyun/admin/mapper/MenuMapper.java
40d168978e42719663e93558db75ae5a3ad0cf6f
[]
no_license
mu-yun/spring-boot
https://github.com/mu-yun/spring-boot
8fb82ff2ce454728072c3153009919cd6af4fc77
5099b3b05ad154d3bf24f1130027df19e1a114fd
refs/heads/master
2021-03-20T22:04:04.016000
2020-07-11T05:08:49
2020-12-19T18:56:17
247,237,826
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.muyun.admin.mapper; import com.muyun.admin.dto.MenuDTO; import com.muyun.admin.dto.MenuTreeDTO; import com.muyun.admin.entity.Menu; import com.muyun.admin.model.Route; import com.muyun.admin.vo.MenuTreeVO; import com.muyun.admin.vo.MenuVO; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.MappingTarget; import java.util.List; import java.util.Set; /** * @author muyun * @date 2020/5/26 */ @Mapper(config = MapStructConfig.class) public interface MenuMapper { Menu idToMenu(Long id); Set<Menu> idsToMenus(Set<Long> ids); Menu toMenu(MenuDTO menuDTO); void updateMenu(@MappingTarget Menu menu, MenuDTO menuDTO); //avoid infinite loop @Mapping(target = "roles", ignore = true) MenuVO toMenuVO(Menu menu, boolean hasChildren); MenuTreeVO toMenuTreeVO(MenuTreeDTO menuTreeDTO, boolean childless); Route toRoute(Menu menu, List<Route> children); }
UTF-8
Java
935
java
MenuMapper.java
Java
[ { "context": "a.util.List;\nimport java.util.Set;\n\n/**\n * @author muyun\n * @date 2020/5/26\n */\n@Mapper(config = MapStruct", "end": 415, "score": 0.9996376633644104, "start": 410, "tag": "USERNAME", "value": "muyun" } ]
null
[]
package com.muyun.admin.mapper; import com.muyun.admin.dto.MenuDTO; import com.muyun.admin.dto.MenuTreeDTO; import com.muyun.admin.entity.Menu; import com.muyun.admin.model.Route; import com.muyun.admin.vo.MenuTreeVO; import com.muyun.admin.vo.MenuVO; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.MappingTarget; import java.util.List; import java.util.Set; /** * @author muyun * @date 2020/5/26 */ @Mapper(config = MapStructConfig.class) public interface MenuMapper { Menu idToMenu(Long id); Set<Menu> idsToMenus(Set<Long> ids); Menu toMenu(MenuDTO menuDTO); void updateMenu(@MappingTarget Menu menu, MenuDTO menuDTO); //avoid infinite loop @Mapping(target = "roles", ignore = true) MenuVO toMenuVO(Menu menu, boolean hasChildren); MenuTreeVO toMenuTreeVO(MenuTreeDTO menuTreeDTO, boolean childless); Route toRoute(Menu menu, List<Route> children); }
935
0.746524
0.739037
38
23.605263
19.670362
72
false
false
0
0
0
0
0
0
0.631579
false
false
1
7db922fed031ac5e639902ba205728f211046101
13,735,305,467,906
db52a5564bec71ab745073a76cb4e934bec44a63
/app/src/main/java/com/thinhlp/cocshopapp/entities/Cart.java
a525d7dda000989d39e5400b5fb044718e6e0753
[]
no_license
ThinhLP/CocShopApp
https://github.com/ThinhLP/CocShopApp
62caf060fdd1313f1abbbc4372c31a1b546c75a0
159e34dde9550aa18ad7eb2b36efb833f20d2b8b
refs/heads/master
2021-01-22T22:43:56.893000
2017-07-17T08:42:04
2017-07-17T08:42:04
92,786,785
0
0
null
false
2017-07-16T08:49:24
2017-05-30T00:57:17
2017-07-12T09:20:49
2017-07-16T08:49:24
372
0
0
3
Java
null
null
package com.thinhlp.cocshopapp.entities; import java.util.Date; import java.util.List; /** * Created by thinhlp on 7/14/17. */ public class Cart { private int customerId; private String customerName; private String orderDate; private List<CartItem> cartItems; public Cart() { } public Cart(int customerId, String customerName, String orderDate, List<CartItem> cartItems) { this.customerId = customerId; this.customerName = customerName; this.orderDate = orderDate; this.cartItems = cartItems; } public int getCustomerId() { return customerId; } public void setCustomerId(int customerId) { this.customerId = customerId; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getOrderDate() { return orderDate; } public void setOrderDate(String orderDate) { this.orderDate = orderDate; } public List<CartItem> getCartItems() { return cartItems; } public void setCartItems(List<CartItem> cartItems) { this.cartItems = cartItems; } }
UTF-8
Java
1,242
java
Cart.java
Java
[ { "context": "il.Date;\nimport java.util.List;\n\n/**\n * Created by thinhlp on 7/14/17.\n */\n\npublic class Cart {\n private ", "end": 114, "score": 0.9996748566627502, "start": 107, "tag": "USERNAME", "value": "thinhlp" } ]
null
[]
package com.thinhlp.cocshopapp.entities; import java.util.Date; import java.util.List; /** * Created by thinhlp on 7/14/17. */ public class Cart { private int customerId; private String customerName; private String orderDate; private List<CartItem> cartItems; public Cart() { } public Cart(int customerId, String customerName, String orderDate, List<CartItem> cartItems) { this.customerId = customerId; this.customerName = customerName; this.orderDate = orderDate; this.cartItems = cartItems; } public int getCustomerId() { return customerId; } public void setCustomerId(int customerId) { this.customerId = customerId; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getOrderDate() { return orderDate; } public void setOrderDate(String orderDate) { this.orderDate = orderDate; } public List<CartItem> getCartItems() { return cartItems; } public void setCartItems(List<CartItem> cartItems) { this.cartItems = cartItems; } }
1,242
0.651369
0.647343
57
20.789474
20.160528
98
false
false
0
0
0
0
0
0
0.385965
false
false
1
04af5c1917332f3c70609b6e58523948c42abf9b
23,055,384,469,978
ad72f694ee0e22d3b4d5f6d7a9bde8117784c556
/src/main/java/com/example/demo/application/exceptions/InvalidPageSizeRequestException.java
b6545c7f4c8c12f8e337a667f13f9fc7b8d13006
[]
no_license
liranzxc/playground_lazar
https://github.com/liranzxc/playground_lazar
16d5bdb2486fc31b8ae16cbf439e35faccd207da
a889987c11328ae658c0ef0f66be3ef028d78df3
refs/heads/master
2020-04-02T06:02:15.235000
2019-03-18T15:54:18
2019-03-18T15:54:18
154,124,442
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.application.exceptions; public class InvalidPageSizeRequestException extends Exception { private static final long serialVersionUID = 1L; private static final String defaultMessage = "Page size must be at least 1"; public InvalidPageSizeRequestException(String string) { super(string); } public InvalidPageSizeRequestException() { super(defaultMessage); } }
UTF-8
Java
398
java
InvalidPageSizeRequestException.java
Java
[]
null
[]
package com.example.demo.application.exceptions; public class InvalidPageSizeRequestException extends Exception { private static final long serialVersionUID = 1L; private static final String defaultMessage = "Page size must be at least 1"; public InvalidPageSizeRequestException(String string) { super(string); } public InvalidPageSizeRequestException() { super(defaultMessage); } }
398
0.79397
0.788945
16
23.875
26.734516
77
false
false
0
0
0
0
0
0
0.9375
false
false
1
0b8c7a7d518a4523d4f05e90845e5b538c7bf2dc
28,922,309,796,672
3c97ef0dd12b72c2de31264665cdae3c93de7281
/app/src/main/java/co/edu/usbcali/finalproject/domain/IConnexionRest.java
b7cbcfbf823c62b583edecd742501a5bb0b00c50
[]
no_license
marlonramirez/final-project
https://github.com/marlonramirez/final-project
fbd915eea5fbfcdaec2395808b4fb90031aa32a8
8012fcc8b298efc05c36cd68c1d6c68682976ada
refs/heads/master
2021-09-09T16:21:17.852000
2018-03-17T23:07:38
2018-03-17T23:07:38
125,158,210
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.edu.usbcali.finalproject.domain; import com.google.gson.JsonObject; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; /** * Created by Marlon.Ramirez on 16/02/2018. */ public interface IConnexionRest { @GET("directions/json") Call<JsonObject> getDirection(@Query("origin") String origin, @Query("destination") String destination, @Query("language") String language, @Query("mode") String mode, @Query("key") String key); }
UTF-8
Java
478
java
IConnexionRest.java
Java
[ { "context": "T;\nimport retrofit2.http.Query;\n\n/**\n * Created by Marlon.Ramirez on 16/02/2018.\n */\n\npublic interface IConnexionRe", "end": 193, "score": 0.9998910427093506, "start": 179, "tag": "NAME", "value": "Marlon.Ramirez" } ]
null
[]
package co.edu.usbcali.finalproject.domain; import com.google.gson.JsonObject; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; /** * Created by Marlon.Ramirez on 16/02/2018. */ public interface IConnexionRest { @GET("directions/json") Call<JsonObject> getDirection(@Query("origin") String origin, @Query("destination") String destination, @Query("language") String language, @Query("mode") String mode, @Query("key") String key); }
478
0.740586
0.717573
17
27.117647
45.592674
198
false
false
0
0
0
0
0
0
0.588235
false
false
1
b3ebcb1edf0685feb36dcf4e5700610f9bec9e9b
14,139,032,360,040
4ffb39fec0bc0ebdb15ea8b389bbfeead24e22b1
/lighty-examples/controllers/lighty-controller-springboot-netconf/src/main/java/io/lighty/core/controller/springboot/MainApp.java
f791092b653c4b52c46a522d9517581a965269d3
[ "Fair" ]
permissive
miroslavKovacPantheon/lighty-core
https://github.com/miroslavKovacPantheon/lighty-core
bd006af784e1198ce1f1fec8db2072fdc41ac48a
a44ba1319c4352e5b5a0bedb32717ae886107530
refs/heads/master
2020-03-21T18:03:05.878000
2018-06-19T08:54:55
2018-06-19T14:58:01
135,686,892
0
0
null
true
2018-06-01T07:59:41
2018-06-01T07:59:41
2018-05-25T05:56:15
2018-05-29T15:03:55
123
0
0
0
null
false
null
/* * Copyright (c) 2018 Pantheon Technologies s.r.o. All Rights Reserved. * * This Source Code Form is subject to the terms of the lighty.io-core * Fair License 5, version 0.9.1. You may obtain a copy of the License * at: https://github.com/PantheonTechnologies/lighty-core/LICENSE.md */ package io.lighty.core.controller.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MainApp { public static void main(String[] args) { SpringApplication.run(MainApp.class, args); } }
UTF-8
Java
615
java
MainApp.java
Java
[ { "context": "/*\n * Copyright (c) 2018 Pantheon Technologies s.r.o. All Rights Reserved.\n *\n * This Source Cod", "end": 46, "score": 0.7681309580802917, "start": 25, "tag": "NAME", "value": "Pantheon Technologies" }, { "context": "n a copy of the License\n * at: https://github.com/PantheonTechnologies/lighty-core/LICENSE.md\n */\n\npackage io.lighty.cor", "end": 266, "score": 0.9979420304298401, "start": 246, "tag": "USERNAME", "value": "PantheonTechnologies" } ]
null
[]
/* * Copyright (c) 2018 <NAME> s.r.o. All Rights Reserved. * * This Source Code Form is subject to the terms of the lighty.io-core * Fair License 5, version 0.9.1. You may obtain a copy of the License * at: https://github.com/PantheonTechnologies/lighty-core/LICENSE.md */ package io.lighty.core.controller.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MainApp { public static void main(String[] args) { SpringApplication.run(MainApp.class, args); } }
600
0.756098
0.743089
20
29.75
28.807768
71
false
false
0
0
0
0
0
0
0.3
false
false
1
ff1e3fa3dcabe775970a746fa9f13db1b1a4961c
24,318,104,855,226
b63b529c8cb1896910a09b845f4000a0f74575c6
/flowfence/flowfence.service/src/main/java/edu/umich/flowfence/service/Handle.java
b869ca535b1e99ea608c7043a8b3f1155502e729
[]
no_license
davinomjr/FlowFence_Release
https://github.com/davinomjr/FlowFence_Release
647d3a560e77ab7cc4a041b6aff55d97a8333735
4eeb99ec4a994e36907b34dbe218a1e49df91fda
refs/heads/master
2020-03-21T13:55:38.344000
2018-10-31T14:45:09
2018-10-31T14:45:09
138,632,167
1
0
null
true
2018-06-25T18:06:23
2018-06-25T18:06:23
2017-01-13T03:04:37
2017-02-03T15:36:38
12,814
0
0
0
null
false
null
/* * Copyright (C) 2017 The Regents of the University of Michigan * * 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 edu.umich.flowfence.service; import android.os.ConditionVariable; import android.os.DeadObjectException; import android.os.RemoteException; import android.util.Log; import java.util.Collections; import java.util.HashSet; import java.util.Set; import edu.umich.flowfence.common.CallParam; import edu.umich.flowfence.common.CallResult; import edu.umich.flowfence.common.Direction; import edu.umich.flowfence.common.HandleDestroyedException; import edu.umich.flowfence.common.IHandle; import edu.umich.flowfence.common.IHandleDebug; import edu.umich.flowfence.common.ParamInfo; import edu.umich.flowfence.common.ParceledPayload; import edu.umich.flowfence.common.ParceledThrowable; import edu.umich.flowfence.common.QMDescriptor; import edu.umich.flowfence.common.TaintSet; import edu.umich.flowfence.internal.ISandboxObject; import edu.umich.flowfence.common.ParceledPayloadExceptionResult; public class Handle extends IHandle.Stub { private static final String TAG = "FF.TSHandle"; private static final boolean localLOGV = Log.isLoggable(TAG, Log.VERBOSE); private static final boolean localLOGD = Log.isLoggable(TAG, Log.DEBUG); // Set of known-immutable types. // These can be safely reused across multiple calls. private static final Set<String> g_mKnownImmutableTypes; static { HashSet<String> immut = new HashSet<>(); immut.add("java.lang.String"); immut.add("int"); immut.add("java.lang.Integer"); immut.add("long"); immut.add("java.lang.Long"); immut.add("byte"); immut.add("java.lang.Byte"); immut.add("short"); immut.add("java.lang.Short"); immut.add("char"); immut.add("java.lang.Character"); immut.add("boolean"); immut.add("java.lang.Boolean"); immut.add("float"); immut.add("java.lang.Float"); immut.add("double"); immut.add("java.lang.Double"); immut.add("void"); immut.add("java.lang.Void"); g_mKnownImmutableTypes = Collections.unmodifiableSet(immut); } private enum State { PENDING, COMPLETE, DESTROYED }; private State mState = State.PENDING; // Lock: Protects all state. // CV: Blocks until computation is complete. private final ConditionVariable mSyncRoot = new ConditionVariable(); private boolean mReleased = false; // The set of calls waiting on us. // TODO: Should this be weak? Or a set? private Set<CallRecord> mSuccessors = new HashSet<>(); // The CallRecord describing the call. Contains arguments and preds. private CallRecord mCallRecord; // Used by finished calls. // The Sandbox that defined the value. private Sandbox mDefiningSandbox = null; // The SandboxObjects that are live for this value. private PerSandboxMap<ISandboxObject> mLiveValues = new PerSandboxMap<>(); // The marshaled value. private ParceledPayload mMarshaled = null; // The taint of the value. private TaintSet mTaint = TaintSet.EMPTY; // The exception that occurred when running the QM. Null if no exception. private Throwable mThrowable = null; private Sandbox.EventHandler mHandler; private boolean mValueNull; private int mParamIndex; private ParamInfo mParamInfo = null; /*package*/ Handle(CallRecord record, int index) { mCallRecord = record; mParamIndex = index; } private void checkNotDestroyed() { if (mState == State.DESTROYED) { throw new HandleDestroyedException("Handle destroyed"); } } private void checkNotReleased() { if (mReleased) { throw new HandleDestroyedException("Handle has been released"); } } private void checkPending() { checkNotDestroyed(); if (mState == State.COMPLETE) { throw new IllegalStateException("Already complete"); } } private void checkComplete() { checkNotDestroyed(); if (mState == State.PENDING) { throw new IllegalStateException("Not yet complete"); } } /** * Add a CallRecord that depends on this value. * @param succ The CallRecord to add. * @param releaseAtomic True to release() atomically with taking this reference. * @return True if the CallRecord needs to wait for {@link CallRecord#onDataReady(Handle)} on this Handle, * false if it is already completed and/or already referenced by that CallRecord. */ public boolean addSuccessor(CallRecord succ, boolean releaseAtomic) { synchronized (mSyncRoot) { checkNotReleased(); checkNotDestroyed(); if (releaseAtomic) { mReleased = true; } boolean needsWait = mSuccessors.add(succ) && mState == State.PENDING; checkForDestroyLocked(); return needsWait; } } public boolean removeSuccessor(CallRecord succ) { synchronized (mSyncRoot) { checkNotDestroyed(); boolean didRemove = mSuccessors.remove(succ); checkForDestroyLocked(); return didRemove; } } public boolean isException() { synchronized (mSyncRoot) { checkComplete(); return (mThrowable != null); } } public boolean isMarshalled() { synchronized (mSyncRoot) { checkComplete(); return (mMarshaled != null || mValueNull || mThrowable != null); } } public boolean isLiveIn(Sandbox sb) { synchronized (mSyncRoot) { checkComplete(); return mLiveValues.containsKey(sb); } } public TaintSet getTaint() { synchronized (mSyncRoot) { checkComplete(); return mTaint; } } // About refcounting: // All handles start with one reference (the handle returned to the app). // When a handle is passed to a later QM to use it, that CallRecord takes a reference. // If, when a QM is about to execute, there is only 1 reference on it, we can reuse any // live copy of it and don't need to worry about marshaling it out. // If a handle hits 0 references, we mark it dead. // References are 1 ref if not released, +1 for every successor. public int getRefCount() { synchronized (mSyncRoot) { return getRefCountLocked(); } } private int getRefCountLocked() { if (mState == State.DESTROYED) { return 0; } else { int refcount = mReleased ? 0 : 1; refcount += mSuccessors.size(); return refcount; } } public void onComplete(Sandbox sandbox, ISandboxObject hObj) { synchronized (mSyncRoot) { checkPending(); mState = State.COMPLETE; mDefiningSandbox = sandbox; mValueNull = (hObj == null); if (!mValueNull) { mLiveValues.put(sandbox, hObj); mHandler = new Sandbox.EventHandler() { @Override public boolean onEvent(String event, Sandbox sender, Object args) throws Exception { marshalOut(); return true; } }; sandbox.onBeforeDisconnect.register(this, mHandler); sandbox.onBeforeTaintAdd.register(this, mHandler); sandbox.registerUnmarshalledObject(this, hObj); } mTaint = sandbox.getTaints(); mThrowable = null; callSuccessorsLocked(); } } public void onException(Sandbox sandbox, Throwable t) { synchronized (mSyncRoot) { checkPending(); mState = State.COMPLETE; mDefiningSandbox = sandbox; mThrowable = t; mTaint = sandbox.getTaints(); callSuccessorsLocked(); } } private void callSuccessorsLocked() { for (CallRecord record : mSuccessors) { record.onDataReady(this); } } private void unregisterMarshal() { mDefiningSandbox.onBeforeDisconnect.unregister(mHandler); mDefiningSandbox.onBeforeTaintAdd.unregister(mHandler); mDefiningSandbox.unregisterUnmarshalledObject(this); } public void marshalOut() { synchronized (mSyncRoot) { checkComplete(); if (isMarshalled()) { return; } try { ISandboxObject obj = mLiveValues.get(mDefiningSandbox); if (obj == null) { // shouldn't have happened - means the sandbox has been destroyed Log.e(TAG, "Can't find live value to marshal out"); mThrowable = new DeadObjectException(); } else { ParceledPayloadExceptionResult result = obj.marshalOut(); if (result.isException()) { mThrowable = result.getException(); } else { mMarshaled = result.getResult(); } } } catch (Exception e) { mThrowable = e; } if (!mDefiningSandbox.getTaints().isSubsetOf(TaintSet.nullToEmpty(mTaint))) { Log.e(TAG, "Sandbox taints have increased prior to marshal out"); mTaint = mDefiningSandbox.getTaints(); } unregisterMarshal(); mHandler = null; } } public static CallParam getOutboundCallParam(Sandbox sb, CallParam source, CallRecord record) throws Exception { switch (source.getType()) { case CallParam.TYPE_NULL: case CallParam.TYPE_DATA: return source; case CallParam.TYPE_HANDLE: { int flags = source.getHeader(); if ((flags & CallParam.HANDLE_SYNC_ONLY) != 0) { return null; } Handle h = (Handle) source.getPayload(); return h.getCallParam(sb, flags & CallParam.MASK_FLAG, record); } default: throw new IllegalArgumentException(); } } private CallParam getCallParam(Sandbox sb, int flags, CallRecord record) throws Exception { CallParam rv = new CallParam(); synchronized (mSyncRoot) { // Can we keep this one alive? We can if we have a live object in that sandbox. if (mThrowable != null) { ParceledThrowable.throwUnchecked(mThrowable); } ISandboxObject sbo = mLiveValues.get(sb); if (sbo != null) { // Do we need to marshal out? We don't if we're the last ones to use this. if (isImmutable()) { // We can reuse immutable objects without needing to marshal in and out. // TODO: support @Immutable annotation. if (localLOGV) { Log.v(TAG, "Skipping marshal-out for immutable object " + toString()); } } else { if (mReleased && mSuccessors.size() == 1 && mSuccessors.contains(record)) { if (localLOGV) { Log.v(TAG, "Skipping marshal-out for discarded object " + toString()); } unregisterMarshal(); } else { if (localLOGV) { Log.v(TAG, "Marshalling out live object " + toString()); } marshalOut(); } mLiveValues.remove(sb); flags |= CallParam.HANDLE_RELEASE; } if (localLOGV) { Log.v(TAG, "Reusing sandbox object for " + toString()); } rv.setHandle(sbo.asBinder(), flags); } else { // No live value. Marshal if necessary. if (localLOGV) { Log.v(TAG, "Marshalling from storage " + toString()); } marshalOut(); if (mValueNull) { rv.setNull(flags); } else { rv.setData(mMarshaled, flags); } } // Last double-check for exceptions, since marshalOut might have thrown them. if (mThrowable != null) { ParceledThrowable.throwUnchecked(mThrowable); } return rv; } } private boolean isImmutable() { return g_mKnownImmutableTypes.contains(getParamInfo().getTypeName()); } private void checkForDestroyLocked() { if (getRefCountLocked() == 0) { if (localLOGV) { Log.v(TAG, "Destroying "+this, new Exception()); } // no references left - destroy if (mDefiningSandbox != null) { mDefiningSandbox.onBeforeDisconnect.unregister(mHandler); mDefiningSandbox.onBeforeTaintAdd.unregister(mHandler); mDefiningSandbox.unregisterUnmarshalledObject(this); } /* // Shouldn't do this - let IBinder ref counting handle this. for (ISandboxObject sbo : mLiveValues.values()) { try { sbo.destroy(); } catch (RemoteException re) { Log.e(TAG, "Failed to destroy ISandboxObject", re); } } */ mCallRecord = null; mMarshaled = null; mLiveValues = null; mDefiningSandbox = null; mHandler = null; mThrowable = null; mSuccessors = null; mState = State.DESTROYED; mParamInfo = null; } } @Override public void release() { synchronized (mSyncRoot) { if (localLOGV) { Log.v(TAG, "Releasing "+this, new Exception()); } mReleased = true; checkForDestroyLocked(); if (localLOGV && getRefCountLocked() > 0) { Log.v(TAG, "Still have "+getRefCountLocked()+" successors on "+this); } } } @Override public Handle withTaint(TaintSet newTaints) { // TODO return null; } @Override public IHandleDebug getDebug() { // TODO return null; } @Override public QMDescriptor getQMDescriptor() { synchronized (mSyncRoot) { checkNotDestroyed(); return mCallRecord.getQM().getDescriptor(); } } @Override public int getParamIndex() throws RemoteException { synchronized (mSyncRoot) { checkNotDestroyed(); return mParamIndex; } } @Override public ParamInfo getParamInfo() { synchronized (mSyncRoot) { checkNotDestroyed(); if (mParamInfo == null) { QMRef qm = mCallRecord.getQM(); if (mParamIndex == CallResult.RETURN_VALUE) { mParamInfo = new ParamInfo(qm.getResultType(), mParamIndex, Direction.OUT); } else { mParamInfo = qm.getParamInfo().get(mParamIndex); } } return mParamInfo; } } @Override public ParceledPayloadExceptionResult tryDeclassify(boolean mergeTaints) { // TODO return null; } @Override public boolean isComplete() { synchronized (mSyncRoot) { checkNotDestroyed(); return (mState == State.COMPLETE); } } @Override public boolean tryWaitForComplete() { // TODO deadlock prevention mCallRecord.waitForReady(); return true; } @Override public String toString() { return String.format("Handle[%s]{%s}", getParamInfo(), mCallRecord); } }
UTF-8
Java
16,907
java
Handle.java
Java
[]
null
[]
/* * Copyright (C) 2017 The Regents of the University of Michigan * * 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 edu.umich.flowfence.service; import android.os.ConditionVariable; import android.os.DeadObjectException; import android.os.RemoteException; import android.util.Log; import java.util.Collections; import java.util.HashSet; import java.util.Set; import edu.umich.flowfence.common.CallParam; import edu.umich.flowfence.common.CallResult; import edu.umich.flowfence.common.Direction; import edu.umich.flowfence.common.HandleDestroyedException; import edu.umich.flowfence.common.IHandle; import edu.umich.flowfence.common.IHandleDebug; import edu.umich.flowfence.common.ParamInfo; import edu.umich.flowfence.common.ParceledPayload; import edu.umich.flowfence.common.ParceledThrowable; import edu.umich.flowfence.common.QMDescriptor; import edu.umich.flowfence.common.TaintSet; import edu.umich.flowfence.internal.ISandboxObject; import edu.umich.flowfence.common.ParceledPayloadExceptionResult; public class Handle extends IHandle.Stub { private static final String TAG = "FF.TSHandle"; private static final boolean localLOGV = Log.isLoggable(TAG, Log.VERBOSE); private static final boolean localLOGD = Log.isLoggable(TAG, Log.DEBUG); // Set of known-immutable types. // These can be safely reused across multiple calls. private static final Set<String> g_mKnownImmutableTypes; static { HashSet<String> immut = new HashSet<>(); immut.add("java.lang.String"); immut.add("int"); immut.add("java.lang.Integer"); immut.add("long"); immut.add("java.lang.Long"); immut.add("byte"); immut.add("java.lang.Byte"); immut.add("short"); immut.add("java.lang.Short"); immut.add("char"); immut.add("java.lang.Character"); immut.add("boolean"); immut.add("java.lang.Boolean"); immut.add("float"); immut.add("java.lang.Float"); immut.add("double"); immut.add("java.lang.Double"); immut.add("void"); immut.add("java.lang.Void"); g_mKnownImmutableTypes = Collections.unmodifiableSet(immut); } private enum State { PENDING, COMPLETE, DESTROYED }; private State mState = State.PENDING; // Lock: Protects all state. // CV: Blocks until computation is complete. private final ConditionVariable mSyncRoot = new ConditionVariable(); private boolean mReleased = false; // The set of calls waiting on us. // TODO: Should this be weak? Or a set? private Set<CallRecord> mSuccessors = new HashSet<>(); // The CallRecord describing the call. Contains arguments and preds. private CallRecord mCallRecord; // Used by finished calls. // The Sandbox that defined the value. private Sandbox mDefiningSandbox = null; // The SandboxObjects that are live for this value. private PerSandboxMap<ISandboxObject> mLiveValues = new PerSandboxMap<>(); // The marshaled value. private ParceledPayload mMarshaled = null; // The taint of the value. private TaintSet mTaint = TaintSet.EMPTY; // The exception that occurred when running the QM. Null if no exception. private Throwable mThrowable = null; private Sandbox.EventHandler mHandler; private boolean mValueNull; private int mParamIndex; private ParamInfo mParamInfo = null; /*package*/ Handle(CallRecord record, int index) { mCallRecord = record; mParamIndex = index; } private void checkNotDestroyed() { if (mState == State.DESTROYED) { throw new HandleDestroyedException("Handle destroyed"); } } private void checkNotReleased() { if (mReleased) { throw new HandleDestroyedException("Handle has been released"); } } private void checkPending() { checkNotDestroyed(); if (mState == State.COMPLETE) { throw new IllegalStateException("Already complete"); } } private void checkComplete() { checkNotDestroyed(); if (mState == State.PENDING) { throw new IllegalStateException("Not yet complete"); } } /** * Add a CallRecord that depends on this value. * @param succ The CallRecord to add. * @param releaseAtomic True to release() atomically with taking this reference. * @return True if the CallRecord needs to wait for {@link CallRecord#onDataReady(Handle)} on this Handle, * false if it is already completed and/or already referenced by that CallRecord. */ public boolean addSuccessor(CallRecord succ, boolean releaseAtomic) { synchronized (mSyncRoot) { checkNotReleased(); checkNotDestroyed(); if (releaseAtomic) { mReleased = true; } boolean needsWait = mSuccessors.add(succ) && mState == State.PENDING; checkForDestroyLocked(); return needsWait; } } public boolean removeSuccessor(CallRecord succ) { synchronized (mSyncRoot) { checkNotDestroyed(); boolean didRemove = mSuccessors.remove(succ); checkForDestroyLocked(); return didRemove; } } public boolean isException() { synchronized (mSyncRoot) { checkComplete(); return (mThrowable != null); } } public boolean isMarshalled() { synchronized (mSyncRoot) { checkComplete(); return (mMarshaled != null || mValueNull || mThrowable != null); } } public boolean isLiveIn(Sandbox sb) { synchronized (mSyncRoot) { checkComplete(); return mLiveValues.containsKey(sb); } } public TaintSet getTaint() { synchronized (mSyncRoot) { checkComplete(); return mTaint; } } // About refcounting: // All handles start with one reference (the handle returned to the app). // When a handle is passed to a later QM to use it, that CallRecord takes a reference. // If, when a QM is about to execute, there is only 1 reference on it, we can reuse any // live copy of it and don't need to worry about marshaling it out. // If a handle hits 0 references, we mark it dead. // References are 1 ref if not released, +1 for every successor. public int getRefCount() { synchronized (mSyncRoot) { return getRefCountLocked(); } } private int getRefCountLocked() { if (mState == State.DESTROYED) { return 0; } else { int refcount = mReleased ? 0 : 1; refcount += mSuccessors.size(); return refcount; } } public void onComplete(Sandbox sandbox, ISandboxObject hObj) { synchronized (mSyncRoot) { checkPending(); mState = State.COMPLETE; mDefiningSandbox = sandbox; mValueNull = (hObj == null); if (!mValueNull) { mLiveValues.put(sandbox, hObj); mHandler = new Sandbox.EventHandler() { @Override public boolean onEvent(String event, Sandbox sender, Object args) throws Exception { marshalOut(); return true; } }; sandbox.onBeforeDisconnect.register(this, mHandler); sandbox.onBeforeTaintAdd.register(this, mHandler); sandbox.registerUnmarshalledObject(this, hObj); } mTaint = sandbox.getTaints(); mThrowable = null; callSuccessorsLocked(); } } public void onException(Sandbox sandbox, Throwable t) { synchronized (mSyncRoot) { checkPending(); mState = State.COMPLETE; mDefiningSandbox = sandbox; mThrowable = t; mTaint = sandbox.getTaints(); callSuccessorsLocked(); } } private void callSuccessorsLocked() { for (CallRecord record : mSuccessors) { record.onDataReady(this); } } private void unregisterMarshal() { mDefiningSandbox.onBeforeDisconnect.unregister(mHandler); mDefiningSandbox.onBeforeTaintAdd.unregister(mHandler); mDefiningSandbox.unregisterUnmarshalledObject(this); } public void marshalOut() { synchronized (mSyncRoot) { checkComplete(); if (isMarshalled()) { return; } try { ISandboxObject obj = mLiveValues.get(mDefiningSandbox); if (obj == null) { // shouldn't have happened - means the sandbox has been destroyed Log.e(TAG, "Can't find live value to marshal out"); mThrowable = new DeadObjectException(); } else { ParceledPayloadExceptionResult result = obj.marshalOut(); if (result.isException()) { mThrowable = result.getException(); } else { mMarshaled = result.getResult(); } } } catch (Exception e) { mThrowable = e; } if (!mDefiningSandbox.getTaints().isSubsetOf(TaintSet.nullToEmpty(mTaint))) { Log.e(TAG, "Sandbox taints have increased prior to marshal out"); mTaint = mDefiningSandbox.getTaints(); } unregisterMarshal(); mHandler = null; } } public static CallParam getOutboundCallParam(Sandbox sb, CallParam source, CallRecord record) throws Exception { switch (source.getType()) { case CallParam.TYPE_NULL: case CallParam.TYPE_DATA: return source; case CallParam.TYPE_HANDLE: { int flags = source.getHeader(); if ((flags & CallParam.HANDLE_SYNC_ONLY) != 0) { return null; } Handle h = (Handle) source.getPayload(); return h.getCallParam(sb, flags & CallParam.MASK_FLAG, record); } default: throw new IllegalArgumentException(); } } private CallParam getCallParam(Sandbox sb, int flags, CallRecord record) throws Exception { CallParam rv = new CallParam(); synchronized (mSyncRoot) { // Can we keep this one alive? We can if we have a live object in that sandbox. if (mThrowable != null) { ParceledThrowable.throwUnchecked(mThrowable); } ISandboxObject sbo = mLiveValues.get(sb); if (sbo != null) { // Do we need to marshal out? We don't if we're the last ones to use this. if (isImmutable()) { // We can reuse immutable objects without needing to marshal in and out. // TODO: support @Immutable annotation. if (localLOGV) { Log.v(TAG, "Skipping marshal-out for immutable object " + toString()); } } else { if (mReleased && mSuccessors.size() == 1 && mSuccessors.contains(record)) { if (localLOGV) { Log.v(TAG, "Skipping marshal-out for discarded object " + toString()); } unregisterMarshal(); } else { if (localLOGV) { Log.v(TAG, "Marshalling out live object " + toString()); } marshalOut(); } mLiveValues.remove(sb); flags |= CallParam.HANDLE_RELEASE; } if (localLOGV) { Log.v(TAG, "Reusing sandbox object for " + toString()); } rv.setHandle(sbo.asBinder(), flags); } else { // No live value. Marshal if necessary. if (localLOGV) { Log.v(TAG, "Marshalling from storage " + toString()); } marshalOut(); if (mValueNull) { rv.setNull(flags); } else { rv.setData(mMarshaled, flags); } } // Last double-check for exceptions, since marshalOut might have thrown them. if (mThrowable != null) { ParceledThrowable.throwUnchecked(mThrowable); } return rv; } } private boolean isImmutable() { return g_mKnownImmutableTypes.contains(getParamInfo().getTypeName()); } private void checkForDestroyLocked() { if (getRefCountLocked() == 0) { if (localLOGV) { Log.v(TAG, "Destroying "+this, new Exception()); } // no references left - destroy if (mDefiningSandbox != null) { mDefiningSandbox.onBeforeDisconnect.unregister(mHandler); mDefiningSandbox.onBeforeTaintAdd.unregister(mHandler); mDefiningSandbox.unregisterUnmarshalledObject(this); } /* // Shouldn't do this - let IBinder ref counting handle this. for (ISandboxObject sbo : mLiveValues.values()) { try { sbo.destroy(); } catch (RemoteException re) { Log.e(TAG, "Failed to destroy ISandboxObject", re); } } */ mCallRecord = null; mMarshaled = null; mLiveValues = null; mDefiningSandbox = null; mHandler = null; mThrowable = null; mSuccessors = null; mState = State.DESTROYED; mParamInfo = null; } } @Override public void release() { synchronized (mSyncRoot) { if (localLOGV) { Log.v(TAG, "Releasing "+this, new Exception()); } mReleased = true; checkForDestroyLocked(); if (localLOGV && getRefCountLocked() > 0) { Log.v(TAG, "Still have "+getRefCountLocked()+" successors on "+this); } } } @Override public Handle withTaint(TaintSet newTaints) { // TODO return null; } @Override public IHandleDebug getDebug() { // TODO return null; } @Override public QMDescriptor getQMDescriptor() { synchronized (mSyncRoot) { checkNotDestroyed(); return mCallRecord.getQM().getDescriptor(); } } @Override public int getParamIndex() throws RemoteException { synchronized (mSyncRoot) { checkNotDestroyed(); return mParamIndex; } } @Override public ParamInfo getParamInfo() { synchronized (mSyncRoot) { checkNotDestroyed(); if (mParamInfo == null) { QMRef qm = mCallRecord.getQM(); if (mParamIndex == CallResult.RETURN_VALUE) { mParamInfo = new ParamInfo(qm.getResultType(), mParamIndex, Direction.OUT); } else { mParamInfo = qm.getParamInfo().get(mParamIndex); } } return mParamInfo; } } @Override public ParceledPayloadExceptionResult tryDeclassify(boolean mergeTaints) { // TODO return null; } @Override public boolean isComplete() { synchronized (mSyncRoot) { checkNotDestroyed(); return (mState == State.COMPLETE); } } @Override public boolean tryWaitForComplete() { // TODO deadlock prevention mCallRecord.waitForReady(); return true; } @Override public String toString() { return String.format("Handle[%s]{%s}", getParamInfo(), mCallRecord); } }
16,907
0.56657
0.565446
500
32.813999
24.28834
116
false
false
0
0
0
0
0
0
0.496
false
false
1
b04051f8010358f2540c7062dae1c3457da3941d
28,887,950,069,539
caffac39a14d332c3132213632f5c29563f0a2ec
/plugins/org.fhir4emf.metamodel.fhir/src/org/hl7/fhir/jaxb/QuestionnaireResponseStatusImplAdapter.java
24393e0d3d5e2d90a8c030a63e3f18e2432636b1
[]
no_license
patins1/fhir4emf
https://github.com/patins1/fhir4emf
ef5e86fb0b206f54347aeffbf38974f562c7bbde
213a76f0a024cfe52d227955bf7c46b113fe46fe
refs/heads/master
2021-09-28T11:46:11.564000
2018-11-17T05:16:58
2018-11-17T05:16:58
83,200,940
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.hl7.fhir.jaxb; import org.hl7.fhir.FhirFactory; import org.hl7.fhir.QuestionnaireResponseStatus; import javax.xml.bind.annotation.adapters.XmlAdapter; import org.hl7.fhir.QuestionnaireResponseStatusList; public class QuestionnaireResponseStatusImplAdapter extends XmlAdapter<String, QuestionnaireResponseStatus> { @Override public QuestionnaireResponseStatus unmarshal(String v) throws Exception { QuestionnaireResponseStatus result = FhirFactory.eINSTANCE.createQuestionnaireResponseStatus(); result.setValue(QuestionnaireResponseStatusList.get(v)); return result; } @Override public String marshal(QuestionnaireResponseStatus v) throws Exception { return v.getValue().getLiteral(); } }
UTF-8
Java
730
java
QuestionnaireResponseStatusImplAdapter.java
Java
[]
null
[]
package org.hl7.fhir.jaxb; import org.hl7.fhir.FhirFactory; import org.hl7.fhir.QuestionnaireResponseStatus; import javax.xml.bind.annotation.adapters.XmlAdapter; import org.hl7.fhir.QuestionnaireResponseStatusList; public class QuestionnaireResponseStatusImplAdapter extends XmlAdapter<String, QuestionnaireResponseStatus> { @Override public QuestionnaireResponseStatus unmarshal(String v) throws Exception { QuestionnaireResponseStatus result = FhirFactory.eINSTANCE.createQuestionnaireResponseStatus(); result.setValue(QuestionnaireResponseStatusList.get(v)); return result; } @Override public String marshal(QuestionnaireResponseStatus v) throws Exception { return v.getValue().getLiteral(); } }
730
0.817808
0.812329
28
25.071428
32.14135
109
false
false
0
0
0
0
0
0
1.035714
false
false
1
ec91225fca78e8760f2ba8249100aa83bc95b8e2
5,669,356,859,056
e8ad48953c08f1326e63e0ad1456e1ff24a79cde
/src/main/java/cn/com/yusys/yusp/tool/web/fillter/AMRequestFilter.java
51416e73bca5657a8fb27b388a0c83c1e7e7d8f2
[]
no_license
figuewang/code-generate
https://github.com/figuewang/code-generate
3cf0a80a23407bdec66e75154c5ceb4b65c188e0
25366ab704472b3def6f03c322294855358c89f8
refs/heads/master
2020-03-27T19:36:56.619000
2019-03-29T09:28:47
2019-03-29T09:28:47
147,000,945
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.yusys.yusp.tool.web.fillter; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; public class AMRequestFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; Map<String, String[]> parameterMap = request.getParameterMap(); Set<Entry<String, String[]>> entrySet = parameterMap.entrySet(); Map<String, List<String>> map = new HashMap<>(); for (Entry<String, String[]> entry : entrySet) { map.put(entry.getKey(), Arrays.asList(entry.getValue())); } System.out.println(">>> from 【"+request.getRemoteAddr()+":"+request.getRemotePort()+"】 to >> " + request.getRequestURL() + " "+request.getCharacterEncoding() +" -> " + map); filterChain.doFilter(servletRequest, servletResponse); System.out.println("<<< 结束-----------------------"); } @Override public void destroy() { } }
UTF-8
Java
1,591
java
AMRequestFilter.java
Java
[]
null
[]
package cn.com.yusys.yusp.tool.web.fillter; import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; public class AMRequestFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; Map<String, String[]> parameterMap = request.getParameterMap(); Set<Entry<String, String[]>> entrySet = parameterMap.entrySet(); Map<String, List<String>> map = new HashMap<>(); for (Entry<String, String[]> entry : entrySet) { map.put(entry.getKey(), Arrays.asList(entry.getValue())); } System.out.println(">>> from 【"+request.getRemoteAddr()+":"+request.getRemotePort()+"】 to >> " + request.getRequestURL() + " "+request.getCharacterEncoding() +" -> " + map); filterChain.doFilter(servletRequest, servletResponse); System.out.println("<<< 结束-----------------------"); } @Override public void destroy() { } }
1,591
0.699937
0.699937
44
35
34.345837
181
false
false
0
0
0
0
0
0
0.727273
false
false
1
13a47a6097720d15f093670bbca928072ee2f960
7,876,970,085,824
1bea62b4579f1b1de3482cc0326f683cc1436458
/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalDayTime.java
656de7bb6694d037350a66f6c001d535b81aa711
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "Python-2.0", "BSD-2-Clause" ]
permissive
apache/hive
https://github.com/apache/hive
f23dd565389b2c7988d0bbc665315234e54ed62c
c93276ab1771cbab7da93049daba48cc5213192e
refs/heads/master
2023-09-04T10:37:39.942000
2023-09-03T11:20:28
2023-09-03T11:20:28
206,444
5,152
4,688
Apache-2.0
false
2023-09-14T19:36:42
2009-05-21T02:31:01
2023-09-14T15:43:48
2023-09-14T19:36:41
683,851
5,065
4,517
96
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.serde2.lazybinary; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable; import org.apache.hadoop.hive.serde2.lazy.ByteArrayRef; import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt; import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VLong; import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalDayTimeObjectInspector; /** * LazyBinaryHiveIntervalDayTime * A LazyBinaryObject that encodes a HiveIntervalDayTime */ public class LazyBinaryHiveIntervalDayTime extends LazyBinaryPrimitive<WritableHiveIntervalDayTimeObjectInspector, HiveIntervalDayTimeWritable>{ static final Logger LOG = LoggerFactory.getLogger(LazyBinaryHiveIntervalDayTime.class); /** * Reusable member for decoding integer. */ VInt vInt = new LazyBinaryUtils.VInt(); VLong vLong = new LazyBinaryUtils.VLong(); LazyBinaryHiveIntervalDayTime(WritableHiveIntervalDayTimeObjectInspector oi) { super(oi); data = new HiveIntervalDayTimeWritable(); } LazyBinaryHiveIntervalDayTime(LazyBinaryHiveIntervalDayTime copy) { super(copy); data = new HiveIntervalDayTimeWritable(copy.data); } @Override public void init(ByteArrayRef bytes, int start, int length) { data.setFromBytes(bytes.getData(), start, length, vInt, vLong); } }
UTF-8
Java
2,213
java
LazyBinaryHiveIntervalDayTime.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.serde2.lazybinary; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable; import org.apache.hadoop.hive.serde2.lazy.ByteArrayRef; import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt; import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VLong; import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalDayTimeObjectInspector; /** * LazyBinaryHiveIntervalDayTime * A LazyBinaryObject that encodes a HiveIntervalDayTime */ public class LazyBinaryHiveIntervalDayTime extends LazyBinaryPrimitive<WritableHiveIntervalDayTimeObjectInspector, HiveIntervalDayTimeWritable>{ static final Logger LOG = LoggerFactory.getLogger(LazyBinaryHiveIntervalDayTime.class); /** * Reusable member for decoding integer. */ VInt vInt = new LazyBinaryUtils.VInt(); VLong vLong = new LazyBinaryUtils.VLong(); LazyBinaryHiveIntervalDayTime(WritableHiveIntervalDayTimeObjectInspector oi) { super(oi); data = new HiveIntervalDayTimeWritable(); } LazyBinaryHiveIntervalDayTime(LazyBinaryHiveIntervalDayTime copy) { super(copy); data = new HiveIntervalDayTimeWritable(copy.data); } @Override public void init(ByteArrayRef bytes, int start, int length) { data.setFromBytes(bytes.getData(), start, length, vInt, vLong); } }
2,213
0.784004
0.778581
56
38.517857
30.546797
106
false
false
0
0
0
0
0
0
0.5
false
false
1
54ad3ca1b477133e343765ba9af31796542c76c3
15,796,889,720,363
45e3b7f4f314d0c372b36041f68427f5fd0175cf
/app/src/main/java/de/derandroidpro/showcaseviewtutorial/MainActivity.java
2ff4fe1f437c8af4be2a80951bdf0dd7666e2dae
[]
no_license
KinggKratos/ShowcaseViewTutorial
https://github.com/KinggKratos/ShowcaseViewTutorial
a49c9d08d6800cb60c9e0be92b9ddb10f929a4d9
dd56486d937ae9fdb378b6a64b963aeb8fab97a7
refs/heads/master
2021-05-01T12:21:50.194000
2015-12-22T18:48:04
2015-12-22T18:48:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.derandroidpro.showcaseviewtutorial; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.github.amlcurran.showcaseview.OnShowcaseEventListener; import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ViewTarget; public class MainActivity extends AppCompatActivity { Button btn; ShowcaseView.Builder showCaseView; final int SHOWCASEVIEW_ID = 28; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.button); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "Button", Toast.LENGTH_SHORT).show(); } }); showShowCaseView(); } public void showShowCaseView(){ showCaseView = new ShowcaseView.Builder(this) .withMaterialShowcase() .setTarget(new ViewTarget(R.id.button, this)) .setContentTitle("Cooles Feature") .setContentText("Klicke auf diesen Button, um das coolste Feature dieser App zu erleben.") .setStyle(R.style.ShowCaseViewStyle) .singleShot(SHOWCASEVIEW_ID) .setShowcaseEventListener(new OnShowcaseEventListener() { @Override public void onShowcaseViewHide(ShowcaseView showcaseView) { } @Override public void onShowcaseViewDidHide(ShowcaseView showcaseView) { } @Override public void onShowcaseViewShow(ShowcaseView showcaseView) { } }); showCaseView.build(); } }
UTF-8
Java
2,013
java
MainActivity.java
Java
[ { "context": ";\nimport android.widget.Toast;\n\nimport com.github.amlcurran.showcaseview.OnShowcaseEventListener;\nimport com.", "end": 236, "score": 0.9989544749259949, "start": 227, "tag": "USERNAME", "value": "amlcurran" }, { "context": "seview.OnShowcaseEventListener;\nimport com.github.amlcurran.showcaseview.ShowcaseView;\nimport com.github.amlc", "end": 302, "score": 0.9990158677101135, "start": 293, "tag": "USERNAME", "value": "amlcurran" }, { "context": "rran.showcaseview.ShowcaseView;\nimport com.github.amlcurran.showcaseview.targets.ViewTarget;\n\npublic class Ma", "end": 357, "score": 0.9987342357635498, "start": 348, "tag": "USERNAME", "value": "amlcurran" } ]
null
[]
package de.derandroidpro.showcaseviewtutorial; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.github.amlcurran.showcaseview.OnShowcaseEventListener; import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ViewTarget; public class MainActivity extends AppCompatActivity { Button btn; ShowcaseView.Builder showCaseView; final int SHOWCASEVIEW_ID = 28; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.button); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "Button", Toast.LENGTH_SHORT).show(); } }); showShowCaseView(); } public void showShowCaseView(){ showCaseView = new ShowcaseView.Builder(this) .withMaterialShowcase() .setTarget(new ViewTarget(R.id.button, this)) .setContentTitle("Cooles Feature") .setContentText("Klicke auf diesen Button, um das coolste Feature dieser App zu erleben.") .setStyle(R.style.ShowCaseViewStyle) .singleShot(SHOWCASEVIEW_ID) .setShowcaseEventListener(new OnShowcaseEventListener() { @Override public void onShowcaseViewHide(ShowcaseView showcaseView) { } @Override public void onShowcaseViewDidHide(ShowcaseView showcaseView) { } @Override public void onShowcaseViewShow(ShowcaseView showcaseView) { } }); showCaseView.build(); } }
2,013
0.628912
0.627422
63
30.952381
26.809397
106
false
false
0
0
0
0
0
0
0.380952
false
false
1
737a5fbf8c00c6896357dd0f1bcbc2566fc6543b
20,822,001,519,460
9238f909f8845618240232ef609871cc4acb07fc
/src/main/java/com/gnopai/ji65/interpreter/instruction/Ldx.java
a9bd0a711c0d235f53cc0613aa98560d4ee61f58
[ "MIT" ]
permissive
gnopai/ji65
https://github.com/gnopai/ji65
303f4e5f8d10944fdaecfe2e22369f37b2fff0b0
034c0e8e169cf99930ed34c8fb2f28ff9ac742bf
refs/heads/master
2021-07-18T08:00:44.631000
2020-05-09T22:44:22
2020-05-09T22:44:22
154,732,084
0
0
MIT
false
2020-05-09T22:44:24
2018-10-25T20:18:12
2020-04-28T03:30:19
2020-05-09T22:44:23
562
0
0
0
Java
false
false
package com.gnopai.ji65.interpreter.instruction; import com.gnopai.ji65.Cpu; import static com.gnopai.ji65.InstructionType.LDX; public class Ldx extends LoadInstruction { public Ldx() { super(LDX, Cpu::setX); } }
UTF-8
Java
232
java
Ldx.java
Java
[]
null
[]
package com.gnopai.ji65.interpreter.instruction; import com.gnopai.ji65.Cpu; import static com.gnopai.ji65.InstructionType.LDX; public class Ldx extends LoadInstruction { public Ldx() { super(LDX, Cpu::setX); } }
232
0.719828
0.693965
11
20.09091
19.322407
50
false
false
0
0
0
0
0
0
0.454545
false
false
1
786b90509e2d2a03a0f58b1db603d29523f9a385
22,462,679,025,848
a1220059b5fb209a0cb284708305ae0adb9e3b4a
/src/main/java/de/leanbyte/checklisttask/model/CheckList.java
8fbccb36068873f9bbb823649a3f7269fb6bd2ed
[]
no_license
suno09/leanbyte-larger-checklist-backend
https://github.com/suno09/leanbyte-larger-checklist-backend
66568ae6529795920b7dc5dc0375bf0a55c7f24b
ec76188d10ea538930fc39acbb74741a8a88066a
refs/heads/main
2023-07-01T13:10:12.139000
2021-07-29T14:18:37
2021-07-29T14:18:37
390,519,187
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.leanbyte.checklisttask.model; import com.arangodb.springframework.annotation.Document; import lombok.Getter; import lombok.Setter; import org.springframework.data.annotation.Id; /** * The checklist model */ @Document @Getter @Setter public class CheckList { @Id private String id; private String title = ""; private String[][] checklists; @Override public String toString() { return "CheckList{" + "id='" + id + '\'' + ", title='" + title + '\'' + '}'; } }
UTF-8
Java
559
java
CheckList.java
Java
[]
null
[]
package de.leanbyte.checklisttask.model; import com.arangodb.springframework.annotation.Document; import lombok.Getter; import lombok.Setter; import org.springframework.data.annotation.Id; /** * The checklist model */ @Document @Getter @Setter public class CheckList { @Id private String id; private String title = ""; private String[][] checklists; @Override public String toString() { return "CheckList{" + "id='" + id + '\'' + ", title='" + title + '\'' + '}'; } }
559
0.595707
0.595707
29
18.275862
16.040674
56
false
false
0
0
0
0
0
0
0.344828
false
false
1
797bcb733d7fe56803a843dc0dafedd62de9ef83
22,282,290,356,536
b339ac425648b032737f13b36d613112336c8bbe
/app/src/main/java/com/makeus/android/endgame/src/profile/models/ProfileResponse.java
a3a6ebe2ac5c5f25e7ed3ce31e69faee70d810f6
[]
no_license
Haeseong5/Endgame
https://github.com/Haeseong5/Endgame
282f5e1a847e656713d682b9673ac6dbc335590b
6580ef72dd3e1e744aad81b3a17f3b685b771159
refs/heads/master
2023-02-12T15:59:51.329000
2021-01-04T04:35:03
2021-01-04T04:35:03
326,570,787
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.makeus.android.endgame.src.profile.models; import com.google.gson.annotations.SerializedName; import com.makeus.android.endgame.src.game.result.models.CommentResult; import com.makeus.android.endgame.src.game.result.models.RecordResult; import java.util.ArrayList; public class ProfileResponse { @SerializedName("isSuccess") private Boolean isSuccess; @SerializedName("code") private Integer code; @SerializedName("message") private String message; @SerializedName("result") private Profile result; public class Profile{ @SerializedName("userInfo") private UserInfo userInfo; @SerializedName("records") private ArrayList<RecordResult> records; @SerializedName("comments") private ArrayList<CommentResult> comments; public class UserInfo{ @SerializedName("email") private String email; @SerializedName("nickname") private String nickname; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } } public UserInfo getUserInfo() { return userInfo; } public void setUserInfo(UserInfo userInfo) { this.userInfo = userInfo; } public ArrayList<RecordResult> getRecords() { return records; } public void setRecords(ArrayList<RecordResult> records) { this.records = records; } public ArrayList<CommentResult> getComments() { return comments; } public void setComments(ArrayList<CommentResult> comments) { this.comments = comments; } } public Boolean getSuccess() { return isSuccess; } public Profile getResult() { return result; } public void setResult(Profile result) { this.result = result; } public void setSuccess(Boolean isSuccess) { this.isSuccess = isSuccess; } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
UTF-8
Java
2,587
java
ProfileResponse.java
Java
[]
null
[]
package com.makeus.android.endgame.src.profile.models; import com.google.gson.annotations.SerializedName; import com.makeus.android.endgame.src.game.result.models.CommentResult; import com.makeus.android.endgame.src.game.result.models.RecordResult; import java.util.ArrayList; public class ProfileResponse { @SerializedName("isSuccess") private Boolean isSuccess; @SerializedName("code") private Integer code; @SerializedName("message") private String message; @SerializedName("result") private Profile result; public class Profile{ @SerializedName("userInfo") private UserInfo userInfo; @SerializedName("records") private ArrayList<RecordResult> records; @SerializedName("comments") private ArrayList<CommentResult> comments; public class UserInfo{ @SerializedName("email") private String email; @SerializedName("nickname") private String nickname; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } } public UserInfo getUserInfo() { return userInfo; } public void setUserInfo(UserInfo userInfo) { this.userInfo = userInfo; } public ArrayList<RecordResult> getRecords() { return records; } public void setRecords(ArrayList<RecordResult> records) { this.records = records; } public ArrayList<CommentResult> getComments() { return comments; } public void setComments(ArrayList<CommentResult> comments) { this.comments = comments; } } public Boolean getSuccess() { return isSuccess; } public Profile getResult() { return result; } public void setResult(Profile result) { this.result = result; } public void setSuccess(Boolean isSuccess) { this.isSuccess = isSuccess; } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
2,587
0.593738
0.593738
110
22.518183
19.299898
71
false
false
0
0
0
0
0
0
0.290909
false
false
1
ec2cc1f0ac71840b2b3b38b384c92ac81c885829
8,564,164,838,916
22a4d49f9bbfe9cd09f3c8bdcb55e5715a65e3a3
/chapter_008_ood/src/main/java/ru/job4j/ood/calculator/ExpressionEvaluator.java
062ade54c283dc3ee4e5d38472d3ff7d3023090b
[ "Apache-2.0" ]
permissive
dpopkov/job4j
https://github.com/dpopkov/job4j
47b0511818a0a2539dc9e977036a6cc0bf0ed973
b96f49f7b9ccd0469bf059663d81b3bde739363c
refs/heads/master
2022-09-23T06:38:57.900000
2021-04-27T20:10:59
2021-04-27T20:10:59
145,213,360
1
2
Apache-2.0
false
2022-09-01T23:13:35
2018-08-18T11:08:19
2021-04-27T20:11:37
2022-09-01T23:13:33
601
0
0
6
Java
false
false
package ru.job4j.ood.calculator; /** * Evaluates arithmetic expressions in string format. */ public interface ExpressionEvaluator { /** * Evaluates an expression that should contain first operand, operation, and second operand, * or a single number. * @param expr expression * @return result of evaluation */ double evaluate(String expr); /** * Evaluates an expression that should use result of previous calculation as first operand. * @param firstOperand result of previous calculation * @param expr expression * @return result of evaluation */ double evaluate(double firstOperand, String expr); }
UTF-8
Java
670
java
ExpressionEvaluator.java
Java
[]
null
[]
package ru.job4j.ood.calculator; /** * Evaluates arithmetic expressions in string format. */ public interface ExpressionEvaluator { /** * Evaluates an expression that should contain first operand, operation, and second operand, * or a single number. * @param expr expression * @return result of evaluation */ double evaluate(String expr); /** * Evaluates an expression that should use result of previous calculation as first operand. * @param firstOperand result of previous calculation * @param expr expression * @return result of evaluation */ double evaluate(double firstOperand, String expr); }
670
0.695522
0.69403
23
28.130434
27.658325
96
false
false
0
0
0
0
0
0
0.304348
false
false
1
ddb0611c7616149a82f194cb1a23a5371aea2376
8,564,164,838,642
672639896795abd7dd8484c32c27577590920e92
/ron-coupon-service/coupon-template/src/main/java/com/ron/coupon/converter/CouponCategoryConverter.java
d514040a089ab730c78952630ada1f4310ed758a
[]
no_license
stephenC030/CouponManage
https://github.com/stephenC030/CouponManage
69bbb4ed8656a5606c25f7afc51faa37dc7b914e
c2546db66ce2426f8f674fca1b081a2ebb593171
refs/heads/main
2022-12-23T00:22:03.809000
2020-10-01T22:49:16
2020-10-01T22:49:16
300,429,900
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ron.coupon.converter; import com.ron.coupon.constant.CouponCategory; import javax.persistence.AttributeConverter; import javax.persistence.Converter; /** * Coupon category enum properties converter * AttributeConverter<X, Y> * X: Entity class type * Y: SQL column type */ @Converter public class CouponCategoryConverter implements AttributeConverter<CouponCategory, String> { /** Convert X to Y to store in DB. Used when insert and update DB. */ @Override public String convertToDatabaseColumn(CouponCategory couponCategory) { return couponCategory.getCode(); } /** Convert String Y from DB back to X. Used when Look up in DB */ @Override public CouponCategory convertToEntityAttribute(String s) { return CouponCategory.of(s); } }
UTF-8
Java
815
java
CouponCategoryConverter.java
Java
[]
null
[]
package com.ron.coupon.converter; import com.ron.coupon.constant.CouponCategory; import javax.persistence.AttributeConverter; import javax.persistence.Converter; /** * Coupon category enum properties converter * AttributeConverter<X, Y> * X: Entity class type * Y: SQL column type */ @Converter public class CouponCategoryConverter implements AttributeConverter<CouponCategory, String> { /** Convert X to Y to store in DB. Used when insert and update DB. */ @Override public String convertToDatabaseColumn(CouponCategory couponCategory) { return couponCategory.getCode(); } /** Convert String Y from DB back to X. Used when Look up in DB */ @Override public CouponCategory convertToEntityAttribute(String s) { return CouponCategory.of(s); } }
815
0.722699
0.722699
27
29.185184
24.040148
74
false
false
0
0
0
0
0
0
0.296296
false
false
1
45bc0e9de51fb594d416df9f69cb172fb32ebd2e
18,794,776,945,580
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i61207.java
3446d279757bbddc11ee845ca6611084cc527b65
[]
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 i61207 {}
UTF-8
Java
69
java
i61207.java
Java
[]
null
[]
package number_of_direct_superinterfaces; public interface i61207 {}
69
0.826087
0.753623
3
22.333334
16.937796
41
false
false
0
0
0
0
0
0
0.333333
false
false
1
9de33a4de614a19d27a02cb13c7c8ff048726368
26,053,271,648,411
2798ba07a27401d8ba55aa3f8518dc3edb7dc995
/fau/lab_9/Q1.java
26d266a41ff846207c29ed0c3394f95a208789f4
[]
no_license
valen22br/JavaPrograms
https://github.com/valen22br/JavaPrograms
53428c9850e71a08a1cbdf19d5f1b0c34fa631f5
d39af453f79a9689eee1c068c3329bc3c0ba0587
refs/heads/master
2021-05-09T04:46:28.607000
2018-04-22T19:43:54
2018-04-22T19:43:54
119,285,523
0
0
null
false
2018-04-22T19:43:55
2018-01-28T18:24:28
2018-04-20T01:47:54
2018-04-22T19:43:55
1,319
0
0
0
Java
false
null
/*/** * /**************************************************************************** * Name: Luis Gustavo Grubert Valensuela Z#:23351882 lvalensuela2015@fau.edu * Course: JavaProgramming * Professor: Dr. Mehrdad Nojoumian * Due Date:04/05/2018 Due Time: 11:30PM * Assignment Number: lab 09 * Last Changed: 04/05/2018 * * Description: * program that implements the quick sort method to a integer array * Time Complexity: * Worst case: O(n^2) /******************************************************************************* */ package lab9.q1; /** * * @author Luis Gustavo Grubert Valensuela */ import java.util.*; /** * Class to implement the quick sort method for sorting a integer array * @uthor Luis Gustavo Grubert Valensuela */ class QuickSort{ int partition(int [] arrayA, int low, int hight) { int pivot = arrayA[hight]; int i = (low -1); //index of smaller element for(int j = low; j < hight; j++) { //if current element is smaller than or equal to pivot if(arrayA[j] <= pivot) { i++; //swap arrayA[i] and arrayA[j] int temp = arrayA[i]; arrayA[i] = arrayA[j]; arrayA[j] = temp; } } //swap arrayA[i+1] and arrayA[hight] (or pivot) int temp = arrayA[i+1]; arrayA[i+1] = arrayA[hight]; arrayA[hight] = temp; return i+1; } /** * Method that implements the QuickSort() * arrayA[] - Array to be sorted, * low - Starting Index, * hight - Ending index * @param arrayA * @param low * @param hight */ void sort(int [] arrayA, int low, int hight) { if(low < hight) { int pi = partition(arrayA,low,hight); sort(arrayA, low, pi-1); sort(arrayA, pi+1, hight); } } } public class Q1 { /** * Auxiliary function to print a int array.\ * @param arrayA */ public static void printArray(int [] arrayA) { for (int i = 0; i < arrayA.length; i++) { System.out.print(arrayA[i] + " "); } System.out.println(""); } public static void main(String[] args) { /* Creation of an array with length of lengthArray with random numbers from the class Random. */ int [] unsortedArray; int lengthArray = 501; unsortedArray = new int[lengthArray]; Random rand = new Random(); for (int i = 0; i < lengthArray; i++) { unsortedArray[i] = rand.nextInt(10000) + 1; } System.out.println("Given Array"); printArray(unsortedArray); QuickSort quickSortObj = new QuickSort(); long startTime = System.nanoTime(); quickSortObj.sort(unsortedArray, 0, lengthArray-1); long endTime = System.nanoTime(); System.out.println("Total Time of execution: " + (endTime - startTime)); System.out.println("Sorted Array"); printArray(unsortedArray); } }
UTF-8
Java
3,446
java
Q1.java
Java
[ { "context": "*****************************************\n * Name: Luis Gustavo Grubert Valensuela Z#:23351882 lvalensuela2015@fau.edu\n * Course: Ja", "end": 127, "score": 0.9998124241828918, "start": 96, "tag": "NAME", "value": "Luis Gustavo Grubert Valensuela" }, { "context": " Name: Luis Gustavo Grubert Valensuela Z#:23351882 lvalensuela2015@fau.edu\n * Course: JavaProgramming\n * Professor: Dr. Mehr", "end": 163, "score": 0.9999336004257202, "start": 140, "tag": "EMAIL", "value": "lvalensuela2015@fau.edu" }, { "context": "u.edu\n * Course: JavaProgramming\n * Professor: Dr. Mehrdad Nojoumian\n * Due Date:04/05/2018 Due Time: 11:3", "end": 226, "score": 0.9998982548713684, "start": 209, "tag": "NAME", "value": "Mehrdad Nojoumian" }, { "context": "**********\n */\npackage lab9.q1;\n\n/**\n *\n * @author Luis Gustavo Grubert Valensuela\n */\nimport java.util.*;\n/**\n * Class to implement", "end": 618, "score": 0.9998837113380432, "start": 587, "tag": "NAME", "value": "Luis Gustavo Grubert Valensuela" }, { "context": " sort method for sorting a integer array\n * @uthor Luis Gustavo Grubert Valensuela\n */\nclass QuickSort{\n int partition(int []", "end": 760, "score": 0.9998801350593567, "start": 729, "tag": "NAME", "value": "Luis Gustavo Grubert Valensuela" } ]
null
[]
/*/** * /**************************************************************************** * Name: <NAME> Z#:23351882 <EMAIL> * Course: JavaProgramming * Professor: Dr. <NAME> * Due Date:04/05/2018 Due Time: 11:30PM * Assignment Number: lab 09 * Last Changed: 04/05/2018 * * Description: * program that implements the quick sort method to a integer array * Time Complexity: * Worst case: O(n^2) /******************************************************************************* */ package lab9.q1; /** * * @author <NAME> */ import java.util.*; /** * Class to implement the quick sort method for sorting a integer array * @uthor <NAME> */ class QuickSort{ int partition(int [] arrayA, int low, int hight) { int pivot = arrayA[hight]; int i = (low -1); //index of smaller element for(int j = low; j < hight; j++) { //if current element is smaller than or equal to pivot if(arrayA[j] <= pivot) { i++; //swap arrayA[i] and arrayA[j] int temp = arrayA[i]; arrayA[i] = arrayA[j]; arrayA[j] = temp; } } //swap arrayA[i+1] and arrayA[hight] (or pivot) int temp = arrayA[i+1]; arrayA[i+1] = arrayA[hight]; arrayA[hight] = temp; return i+1; } /** * Method that implements the QuickSort() * arrayA[] - Array to be sorted, * low - Starting Index, * hight - Ending index * @param arrayA * @param low * @param hight */ void sort(int [] arrayA, int low, int hight) { if(low < hight) { int pi = partition(arrayA,low,hight); sort(arrayA, low, pi-1); sort(arrayA, pi+1, hight); } } } public class Q1 { /** * Auxiliary function to print a int array.\ * @param arrayA */ public static void printArray(int [] arrayA) { for (int i = 0; i < arrayA.length; i++) { System.out.print(arrayA[i] + " "); } System.out.println(""); } public static void main(String[] args) { /* Creation of an array with length of lengthArray with random numbers from the class Random. */ int [] unsortedArray; int lengthArray = 501; unsortedArray = new int[lengthArray]; Random rand = new Random(); for (int i = 0; i < lengthArray; i++) { unsortedArray[i] = rand.nextInt(10000) + 1; } System.out.println("Given Array"); printArray(unsortedArray); QuickSort quickSortObj = new QuickSort(); long startTime = System.nanoTime(); quickSortObj.sort(unsortedArray, 0, lengthArray-1); long endTime = System.nanoTime(); System.out.println("Total Time of execution: " + (endTime - startTime)); System.out.println("Sorted Array"); printArray(unsortedArray); } }
3,344
0.472142
0.45531
122
27.245901
20.932878
80
false
false
0
0
0
0
0
0
0.418033
false
false
1
c59993dc768cc64be5f2a88ec4ab7ab055ce1605
15,530,601,779,210
2c6517cf0a1544c5f4c7c6db55434c0ddc1625e0
/app/src/main/java/newsviewer/sample/com/newsviewertest/fragment/MainFragment.java
f116fc034fa57a387dc405b5b4eeec21be10fe85
[]
no_license
JadeByfield89/NewsViewerTest
https://github.com/JadeByfield89/NewsViewerTest
fb9c7323c0a5f8525712dba3d4d6a71a8d0dd2b5
dd21bd4adb23020823c7f44f06c8194c866667bd
refs/heads/master
2016-09-05T21:09:32.861000
2015-01-12T08:27:21
2015-01-12T08:27:21
29,124,948
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package newsviewer.sample.com.newsviewertest.fragment; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.app.Fragment; import android.support.v4.view.ViewPager; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; import newsviewer.sample.com.newsviewertest.R; import newsviewer.sample.com.newsviewertest.adapter.NewsPagerAdapter; import newsviewer.sample.com.newsviewertest.model.News; import newsviewer.sample.com.newsviewertest.network.NewsRequest; import newsviewer.sample.com.newsviewertest.util.CycleTimer; import newsviewer.sample.com.newsviewertest.view.VerticalNewsView; public class MainFragment extends Fragment implements CycleTimer.onIntervalReachedListener { private static final String TAG = "MainFragment"; private CycleTimer mCycleTimer; private onTimerChangedListener mListener; public static final int MODE_PERIODIC = 0; public static final int MODE_STANDARD = 1; private int CURRENT_MODE; private List<News> mNewsList; private int[] mParamsAlignPool = {RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.CENTER_HORIZONTAL}; //private int[] mParamsRelationPool = { RelativeLayout.RIGHT_OF, RelativeLayout.LEFT_OF}; //private RelativeLayout mContainer; private ScrollView mContainer; private RelativeLayout mInsideContainer; private ViewPager mViewPager; // TODO: Rename and change types and number of parameters public static MainFragment newInstance(String param1, String param2) { MainFragment fragment = new MainFragment(); /*Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args);*/ return fragment; } public MainFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_main, container, false); mContainer = (ScrollView) v.findViewById(R.id.svContainer); //mScrollContainer = (ScrollView)v.findViewById(R.id.svScrollContainer); mInsideContainer = (RelativeLayout) mContainer.findViewById(R.id.rlInsideContainer); mViewPager = (ViewPager) v.findViewById(R.id.pager); // Create and start the cycle timer mCycleTimer = new CycleTimer(getActivity()); mCycleTimer.registerListener(this); mCycleTimer.startTimer(); NewsRequest request = new NewsRequest(getActivity()); request.getNews(); mNewsList = request.getResults(); return v; } @Override public void onResume() { super.onResume(); refreshLayout(); } @Override public void onFinish() { //Before refreshing the layout, check to make sure that we are in fact //In Periodic Cycle Mode if (CURRENT_MODE == MODE_PERIODIC) { try { refreshLayout(); } catch (Exception e) { e.printStackTrace(); } } } public static int getRandomParam(int[] array) { int rnd = new Random().nextInt(array.length); return array[rnd]; } public void refreshLayout() { //Hide the ViewPager from the layout mViewPager.setVisibility(View.GONE); //Just some added "randomness" :) Collections.shuffle(mNewsList); //Remove all previous subviews from layout mInsideContainer.removeAllViews(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } //On each refresh we need to re-layout the news items in a way that makes "sense" //Each News item consists of a thumbnail, article title, and url link(truncated to one line for cleanliness) //First, we iterate through the news items returned from the API call int numItems = mNewsList.size(); for (int i = 0; i < mNewsList.size(); i++) { //Then, we create a View for each News object //In this case we're using our custom VerticalNewsView class VerticalNewsView vertView = new VerticalNewsView(getActivity()); vertView.setTitle(mNewsList.get(i).getTitle()); vertView.setUrl(mNewsList.get(i).getUrl()); vertView.setImage(mNewsList.get(i).getThumbnailUrl()); vertView.setId(i); //Create a new set of layout params for each view RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); //We randomly select a layout param attribute from our pool of attributes //CENTER, LEFT, RIGHT, etc if (i == 0) { params.addRule(getRandomParam(mParamsAlignPool)); //Adding the BELOW rule guarantees that each subview is rendered on a new "line" //and will not overlap with a previous view } else { params.addRule(RelativeLayout.BELOW, i - 1); params.addRule(getRandomParam(mParamsAlignPool)); //params.setMargins(new Random().nextInt(60), new Random().nextInt(60), new Random().nextInt(60), new Random().nextInt(60) ); } //Set the subview's layout params vertView.setLayoutParams(params); //Add the view to the layout mInsideContainer.addView(vertView); } } private void refreshLayoutStandard() { mInsideContainer.removeAllViews(); // mInsideContainer.addView(mViewPager); mViewPager.setVisibility(View.VISIBLE); NewsPagerAdapter adapter = new NewsPagerAdapter(getActivity(), 3); adapter.setNewsList((ArrayList) mNewsList); adapter.setPager(mViewPager); mViewPager.setAdapter(adapter); } @Override public void onTick(long l) { mListener.onTimerTick(l); } public interface onTimerChangedListener { public void onTimerTick(long l); } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (onTimerChangedListener) activity; } catch (ClassCastException e) { e.printStackTrace(); Log.d(TAG, "ClassCastException. MainActivity must implement onTimerChangedListener!"); } } public void setCurrentMode(int mode) { this.CURRENT_MODE = mode; if (CURRENT_MODE == MODE_PERIODIC) { mCycleTimer.cancelTimer(); mCycleTimer.startTimer(); refreshLayout(); } else if (CURRENT_MODE == MODE_STANDARD) { mCycleTimer.cancelTimer(); refreshLayoutStandard(); } } }
UTF-8
Java
7,559
java
MainFragment.java
Java
[]
null
[]
package newsviewer.sample.com.newsviewertest.fragment; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.app.Fragment; import android.support.v4.view.ViewPager; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; import newsviewer.sample.com.newsviewertest.R; import newsviewer.sample.com.newsviewertest.adapter.NewsPagerAdapter; import newsviewer.sample.com.newsviewertest.model.News; import newsviewer.sample.com.newsviewertest.network.NewsRequest; import newsviewer.sample.com.newsviewertest.util.CycleTimer; import newsviewer.sample.com.newsviewertest.view.VerticalNewsView; public class MainFragment extends Fragment implements CycleTimer.onIntervalReachedListener { private static final String TAG = "MainFragment"; private CycleTimer mCycleTimer; private onTimerChangedListener mListener; public static final int MODE_PERIODIC = 0; public static final int MODE_STANDARD = 1; private int CURRENT_MODE; private List<News> mNewsList; private int[] mParamsAlignPool = {RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.CENTER_HORIZONTAL}; //private int[] mParamsRelationPool = { RelativeLayout.RIGHT_OF, RelativeLayout.LEFT_OF}; //private RelativeLayout mContainer; private ScrollView mContainer; private RelativeLayout mInsideContainer; private ViewPager mViewPager; // TODO: Rename and change types and number of parameters public static MainFragment newInstance(String param1, String param2) { MainFragment fragment = new MainFragment(); /*Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args);*/ return fragment; } public MainFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_main, container, false); mContainer = (ScrollView) v.findViewById(R.id.svContainer); //mScrollContainer = (ScrollView)v.findViewById(R.id.svScrollContainer); mInsideContainer = (RelativeLayout) mContainer.findViewById(R.id.rlInsideContainer); mViewPager = (ViewPager) v.findViewById(R.id.pager); // Create and start the cycle timer mCycleTimer = new CycleTimer(getActivity()); mCycleTimer.registerListener(this); mCycleTimer.startTimer(); NewsRequest request = new NewsRequest(getActivity()); request.getNews(); mNewsList = request.getResults(); return v; } @Override public void onResume() { super.onResume(); refreshLayout(); } @Override public void onFinish() { //Before refreshing the layout, check to make sure that we are in fact //In Periodic Cycle Mode if (CURRENT_MODE == MODE_PERIODIC) { try { refreshLayout(); } catch (Exception e) { e.printStackTrace(); } } } public static int getRandomParam(int[] array) { int rnd = new Random().nextInt(array.length); return array[rnd]; } public void refreshLayout() { //Hide the ViewPager from the layout mViewPager.setVisibility(View.GONE); //Just some added "randomness" :) Collections.shuffle(mNewsList); //Remove all previous subviews from layout mInsideContainer.removeAllViews(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } //On each refresh we need to re-layout the news items in a way that makes "sense" //Each News item consists of a thumbnail, article title, and url link(truncated to one line for cleanliness) //First, we iterate through the news items returned from the API call int numItems = mNewsList.size(); for (int i = 0; i < mNewsList.size(); i++) { //Then, we create a View for each News object //In this case we're using our custom VerticalNewsView class VerticalNewsView vertView = new VerticalNewsView(getActivity()); vertView.setTitle(mNewsList.get(i).getTitle()); vertView.setUrl(mNewsList.get(i).getUrl()); vertView.setImage(mNewsList.get(i).getThumbnailUrl()); vertView.setId(i); //Create a new set of layout params for each view RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); //We randomly select a layout param attribute from our pool of attributes //CENTER, LEFT, RIGHT, etc if (i == 0) { params.addRule(getRandomParam(mParamsAlignPool)); //Adding the BELOW rule guarantees that each subview is rendered on a new "line" //and will not overlap with a previous view } else { params.addRule(RelativeLayout.BELOW, i - 1); params.addRule(getRandomParam(mParamsAlignPool)); //params.setMargins(new Random().nextInt(60), new Random().nextInt(60), new Random().nextInt(60), new Random().nextInt(60) ); } //Set the subview's layout params vertView.setLayoutParams(params); //Add the view to the layout mInsideContainer.addView(vertView); } } private void refreshLayoutStandard() { mInsideContainer.removeAllViews(); // mInsideContainer.addView(mViewPager); mViewPager.setVisibility(View.VISIBLE); NewsPagerAdapter adapter = new NewsPagerAdapter(getActivity(), 3); adapter.setNewsList((ArrayList) mNewsList); adapter.setPager(mViewPager); mViewPager.setAdapter(adapter); } @Override public void onTick(long l) { mListener.onTimerTick(l); } public interface onTimerChangedListener { public void onTimerTick(long l); } @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (onTimerChangedListener) activity; } catch (ClassCastException e) { e.printStackTrace(); Log.d(TAG, "ClassCastException. MainActivity must implement onTimerChangedListener!"); } } public void setCurrentMode(int mode) { this.CURRENT_MODE = mode; if (CURRENT_MODE == MODE_PERIODIC) { mCycleTimer.cancelTimer(); mCycleTimer.startTimer(); refreshLayout(); } else if (CURRENT_MODE == MODE_STANDARD) { mCycleTimer.cancelTimer(); refreshLayoutStandard(); } } }
7,559
0.656833
0.653658
238
30.760504
28.735344
155
false
false
0
0
0
0
0
0
0.533613
false
false
1
9df3cfbe90b39378e73d6de80af85b7be4afd9ad
5,360,119,221,127
a5bc9d5471cf62eb3f28e0a806a27e73917ae577
/Basic/DynamicXpath.java
f88c898a4cc1ffd6ba2d0f866646e68764451023
[]
no_license
RashidulHasanRatul/Selenium-20-days
https://github.com/RashidulHasanRatul/Selenium-20-days
668e02587630b8e3f4feaf8e7f306a8ea21c2a60
5e6472d10243058279cd11ac97dc53edcb5bb297
refs/heads/main
2023-07-14T00:32:37.977000
2021-08-19T13:48:55
2021-08-19T13:48:55
385,615,120
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Testing; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class DynamicXpath { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); String Url = "http://18.209.122.163/admin/login"; driver.get(Url); WebElement email = driver.findElement(By.name("email")); WebElement password = driver.findElement(By.name("password")); //set the element input email.sendKeys("superadmin@gmail.com"); password.sendKeys("superadmin"); //find the button and click on it WebElement login = driver.findElement(By.className("btn-primary")); login.click(); WebElement catalogue = driver.findElement(By.linkText("Catalogue")); catalogue.click(); WebElement Product = driver.findElement(By.xpath("//a[@href='http://18.209.122.163/admin/product']")); Product.click(); } }
UTF-8
Java
1,229
java
DynamicXpath.java
Java
[ { "context": "package Testing;\r\n\r\nimport io.github.bonigarcia.wdm.WebDriverManager;\r\nimport org.openqa.selenium", "end": 47, "score": 0.9983640909194946, "start": 37, "tag": "USERNAME", "value": "bonigarcia" }, { "context": "w().maximize();\r\n\r\n String Url = \"http://18.209.122.163/admin/login\";\r\n\r\n driver.get(Url);\r\n\r\n ", "end": 505, "score": 0.8915197253227234, "start": 494, "tag": "IP_ADDRESS", "value": "209.122.163" }, { "context": " //set the element input\r\n email.sendKeys(\"superadmin@gmail.com\");\r\n password.sendKeys(\"superadmin\");\r\n\r\n ", "end": 770, "score": 0.9998902678489685, "start": 750, "tag": "EMAIL", "value": "superadmin@gmail.com" }, { "context": "peradmin@gmail.com\");\r\n password.sendKeys(\"superadmin\");\r\n\r\n //find the button and click on it\r\n", "end": 812, "score": 0.9990065097808838, "start": 802, "tag": "PASSWORD", "value": "superadmin" } ]
null
[]
package Testing; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class DynamicXpath { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); String Url = "http://18.209.122.163/admin/login"; driver.get(Url); WebElement email = driver.findElement(By.name("email")); WebElement password = driver.findElement(By.name("password")); //set the element input email.sendKeys("<EMAIL>"); password.sendKeys("<PASSWORD>"); //find the button and click on it WebElement login = driver.findElement(By.className("btn-primary")); login.click(); WebElement catalogue = driver.findElement(By.linkText("Catalogue")); catalogue.click(); WebElement Product = driver.findElement(By.xpath("//a[@href='http://18.209.122.163/admin/product']")); Product.click(); } }
1,216
0.638731
0.62083
45
25.311111
27.205246
110
false
false
0
0
0
0
0
0
0.466667
false
false
1
8e345027d68a781faa763e0085dc20701923340f
3,848,290,737,544
8954db1e5d45f3e0b035c717cb5ede73f3d5cfe8
/WindowsMediaRemoteServer/RemoteMediaServer/src/remotemediaserver/DoKeyBoardControl.java
5eb12df4b9ba3427671ab1842d929f21469907f8
[]
no_license
mcsheehan/AndroidCodeBackup
https://github.com/mcsheehan/AndroidCodeBackup
45f588a52fb9e090558d1d3a6dcddaa694267a45
f2fbf0a136aa11af4566d77ed513b0aa28be70f1
refs/heads/master
2021-01-01T15:31:08.384000
2011-04-08T21:18:15
2011-04-08T21:18:15
1,488,275
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package remotemediaserver; import java.awt.Robot; import java.awt.event.KeyEvent; import java.awt.AWTException; /** * * @author mcs */ public class DoKeyBoardControl { public static void HandleKeyPresses(KeyPressed Input) { try { Robot robot = new Robot(); switch (Input) { case UP: robot.keyPress(KeyEvent.VK_UP); break; case DOWN: robot.keyPress(KeyEvent.VK_DOWN); break; case LEFT: robot.keyPress(KeyEvent.VK_LEFT); break; case RIGHT: robot.keyPress(KeyEvent.VK_RIGHT); break; } } catch (AWTException e) { } } public static void DoKeyDown() { } public enum KeyPressed { UP, DOWN, LEFT, RIGHT, PLAY, PAUSE, STOP, FASTFORWARD, REWIND; //; is optional } }
UTF-8
Java
1,092
java
DoKeyBoardControl.java
Java
[ { "context": ";\nimport java.awt.AWTException;\n\n/**\n *\n * @author mcs\n */\npublic class DoKeyBoardControl {\n\n public ", "end": 235, "score": 0.9996399879455566, "start": 232, "tag": "USERNAME", "value": "mcs" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package remotemediaserver; import java.awt.Robot; import java.awt.event.KeyEvent; import java.awt.AWTException; /** * * @author mcs */ public class DoKeyBoardControl { public static void HandleKeyPresses(KeyPressed Input) { try { Robot robot = new Robot(); switch (Input) { case UP: robot.keyPress(KeyEvent.VK_UP); break; case DOWN: robot.keyPress(KeyEvent.VK_DOWN); break; case LEFT: robot.keyPress(KeyEvent.VK_LEFT); break; case RIGHT: robot.keyPress(KeyEvent.VK_RIGHT); break; } } catch (AWTException e) { } } public static void DoKeyDown() { } public enum KeyPressed { UP, DOWN, LEFT, RIGHT, PLAY, PAUSE, STOP, FASTFORWARD, REWIND; //; is optional } }
1,092
0.507326
0.507326
48
21.75
19.99427
87
false
false
0
0
0
0
0
0
0.520833
false
false
1
d69d66c63602e926d46344ae51c4e7e3f0b5855d
15,599,321,270,213
ef0950712ae77d125accf2ec6f9c91cb16c763f6
/TopCAT/src/main/java/uk/ac/stfc/topcat/gwt/client/widget/FreeTextSearchSubPanel.java
03f61bb28f9e9083f3d3692ae03cb41a2706889f
[]
no_license
condiesmith/topcat
https://github.com/condiesmith/topcat
20867fa57420c9ab8d70e0ee35f1d0ff50c7093d
5c2793f1e660bb634b79e2e044193d63bf0320b3
refs/heads/master
2021-01-24T23:40:59.216000
2014-11-06T10:29:58
2014-11-06T10:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * * Copyright (c) 2009-2013 * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the distribution. * Neither the name of the STFC nor the names of its contributors may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ package uk.ac.stfc.topcat.gwt.client.widget; /** * Imports */ import uk.ac.stfc.topcat.core.gwt.module.TAdvancedSearchDetails; import uk.ac.stfc.topcat.gwt.client.callback.EventPipeLine; import uk.ac.stfc.topcat.gwt.client.event.LoginEvent; import uk.ac.stfc.topcat.gwt.client.event.LogoutEvent; import uk.ac.stfc.topcat.gwt.client.eventHandler.LoginEventHandler; import uk.ac.stfc.topcat.gwt.client.eventHandler.LogoutEventHandler; import com.extjs.gxt.ui.client.event.ButtonEvent; import com.extjs.gxt.ui.client.event.Events; import com.extjs.gxt.ui.client.event.Listener; import com.extjs.gxt.ui.client.widget.Composite; import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.extjs.gxt.ui.client.widget.Text; import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.form.LabelField; import com.extjs.gxt.ui.client.widget.form.TextField; import com.google.gwt.user.client.ui.FlexTable; /** * This is a widget, used in search panel. It shows advanced search options to * be set by user. * * <p> * * @author Mr. wayne Chung * @version 1.0, &nbsp; 21-Nov-2013 * @since iCAT Version 4.3 */ public class FreeTextSearchSubPanel extends Composite { private EventPipeLine eventBus; private TextField<String> txtFldQuery; public FreeTextSearchSubPanel() { eventBus = EventPipeLine.getInstance(); LayoutContainer layoutContainer = new LayoutContainer(); FlexTable flexTable = new FlexTable(); flexTable.setCellSpacing(5); layoutContainer.add(flexTable); LabelField lblfldQuery = new LabelField("Search"); flexTable.setWidget(0, 0, lblfldQuery); txtFldQuery = new TextField<String>(); flexTable.setWidget(0, 1, txtFldQuery); flexTable.setWidget(1, 0, new Text()); Button btnSearch = new Button("Search"); btnSearch.addListener(Events.Select, new Listener<ButtonEvent>() { @Override public void handleEvent(ButtonEvent e) { if (validateInput()) { TAdvancedSearchDetails searchDetails = new TAdvancedSearchDetails(); searchDetails.setFreeTextQuery(txtFldQuery.getValue().trim()); searchDetails.setSearchAllData(true); eventBus.searchForInvestigationByFreeText(searchDetails); } } }); flexTable.setWidget(2, 1, btnSearch); flexTable.setWidget(3, 0, new Text()); initComponent(layoutContainer); layoutContainer.setBorders(true); createLoginHandler(); createLogoutHandler(); } private boolean validateInput() { if (txtFldQuery.getValue() == null || txtFldQuery.getValue().trim().isEmpty()) { return false; } return true; } /** * Setup a handler to react to Login events. */ private void createLoginHandler() { LoginEvent.register(EventPipeLine.getEventBus(), new LoginEventHandler() { @Override public void login(LoginEvent event) { } }); } /** * Setup a handler to react to Logout events. */ private void createLogoutHandler() { LogoutEvent.register(EventPipeLine.getEventBus(), new LogoutEventHandler() { @Override public void logout(LogoutEvent event) { } }); } }
UTF-8
Java
5,362
java
FreeTextSearchSubPanel.java
Java
[ { "context": "\r\n * be set by user.\r\n * \r\n * <p>\r\n * \r\n * @author Mr. wayne Chung\r\n * @version 1.0, &nbsp; 21-Nov-2013\r", "end": 2641, "score": 0.988217830657959, "start": 2639, "tag": "NAME", "value": "Mr" }, { "context": " be set by user.\r\n * \r\n * <p>\r\n * \r\n * @author Mr. wayne Chung\r\n * @version 1.0, &nbsp; 21-Nov-2013\r\n * @since i", "end": 2654, "score": 0.995754599571228, "start": 2643, "tag": "NAME", "value": "wayne Chung" } ]
null
[]
/** * * Copyright (c) 2009-2013 * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the distribution. * Neither the name of the STFC nor the names of its contributors may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ package uk.ac.stfc.topcat.gwt.client.widget; /** * Imports */ import uk.ac.stfc.topcat.core.gwt.module.TAdvancedSearchDetails; import uk.ac.stfc.topcat.gwt.client.callback.EventPipeLine; import uk.ac.stfc.topcat.gwt.client.event.LoginEvent; import uk.ac.stfc.topcat.gwt.client.event.LogoutEvent; import uk.ac.stfc.topcat.gwt.client.eventHandler.LoginEventHandler; import uk.ac.stfc.topcat.gwt.client.eventHandler.LogoutEventHandler; import com.extjs.gxt.ui.client.event.ButtonEvent; import com.extjs.gxt.ui.client.event.Events; import com.extjs.gxt.ui.client.event.Listener; import com.extjs.gxt.ui.client.widget.Composite; import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.extjs.gxt.ui.client.widget.Text; import com.extjs.gxt.ui.client.widget.button.Button; import com.extjs.gxt.ui.client.widget.form.LabelField; import com.extjs.gxt.ui.client.widget.form.TextField; import com.google.gwt.user.client.ui.FlexTable; /** * This is a widget, used in search panel. It shows advanced search options to * be set by user. * * <p> * * @author Mr. <NAME> * @version 1.0, &nbsp; 21-Nov-2013 * @since iCAT Version 4.3 */ public class FreeTextSearchSubPanel extends Composite { private EventPipeLine eventBus; private TextField<String> txtFldQuery; public FreeTextSearchSubPanel() { eventBus = EventPipeLine.getInstance(); LayoutContainer layoutContainer = new LayoutContainer(); FlexTable flexTable = new FlexTable(); flexTable.setCellSpacing(5); layoutContainer.add(flexTable); LabelField lblfldQuery = new LabelField("Search"); flexTable.setWidget(0, 0, lblfldQuery); txtFldQuery = new TextField<String>(); flexTable.setWidget(0, 1, txtFldQuery); flexTable.setWidget(1, 0, new Text()); Button btnSearch = new Button("Search"); btnSearch.addListener(Events.Select, new Listener<ButtonEvent>() { @Override public void handleEvent(ButtonEvent e) { if (validateInput()) { TAdvancedSearchDetails searchDetails = new TAdvancedSearchDetails(); searchDetails.setFreeTextQuery(txtFldQuery.getValue().trim()); searchDetails.setSearchAllData(true); eventBus.searchForInvestigationByFreeText(searchDetails); } } }); flexTable.setWidget(2, 1, btnSearch); flexTable.setWidget(3, 0, new Text()); initComponent(layoutContainer); layoutContainer.setBorders(true); createLoginHandler(); createLogoutHandler(); } private boolean validateInput() { if (txtFldQuery.getValue() == null || txtFldQuery.getValue().trim().isEmpty()) { return false; } return true; } /** * Setup a handler to react to Login events. */ private void createLoginHandler() { LoginEvent.register(EventPipeLine.getEventBus(), new LoginEventHandler() { @Override public void login(LoginEvent event) { } }); } /** * Setup a handler to react to Logout events. */ private void createLogoutHandler() { LogoutEvent.register(EventPipeLine.getEventBus(), new LogoutEventHandler() { @Override public void logout(LogoutEvent event) { } }); } }
5,357
0.645282
0.639873
141
36.02837
34.689491
136
false
false
0
0
0
0
0
0
0.602837
false
false
1
e140d1117d30ce7be507e9d23a9865995f7335de
20,598,663,184,131
193278d4999a87336051a09f9589ab063eaf2e9f
/reports/Boychenko/Lab4/src/Lab4.3/src/Student.java
3efea22830e043030a7d1e0f57ca677d78ee6dbb
[]
no_license
kroschenko/ssp_asoi_2020
https://github.com/kroschenko/ssp_asoi_2020
d5666754457dc0c3431da83e8367dd517ec46007
65fc8d1ea11da6ecd9e6faab41899ad77dbfea9b
refs/heads/master
2023-02-05T08:49:33.487000
2020-12-17T08:09:00
2020-12-17T08:09:00
292,503,975
0
26
null
false
2020-12-17T08:08:09
2020-09-03T07:54:04
2020-12-15T06:56:07
2020-12-17T08:08:08
75,435
0
23
2
Java
false
false
import java.util.ArrayList; import java.util.List; public class Student extends Human { public Student(String name, Integer age, String group) { super(name, age); this.group = group; } private String group; private final List<Course> courses = new ArrayList<>(); public void signForCourse(String courseName) { if (courseName.isBlank()) throw new RuntimeException("You must declare course name"); Course.courses.forEach(course -> { if (course.getCourseName().equals(courseName)) { this.courses.add(course); course.getStudents().add(this); } }); } public List<Course> getCourses() { return courses; } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", age=" + age + ", group=" + group + '}'; } }
UTF-8
Java
968
java
Student.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.List; public class Student extends Human { public Student(String name, Integer age, String group) { super(name, age); this.group = group; } private String group; private final List<Course> courses = new ArrayList<>(); public void signForCourse(String courseName) { if (courseName.isBlank()) throw new RuntimeException("You must declare course name"); Course.courses.forEach(course -> { if (course.getCourseName().equals(courseName)) { this.courses.add(course); course.getStudents().add(this); } }); } public List<Course> getCourses() { return courses; } @Override public String toString() { return "Student{" + "name='" + name + '\'' + ", age=" + age + ", group=" + group + '}'; } }
968
0.534091
0.534091
39
23.820513
20.131454
71
false
false
0
0
0
0
0
0
0.435897
false
false
1
ea6f771b77344ecf3b37f2ac021c37736b03c0ad
20,598,663,184,306
59547d9514b0457ef7ff19615b60e8d5037491f6
/test/reserva/ReservaTest.java
f9816523e82a5f8c25f2fb0807e9f35520061e12
[]
no_license
CundariNicolas/PO2_TP_FINAL_2021
https://github.com/CundariNicolas/PO2_TP_FINAL_2021
0916452c71104668fa6394dcc11ea5cb96358a87
b7acf2c82dfbf5a08930f20d02bee7afb6941e1c
refs/heads/main
2023-07-30T10:06:53.032000
2021-09-13T21:53:09
2021-09-13T21:53:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package reserva; import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Calendar; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import formasDePago.FormaDePago; import inmueble.Inmueble; import publicacion.PrecioDiaOcupacion; import publicacion.Publicacion; import usuario.Usuario; class ReservaTest { private Reserva reserva1; private Reserva reservaCondicional; private Publicacion publicacion1 = mock(Publicacion.class); private Calendar fechaIN; private Calendar fechaOUT; private ArrayList<PrecioDiaOcupacion> precio = new ArrayList<PrecioDiaOcupacion>(); private FormaDePago formaDePago = mock(FormaDePago.class); private Usuario inquilino = mock(Usuario.class); @BeforeEach void setUp() { fechaIN = Calendar.getInstance(); fechaIN.set(2021, 10, 5); fechaOUT = Calendar.getInstance(); fechaOUT.set(2021, 11, 12); reserva1 = new Reserva(publicacion1, fechaIN, fechaOUT, precio, formaDePago, inquilino); reservaCondicional = Reserva.reservaCondicional(publicacion1, fechaIN, fechaOUT, precio, formaDePago, inquilino); } @Test void testReserva() { assertEquals(reserva1.getClass(), Reserva.class); } @Test void testReservaCondicional() { assertEquals(reservaCondicional.getClass(), Reserva.class); assertEquals(reservaCondicional.getEstado().getClass(), EstadoCondicional.class); assertTrue(reservaCondicional.esCondicional()); } @Test void testSetEstado() { reserva1.setEstado(EstadoCancelado.getInstance()); assertEquals(reserva1.getEstado().getClass(), EstadoCancelado.class); } @Test void testGetFecgaHoraReserva() { assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.YEAR), Calendar.getInstance().get(Calendar.YEAR)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.MONTH)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.DAY_OF_MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.HOUR), Calendar.getInstance().get(Calendar.HOUR)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.MINUTE), Calendar.getInstance().get(Calendar.MINUTE)); } @Test void testGetPublicacion() { assertEquals(reserva1.getPublicacion().getClass(), Publicacion.class); } @Test void testGetFechaInicio() { assertEquals(reserva1.getFechaInicio().get(Calendar.YEAR), fechaIN.get(Calendar.YEAR)); assertEquals(reserva1.getFechaInicio().get(Calendar.MONTH), fechaIN.get(Calendar.MONTH)); assertEquals(reserva1.getFechaInicio().get(Calendar.DAY_OF_MONTH), fechaIN.get(Calendar.DAY_OF_MONTH)); } @Test void testGetFechaFin() { assertEquals(reserva1.getFechaFin().get(Calendar.YEAR), fechaOUT.get(Calendar.YEAR)); assertEquals(reserva1.getFechaFin().get(Calendar.MONTH), fechaOUT.get(Calendar.MONTH)); assertEquals(reserva1.getFechaFin().get(Calendar.DAY_OF_MONTH), fechaOUT.get(Calendar.DAY_OF_MONTH)); } @Test void testGetPrecios() { PrecioDiaOcupacion precioDia = mock(PrecioDiaOcupacion.class); precio.add(precioDia); assertEquals(reserva1.getPrecios().get(0).getClass(), PrecioDiaOcupacion.class); } @Test void testGetFormaDePago() { formaDePago = mock(FormaDePago.class); assertEquals(reserva1.getFormaDePago().getClass(), FormaDePago.class); } @Test void testGetInquilino() { assertEquals(reserva1.getInquilino().getClass(), Usuario.class); } @Test void testEnviarA() { Reserva reservaMock = mock(Reserva.class); reservaMock .enviarA("pepe@gmail.com"); verify(reservaMock).enviarA("pepe@gmail.com"); } @Test void testAceptar() { Inmueble inmueble = mock(Inmueble.class); when(publicacion1.getInmueble()).thenReturn(inmueble); reserva1.aceptar(); assertEquals(reserva1.getEstado().getClass(), EstadoConsolidado.class); } @Test void testRechazar() { reserva1.rechazar(); assertEquals(reserva1.getEstado().getClass(), EstadoRechazado.class); } @Test void testCancelar() { reserva1.cancelar(); assertEquals(reserva1.getEstado().getClass(), EstadoCancelado.class); } @Test void testEsFutura() { assertTrue(reserva1.esFutura()); } @Test void testEsDeCiudad() { when(publicacion1.getCiudadInmueble()).thenReturn("Cordoba"); assertTrue(reserva1.esDeCiudad("Cordoba")); assertFalse(reserva1.esDeCiudad("Rio")); } @Test void testEsCondicional() { assertTrue(reservaCondicional.esCondicional()); } @Test void testEstaFinalizada() { assertFalse(reserva1.estaFinalizada()); } @Test void testPrecioTotalReserva() { PrecioDiaOcupacion precioDia = mock(PrecioDiaOcupacion.class); when(precioDia.getPrecio()).thenReturn(100.00); precio.add(precioDia); precio.add(precioDia); assertEquals(reserva1.precioTotalReserva(), 200.00); } @Test void testValorEnCantidadDeDias() { PrecioDiaOcupacion precioDia = mock(PrecioDiaOcupacion.class); when(precioDia.getPrecio()).thenReturn(333.33); precio.add(precioDia); precio.add(precioDia); assertEquals(reserva1.valorEnCantidadDeDias(1), 333.33); assertEquals(reserva1.valorEnCantidadDeDias(2), 666.66); } @Test void testSeConcreto() { assertFalse(reserva1.seConcreto()); } }
UTF-8
Java
5,582
java
ReservaTest.java
Java
[ { "context": "k = mock(Reserva.class);\r\n\t\treservaMock .enviarA(\"pepe@gmail.com\");\r\n\t\tverify(reservaMock).enviarA(\"pepe@gmail.com", "end": 3847, "score": 0.9999232292175293, "start": 3833, "tag": "EMAIL", "value": "pepe@gmail.com" }, { "context": "pepe@gmail.com\");\r\n\t\tverify(reservaMock).enviarA(\"pepe@gmail.com\");\t\t\r\n\t}\r\n\r\n\t@Test\r\n\tvoid testAceptar() {\r\n\t\tInmu", "end": 3897, "score": 0.9999231696128845, "start": 3883, "tag": "EMAIL", "value": "pepe@gmail.com" } ]
null
[]
package reserva; import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Calendar; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import formasDePago.FormaDePago; import inmueble.Inmueble; import publicacion.PrecioDiaOcupacion; import publicacion.Publicacion; import usuario.Usuario; class ReservaTest { private Reserva reserva1; private Reserva reservaCondicional; private Publicacion publicacion1 = mock(Publicacion.class); private Calendar fechaIN; private Calendar fechaOUT; private ArrayList<PrecioDiaOcupacion> precio = new ArrayList<PrecioDiaOcupacion>(); private FormaDePago formaDePago = mock(FormaDePago.class); private Usuario inquilino = mock(Usuario.class); @BeforeEach void setUp() { fechaIN = Calendar.getInstance(); fechaIN.set(2021, 10, 5); fechaOUT = Calendar.getInstance(); fechaOUT.set(2021, 11, 12); reserva1 = new Reserva(publicacion1, fechaIN, fechaOUT, precio, formaDePago, inquilino); reservaCondicional = Reserva.reservaCondicional(publicacion1, fechaIN, fechaOUT, precio, formaDePago, inquilino); } @Test void testReserva() { assertEquals(reserva1.getClass(), Reserva.class); } @Test void testReservaCondicional() { assertEquals(reservaCondicional.getClass(), Reserva.class); assertEquals(reservaCondicional.getEstado().getClass(), EstadoCondicional.class); assertTrue(reservaCondicional.esCondicional()); } @Test void testSetEstado() { reserva1.setEstado(EstadoCancelado.getInstance()); assertEquals(reserva1.getEstado().getClass(), EstadoCancelado.class); } @Test void testGetFecgaHoraReserva() { assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.YEAR), Calendar.getInstance().get(Calendar.YEAR)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.MONTH)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.DAY_OF_MONTH), Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.HOUR), Calendar.getInstance().get(Calendar.HOUR)); assertEquals(reserva1.getFecgaHoraReserva().get(Calendar.MINUTE), Calendar.getInstance().get(Calendar.MINUTE)); } @Test void testGetPublicacion() { assertEquals(reserva1.getPublicacion().getClass(), Publicacion.class); } @Test void testGetFechaInicio() { assertEquals(reserva1.getFechaInicio().get(Calendar.YEAR), fechaIN.get(Calendar.YEAR)); assertEquals(reserva1.getFechaInicio().get(Calendar.MONTH), fechaIN.get(Calendar.MONTH)); assertEquals(reserva1.getFechaInicio().get(Calendar.DAY_OF_MONTH), fechaIN.get(Calendar.DAY_OF_MONTH)); } @Test void testGetFechaFin() { assertEquals(reserva1.getFechaFin().get(Calendar.YEAR), fechaOUT.get(Calendar.YEAR)); assertEquals(reserva1.getFechaFin().get(Calendar.MONTH), fechaOUT.get(Calendar.MONTH)); assertEquals(reserva1.getFechaFin().get(Calendar.DAY_OF_MONTH), fechaOUT.get(Calendar.DAY_OF_MONTH)); } @Test void testGetPrecios() { PrecioDiaOcupacion precioDia = mock(PrecioDiaOcupacion.class); precio.add(precioDia); assertEquals(reserva1.getPrecios().get(0).getClass(), PrecioDiaOcupacion.class); } @Test void testGetFormaDePago() { formaDePago = mock(FormaDePago.class); assertEquals(reserva1.getFormaDePago().getClass(), FormaDePago.class); } @Test void testGetInquilino() { assertEquals(reserva1.getInquilino().getClass(), Usuario.class); } @Test void testEnviarA() { Reserva reservaMock = mock(Reserva.class); reservaMock .enviarA("<EMAIL>"); verify(reservaMock).enviarA("<EMAIL>"); } @Test void testAceptar() { Inmueble inmueble = mock(Inmueble.class); when(publicacion1.getInmueble()).thenReturn(inmueble); reserva1.aceptar(); assertEquals(reserva1.getEstado().getClass(), EstadoConsolidado.class); } @Test void testRechazar() { reserva1.rechazar(); assertEquals(reserva1.getEstado().getClass(), EstadoRechazado.class); } @Test void testCancelar() { reserva1.cancelar(); assertEquals(reserva1.getEstado().getClass(), EstadoCancelado.class); } @Test void testEsFutura() { assertTrue(reserva1.esFutura()); } @Test void testEsDeCiudad() { when(publicacion1.getCiudadInmueble()).thenReturn("Cordoba"); assertTrue(reserva1.esDeCiudad("Cordoba")); assertFalse(reserva1.esDeCiudad("Rio")); } @Test void testEsCondicional() { assertTrue(reservaCondicional.esCondicional()); } @Test void testEstaFinalizada() { assertFalse(reserva1.estaFinalizada()); } @Test void testPrecioTotalReserva() { PrecioDiaOcupacion precioDia = mock(PrecioDiaOcupacion.class); when(precioDia.getPrecio()).thenReturn(100.00); precio.add(precioDia); precio.add(precioDia); assertEquals(reserva1.precioTotalReserva(), 200.00); } @Test void testValorEnCantidadDeDias() { PrecioDiaOcupacion precioDia = mock(PrecioDiaOcupacion.class); when(precioDia.getPrecio()).thenReturn(333.33); precio.add(precioDia); precio.add(precioDia); assertEquals(reserva1.valorEnCantidadDeDias(1), 333.33); assertEquals(reserva1.valorEnCantidadDeDias(2), 666.66); } @Test void testSeConcreto() { assertFalse(reserva1.seConcreto()); } }
5,568
0.736474
0.721784
183
28.502731
30.252647
125
false
false
0
0
0
0
0
0
1.808743
false
false
1
145459e5cfd71cee3a878d1c504d99cb5a93e800
23,467,701,352,683
ed5159d056e98d6715357d0d14a9b3f20b764f89
/src/irvine/oeis/a074/A074354.java
da204fce362d42bbe4fa676821367635e2b49adc
[]
no_license
flywind2/joeis
https://github.com/flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080000
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package irvine.oeis.a074; // Generated by gen_pattern.pl - DO NOT EDIT here! import irvine.oeis.GeneratingFunctionSequence; /** * A074354 Coefficient of <code>q^3</code> in <code>nu(n)</code>, where <code>nu(0)=1, nu(1)=b</code> and, for <code>n&gt;=2, nu(n)=b*nu(n-1)+lambda*(1+q+q^2+...+q^(n-2))*nu(n-2)</code> with <code>(b,lambda)=(1,2)</code>. * @author Georg Fischer */ public class A074354 extends GeneratingFunctionSequence { /** Construct the sequence. */ public A074354() { super(0, new long[] {0, 0, 0, 0, 0, 14, 8, -66, -28, 72, 48}, new long[] {1, -4, -2, 20, 1, -40, -8, 32, 16}); } }
UTF-8
Java
621
java
A074354.java
Java
[ { "context": "de> with <code>(b,lambda)=(1,2)</code>.\n * @author Georg Fischer\n */\npublic class A074354 extends GeneratingFuncti", "end": 376, "score": 0.9998705983161926, "start": 363, "tag": "NAME", "value": "Georg Fischer" } ]
null
[]
package irvine.oeis.a074; // Generated by gen_pattern.pl - DO NOT EDIT here! import irvine.oeis.GeneratingFunctionSequence; /** * A074354 Coefficient of <code>q^3</code> in <code>nu(n)</code>, where <code>nu(0)=1, nu(1)=b</code> and, for <code>n&gt;=2, nu(n)=b*nu(n-1)+lambda*(1+q+q^2+...+q^(n-2))*nu(n-2)</code> with <code>(b,lambda)=(1,2)</code>. * @author <NAME> */ public class A074354 extends GeneratingFunctionSequence { /** Construct the sequence. */ public A074354() { super(0, new long[] {0, 0, 0, 0, 0, 14, 8, -66, -28, 72, 48}, new long[] {1, -4, -2, 20, 1, -40, -8, 32, 16}); } }
614
0.608696
0.507246
17
35.529411
51.472572
221
false
false
0
0
0
0
0
0
1.764706
false
false
1
35cc0b73e975703cbbb64213cc5a6b8dd944f09b
15,899,968,978,099
639d142d0a637cedc6d6f33b380adace3b30bca4
/product/production/hmp-main/src/main/java/gov/va/cprs/ClassicCoverVisitViewDef.java
da7685b3fc7f31029b00d4f2853c12cc28239b33
[]
no_license
robcaruso/ehmp
https://github.com/robcaruso/ehmp
8f962b940e1e705807af74dda593aeb078b3a4f4
68c7eeb3d649eeea9e642668bf4b2b98cfc52d48
refs/heads/master
2018-01-10T19:41:18.607000
2016-03-08T16:14:31
2016-03-08T16:14:31
54,897,812
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gov.va.cprs; import gov.va.cpe.vpr.queryeng.Query; import gov.va.cpe.vpr.queryeng.ViewDef; import gov.va.cpe.vpr.queryeng.ViewParam; import gov.va.cpe.vpr.queryeng.query.JDSQuery; import gov.va.cpe.vpr.queryeng.query.QueryDef; import gov.va.cpe.vpr.queryeng.RenderTask; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Map; @Component(value = "gov.va.cprs.ClassicCoverVisitViewDef") @Scope("prototype") public class ClassicCoverVisitViewDef extends ViewDef { public ClassicCoverVisitViewDef() { declareParam(new ViewParam.PatientIDParam()); declareParam(new ViewParam.SimpleViewParam("filter_start")); // start date declareParam(new ViewParam.SimpleViewParam("filter_stop")); // stop date declareParam(new ViewParam.DateRangeParam("range","t-180..t")); QueryDef qry = new QueryDef("visit-time", "?:range.startHL7", "?:range.endHL7"); qry.where("typeName").ne("DAILY HOSPITALIZATION DATA"); Query q1 = new JDSQuery("uid", qry); addQuery(q1); } }
UTF-8
Java
1,130
java
ClassicCoverVisitViewDef.java
Java
[]
null
[]
package gov.va.cprs; import gov.va.cpe.vpr.queryeng.Query; import gov.va.cpe.vpr.queryeng.ViewDef; import gov.va.cpe.vpr.queryeng.ViewParam; import gov.va.cpe.vpr.queryeng.query.JDSQuery; import gov.va.cpe.vpr.queryeng.query.QueryDef; import gov.va.cpe.vpr.queryeng.RenderTask; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Map; @Component(value = "gov.va.cprs.ClassicCoverVisitViewDef") @Scope("prototype") public class ClassicCoverVisitViewDef extends ViewDef { public ClassicCoverVisitViewDef() { declareParam(new ViewParam.PatientIDParam()); declareParam(new ViewParam.SimpleViewParam("filter_start")); // start date declareParam(new ViewParam.SimpleViewParam("filter_stop")); // stop date declareParam(new ViewParam.DateRangeParam("range","t-180..t")); QueryDef qry = new QueryDef("visit-time", "?:range.startHL7", "?:range.endHL7"); qry.where("typeName").ne("DAILY HOSPITALIZATION DATA"); Query q1 = new JDSQuery("uid", qry); addQuery(q1); } }
1,130
0.730088
0.723894
31
35.419353
26.405979
88
false
false
0
0
0
0
0
0
0.741935
false
false
1
e77c86caced5fbe590c2bbdddd5e6bd5a0d8624f
15,564,961,541,771
a4a430534bb134673581417db8c5353ba837701d
/advertisement/src/main/java/com/ra/advertisement/entity/Advertisement.java
994528030b4bdcb5b49485c4a0e8cc70bc199d7f
[]
no_license
A-Tymchenko/neptune
https://github.com/A-Tymchenko/neptune
05cc290f0cd4ffee04259de482e2209eee3a49b0
3879e71ad2e9a21c0484cfdcc8781c55df347dfc
refs/heads/master
2020-05-28T13:47:51.992000
2018-08-29T13:13:20
2018-08-29T13:13:20
189,021,263
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ra.advertisement.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.ToString; @Getter @Setter @ToString @NoArgsConstructor @AllArgsConstructor @RequiredArgsConstructor public class Advertisement { private Long adId; @NonNull private String title; @NonNull private String context; @NonNull private String imageUrl; @NonNull private String language; }
UTF-8
Java
544
java
Advertisement.java
Java
[]
null
[]
package com.ra.advertisement.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.ToString; @Getter @Setter @ToString @NoArgsConstructor @AllArgsConstructor @RequiredArgsConstructor public class Advertisement { private Long adId; @NonNull private String title; @NonNull private String context; @NonNull private String imageUrl; @NonNull private String language; }
544
0.78125
0.78125
27
19.148148
10.637821
38
false
false
0
0
0
0
0
0
0.481481
false
false
1
9c8b3aaf1fb943986e254b3831bf1560607a16e3
23,373,212,093,953
18d9f0029d6702073be25f58512741225906aafe
/src/main/java/com/idp/common/util/ConstProject.java
6b7457d1c19b4f7e5fc5d0201c7c54e0b32f159c
[ "Apache-2.0" ]
permissive
attendanceTeam/attendanceProject
https://github.com/attendanceTeam/attendanceProject
64843e34aa9e725c9f52cc558e9c0af5ef9cf27b
5c735724667224896a9a33b5546100c585da7795
refs/heads/master
2021-01-23T02:06:26.366000
2017-06-30T14:48:02
2017-06-30T14:48:02
85,966,911
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.idp.common.util; public class ConstProject { public static final String ROLE_ADMIN_ID ="001"; public static final String ROLE_TEACHER_ID ="002"; public static final String ROLE_STUDENT_ID ="003"; //设置最初的日期(开学日期)用以计算当前时间是第几周 public static final String BEGIN_DATE ="2017-1-1"; // public static final String BEGIN_CLASS_TIME ="8:00"; // public static final String END_CLASS_TIME ="10:00"; //设置周几可以签到 public static final int WEEK = 1; //考勤--未标记 public static final String ATTENDANCE_NO_MARK = "0"; //考勤--成功 public static final String ATTENDANCE_SUCCESS = "1"; //考勤--迟到 public static final String ATTENDANCE_LATER = "2"; //考勤--缺勤 public static final String ATTENDANCE_ABSENCE = "3"; //考勤--请假 public static final String ATTENDANCE_LEAVE = "4"; }
UTF-8
Java
916
java
ConstProject.java
Java
[]
null
[]
package com.idp.common.util; public class ConstProject { public static final String ROLE_ADMIN_ID ="001"; public static final String ROLE_TEACHER_ID ="002"; public static final String ROLE_STUDENT_ID ="003"; //设置最初的日期(开学日期)用以计算当前时间是第几周 public static final String BEGIN_DATE ="2017-1-1"; // public static final String BEGIN_CLASS_TIME ="8:00"; // public static final String END_CLASS_TIME ="10:00"; //设置周几可以签到 public static final int WEEK = 1; //考勤--未标记 public static final String ATTENDANCE_NO_MARK = "0"; //考勤--成功 public static final String ATTENDANCE_SUCCESS = "1"; //考勤--迟到 public static final String ATTENDANCE_LATER = "2"; //考勤--缺勤 public static final String ATTENDANCE_ABSENCE = "3"; //考勤--请假 public static final String ATTENDANCE_LEAVE = "4"; }
916
0.686881
0.652228
28
26.857143
22.103189
55
false
false
0
0
0
0
0
0
1.321429
false
false
1
e4f28144cf6ad0afc9a812364015ae0795188ed1
23,373,212,095,322
8e24889710366cfbebb0bf91112e854be42a24c9
/src/main/java/duke/exceptions/DukeException.java
7e5f5aa3c9dd20923c56d4579fa6d21fb372f79a
[]
no_license
yzhilong/ip
https://github.com/yzhilong/ip
bd32465cfc4650b0ddf19fedd2a583abef975853
cda1459fc8a5a294a9f19426bbf7dfdf619de844
refs/heads/master
2023-08-17T19:30:37.786000
2021-09-17T04:54:26
2021-09-17T04:54:26
395,923,170
0
0
null
true
2021-09-08T09:13:51
2021-08-14T07:05:29
2021-09-08T09:07:18
2021-09-08T09:13:50
1,487
0
0
0
Java
false
false
package duke.exceptions; public class DukeException extends Exception { /** * DukeException constructor. * * @param errorMessage Message to be shown to user when this exception occurs. */ public DukeException(String errorMessage) { super("OOPS!!! " + errorMessage); } /** * Returns the String representation of the Exception. * * @return String representation of the Exception. */ @Override public String toString() { return String.format("OOPS!!! %s", super.getMessage()); } }
UTF-8
Java
565
java
DukeException.java
Java
[]
null
[]
package duke.exceptions; public class DukeException extends Exception { /** * DukeException constructor. * * @param errorMessage Message to be shown to user when this exception occurs. */ public DukeException(String errorMessage) { super("OOPS!!! " + errorMessage); } /** * Returns the String representation of the Exception. * * @return String representation of the Exception. */ @Override public String toString() { return String.format("OOPS!!! %s", super.getMessage()); } }
565
0.628319
0.628319
23
23.565218
24.010551
82
false
false
0
0
0
0
0
0
0.173913
false
false
1
1d8b21e5690be90c78c291ac69cfad10ee012cc4
13,426,067,812,665
c7772dd35626b343dd2ed40518340aa80b9f618d
/src/testIntegration/java/uk/gov/justice/digital/delius/controller/api/ResponsibleOfficerAPITest.java
d01be0694e05a1d5ea2cfac4001a0609a8fabfee
[ "MIT" ]
permissive
ollietreend/community-api
https://github.com/ollietreend/community-api
666cab98571160f155bef04ce1703026854f8494
9431b03e93d7540bba2a3b1dfafc5983750d68f1
refs/heads/main
2023-04-17T06:03:18.650000
2021-04-22T08:32:58
2021-04-22T08:32:58
360,905,069
0
0
MIT
true
2021-04-23T14:07:45
2021-04-23T14:07:44
2021-04-22T08:33:01
2021-04-23T12:43:53
8,816
0
0
0
null
false
false
package uk.gov.justice.digital.delius.controller.api; import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; import io.restassured.config.ObjectMapperConfig; import io.restassured.config.RestAssuredConfig; import io.restassured.parsing.Parser; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ActiveProfiles; import uk.gov.justice.digital.delius.data.api.ResponsibleOfficer; import uk.gov.justice.digital.delius.jwt.Jwt; import uk.gov.justice.digital.delius.user.UserData; import java.util.Arrays; import java.util.List; import java.util.UUID; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("dev-seed") public class ResponsibleOfficerAPITest { @LocalServerPort int port; @Autowired JdbcTemplate jdbcTemplate; @Autowired private ObjectMapper objectMapper; @Autowired private Jwt jwt; @BeforeEach public void setup() { RestAssured.port = port; RestAssured.basePath = "/api"; RestAssured.defaultParser = Parser.JSON; RestAssured.config = RestAssuredConfig.config().objectMapperConfig(new ObjectMapperConfig().jackson2ObjectMapperFactory( (aClass, s) -> objectMapper )); } @Test public void getCurrentRoForOffender() { ResponsibleOfficer[] responsibleOfficers = given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G0560UO/responsibleOfficers?current=true") .then() .statusCode(200) .extract() .body() .as(ResponsibleOfficer[].class); List<ResponsibleOfficer> listOfRos = Arrays.asList(responsibleOfficers); assertThat(listOfRos).hasSize(1); } @Test public void getAllRosForOffender() { ResponsibleOfficer[] responsibleOfficers = given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G4106UN/responsibleOfficers") .then() .statusCode(200) .extract() .body() .as(ResponsibleOfficer[].class); List<ResponsibleOfficer> listOfRos = Arrays.asList(responsibleOfficers); assertThat(listOfRos).hasSize(1); } @Test public void invalidOffenderNotFound() { given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G9999NN/responsibleOfficers") .then() .statusCode(404); } @Test public void noRosReturnEmptyList() { ResponsibleOfficer[] responsibleOfficers = given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G8331VA/responsibleOfficers") .then() .statusCode(200) .extract() .body() .as(ResponsibleOfficer[].class); List<ResponsibleOfficer> listOfRos = Arrays.asList(responsibleOfficers); assertThat(listOfRos).isEmpty(); } private String aValidToken() { return aValidTokenFor(UUID.randomUUID().toString()); } private String aValidTokenFor(String distinguishedName) { return "Bearer " + jwt.buildToken(UserData.builder() .distinguishedName(distinguishedName) .uid("bobby.davro").build()); } }
UTF-8
Java
4,010
java
ResponsibleOfficerAPITest.java
Java
[ { "context": "shedName(distinguishedName)\n .uid(\"bobby.davro\").build());\n }\n}\n", "end": 3989, "score": 0.9988476037979126, "start": 3978, "tag": "USERNAME", "value": "bobby.davro" } ]
null
[]
package uk.gov.justice.digital.delius.controller.api; import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; import io.restassured.config.ObjectMapperConfig; import io.restassured.config.RestAssuredConfig; import io.restassured.parsing.Parser; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ActiveProfiles; import uk.gov.justice.digital.delius.data.api.ResponsibleOfficer; import uk.gov.justice.digital.delius.jwt.Jwt; import uk.gov.justice.digital.delius.user.UserData; import java.util.Arrays; import java.util.List; import java.util.UUID; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("dev-seed") public class ResponsibleOfficerAPITest { @LocalServerPort int port; @Autowired JdbcTemplate jdbcTemplate; @Autowired private ObjectMapper objectMapper; @Autowired private Jwt jwt; @BeforeEach public void setup() { RestAssured.port = port; RestAssured.basePath = "/api"; RestAssured.defaultParser = Parser.JSON; RestAssured.config = RestAssuredConfig.config().objectMapperConfig(new ObjectMapperConfig().jackson2ObjectMapperFactory( (aClass, s) -> objectMapper )); } @Test public void getCurrentRoForOffender() { ResponsibleOfficer[] responsibleOfficers = given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G0560UO/responsibleOfficers?current=true") .then() .statusCode(200) .extract() .body() .as(ResponsibleOfficer[].class); List<ResponsibleOfficer> listOfRos = Arrays.asList(responsibleOfficers); assertThat(listOfRos).hasSize(1); } @Test public void getAllRosForOffender() { ResponsibleOfficer[] responsibleOfficers = given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G4106UN/responsibleOfficers") .then() .statusCode(200) .extract() .body() .as(ResponsibleOfficer[].class); List<ResponsibleOfficer> listOfRos = Arrays.asList(responsibleOfficers); assertThat(listOfRos).hasSize(1); } @Test public void invalidOffenderNotFound() { given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G9999NN/responsibleOfficers") .then() .statusCode(404); } @Test public void noRosReturnEmptyList() { ResponsibleOfficer[] responsibleOfficers = given() .header("Authorization", aValidToken()) .when() .get("/offenders/nomsNumber/G8331VA/responsibleOfficers") .then() .statusCode(200) .extract() .body() .as(ResponsibleOfficer[].class); List<ResponsibleOfficer> listOfRos = Arrays.asList(responsibleOfficers); assertThat(listOfRos).isEmpty(); } private String aValidToken() { return aValidTokenFor(UUID.randomUUID().toString()); } private String aValidTokenFor(String distinguishedName) { return "Bearer " + jwt.buildToken(UserData.builder() .distinguishedName(distinguishedName) .uid("bobby.davro").build()); } }
4,010
0.638653
0.630923
126
30.825397
24.526979
128
false
false
0
0
0
0
0
0
0.365079
false
false
1
6171ae989a9e2c33c470ae8e9c5d3fdeb691a2ef
38,242,388,811,065
ef58f7cd07eb02b1f71265cb150cc53239890cdd
/modules/java-mgmt/cloudius/src/main/java/com/cloudius/cli/tests/TestELF.java
32b3055d90735c12c1221a4ba4430ee9878aa6cc
[ "BSD-3-Clause" ]
permissive
SpirentOrion/osv
https://github.com/SpirentOrion/osv
4a636e5802551c15db8c27edd71709bae8bff914
32348562e2ba0b2275b2d8d64a78af97bedcdc88
refs/heads/master
2020-04-05T04:24:05.007000
2020-02-19T23:56:55
2020-02-19T23:56:55
40,269,211
2
3
NOASSERTION
true
2020-02-19T23:56:56
2015-08-05T21:15:32
2020-02-19T21:41:42
2020-02-19T23:56:55
19,684
1
2
0
C
false
false
package com.cloudius.cli.tests; import java.io.IOException; import com.cloudius.util.Exec; public class TestELF implements Test { private String _elf_path; public TestELF(String elf_path) { _elf_path = elf_path; } public boolean run() { // Prepare argv String[] argv = new String[1]; argv[0] = _elf_path; try { return (Exec.run(argv) == 0); } catch(IOException e) { return false; } } }
UTF-8
Java
506
java
TestELF.java
Java
[]
null
[]
package com.cloudius.cli.tests; import java.io.IOException; import com.cloudius.util.Exec; public class TestELF implements Test { private String _elf_path; public TestELF(String elf_path) { _elf_path = elf_path; } public boolean run() { // Prepare argv String[] argv = new String[1]; argv[0] = _elf_path; try { return (Exec.run(argv) == 0); } catch(IOException e) { return false; } } }
506
0.541502
0.535573
26
18.5
13.845994
38
false
false
0
0
0
0
0
0
0.423077
false
false
1
cd15ef4afda67365df8c994f213928cab9be0ab5
35,158,602,312,598
f93853d8a9dd7fbe12533e0abfef04cbc5c92a88
/womki1.1/controller/servlets/xmlLaden.java
af9e639d866d9affbc6fd11ef11436f01eb28f33
[]
no_license
dasDome/TurnOnlineGame
https://github.com/dasDome/TurnOnlineGame
54bdc39a1172a8eb700cf53bc06e4b7f85a2a02d
d8287d35a536a1d647d5633a241a6cce2f92266b
refs/heads/master
2021-05-15T21:31:49.770000
2017-10-11T08:09:47
2017-10-11T08:09:47
106,524,759
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package servlets; import game.character.Figur; import game.management.Rollenfiguren; import game.management.WorldOfMKIBean; import game.speicherung.DateiArten; import game.speicherung.iDatenzugriff3; import java.io.IOException; import java.util.Properties; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.sun.xml.internal.ws.api.PropertySet.Property; /** * Servlet implementation class xmlLaden */ @WebServlet("/xmlLaden") public class xmlLaden extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public xmlLaden() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String goTo = "/Hauptseite.jsp"; int id=(int)request.getSession().getAttribute("spielId"); WorldOfMKIBean game=(WorldOfMKIBean)request.getSession().getServletContext().getAttribute("Spiel"+id); String dateiName="D:\\Uni\\Inf2\\praktikum\\womki1.1\\WebContent\\saves\\Name2"; iDatenzugriff3 i=null; Properties l=i.laden(dateiName); String name= l.getProperty("name"); request.getSession().setAttribute("figur",getFigur(game, name)); KarteAktualisieren2.aktualisierenKarte(game, request); ServletContext con=getServletContext(); RequestDispatcher rq=con.getRequestDispatcher(goTo) ; rq.forward(request, response); } private Figur getFigur(WorldOfMKIBean game,String name){ for(Figur f:game.getFiguren()){ System.out.println("spieler"+name); System.out.println(f.getName()); if(f.getName().equals(name)){ return f; } }return null; // // throw new RuntimeException("Figur konnte nicht gefunden werden"); } }
UTF-8
Java
2,368
java
xmlLaden.java
Java
[]
null
[]
package servlets; import game.character.Figur; import game.management.Rollenfiguren; import game.management.WorldOfMKIBean; import game.speicherung.DateiArten; import game.speicherung.iDatenzugriff3; import java.io.IOException; import java.util.Properties; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.sun.xml.internal.ws.api.PropertySet.Property; /** * Servlet implementation class xmlLaden */ @WebServlet("/xmlLaden") public class xmlLaden extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public xmlLaden() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String goTo = "/Hauptseite.jsp"; int id=(int)request.getSession().getAttribute("spielId"); WorldOfMKIBean game=(WorldOfMKIBean)request.getSession().getServletContext().getAttribute("Spiel"+id); String dateiName="D:\\Uni\\Inf2\\praktikum\\womki1.1\\WebContent\\saves\\Name2"; iDatenzugriff3 i=null; Properties l=i.laden(dateiName); String name= l.getProperty("name"); request.getSession().setAttribute("figur",getFigur(game, name)); KarteAktualisieren2.aktualisierenKarte(game, request); ServletContext con=getServletContext(); RequestDispatcher rq=con.getRequestDispatcher(goTo) ; rq.forward(request, response); } private Figur getFigur(WorldOfMKIBean game,String name){ for(Figur f:game.getFiguren()){ System.out.println("spieler"+name); System.out.println(f.getName()); if(f.getName().equals(name)){ return f; } }return null; // // throw new RuntimeException("Figur konnte nicht gefunden werden"); } }
2,368
0.758446
0.755068
75
30.573334
28.07427
119
false
false
0
0
0
0
0
0
1.56
false
false
1
5dfde86472488fffb994613653e90d1259719181
33,045,478,429,618
eec2073faf507ca2f439de014319a15f47393476
/src/main/java/edu/quipu/rrhh/controllers/DescansoMedicoController.java
c116337a04b30837691f7f737f10ab6938ca1dba
[]
no_license
erick485/ERP_Quipucamayoc
https://github.com/erick485/ERP_Quipucamayoc
d5e8f76c27db7c9e04db79776a060a8a72f1c96f
fcaddc48cf40530e6e53913d9f898e02d1c0969d
refs/heads/master
2015-08-13T10:47:50.566000
2015-07-06T16:55:44
2015-07-06T16:55:44
23,934,546
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.quipu.rrhh.controllers; import edu.quipu.rrhh.models.DescansoMedico; import edu.quipu.rrhh.services.DescansoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; @Controller @RequestMapping(value = "/rest/descansos") public class DescansoMedicoController { private static final Logger log= LoggerFactory.getLogger(DescansoMedicoController.class); @Autowired DescansoService descansoservice; @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json", value = "/addDescanso") @ResponseStatus(HttpStatus.CREATED) @ResponseBody public String addDescanso(@RequestBody DescansoMedico descansomedico){ descansoservice.addDescanso(descansomedico); return "save"; } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "/codigo/{cod}/numserest/{num}") @ResponseBody public List<DescansoMedico> buscarResoluciones(@PathVariable(value = "cod") String codigo,@PathVariable(value = "num") Integer numserest){ System.out.println("controller descansos"); System.out.println(codigo+"-"); System.out.println(numserest); return descansoservice.buscarDescansos(codigo, numserest); } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "/acumulado/codigo/{cod}/numserest/{num}") @ResponseBody public List<DescansoMedico> buscarAcumulado(@PathVariable(value = "cod") String codigo,@PathVariable(value = "num") Integer numserest){ System.out.println("controller acumulado"); System.out.println(codigo+"-"); System.out.println(numserest); return descansoservice.buscarAcumulado(codigo, numserest); } @RequestMapping(method = RequestMethod.DELETE, /*consumes = "application/json",*/produces = "application/json", value = "/deleteDescansoMed/{idDesc}") @ResponseStatus(HttpStatus.ACCEPTED) @ResponseBody public String eliminarDescaMed(@PathVariable(value = "idDesc") Integer idDesc) { System.out.println("controller"+idDesc); descansoservice.removeDescMed(idDesc); return "delete" +idDesc; } @RequestMapping(method = RequestMethod.POST,consumes = "application/json",produces = "application/json",value = "/updateDescMed") @ResponseStatus(HttpStatus.CREATED) @ResponseBody public String UpdateDescanso(@RequestBody DescansoMedico descMed){ System.out.print("Hola Mundooooooooooo!!!!"+descMed.getId_desc_med()); descansoservice.updateDescMed(descMed); return ""; } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "listar/{mes}/{anio}") @ResponseBody public List<DescansoMedico> listarDescansos(@PathVariable(value = "mes") String mes,@PathVariable(value = "anio") String anio){ System.out.println("anio "+anio+" mes "+mes); return descansoservice.listarDescansos(anio,mes); } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "listarxanio/{anio}") @ResponseBody public List<DescansoMedico> listarDescansosxanio(@PathVariable(value = "anio") String anio){ System.out.println("listar x año : "+anio); return descansoservice.listarDescansosxanio(anio); } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "/citts/{citt}") @ResponseBody public List<DescansoMedico> buscarCitts(@PathVariable(value = "citt") String citt){ System.out.println("controller citt"); System.out.println(citt); List<DescansoMedico> des=descansoservice.buscarCitt(citt); System.out.println(des.size()+" --- ///"); return descansoservice.buscarCitt(citt); } }
UTF-8
Java
4,022
java
DescansoMedicoController.java
Java
[]
null
[]
package edu.quipu.rrhh.controllers; import edu.quipu.rrhh.models.DescansoMedico; import edu.quipu.rrhh.services.DescansoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; @Controller @RequestMapping(value = "/rest/descansos") public class DescansoMedicoController { private static final Logger log= LoggerFactory.getLogger(DescansoMedicoController.class); @Autowired DescansoService descansoservice; @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json", value = "/addDescanso") @ResponseStatus(HttpStatus.CREATED) @ResponseBody public String addDescanso(@RequestBody DescansoMedico descansomedico){ descansoservice.addDescanso(descansomedico); return "save"; } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "/codigo/{cod}/numserest/{num}") @ResponseBody public List<DescansoMedico> buscarResoluciones(@PathVariable(value = "cod") String codigo,@PathVariable(value = "num") Integer numserest){ System.out.println("controller descansos"); System.out.println(codigo+"-"); System.out.println(numserest); return descansoservice.buscarDescansos(codigo, numserest); } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "/acumulado/codigo/{cod}/numserest/{num}") @ResponseBody public List<DescansoMedico> buscarAcumulado(@PathVariable(value = "cod") String codigo,@PathVariable(value = "num") Integer numserest){ System.out.println("controller acumulado"); System.out.println(codigo+"-"); System.out.println(numserest); return descansoservice.buscarAcumulado(codigo, numserest); } @RequestMapping(method = RequestMethod.DELETE, /*consumes = "application/json",*/produces = "application/json", value = "/deleteDescansoMed/{idDesc}") @ResponseStatus(HttpStatus.ACCEPTED) @ResponseBody public String eliminarDescaMed(@PathVariable(value = "idDesc") Integer idDesc) { System.out.println("controller"+idDesc); descansoservice.removeDescMed(idDesc); return "delete" +idDesc; } @RequestMapping(method = RequestMethod.POST,consumes = "application/json",produces = "application/json",value = "/updateDescMed") @ResponseStatus(HttpStatus.CREATED) @ResponseBody public String UpdateDescanso(@RequestBody DescansoMedico descMed){ System.out.print("Hola Mundooooooooooo!!!!"+descMed.getId_desc_med()); descansoservice.updateDescMed(descMed); return ""; } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "listar/{mes}/{anio}") @ResponseBody public List<DescansoMedico> listarDescansos(@PathVariable(value = "mes") String mes,@PathVariable(value = "anio") String anio){ System.out.println("anio "+anio+" mes "+mes); return descansoservice.listarDescansos(anio,mes); } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "listarxanio/{anio}") @ResponseBody public List<DescansoMedico> listarDescansosxanio(@PathVariable(value = "anio") String anio){ System.out.println("listar x año : "+anio); return descansoservice.listarDescansosxanio(anio); } @RequestMapping(method = RequestMethod.GET,produces ="application/json",value = "/citts/{citt}") @ResponseBody public List<DescansoMedico> buscarCitts(@PathVariable(value = "citt") String citt){ System.out.println("controller citt"); System.out.println(citt); List<DescansoMedico> des=descansoservice.buscarCitt(citt); System.out.println(des.size()+" --- ///"); return descansoservice.buscarCitt(citt); } }
4,022
0.720468
0.71997
94
41.776596
39.67934
154
false
false
0
0
0
0
0
0
0.659574
false
false
1
b63cd97efb24d3f8ce23e7fc34e758adbee0ddf3
38,190,849,200,448
5fd5b6466346817daa851eb0e297a2a3a2551a85
/src/main/java/com/institute/acbank/client/resource/ClientResource.java
9709886e3868d55c341c02f18ae939a4fca91da2
[]
no_license
WilliamsJose/acbank
https://github.com/WilliamsJose/acbank
9b8399337978b8db4dcd6a80b93b50ac5b6f27fd
64b9b3b1ff80f524a363f0203bfbb496262d9d2c
refs/heads/main
2023-04-18T12:25:09.612000
2021-04-22T01:45:49
2021-04-22T01:45:49
359,661,917
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.institute.acbank.client.resource; import java.net.URI; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.institute.acbank.client.domain.Client; import com.institute.acbank.client.domain.dto.ClientConverterDTO; import com.institute.acbank.client.domain.dto.ClientDTO; import com.institute.acbank.client.service.ClientServiceImpl; @RestController @RequestMapping("/clients") public class ClientResource { @Autowired ClientServiceImpl service; @GetMapping public ResponseEntity<List<ClientDTO>> getAllClients() { return ResponseEntity.ok(ClientConverterDTO.convertClientsToDTO(this.service.getAllClients())); } @PutMapping public ResponseEntity<ClientDTO> updateClientById(@RequestBody Client client, @RequestParam("cpfcnpj") String cpfcnpj) { this.service.updateClient(client, cpfcnpj); return ResponseEntity.created(URI.create("/clients/" + client.getName())).build(); } @GetMapping("/{cpfcnpj}") public ResponseEntity<ClientDTO> getClientByCpfCnpj(@PathVariable("cpfcnpj") String cpfcnpj) { return ResponseEntity.ok(this.service.getClientByCpfCnpj(cpfcnpj)); } @PostMapping public ResponseEntity<ClientDTO> createClient(@Valid @RequestBody Client client) { return ResponseEntity.ok(this.service.createClient(client)); } @DeleteMapping("/{id}") public ResponseEntity<Object> deleteClient(@PathVariable("id") Long id) { this.service.deleteClient(id); return ResponseEntity.noContent().build(); } }
UTF-8
Java
2,132
java
ClientResource.java
Java
[]
null
[]
package com.institute.acbank.client.resource; import java.net.URI; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.institute.acbank.client.domain.Client; import com.institute.acbank.client.domain.dto.ClientConverterDTO; import com.institute.acbank.client.domain.dto.ClientDTO; import com.institute.acbank.client.service.ClientServiceImpl; @RestController @RequestMapping("/clients") public class ClientResource { @Autowired ClientServiceImpl service; @GetMapping public ResponseEntity<List<ClientDTO>> getAllClients() { return ResponseEntity.ok(ClientConverterDTO.convertClientsToDTO(this.service.getAllClients())); } @PutMapping public ResponseEntity<ClientDTO> updateClientById(@RequestBody Client client, @RequestParam("cpfcnpj") String cpfcnpj) { this.service.updateClient(client, cpfcnpj); return ResponseEntity.created(URI.create("/clients/" + client.getName())).build(); } @GetMapping("/{cpfcnpj}") public ResponseEntity<ClientDTO> getClientByCpfCnpj(@PathVariable("cpfcnpj") String cpfcnpj) { return ResponseEntity.ok(this.service.getClientByCpfCnpj(cpfcnpj)); } @PostMapping public ResponseEntity<ClientDTO> createClient(@Valid @RequestBody Client client) { return ResponseEntity.ok(this.service.createClient(client)); } @DeleteMapping("/{id}") public ResponseEntity<Object> deleteClient(@PathVariable("id") Long id) { this.service.deleteClient(id); return ResponseEntity.noContent().build(); } }
2,132
0.810976
0.810976
64
32.3125
29.580334
97
false
false
0
0
0
0
0
0
0.984375
false
false
1
2fa680c8cfd21ccb2492783b58f329ced0be0d77
8,409,546,011,625
367ff328ee5d1cae942670fffe1cab56c2441dab
/src/main/java/beans/enums/Roles.java
47f9ee9cc3cb02c03e7476b854e99fe3ca67779d
[]
no_license
Kostyanoid/spring-advanced-course
https://github.com/Kostyanoid/spring-advanced-course
66ee324ef41df8b33d598e0f8d996cdc6afb7171
e50ff4642be98762fc486d7d6e9b5ffdb7e9814e
refs/heads/master
2020-04-04T23:43:46.767000
2018-11-28T09:14:05
2018-11-28T09:14:05
155,724,729
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package beans.enums; public enum Roles { RESGISTERED_USER, BOOKING_MANAGER; }
UTF-8
Java
87
java
Roles.java
Java
[]
null
[]
package beans.enums; public enum Roles { RESGISTERED_USER, BOOKING_MANAGER; }
87
0.701149
0.701149
6
13.5
9.215024
21
false
false
0
0
0
0
0
0
0.5
false
false
1
8cc1dac583a3baba1093996c7518ef547e9dd363
8,409,546,013,429
7691d0bf866ecaef73549f76a248a92b19f5e9b5
/AppEstagio/src/main/java/br/com/taldi/usina/GeracaoSolar.java
921fd120edc815a1e89283a693e810afdb08dc19
[]
no_license
diegofrndes/app-estagio
https://github.com/diegofrndes/app-estagio
7e81409cfbad9dd11cae2453ee20512b21869136
59711a407e720229db0d3763d9ee3943cc6175d3
refs/heads/master
2021-09-05T06:11:36.626000
2018-01-24T17:08:58
2018-01-24T17:08:58
113,692,789
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.taldi.usina; import java.math.BigDecimal; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.UniqueConstraint; @Entity @Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "data", "id_usina_solar" })}) public class GeracaoSolar { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(columnDefinition = "DECIMAL(19,3)") private BigDecimal quantidade; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "id_usina_solar") private UsinaSolar usinaSolar; @Temporal(TemporalType.DATE) private Date data; public long getId() { return id; } public void setId(long id) { this.id = id; } public Date getData() { return data; } public void setData(Date data) { this.data = data; } public BigDecimal getQuantidade() { return quantidade; } public void setQuantidade(BigDecimal quantidade) { this.quantidade = quantidade; } }
UTF-8
Java
1,420
java
GeracaoSolar.java
Java
[]
null
[]
package br.com.taldi.usina; import java.math.BigDecimal; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.UniqueConstraint; @Entity @Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "data", "id_usina_solar" })}) public class GeracaoSolar { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(columnDefinition = "DECIMAL(19,3)") private BigDecimal quantidade; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "id_usina_solar") private UsinaSolar usinaSolar; @Temporal(TemporalType.DATE) private Date data; public long getId() { return id; } public void setId(long id) { this.id = id; } public Date getData() { return data; } public void setData(Date data) { this.data = data; } public BigDecimal getQuantidade() { return quantidade; } public void setQuantidade(BigDecimal quantidade) { this.quantidade = quantidade; } }
1,420
0.738028
0.735915
58
22.482759
18.788515
92
false
false
0
0
0
0
0
0
1.086207
false
false
1
d8083cd9917ced63e1c3432c8c9684d2d4df7cb4
13,700,945,697,421
97c4a8d49b527fd36e7796083b017984b4797f8a
/app/src/main/java/com/shazam/choreographerexample/animation/choreographer/DullChoreographer.java
fe4ab40aaf4fc4677d8c829254a0d161d48e7eeb
[ "Apache-2.0" ]
permissive
lizhengdao/choreographer-example
https://github.com/lizhengdao/choreographer-example
d023901c417262339461622e8e19d7b027cb469e
75f7e0df977a1837a6fdf2d9a462a0d8482e96d6
refs/heads/master
2023-03-18T14:31:10.315000
2017-08-15T17:06:53
2017-08-15T17:06:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2017 Shazam Entertainment Limited * * 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.shazam.choreographerexample.animation.choreographer; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import com.shazam.choreographerexample.animation.LiteAnimator; import com.shazam.choreographerexample.animation.interpolator.MirrorInterpolator; import com.shazam.choreographerexample.animation.interpolator.SequentialInterpolator; import static android.graphics.Color.CYAN; import static com.shazam.choreographerexample.Math.mapFromPercent; import static com.shazam.choreographerexample.animation.LiteAnimator.animator; public class DullChoreographer implements Choreographer { private static final int DURATION = 1500; private static final float BTN_SCALE_MIN = 0.90f; private static final float BTN_SCALE_MAX = 0.95f; private final Interpolator internalInterpolator = new AccelerateDecelerateInterpolator(); private final LiteAnimator btnScaleAnimator = animator(DURATION, new SequentialInterpolator(.5f, internalInterpolator, new MirrorInterpolator(internalInterpolator))); private Frame lastFrame; @Override public Frame frameOn(long now) { if (lastFrame == null) { btnScaleAnimator.restart(now); lastFrame = new Frame(); lastFrame.scale = 1; lastFrame.alpha = .2f; lastFrame.translationY = 0f; lastFrame.color = CYAN; } float animatedFraction = btnScaleAnimator.getAnimatedFraction(now); lastFrame.scale = mapFromPercent(animatedFraction, BTN_SCALE_MIN, BTN_SCALE_MAX); return lastFrame; } @Override public long getStartTime() { return btnScaleAnimator.getStartTime(); } }
UTF-8
Java
2,332
java
DullChoreographer.java
Java
[]
null
[]
/* * Copyright 2017 Shazam Entertainment Limited * * 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.shazam.choreographerexample.animation.choreographer; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Interpolator; import com.shazam.choreographerexample.animation.LiteAnimator; import com.shazam.choreographerexample.animation.interpolator.MirrorInterpolator; import com.shazam.choreographerexample.animation.interpolator.SequentialInterpolator; import static android.graphics.Color.CYAN; import static com.shazam.choreographerexample.Math.mapFromPercent; import static com.shazam.choreographerexample.animation.LiteAnimator.animator; public class DullChoreographer implements Choreographer { private static final int DURATION = 1500; private static final float BTN_SCALE_MIN = 0.90f; private static final float BTN_SCALE_MAX = 0.95f; private final Interpolator internalInterpolator = new AccelerateDecelerateInterpolator(); private final LiteAnimator btnScaleAnimator = animator(DURATION, new SequentialInterpolator(.5f, internalInterpolator, new MirrorInterpolator(internalInterpolator))); private Frame lastFrame; @Override public Frame frameOn(long now) { if (lastFrame == null) { btnScaleAnimator.restart(now); lastFrame = new Frame(); lastFrame.scale = 1; lastFrame.alpha = .2f; lastFrame.translationY = 0f; lastFrame.color = CYAN; } float animatedFraction = btnScaleAnimator.getAnimatedFraction(now); lastFrame.scale = mapFromPercent(animatedFraction, BTN_SCALE_MIN, BTN_SCALE_MAX); return lastFrame; } @Override public long getStartTime() { return btnScaleAnimator.getStartTime(); } }
2,332
0.751715
0.742281
56
40.642857
49.028572
308
false
false
0
0
0
0
0
0
0.625
false
false
1
84a7f10df99d55af78a85fd26f687d5097297c7d
12,266,426,632,007
6764560e18b56f96e83d65c4c23a23c91cb57e2b
/src/main/java/com/mabao/controller/vo/ExpressContentVO.java
5f7f20b14848cddcddf378c56608359cd65d9dd2
[]
no_license
RoaringFlame/mabaowang
https://github.com/RoaringFlame/mabaowang
c1fe139fc24892f243ba569682a51757dce9aeef
5e3bfe1a9d95f9622ee39c6116617ee90239dc28
refs/heads/master
2021-01-01T18:45:55.956000
2017-07-26T14:08:27
2017-07-26T14:08:27
98,430,163
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mabao.controller.vo; import com.mabao.util.VoUtil; import com.mabao.util.express.PackDetails; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; public class ExpressContentVO { private String time; private String context; public static ExpressContentVO generateBy(PackDetails packDetails){ ExpressContentVO vo = VoUtil.copyBasic(ExpressContentVO.class,packDetails); SimpleDateFormat myFmt=new SimpleDateFormat("E yyyy-MM-dd HH:mm:ss"); assert vo != null; vo.setTime(myFmt.format(packDetails.getTime())); return vo; } public static List<ExpressContentVO> generateBy(List<PackDetails> packDetailsList){ List<ExpressContentVO> list = new ArrayList<>(); for(PackDetails packDetails: packDetailsList){ list.add(generateBy(packDetails)); } return list; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getContext() { return context; } public void setContext(String context) { this.context = context; } }
UTF-8
Java
1,189
java
ExpressContentVO.java
Java
[]
null
[]
package com.mabao.controller.vo; import com.mabao.util.VoUtil; import com.mabao.util.express.PackDetails; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; public class ExpressContentVO { private String time; private String context; public static ExpressContentVO generateBy(PackDetails packDetails){ ExpressContentVO vo = VoUtil.copyBasic(ExpressContentVO.class,packDetails); SimpleDateFormat myFmt=new SimpleDateFormat("E yyyy-MM-dd HH:mm:ss"); assert vo != null; vo.setTime(myFmt.format(packDetails.getTime())); return vo; } public static List<ExpressContentVO> generateBy(List<PackDetails> packDetailsList){ List<ExpressContentVO> list = new ArrayList<>(); for(PackDetails packDetails: packDetailsList){ list.add(generateBy(packDetails)); } return list; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getContext() { return context; } public void setContext(String context) { this.context = context; } }
1,189
0.672834
0.672834
45
25.422222
23.713558
87
false
false
0
0
0
0
0
0
0.466667
false
false
1
776ab0ee4d1ac2001d70042660cf7f320003fe6c
8,323,646,678,340
6acb9453137d594a605d3c12b4d75a40b8f416d4
/app/src/main/java/com/example/bhupesh/swachhnew/Post.java
934e2a57d414c21b30a1638a176d27aed94ec24e
[]
no_license
Bhupeshverma/SwachhNITC
https://github.com/Bhupeshverma/SwachhNITC
f4444fa8e71db9c57d210c2d2d1abdfc4e536792
262810b99198a15fd2baac0c8532126364fcbde6
refs/heads/master
2021-01-25T06:49:35.208000
2017-06-07T09:35:07
2017-06-07T09:35:07
93,617,511
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bhupesh.swachhnew; import android.content.Intent; import android.support.annotation.NonNull; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import com.firebase.ui.auth.AuthUI; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import java.util.ArrayList; import java.util.List; public class Post extends AppCompatActivity { private static final String TAG = "PostActivity"; private FirebaseAuth mAuth; private FirebaseAuth.AuthStateListener mAuthListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_post); mAuth = FirebaseAuth.getInstance(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); // Set Tabs inside Toolbar TabLayout tabs = (TabLayout) findViewById(R.id.tabs); tabs.setupWithViewPager(viewPager); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = mAuth.getCurrentUser(); if (user != null) { // User is signed in Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid()); } else { // User is signed out Log.d(TAG, "onAuthStateChanged:signed_out"); } // ... } }; } private void setupViewPager(ViewPager viewPager) { Adapter adapter = new Adapter(getSupportFragmentManager()); adapter.addFragment(new ListContentFragment(getApplicationContext()), "DeptList"); adapter.addFragment(new ListContentFragment2(getApplicationContext()), "MyPosts"); viewPager.setAdapter(adapter); } static class Adapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public Adapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, 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; } if(id==R.id.action_signout) { AuthUI.getInstance().signOut(this); startActivity(new Intent(getApplicationContext(),MainActivity.class)); } return super.onOptionsItemSelected(item); } @Override public void onStop() { super.onStop(); if (mAuthListener != null) { mAuth.removeAuthStateListener(mAuthListener); } } @Override public void onStart() { super.onStart(); mAuth.addAuthStateListener(mAuthListener); } }
UTF-8
Java
4,557
java
Post.java
Java
[ { "context": "package com.example.bhupesh.swachhnew;\n\nimport android.content.Intent;\nimport", "end": 27, "score": 0.9065291285514832, "start": 20, "tag": "USERNAME", "value": "bhupesh" } ]
null
[]
package com.example.bhupesh.swachhnew; import android.content.Intent; import android.support.annotation.NonNull; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import com.firebase.ui.auth.AuthUI; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import java.util.ArrayList; import java.util.List; public class Post extends AppCompatActivity { private static final String TAG = "PostActivity"; private FirebaseAuth mAuth; private FirebaseAuth.AuthStateListener mAuthListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_post); mAuth = FirebaseAuth.getInstance(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); // Set Tabs inside Toolbar TabLayout tabs = (TabLayout) findViewById(R.id.tabs); tabs.setupWithViewPager(viewPager); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = mAuth.getCurrentUser(); if (user != null) { // User is signed in Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid()); } else { // User is signed out Log.d(TAG, "onAuthStateChanged:signed_out"); } // ... } }; } private void setupViewPager(ViewPager viewPager) { Adapter adapter = new Adapter(getSupportFragmentManager()); adapter.addFragment(new ListContentFragment(getApplicationContext()), "DeptList"); adapter.addFragment(new ListContentFragment2(getApplicationContext()), "MyPosts"); viewPager.setAdapter(adapter); } static class Adapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public Adapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, 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; } if(id==R.id.action_signout) { AuthUI.getInstance().signOut(this); startActivity(new Intent(getApplicationContext(),MainActivity.class)); } return super.onOptionsItemSelected(item); } @Override public void onStop() { super.onStop(); if (mAuthListener != null) { mAuth.removeAuthStateListener(mAuthListener); } } @Override public void onStart() { super.onStart(); mAuth.addAuthStateListener(mAuthListener); } }
4,557
0.649331
0.647575
145
30.427586
24.393822
90
false
false
0
0
0
0
0
0
0.468966
false
false
1
ad6e6f1c418b3195f4bb182cf583ea912a57bb6f
1,022,202,253,408
ff87b978f1c05830410c5a47b1c8bf672ae3d885
/livk-api-dynamic/src/main/java/com/livk/cloud/dynamic/domain/RedisRoute.java
f0996639778beff149b44482fdd4756fdee3bad2
[ "Apache-2.0" ]
permissive
1375632510/spring-dynamic-gateway
https://github.com/1375632510/spring-dynamic-gateway
d8a606130fd373687a3efc88ae969b9833100bb7
3e80f11add64dfa67177dc028a6025d23c99e6e4
refs/heads/main
2023-08-20T23:46:44.678000
2023-02-14T08:27:16
2023-02-14T08:27:16
358,772,841
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.livk.cloud.dynamic.domain; import com.livk.cloud.dynamic.domain.route.Filter; import com.livk.cloud.dynamic.domain.route.Predicate; import com.livk.cloud.dynamic.validation.annotation.RoutePredicate; import com.livk.cloud.dynamic.validation.annotation.RouteURL; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import java.util.List; import java.util.Map; /** * <p> * DynamicRoute * </p> * * @author livk * @date 2021/11/4 */ @Data public class RedisRoute { @NotBlank(message = "路由id不能为空") private String id; @RoutePredicate(message = "断言匹配不能缺少") private List<Predicate> predicates; private List<Filter> filters; @RouteURL(message = "URI表达式不满足") private String uri; private Map<String, Object> metadata; @NotBlank(message = "路由描述不能为空!") private String description; @Max(value = 1, message = "状态值只能为1或者0") @Min(value = 0, message = "状态值只能为1或者0") @NotNull(message = "状态值不能为空!") private Integer status; private Integer order = 0; }
UTF-8
Java
1,274
java
RedisRoute.java
Java
[ { "context": "\n\n/**\n * <p>\n * DynamicRoute\n * </p>\n *\n * @author livk\n * @date 2021/11/4\n */\n@Data\npublic class RedisRo", "end": 576, "score": 0.9996601343154907, "start": 572, "tag": "USERNAME", "value": "livk" } ]
null
[]
package com.livk.cloud.dynamic.domain; import com.livk.cloud.dynamic.domain.route.Filter; import com.livk.cloud.dynamic.domain.route.Predicate; import com.livk.cloud.dynamic.validation.annotation.RoutePredicate; import com.livk.cloud.dynamic.validation.annotation.RouteURL; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; import java.util.List; import java.util.Map; /** * <p> * DynamicRoute * </p> * * @author livk * @date 2021/11/4 */ @Data public class RedisRoute { @NotBlank(message = "路由id不能为空") private String id; @RoutePredicate(message = "断言匹配不能缺少") private List<Predicate> predicates; private List<Filter> filters; @RouteURL(message = "URI表达式不满足") private String uri; private Map<String, Object> metadata; @NotBlank(message = "路由描述不能为空!") private String description; @Max(value = 1, message = "状态值只能为1或者0") @Min(value = 0, message = "状态值只能为1或者0") @NotNull(message = "状态值不能为空!") private Integer status; private Integer order = 0; }
1,274
0.725256
0.713311
50
22.440001
19.340279
67
false
false
0
0
0
0
0
0
0.46
false
false
1
7a9cbbdd27c4eb5d0a9169a1c1db4955b94b05da
17,368,847,789,949
11a449070bc9f82a9b30e9b0e7bfbf09ddca1655
/app/src/main/java/net/iaround/ui/activity/UserMiGuAnimationVipPayActivity.java
6d915935c65b9332d4adadd24501d339a8e9e06a
[]
no_license
zhangsen22/Iaround
https://github.com/zhangsen22/Iaround
58d3d93639c5e5afb956c0965a733ca76da9dc4a
8a0725319a0bce70430da90cfb0a42f6904f9bd5
refs/heads/master
2020-04-26T02:46:58.483000
2019-03-29T02:52:59
2019-03-29T02:52:59
173,245,150
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.iaround.ui.activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.migu.sdk.api.MiguSdk; import com.migu.sdk.api.OrderIdBean; import com.migu.sdk.api.OrderIdCallBack; import com.migu.sdk.api.PayBean; import com.migu.sdk.api.PayCallBack; import com.migu.sdk.api.PayResult; import net.iaround.BaseApplication; import net.iaround.R; import net.iaround.conf.ErrorCode; import net.iaround.connector.HttpCallBack; import net.iaround.connector.protocol.GoldHttpProtocol; import net.iaround.tools.CommonFunction; import net.iaround.tools.MiguAESUtil; import net.iaround.tools.PhoneInfoUtil; import net.iaround.ui.comon.NetImageView; import org.json.JSONException; import org.json.JSONObject; import java.net.URLEncoder; /** * 咪咕开通会员的类 */ public class UserMiGuAnimationVipPayActivity extends TitleActivity implements View.OnClickListener, HttpCallBack { public static final String KEY_HEADER_ICON = "key_header_icon"; public static final String CHANNEL_ID = "310000022";//需使用自有的CHANNELID public static final String CP_ID = "LP0023";//需使用申请包月对应的CPID public static final String APP_ID_10 = "152835139497717636861581100762";//10元包月对应的产品code public static final String APP_ID_15 = "152835139499417636861597872765";//15元包月对应的产品code public static final String APP_ID_20 = "152835139497818245064481710588";//20元包月对应的产品code private TextView tvTitle; private ImageView ivLeft; private NetImageView vipIcon; private TextView tvNewPay1; private TextView tvNewPay2; private TextView tvNewPay3; private TextView tvPay1Title; private TextView tvPay2Title; private TextView tvPay3Title; private TextView tvGetPackageGift; private TextView tvPay1Hint; private TextView tvPay2Hint; private TextView tvPay3Hint; private LinearLayout llMiguDownload; private LinearLayout llDownloadMiguVideoApk; private LinearLayout llDownloadMiguQuanQuanApk; private long mGetMiguStatusFlag;//得到咪咕动漫订购状态网络请求标识 private long mSetMiguStatusFlag;//设置咪咕动漫订购状态网络请求标识 // 咪咕当前订购状态 private int mOrderStatus = 0; //咪咕动漫H5链接 private String mH5Url; private String headerIcon; // private boolean isFirstGetOrderId = true;//是否成功得到orderId @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // miguSDK初始化 showWaitDialog(); handler.postDelayed(new Runnable() { @Override public void run() { //初始化比较耗时,又不能放到子线程执行 MiguSdk.initializeApp(UserMiGuAnimationVipPayActivity.this, null); destroyWaitDialog(); } }, 1000); setContentView(R.layout.activity_user_vip_new_pay); initData(); initView(); initActionBar(); } /** * 初始化数据 */ private void initData() { headerIcon = getIntent().getStringExtra(KEY_HEADER_ICON); } private void initActionBar() { tvTitle = (TextView) findViewById(R.id.tv_title); ivLeft = (ImageView) findViewById(R.id.iv_left); tvTitle.setText(getResString(R.string.vip_recharge)); findViewById(R.id.fl_left).setOnClickListener(this); ivLeft.setOnClickListener(this); } private void initView() { tvNewPay1 = (TextView) findViewById(R.id.tv_new_pay1); tvNewPay2 = (TextView) findViewById(R.id.tv_new_pay2); tvNewPay3 = (TextView) findViewById(R.id.tv_new_pay3); tvPay1Title = (TextView) findViewById(R.id.tv_pay1_title); tvPay2Title = (TextView) findViewById(R.id.tv_pay2_title); tvPay3Title = (TextView) findViewById(R.id.tv_pay3_title); tvPay1Hint = (TextView) findViewById(R.id.tv_pay1_hint); tvPay2Hint = (TextView) findViewById(R.id.tv_pay2_hint); tvPay3Hint = (TextView) findViewById(R.id.tv_pay3_hint); tvGetPackageGift = (TextView) findViewById(R.id.tv_get_packageGift); vipIcon = (NetImageView) findViewById(R.id.iv_vip_banner); llMiguDownload = (LinearLayout) findViewById(R.id.ll_migu_download); llDownloadMiguVideoApk = (LinearLayout) findViewById(R.id.ll_download_migu_video_apk); llDownloadMiguQuanQuanApk = (LinearLayout) findViewById(R.id.ll_download_migu_quanquan_apk); llMiguDownload.setVisibility(View.VISIBLE); tvPay1Title.setText(getString(R.string.user_vip_animation_pay1_title)); tvPay2Title.setText(getString(R.string.user_vip_animation_pay2_title)); tvPay3Title.setText(getString(R.string.user_vip_animation_pay3_title)); tvPay1Hint.setText(getString(R.string.user_vip_animation_pay1_hint)); tvPay2Hint.setText(getString(R.string.user_vip_animation_pay2_hint)); tvPay3Hint.setText(getString(R.string.user_vip_animation_pay3_hint)); tvGetPackageGift.setText(getString(R.string.user_vip_animation_activity)); tvGetPackageGift.setOnClickListener(this); findViewById(R.id.rl_get_packageGift).setOnClickListener(this); tvNewPay1.setOnClickListener(this); tvNewPay2.setOnClickListener(this); tvNewPay3.setOnClickListener(this); llDownloadMiguVideoApk.setOnClickListener(this); llDownloadMiguQuanQuanApk.setOnClickListener(this); if (headerIcon != null) { if (!TextUtils.isEmpty(headerIcon)) { vipIcon.execute(R.drawable.group_info_bg, headerIcon); } } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.fl_left: case R.id.iv_left: finish(); break; case R.id.tv_new_pay1: if (mOrderStatus > 0) { if (mOrderStatus == 10) {//退订10元 payOrUnsubscribeVip("1300200910", "1000", APP_ID_10, "2", "1"); } return; } //订阅10元 payOrUnsubscribeVip("1300200910", "1000", APP_ID_10, "1", "0"); break; case R.id.tv_new_pay2: if (mOrderStatus > 0) { if (mOrderStatus == 15) {//退订15元 payOrUnsubscribeVip("1300200911", "1500", APP_ID_15, "2", "1"); } return; } //订阅15元 payOrUnsubscribeVip("1300200911", "1500", APP_ID_15, "1", "0"); break; case R.id.tv_new_pay3: if (mOrderStatus > 0) { if (mOrderStatus == 20) {//退订20元 payOrUnsubscribeVip("1300200912", "2000", APP_ID_20, "2", "1"); } return; } //订阅20元 payOrUnsubscribeVip("1300200912", "2000", APP_ID_20, "1", "0"); break; case R.id.ll_download_migu_video_apk: WebViewAvtivity.launchVerifyCode(UserMiGuAnimationVipPayActivity.this, "http://dl.iaround.com/MiguVideo.apk"); break; case R.id.ll_download_migu_quanquan_apk: WebViewAvtivity.launchVerifyCode(UserMiGuAnimationVipPayActivity.this, "http://dl.iaround.com/MiguQQ.apk"); break; case R.id.tv_get_packageGift: case R.id.rl_get_packageGift: WebViewAvtivity.launchVerifyCode(UserMiGuAnimationVipPayActivity.this, getEncodeUrl()); break; } } @Override protected void onResume() { super.onResume(); requestPayMiGu(); } @Override protected void onDestroy() { MiguSdk.exitApp(this); super.onDestroy(); } /** * 得到咪咕订购状态 */ private void requestPayMiGu() { mGetMiguStatusFlag = GoldHttpProtocol.getMiguManLianStatus(this, this); } /** * 设置咪咕订购状态 */ private void setPayMiGuStatus(int orderStatus) { showWaitDialog(); mSetMiguStatusFlag = GoldHttpProtocol.setMiguManLianStatus(this, orderStatus, this); } @Override public void onGeneralSuccess(String result, long flag) { if (flag == mGetMiguStatusFlag) { //会员状态是否开通(遇见服务器接口返回) try { JSONObject obj = new JSONObject(result); if (obj.has("status") && obj.optLong("status") == 200) { mOrderStatus = CommonFunction.jsonOptInt(obj, "manlianStatus"); mH5Url = CommonFunction.jsonOptString(obj, "url"); initViewByOrderStatus(); } } catch (JSONException e) { e.printStackTrace(); } } else if (flag == mSetMiguStatusFlag) { destroyWaitDialog(); initViewByOrderStatus(); CommonFunction.toastMsg(BaseApplication.getInstance(), "操作成功"); } } @Override public void onGeneralError(int e, long flag) { if (flag == mSetMiguStatusFlag) { destroyWaitDialog(); } ErrorCode.toastError(this, e); } private void initViewByOrderStatus() { if (mOrderStatus == 10) { tvNewPay1.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay1.setText("退订"); tvNewPay2.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay2.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay3.setText("开通会员"); } else if (mOrderStatus == 15) { tvNewPay1.setText("开通会员"); tvNewPay1.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay2.setText("退订"); tvNewPay2.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay3.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.btn_user_vip_migu_was); } else if (mOrderStatus == 20) { tvNewPay1.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay1.setText("开通会员"); tvNewPay2.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay2.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay3.setText("退订"); } else { tvNewPay1.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay1.setText("开通会员"); tvNewPay2.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay2.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay3.setText("开通会员"); } } /** * 得到加密过后的字符H5 url * * @return */ private String getEncodeUrl() { String phoneNum = PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getPhoneNum(); String imei = PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getIMEI(); if (TextUtils.isEmpty(imei)) { imei = PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getDeviceId(); } String urlEncodeString = ""; if (!TextUtils.isEmpty(phoneNum)) { if (phoneNum.startsWith("+86")) { phoneNum = phoneNum.substring(3); } } else { //当手机号获取不到时,需要将phoneNum置为null,不然请求咪咕H5界面报参数错误 phoneNum = null; } String productCode; switch (mOrderStatus) { case 10: productCode = APP_ID_10; break; case 15: productCode = APP_ID_15; break; case 20: productCode = APP_ID_20; break; default: productCode = APP_ID_20; } String source = "mobile=" + phoneNum + "|imei=" + imei + "|is_auth_controller=true|is_union=true|watch_num=20|cpId=" + CP_ID + "|productCode=" + productCode; String key = "migudm@XM.com"; try { String encodedString = MiguAESUtil.aesEncrypt(source, key); urlEncodeString = URLEncoder.encode(encodedString, "UTF-8"); urlEncodeString = URLEncoder.encode(urlEncodeString, "UTF-8"); } catch (Exception e) { e.printStackTrace(); } return mH5Url + urlEncodeString; } /** * 订阅或退订 * * @param paycode 计费点Id * @param fee 价格 ,单位为分 * @param appId 产品id * @param orderType 1-订购,2-退订 * @param operType 0-订购,1-退订 */ private void payOrUnsubscribeVip(final String paycode, final String fee, final String appId, final String orderType, final String operType) { showWaitDialog(); new Thread(new Runnable() { @Override public void run() { // if (isFirstGetOrderId) { // try { // Thread.sleep(5000); // } catch (Exception e) { // e.printStackTrace(); // } // } OrderIdBean bean = new OrderIdBean(); bean.setOrderType(orderType); bean.setAppId(appId); //需使用分配的APPID bean.setChannelId(CHANNEL_ID); //需使用自有的CHANNELID bean.setPaycode(paycode); // bean.setPaycode(""); bean.setPayType("1002"); bean.setOperType(operType); bean.setCpId(CP_ID); //需使用申请包月对应的CPID MiguSdk.getOrderId(UserMiGuAnimationVipPayActivity.this, bean, "", "", new OrderIdCallBack.IOrderIdCallback() { @Override public void onResult(int resultCode, String statusCode, String message, String bossid) { // String result = ""; switch (resultCode) { case PayResult.SUCCESS: // result = "获取orderid成功!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; Message msg = new Message(); Bundle data = new Bundle(); data.putString("orderId", message); data.putString("bossId", bossid); data.putString("fee", fee); data.putString("operType", operType); msg.setData(data); handler.sendMessage(msg); break; case PayResult.FAILED: CommonFunction.log("getOrderId", "获取orderid失败!resultCode:" + resultCode + " statusCode:" + statusCode + " message:" + message); if (statusCode != null && statusCode.equals("D1")) { if (!TextUtils.isEmpty(PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getPhoneNum())) { CommonFunction.toastMsg(BaseApplication.getInstance(), "请重试"); } else { CommonFunction.toastMsg(BaseApplication.getInstance(), message); } } else { CommonFunction.toastMsg(BaseApplication.getInstance(), " statusCode:" + statusCode + " message:" + message); } // result = "获取orderid失败!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; break; } destroyWaitDialog(); } }); } }).start(); } Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); Bundle data = msg.getData(); String val = data.getString("orderId"); String bossid = data.getString("bossId"); final String fee = data.getString("fee"); final String operType = data.getString("operType"); //Toast.makeText(UserMiGuAnimationVipPayActivity.this, val, Toast.LENGTH_LONG).show(); PayBean paybean = new PayBean(); paybean.setProductId(bossid); paybean.setCpId(CP_ID); //需使用申请包月对应的CPID paybean.setChannelId(CHANNEL_ID); //需使用自有的CHANNELID paybean.setFee(fee); //需使用所申请包月对应的价格,单位为分 paybean.setOrderId(val); paybean.setSpCode("698043"); paybean.setOperType(operType); paybean.setSyn(false); paybean.setReservedParam2(""); paybean.setReservedParam3(""); paybean.setReservedParam4(""); paybean.setReservedParam5(""); paybean.setPlatfromCode("698043NLPT"); MiguSdk.pay(UserMiGuAnimationVipPayActivity.this, paybean, "", "", new PayCallBack.IPayCallback() { @Override public void onResult(int resultCode, String statusCode, String message) { String result = ""; switch (resultCode) { case PayResult.SUCCESS: //result = "购买道具成功!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; if ("0".equals(operType)) { if ("1000".equals(fee)) { mOrderStatus = 10; } else if ("1500".equals(fee)) { mOrderStatus = 15; } else if ("2000".equals(fee)) { mOrderStatus = 20; } } else if ("1".equals(operType)) { mOrderStatus = 0; } setPayMiGuStatus(mOrderStatus); break; case PayResult.FAILED: //result = "购买道具失败!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; result = "操作失败 " + message; break; case PayResult.CANCELLED: //result = "购买道具取消!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; default: //result = "购买道具取消!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; result = "操作取消"; break; } // Toast.makeText(UserMiGuAnimationVipPayActivity.this, result, Toast.LENGTH_SHORT).show(); CommonFunction.toastMsg(BaseApplication.getInstance(), result); } }); } }; }
UTF-8
Java
20,669
java
UserMiGuAnimationVipPayActivity.java
Java
[ { "context": "roductCode=\" + productCode;\n String key = \"migudm@XM.com\";\n\n try {\n\n String encodedStrin", "end": 12359, "score": 0.8626190423965454, "start": 12346, "tag": "KEY", "value": "migudm@XM.com" } ]
null
[]
package net.iaround.ui.activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.migu.sdk.api.MiguSdk; import com.migu.sdk.api.OrderIdBean; import com.migu.sdk.api.OrderIdCallBack; import com.migu.sdk.api.PayBean; import com.migu.sdk.api.PayCallBack; import com.migu.sdk.api.PayResult; import net.iaround.BaseApplication; import net.iaround.R; import net.iaround.conf.ErrorCode; import net.iaround.connector.HttpCallBack; import net.iaround.connector.protocol.GoldHttpProtocol; import net.iaround.tools.CommonFunction; import net.iaround.tools.MiguAESUtil; import net.iaround.tools.PhoneInfoUtil; import net.iaround.ui.comon.NetImageView; import org.json.JSONException; import org.json.JSONObject; import java.net.URLEncoder; /** * 咪咕开通会员的类 */ public class UserMiGuAnimationVipPayActivity extends TitleActivity implements View.OnClickListener, HttpCallBack { public static final String KEY_HEADER_ICON = "key_header_icon"; public static final String CHANNEL_ID = "310000022";//需使用自有的CHANNELID public static final String CP_ID = "LP0023";//需使用申请包月对应的CPID public static final String APP_ID_10 = "152835139497717636861581100762";//10元包月对应的产品code public static final String APP_ID_15 = "152835139499417636861597872765";//15元包月对应的产品code public static final String APP_ID_20 = "152835139497818245064481710588";//20元包月对应的产品code private TextView tvTitle; private ImageView ivLeft; private NetImageView vipIcon; private TextView tvNewPay1; private TextView tvNewPay2; private TextView tvNewPay3; private TextView tvPay1Title; private TextView tvPay2Title; private TextView tvPay3Title; private TextView tvGetPackageGift; private TextView tvPay1Hint; private TextView tvPay2Hint; private TextView tvPay3Hint; private LinearLayout llMiguDownload; private LinearLayout llDownloadMiguVideoApk; private LinearLayout llDownloadMiguQuanQuanApk; private long mGetMiguStatusFlag;//得到咪咕动漫订购状态网络请求标识 private long mSetMiguStatusFlag;//设置咪咕动漫订购状态网络请求标识 // 咪咕当前订购状态 private int mOrderStatus = 0; //咪咕动漫H5链接 private String mH5Url; private String headerIcon; // private boolean isFirstGetOrderId = true;//是否成功得到orderId @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // miguSDK初始化 showWaitDialog(); handler.postDelayed(new Runnable() { @Override public void run() { //初始化比较耗时,又不能放到子线程执行 MiguSdk.initializeApp(UserMiGuAnimationVipPayActivity.this, null); destroyWaitDialog(); } }, 1000); setContentView(R.layout.activity_user_vip_new_pay); initData(); initView(); initActionBar(); } /** * 初始化数据 */ private void initData() { headerIcon = getIntent().getStringExtra(KEY_HEADER_ICON); } private void initActionBar() { tvTitle = (TextView) findViewById(R.id.tv_title); ivLeft = (ImageView) findViewById(R.id.iv_left); tvTitle.setText(getResString(R.string.vip_recharge)); findViewById(R.id.fl_left).setOnClickListener(this); ivLeft.setOnClickListener(this); } private void initView() { tvNewPay1 = (TextView) findViewById(R.id.tv_new_pay1); tvNewPay2 = (TextView) findViewById(R.id.tv_new_pay2); tvNewPay3 = (TextView) findViewById(R.id.tv_new_pay3); tvPay1Title = (TextView) findViewById(R.id.tv_pay1_title); tvPay2Title = (TextView) findViewById(R.id.tv_pay2_title); tvPay3Title = (TextView) findViewById(R.id.tv_pay3_title); tvPay1Hint = (TextView) findViewById(R.id.tv_pay1_hint); tvPay2Hint = (TextView) findViewById(R.id.tv_pay2_hint); tvPay3Hint = (TextView) findViewById(R.id.tv_pay3_hint); tvGetPackageGift = (TextView) findViewById(R.id.tv_get_packageGift); vipIcon = (NetImageView) findViewById(R.id.iv_vip_banner); llMiguDownload = (LinearLayout) findViewById(R.id.ll_migu_download); llDownloadMiguVideoApk = (LinearLayout) findViewById(R.id.ll_download_migu_video_apk); llDownloadMiguQuanQuanApk = (LinearLayout) findViewById(R.id.ll_download_migu_quanquan_apk); llMiguDownload.setVisibility(View.VISIBLE); tvPay1Title.setText(getString(R.string.user_vip_animation_pay1_title)); tvPay2Title.setText(getString(R.string.user_vip_animation_pay2_title)); tvPay3Title.setText(getString(R.string.user_vip_animation_pay3_title)); tvPay1Hint.setText(getString(R.string.user_vip_animation_pay1_hint)); tvPay2Hint.setText(getString(R.string.user_vip_animation_pay2_hint)); tvPay3Hint.setText(getString(R.string.user_vip_animation_pay3_hint)); tvGetPackageGift.setText(getString(R.string.user_vip_animation_activity)); tvGetPackageGift.setOnClickListener(this); findViewById(R.id.rl_get_packageGift).setOnClickListener(this); tvNewPay1.setOnClickListener(this); tvNewPay2.setOnClickListener(this); tvNewPay3.setOnClickListener(this); llDownloadMiguVideoApk.setOnClickListener(this); llDownloadMiguQuanQuanApk.setOnClickListener(this); if (headerIcon != null) { if (!TextUtils.isEmpty(headerIcon)) { vipIcon.execute(R.drawable.group_info_bg, headerIcon); } } } @Override public void onClick(View v) { switch (v.getId()) { case R.id.fl_left: case R.id.iv_left: finish(); break; case R.id.tv_new_pay1: if (mOrderStatus > 0) { if (mOrderStatus == 10) {//退订10元 payOrUnsubscribeVip("1300200910", "1000", APP_ID_10, "2", "1"); } return; } //订阅10元 payOrUnsubscribeVip("1300200910", "1000", APP_ID_10, "1", "0"); break; case R.id.tv_new_pay2: if (mOrderStatus > 0) { if (mOrderStatus == 15) {//退订15元 payOrUnsubscribeVip("1300200911", "1500", APP_ID_15, "2", "1"); } return; } //订阅15元 payOrUnsubscribeVip("1300200911", "1500", APP_ID_15, "1", "0"); break; case R.id.tv_new_pay3: if (mOrderStatus > 0) { if (mOrderStatus == 20) {//退订20元 payOrUnsubscribeVip("1300200912", "2000", APP_ID_20, "2", "1"); } return; } //订阅20元 payOrUnsubscribeVip("1300200912", "2000", APP_ID_20, "1", "0"); break; case R.id.ll_download_migu_video_apk: WebViewAvtivity.launchVerifyCode(UserMiGuAnimationVipPayActivity.this, "http://dl.iaround.com/MiguVideo.apk"); break; case R.id.ll_download_migu_quanquan_apk: WebViewAvtivity.launchVerifyCode(UserMiGuAnimationVipPayActivity.this, "http://dl.iaround.com/MiguQQ.apk"); break; case R.id.tv_get_packageGift: case R.id.rl_get_packageGift: WebViewAvtivity.launchVerifyCode(UserMiGuAnimationVipPayActivity.this, getEncodeUrl()); break; } } @Override protected void onResume() { super.onResume(); requestPayMiGu(); } @Override protected void onDestroy() { MiguSdk.exitApp(this); super.onDestroy(); } /** * 得到咪咕订购状态 */ private void requestPayMiGu() { mGetMiguStatusFlag = GoldHttpProtocol.getMiguManLianStatus(this, this); } /** * 设置咪咕订购状态 */ private void setPayMiGuStatus(int orderStatus) { showWaitDialog(); mSetMiguStatusFlag = GoldHttpProtocol.setMiguManLianStatus(this, orderStatus, this); } @Override public void onGeneralSuccess(String result, long flag) { if (flag == mGetMiguStatusFlag) { //会员状态是否开通(遇见服务器接口返回) try { JSONObject obj = new JSONObject(result); if (obj.has("status") && obj.optLong("status") == 200) { mOrderStatus = CommonFunction.jsonOptInt(obj, "manlianStatus"); mH5Url = CommonFunction.jsonOptString(obj, "url"); initViewByOrderStatus(); } } catch (JSONException e) { e.printStackTrace(); } } else if (flag == mSetMiguStatusFlag) { destroyWaitDialog(); initViewByOrderStatus(); CommonFunction.toastMsg(BaseApplication.getInstance(), "操作成功"); } } @Override public void onGeneralError(int e, long flag) { if (flag == mSetMiguStatusFlag) { destroyWaitDialog(); } ErrorCode.toastError(this, e); } private void initViewByOrderStatus() { if (mOrderStatus == 10) { tvNewPay1.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay1.setText("退订"); tvNewPay2.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay2.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay3.setText("开通会员"); } else if (mOrderStatus == 15) { tvNewPay1.setText("开通会员"); tvNewPay1.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay2.setText("退订"); tvNewPay2.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay3.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.btn_user_vip_migu_was); } else if (mOrderStatus == 20) { tvNewPay1.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay1.setText("开通会员"); tvNewPay2.setBackgroundResource(R.drawable.btn_user_vip_migu_was); tvNewPay2.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay3.setText("退订"); } else { tvNewPay1.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay1.setText("开通会员"); tvNewPay2.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay2.setText("开通会员"); tvNewPay3.setBackgroundResource(R.drawable.chat_person_background_of_sendgift); tvNewPay3.setText("开通会员"); } } /** * 得到加密过后的字符H5 url * * @return */ private String getEncodeUrl() { String phoneNum = PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getPhoneNum(); String imei = PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getIMEI(); if (TextUtils.isEmpty(imei)) { imei = PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getDeviceId(); } String urlEncodeString = ""; if (!TextUtils.isEmpty(phoneNum)) { if (phoneNum.startsWith("+86")) { phoneNum = phoneNum.substring(3); } } else { //当手机号获取不到时,需要将phoneNum置为null,不然请求咪咕H5界面报参数错误 phoneNum = null; } String productCode; switch (mOrderStatus) { case 10: productCode = APP_ID_10; break; case 15: productCode = APP_ID_15; break; case 20: productCode = APP_ID_20; break; default: productCode = APP_ID_20; } String source = "mobile=" + phoneNum + "|imei=" + imei + "|is_auth_controller=true|is_union=true|watch_num=20|cpId=" + CP_ID + "|productCode=" + productCode; String key = "<KEY>"; try { String encodedString = MiguAESUtil.aesEncrypt(source, key); urlEncodeString = URLEncoder.encode(encodedString, "UTF-8"); urlEncodeString = URLEncoder.encode(urlEncodeString, "UTF-8"); } catch (Exception e) { e.printStackTrace(); } return mH5Url + urlEncodeString; } /** * 订阅或退订 * * @param paycode 计费点Id * @param fee 价格 ,单位为分 * @param appId 产品id * @param orderType 1-订购,2-退订 * @param operType 0-订购,1-退订 */ private void payOrUnsubscribeVip(final String paycode, final String fee, final String appId, final String orderType, final String operType) { showWaitDialog(); new Thread(new Runnable() { @Override public void run() { // if (isFirstGetOrderId) { // try { // Thread.sleep(5000); // } catch (Exception e) { // e.printStackTrace(); // } // } OrderIdBean bean = new OrderIdBean(); bean.setOrderType(orderType); bean.setAppId(appId); //需使用分配的APPID bean.setChannelId(CHANNEL_ID); //需使用自有的CHANNELID bean.setPaycode(paycode); // bean.setPaycode(""); bean.setPayType("1002"); bean.setOperType(operType); bean.setCpId(CP_ID); //需使用申请包月对应的CPID MiguSdk.getOrderId(UserMiGuAnimationVipPayActivity.this, bean, "", "", new OrderIdCallBack.IOrderIdCallback() { @Override public void onResult(int resultCode, String statusCode, String message, String bossid) { // String result = ""; switch (resultCode) { case PayResult.SUCCESS: // result = "获取orderid成功!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; Message msg = new Message(); Bundle data = new Bundle(); data.putString("orderId", message); data.putString("bossId", bossid); data.putString("fee", fee); data.putString("operType", operType); msg.setData(data); handler.sendMessage(msg); break; case PayResult.FAILED: CommonFunction.log("getOrderId", "获取orderid失败!resultCode:" + resultCode + " statusCode:" + statusCode + " message:" + message); if (statusCode != null && statusCode.equals("D1")) { if (!TextUtils.isEmpty(PhoneInfoUtil.getInstance(UserMiGuAnimationVipPayActivity.this).getPhoneNum())) { CommonFunction.toastMsg(BaseApplication.getInstance(), "请重试"); } else { CommonFunction.toastMsg(BaseApplication.getInstance(), message); } } else { CommonFunction.toastMsg(BaseApplication.getInstance(), " statusCode:" + statusCode + " message:" + message); } // result = "获取orderid失败!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; break; } destroyWaitDialog(); } }); } }).start(); } Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); Bundle data = msg.getData(); String val = data.getString("orderId"); String bossid = data.getString("bossId"); final String fee = data.getString("fee"); final String operType = data.getString("operType"); //Toast.makeText(UserMiGuAnimationVipPayActivity.this, val, Toast.LENGTH_LONG).show(); PayBean paybean = new PayBean(); paybean.setProductId(bossid); paybean.setCpId(CP_ID); //需使用申请包月对应的CPID paybean.setChannelId(CHANNEL_ID); //需使用自有的CHANNELID paybean.setFee(fee); //需使用所申请包月对应的价格,单位为分 paybean.setOrderId(val); paybean.setSpCode("698043"); paybean.setOperType(operType); paybean.setSyn(false); paybean.setReservedParam2(""); paybean.setReservedParam3(""); paybean.setReservedParam4(""); paybean.setReservedParam5(""); paybean.setPlatfromCode("698043NLPT"); MiguSdk.pay(UserMiGuAnimationVipPayActivity.this, paybean, "", "", new PayCallBack.IPayCallback() { @Override public void onResult(int resultCode, String statusCode, String message) { String result = ""; switch (resultCode) { case PayResult.SUCCESS: //result = "购买道具成功!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; if ("0".equals(operType)) { if ("1000".equals(fee)) { mOrderStatus = 10; } else if ("1500".equals(fee)) { mOrderStatus = 15; } else if ("2000".equals(fee)) { mOrderStatus = 20; } } else if ("1".equals(operType)) { mOrderStatus = 0; } setPayMiGuStatus(mOrderStatus); break; case PayResult.FAILED: //result = "购买道具失败!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; result = "操作失败 " + message; break; case PayResult.CANCELLED: //result = "购买道具取消!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; default: //result = "购买道具取消!resultCode:"+resultCode+"statusCode:"+statusCode+"message:"+message; result = "操作取消"; break; } // Toast.makeText(UserMiGuAnimationVipPayActivity.this, result, Toast.LENGTH_SHORT).show(); CommonFunction.toastMsg(BaseApplication.getInstance(), result); } }); } }; }
20,661
0.551884
0.531504
492
39.290649
31.150351
168
false
false
0
0
0
0
0
0
0.676829
false
false
12
8fe86f486709a11d669ce5754abddc37abd44b07
24,249,385,407,958
dfbea61d888241288a42774b5edda4e3b69b4ff3
/hbk-admin/src/main/java/com/admin/service/impl/SysDeptServiceImpl.java
1b3eafbbcb386cd01db695d0b83b4d71a5f9d6bb
[]
no_license
wenshuangping/hbk
https://github.com/wenshuangping/hbk
e94dd654ac86e42e512731959ca246d92a9385f7
b81fd19b041f10c6dfc230a06b503803fa069a7e
refs/heads/master
2022-12-23T11:21:24.557000
2019-12-12T13:38:29
2019-12-12T13:38:29
227,332,675
1
0
null
false
2022-12-16T00:38:42
2019-12-11T09:58:33
2021-04-13T07:07:30
2022-12-16T00:38:42
7,962
1
0
2
Java
false
false
package com.admin.service.impl; import com.admin.constant.enums.EnumDept; import com.admin.constant.enums.EnumRole; import com.admin.mapper.SysDeptMapper; import com.admin.model.dto.DeptTree; import com.admin.model.dto.TreeNode; import com.admin.model.entity.SysDept; import com.admin.service.SysDeptService; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.github.common.constant.enums.EnumDelFlag; import com.github.common.util.Res; import com.github.common.vo.UserVO; import com.admin.common.util.TreeUtil; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.*; /** * <p> * 部门|公司管理 服务实现类 * </p> * * @author wsp * @since 2018-01-20 */ @Service public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService { /** * 添加信息部门 * @param dept 部门 * @param userVO 当前用户 * @return */ @Override public Res insertDept(SysDept dept, UserVO userVO) { Res<Integer> res = new Res<>(); if( dept.getParentId()!=0) { SysDept parentDept = this.selectById(dept.getParentId()); if (EnumDept.COMPANY.getValue().equals(parentDept.getType())) { res.setCode(EnumDept.ERROR_ADD_3.getValue()); } } SysDept sysDept = new SysDept(); BeanUtils.copyProperties(dept, sysDept); sysDept.setCreateTime(new Date()); //sysDept.setCreateBy(userVO.getUserId()); sysDept.setUpdateTime(new Date()); // sysDept.setUpdateBy(userVO.getUserId()); this.insert(sysDept); return res; } /** * 删除部门 * * @param id 部门 ID * @return 成功、失败 */ @Override public Boolean deleteDeptById(Integer id,UserVO userVO) { SysDept sysDept = new SysDept(); sysDept.setDeptId(id); sysDept.setUpdateTime(new Date()); sysDept.setUpdateBy(userVO.getUserId()); sysDept.setDelFlag(EnumDelFlag.DELETE.getValue()); this.updateDeptById(sysDept); return Boolean.TRUE; } /** * 更新部门 * * @param sysDept 部门信息 * @return 成功、失败 */ @Override public Boolean updateDeptById(SysDept sysDept) { //更新部门状态 this.updateById(sysDept); return Boolean.TRUE; } /** * 查询部门树 * * @return 树 */ @Override public List<DeptTree> selectListTree(UserVO userVO) { SysDept condition = new SysDept(); condition.setDelFlag(EnumDelFlag.UNDELETE.getValue()); EntityWrapper<SysDept> sysDeptEntityWrapper = new EntityWrapper<>(condition); return getDeptTree(this.selectList(sysDeptEntityWrapper), 0,userVO); } /** * 构建部门树 * * @param depts 部门 * @param root 根节点 * @return */ private List<DeptTree> getDeptTree(List<SysDept> depts, int root,UserVO userVO) { List<DeptTree> trees = new ArrayList<>(); Map<Integer,DeptTree> deptTreeMap =new HashMap<>(); DeptTree node; for (SysDept dept : depts) { if (dept.getParentId().equals(dept.getDeptId())) { continue; } node = new DeptTree(); node.setId(dept.getDeptId()); node.setParentId(dept.getParentId()); node.setName(dept.getName()); node.setType(dept.getType()); node.setAreaId(dept.getAreaId()); trees.add(node); deptTreeMap.put( node.getId(),node); } List<DeptTree> rList =null; if (EnumRole.ROLE_ADMIN.getValue().equals(userVO.getSysRole().getRoleCode()) ){ //超级管理员 rList= TreeUtil.bulid(trees, root); }else { TreeUtil.bulid(trees, root); //普通用户 rList = new LinkedList<>(); DeptTree deptTree=deptTreeMap.get(userVO.getSysRole().getDeptId()); rList.add(deptTreeMap.get(userVO.getSysRole().getDeptId())); } return rList; } /** * 获取当前用户的子部门信息 * * @param userVO 用户信息 * @return 子部门列表 */ @Override public List<Integer> getUserAllDepts(UserVO userVO) { List<DeptTree> deptTreeList= this.selectListTree(userVO); // 获取当前部门的子部门 List<Integer> deptIds = new ArrayList<>(); findDeptIds(deptIds,deptTreeList); return deptIds; } /*** * 查找部门id * @param rlist * @param deptTreeList */ private void findDeptIds(List<Integer> rlist, List<DeptTree> deptTreeList){ for(DeptTree deptTree : deptTreeList){ rlist.add(deptTree.getId()); if(deptTree.getChildren()!=null && deptTree.getChildren().size()>0){ findChildrenDeptIds(rlist,deptTree.getChildren()); } } } /** * 子部门id * @param rlist * @param deptTreeList */ private void findChildrenDeptIds(List<Integer> rlist, List<TreeNode> deptTreeList){ for(TreeNode treeNode : deptTreeList){ rlist.add(treeNode.getId()); if(treeNode.getChildren()!=null && treeNode.getChildren().size()>0){ findChildrenDeptIds(rlist,treeNode.getChildren()); } } } }
UTF-8
Java
5,570
java
SysDeptServiceImpl.java
Java
[ { "context": "\n/**\n * <p>\n * 部门|公司管理 服务实现类\n * </p>\n *\n * @author wsp\n * @since 2018-01-20\n */\n@Service\npublic class Sy", "end": 752, "score": 0.9996650218963623, "start": 749, "tag": "USERNAME", "value": "wsp" } ]
null
[]
package com.admin.service.impl; import com.admin.constant.enums.EnumDept; import com.admin.constant.enums.EnumRole; import com.admin.mapper.SysDeptMapper; import com.admin.model.dto.DeptTree; import com.admin.model.dto.TreeNode; import com.admin.model.entity.SysDept; import com.admin.service.SysDeptService; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.github.common.constant.enums.EnumDelFlag; import com.github.common.util.Res; import com.github.common.vo.UserVO; import com.admin.common.util.TreeUtil; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.*; /** * <p> * 部门|公司管理 服务实现类 * </p> * * @author wsp * @since 2018-01-20 */ @Service public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService { /** * 添加信息部门 * @param dept 部门 * @param userVO 当前用户 * @return */ @Override public Res insertDept(SysDept dept, UserVO userVO) { Res<Integer> res = new Res<>(); if( dept.getParentId()!=0) { SysDept parentDept = this.selectById(dept.getParentId()); if (EnumDept.COMPANY.getValue().equals(parentDept.getType())) { res.setCode(EnumDept.ERROR_ADD_3.getValue()); } } SysDept sysDept = new SysDept(); BeanUtils.copyProperties(dept, sysDept); sysDept.setCreateTime(new Date()); //sysDept.setCreateBy(userVO.getUserId()); sysDept.setUpdateTime(new Date()); // sysDept.setUpdateBy(userVO.getUserId()); this.insert(sysDept); return res; } /** * 删除部门 * * @param id 部门 ID * @return 成功、失败 */ @Override public Boolean deleteDeptById(Integer id,UserVO userVO) { SysDept sysDept = new SysDept(); sysDept.setDeptId(id); sysDept.setUpdateTime(new Date()); sysDept.setUpdateBy(userVO.getUserId()); sysDept.setDelFlag(EnumDelFlag.DELETE.getValue()); this.updateDeptById(sysDept); return Boolean.TRUE; } /** * 更新部门 * * @param sysDept 部门信息 * @return 成功、失败 */ @Override public Boolean updateDeptById(SysDept sysDept) { //更新部门状态 this.updateById(sysDept); return Boolean.TRUE; } /** * 查询部门树 * * @return 树 */ @Override public List<DeptTree> selectListTree(UserVO userVO) { SysDept condition = new SysDept(); condition.setDelFlag(EnumDelFlag.UNDELETE.getValue()); EntityWrapper<SysDept> sysDeptEntityWrapper = new EntityWrapper<>(condition); return getDeptTree(this.selectList(sysDeptEntityWrapper), 0,userVO); } /** * 构建部门树 * * @param depts 部门 * @param root 根节点 * @return */ private List<DeptTree> getDeptTree(List<SysDept> depts, int root,UserVO userVO) { List<DeptTree> trees = new ArrayList<>(); Map<Integer,DeptTree> deptTreeMap =new HashMap<>(); DeptTree node; for (SysDept dept : depts) { if (dept.getParentId().equals(dept.getDeptId())) { continue; } node = new DeptTree(); node.setId(dept.getDeptId()); node.setParentId(dept.getParentId()); node.setName(dept.getName()); node.setType(dept.getType()); node.setAreaId(dept.getAreaId()); trees.add(node); deptTreeMap.put( node.getId(),node); } List<DeptTree> rList =null; if (EnumRole.ROLE_ADMIN.getValue().equals(userVO.getSysRole().getRoleCode()) ){ //超级管理员 rList= TreeUtil.bulid(trees, root); }else { TreeUtil.bulid(trees, root); //普通用户 rList = new LinkedList<>(); DeptTree deptTree=deptTreeMap.get(userVO.getSysRole().getDeptId()); rList.add(deptTreeMap.get(userVO.getSysRole().getDeptId())); } return rList; } /** * 获取当前用户的子部门信息 * * @param userVO 用户信息 * @return 子部门列表 */ @Override public List<Integer> getUserAllDepts(UserVO userVO) { List<DeptTree> deptTreeList= this.selectListTree(userVO); // 获取当前部门的子部门 List<Integer> deptIds = new ArrayList<>(); findDeptIds(deptIds,deptTreeList); return deptIds; } /*** * 查找部门id * @param rlist * @param deptTreeList */ private void findDeptIds(List<Integer> rlist, List<DeptTree> deptTreeList){ for(DeptTree deptTree : deptTreeList){ rlist.add(deptTree.getId()); if(deptTree.getChildren()!=null && deptTree.getChildren().size()>0){ findChildrenDeptIds(rlist,deptTree.getChildren()); } } } /** * 子部门id * @param rlist * @param deptTreeList */ private void findChildrenDeptIds(List<Integer> rlist, List<TreeNode> deptTreeList){ for(TreeNode treeNode : deptTreeList){ rlist.add(treeNode.getId()); if(treeNode.getChildren()!=null && treeNode.getChildren().size()>0){ findChildrenDeptIds(rlist,treeNode.getChildren()); } } } }
5,570
0.603035
0.600599
192
26.802084
23.51379
103
false
false
0
0
0
0
0
0
0.447917
false
false
12
bf5c1f0dc4138359fa59c5a2c1be2dfd5b79c7ca
38,989,713,150,482
4322ca4901c3de56821a9f21d8e99be27c27ed89
/src/com/example/bspatch/DigestUtil.java
06d0f0b85d601b275f333691d0f9b41a5508e0cd
[]
no_license
bufferhayes/BSPatch
https://github.com/bufferhayes/BSPatch
e10a086af40770cdec27066de6bb737c97648968
65c206a4c067c61cc4bac643b2b341220902f791
refs/heads/master
2020-12-11T03:25:52.581000
2014-09-14T09:54:34
2014-09-14T09:54:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bspatch; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class DigestUtil { public static String calculateHash(MessageDigest algorithm, String fileName) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(fileName); BufferedInputStream bis = new BufferedInputStream(fis); DigestInputStream dis = new DigestInputStream(bis, algorithm); // read the file and update the hash calculation while (dis.read() != -1) ; } catch (IOException e) { throw e; } finally { if (fis != null) { try { fis.close(); } catch (IOException e1) { } } } // get the hash value as byte array byte[] hash = algorithm.digest(); return byte2hex(hash); } public static void main(String[] args) { System.out.println("main()"); String fileName = "C:\\22.log"; try { MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest md5 = MessageDigest.getInstance("MD5"); System.out.println(calculateHash(sha1, fileName)); System.out.println(calculateHash(md5, fileName)); System.out.println("sha1:" + getFileSha1(fileName)); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } /** * 适用于上G大的文件 */ public static String getFileSha1(String path){ File file = new File(path); FileInputStream in = null; MessageDigest messagedigest; try { in = new FileInputStream(file); messagedigest = MessageDigest.getInstance("SHA-1"); byte[] buffer = new byte[1024 * 1024 * 10]; int len = 0; while ((len = in.read(buffer)) > 0) { // 该对象通过使用 update()方法处理数据 messagedigest.update(buffer, 0, len); } // 对于给定数量的更新数据,digest 方法只能被调用一次。在调用 digest 之后,MessageDigest // 对象被重新设置成其初始状态。 return byte2hex(messagedigest.digest()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } catch(Exception e){ e.printStackTrace(); } finally { try { if (in != null) { in.close(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return null; } public static String byte2hex(byte[] b) { StringBuffer hs = new StringBuffer(b.length); String stmp = ""; int len = b.length; for (int n = 0; n < len; n++) { stmp = Integer.toHexString(b[n] & 0xFF); if (stmp.length() == 1) hs = hs.append("0").append(stmp); else { hs = hs.append(stmp); } } return String.valueOf(hs); } }
UTF-8
Java
2,876
java
DigestUtil.java
Java
[]
null
[]
package com.example.bspatch; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class DigestUtil { public static String calculateHash(MessageDigest algorithm, String fileName) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(fileName); BufferedInputStream bis = new BufferedInputStream(fis); DigestInputStream dis = new DigestInputStream(bis, algorithm); // read the file and update the hash calculation while (dis.read() != -1) ; } catch (IOException e) { throw e; } finally { if (fis != null) { try { fis.close(); } catch (IOException e1) { } } } // get the hash value as byte array byte[] hash = algorithm.digest(); return byte2hex(hash); } public static void main(String[] args) { System.out.println("main()"); String fileName = "C:\\22.log"; try { MessageDigest sha1 = MessageDigest.getInstance("SHA1"); MessageDigest md5 = MessageDigest.getInstance("MD5"); System.out.println(calculateHash(sha1, fileName)); System.out.println(calculateHash(md5, fileName)); System.out.println("sha1:" + getFileSha1(fileName)); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } /** * 适用于上G大的文件 */ public static String getFileSha1(String path){ File file = new File(path); FileInputStream in = null; MessageDigest messagedigest; try { in = new FileInputStream(file); messagedigest = MessageDigest.getInstance("SHA-1"); byte[] buffer = new byte[1024 * 1024 * 10]; int len = 0; while ((len = in.read(buffer)) > 0) { // 该对象通过使用 update()方法处理数据 messagedigest.update(buffer, 0, len); } // 对于给定数量的更新数据,digest 方法只能被调用一次。在调用 digest 之后,MessageDigest // 对象被重新设置成其初始状态。 return byte2hex(messagedigest.digest()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } catch(Exception e){ e.printStackTrace(); } finally { try { if (in != null) { in.close(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return null; } public static String byte2hex(byte[] b) { StringBuffer hs = new StringBuffer(b.length); String stmp = ""; int len = b.length; for (int n = 0; n < len; n++) { stmp = Integer.toHexString(b[n] & 0xFF); if (stmp.length() == 1) hs = hs.append("0").append(stmp); else { hs = hs.append(stmp); } } return String.valueOf(hs); } }
2,876
0.665696
0.653314
105
25.152382
17.667717
77
false
false
0
0
0
0
0
0
2.780952
false
false
12
96ca4460c87c00c3dffda97b056ca87f49c7f717
37,855,841,770,168
209b6f97fac4126aedd9badefe3d66c3335a78d3
/todo-service/src/main/java/com/alex/todoservice/repositories/implementations/JsonRepository.java
94abdb85bfea28bf0368629bf298289bd2f110ed
[ "MIT" ]
permissive
Alex-451/todo-service
https://github.com/Alex-451/todo-service
63c5d17987cecbe2b2f7d7b0febe7e21a8f41dcd
1e6d463976be1136a06ca2f7a27b1d955aa7e1b7
refs/heads/main
2023-09-02T08:21:49.903000
2021-10-31T14:03:05
2021-10-31T14:03:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alex.todoservice.repositories.implementations; import com.alex.todoservice.exceptions.EntryNotFoundException; import com.alex.todoservice.models.Todo; import com.alex.todoservice.repositories.ObjectRepository; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import org.springframework.stereotype.Repository; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.UncheckedIOException; import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Optional; @Repository @Qualifier("JsonRepository") public class JsonRepository implements ObjectRepository<Todo> { final Gson gson; private static final String jsonFilePath = "todos.json"; private static final Path jsonPath = Paths.get(jsonFilePath); private static final File jsonFile = new File(jsonFilePath); private static final Type objectType = new TypeToken<List<Todo>>() {}.getType(); private List<Todo> todos; public JsonRepository(Gson gson) { try { this.gson = gson; if (jsonFile.exists()) { todos = loadTodos(); } else { jsonFile.createNewFile(); todos = new ArrayList<>(); save(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } } @Override public Todo get(long id) throws EntryNotFoundException { var filteredTodo = todos.stream().filter(t -> t.getId() == id).findFirst(); if (filteredTodo.isPresent()) return filteredTodo.get(); throw new EntryNotFoundException(id); } @Override public List<Todo> getAll() { return todos; } @Override public void add(Todo todo) { long id = getAll().size() + 1; todo.setId(id); todos.add(todo); save(); } @Override public void update(long id, Todo todo) throws EntryNotFoundException { var todoToUpdate = todos.stream().filter(t -> t.getId() == id).findFirst(); if (!todoToUpdate.isPresent()) throw new EntryNotFoundException(id); todo.setId(id); todos.set(todos.indexOf(todoToUpdate.get()), todo); save(); } @Override public void delete(long id) { var todoToRemove = todos.stream().filter(t -> t.getId() == id).findFirst().orElse(null); if (todoToRemove == null) return; todos.remove(todoToRemove); save(); } private void save() { try (var bufferedWriter = Files.newBufferedWriter(jsonPath)) { var json = gson.toJson(todos); bufferedWriter.write(json); } catch (IOException ex) { throw new UncheckedIOException(ex); } } private List<Todo> loadTodos() { try { var jsonContent = new FileReader(jsonFilePath); List<Todo> list = gson.fromJson(jsonContent, objectType); return list; } catch (IOException ex) { throw new UncheckedIOException(ex); } } }
UTF-8
Java
3,414
java
JsonRepository.java
Java
[]
null
[]
package com.alex.todoservice.repositories.implementations; import com.alex.todoservice.exceptions.EntryNotFoundException; import com.alex.todoservice.models.Todo; import com.alex.todoservice.repositories.ObjectRepository; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import org.springframework.stereotype.Repository; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.UncheckedIOException; import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Optional; @Repository @Qualifier("JsonRepository") public class JsonRepository implements ObjectRepository<Todo> { final Gson gson; private static final String jsonFilePath = "todos.json"; private static final Path jsonPath = Paths.get(jsonFilePath); private static final File jsonFile = new File(jsonFilePath); private static final Type objectType = new TypeToken<List<Todo>>() {}.getType(); private List<Todo> todos; public JsonRepository(Gson gson) { try { this.gson = gson; if (jsonFile.exists()) { todos = loadTodos(); } else { jsonFile.createNewFile(); todos = new ArrayList<>(); save(); } } catch (IOException ex) { throw new UncheckedIOException(ex); } } @Override public Todo get(long id) throws EntryNotFoundException { var filteredTodo = todos.stream().filter(t -> t.getId() == id).findFirst(); if (filteredTodo.isPresent()) return filteredTodo.get(); throw new EntryNotFoundException(id); } @Override public List<Todo> getAll() { return todos; } @Override public void add(Todo todo) { long id = getAll().size() + 1; todo.setId(id); todos.add(todo); save(); } @Override public void update(long id, Todo todo) throws EntryNotFoundException { var todoToUpdate = todos.stream().filter(t -> t.getId() == id).findFirst(); if (!todoToUpdate.isPresent()) throw new EntryNotFoundException(id); todo.setId(id); todos.set(todos.indexOf(todoToUpdate.get()), todo); save(); } @Override public void delete(long id) { var todoToRemove = todos.stream().filter(t -> t.getId() == id).findFirst().orElse(null); if (todoToRemove == null) return; todos.remove(todoToRemove); save(); } private void save() { try (var bufferedWriter = Files.newBufferedWriter(jsonPath)) { var json = gson.toJson(todos); bufferedWriter.write(json); } catch (IOException ex) { throw new UncheckedIOException(ex); } } private List<Todo> loadTodos() { try { var jsonContent = new FileReader(jsonFilePath); List<Todo> list = gson.fromJson(jsonContent, objectType); return list; } catch (IOException ex) { throw new UncheckedIOException(ex); } } }
3,414
0.636204
0.635911
124
26.532259
23.27273
96
false
false
0
0
0
0
0
0
0.483871
false
false
12
779292a25d7efc7765d0de6a1661628c84d3622b
35,802,847,421,190
8afaba7c049b4d0e7a0094a7043ac3af3caa4a49
/Server/src/com/tqbdev/server_core/HostListener.java
7d8f2ecea5c6afe5140a3b8a5ca3c3787c0c3bec
[ "Apache-2.0" ]
permissive
tqbdev/snake-game-java
https://github.com/tqbdev/snake-game-java
965b5563e4e1ef2edf62ba95fa459ad15b084718
9266c50d45d72bea0b01b7a1d10b46aa3b8db35c
refs/heads/master
2020-03-18T21:42:41.515000
2018-06-06T03:00:06
2018-06-06T03:00:06
135,297,626
0
0
Apache-2.0
false
2018-06-05T10:21:31
2018-05-29T13:08:25
2018-06-04T16:00:34
2018-06-05T10:21:31
62
0
0
0
Java
false
null
package com.tqbdev.server_core; public interface HostListener { public void startGame(); public void stopGame(); }
UTF-8
Java
118
java
HostListener.java
Java
[]
null
[]
package com.tqbdev.server_core; public interface HostListener { public void startGame(); public void stopGame(); }
118
0.762712
0.762712
6
18.666666
13.123346
31
false
false
0
0
0
0
0
0
0.833333
false
false
12
f9d0236bb2ed2f1b4d17bca98eee48b151cb1473
39,376,260,210,881
50464746b66de13a2b82584b3531ad34ea43a905
/owncarservice/src/main/java/com/ocs/owncarservice/Service/AppointmentImpl.java
4a4faf0d7e41a2f100e0359a55b409dd8aedd331
[]
no_license
Gowthamsasikala/own-car-service-versioncontrol
https://github.com/Gowthamsasikala/own-car-service-versioncontrol
1985a69b8fd75643829aa600ae001c055e0acd8c
33ccfeff466969cf2ee33d62599bea3854282138
refs/heads/master
2020-12-20T18:54:46.449000
2020-02-23T15:33:23
2020-02-23T15:33:23
236,178,354
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ocs.owncarservice.Service; import java.time.LocalDate; import java.time.ZoneId; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ocs.owncarservice.Entity.AppointmentTable; import com.ocs.owncarservice.Entity.DeliveryPartner; import com.ocs.owncarservice.Exception.UserException; import com.ocs.owncarservice.Repo.AppointmentRepo; import com.ocs.owncarservice.Repo.DeliveryPartnerRepo; @Service public class AppointmentImpl implements AppointmentInterface { @Autowired AppointmentRepo apRepo; @Autowired DeliveryPartnerRepo dpRepo; @Override public AppointmentTable CreateAppointment(AppointmentTable appoint) { Date dates = new Date(); LocalDate localDate = dates.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); int year = localDate.getYear(); int month = localDate.getMonthValue(); int day = localDate.getDayOfMonth(); String currentTime = "AP"+dates.getHours()+""+dates.getMinutes()+""+dates.getSeconds(); String AppointId = year+""+month+""+day+""+currentTime; appoint.setAppointmentId(AppointId); AppointmentTable appointment = apRepo.saveAndFlush(appoint); if(appointment != null) { return appointment; } return null; } @Override public List<AppointmentTable> getAppointments(String dates) { List<AppointmentTable> getAppointmentByDates = new ArrayList<>(); List<AppointmentTable> getAllAppointments = apRepo.findAll(); for(AppointmentTable table:getAllAppointments) { if(table.getAppointmentDateTime().split(" ")[0].equals(dates)) { getAppointmentByDates.add(table); } } if(getAppointmentByDates != null) { return getAppointmentByDates; } return null; } @Override public AppointmentTable updateAppointments(AppointmentTable updateAppoint) { Optional<AppointmentTable> update = apRepo.findById(updateAppoint.getAppointmentId()); System.out.println("gow"+update.get().getAddress()); if(update.get() != null) { System.out.println("malini"); System.out.println("hi"+update.get().getPartners().getPartnerId()); Optional<DeliveryPartner> dpupdate = dpRepo.findById(update.get().getPartners().getPartnerId()); update.get().setPartners(dpupdate.get()); update.get().setActiveIndex(updateAppoint.getActiveIndex()); update.get().setStatus(updateAppoint.getStatus()); AppointmentTable updateAP = apRepo.saveAndFlush(update.get()); return updateAP; } return null; } @Override public AppointmentTable updateAppointmentsAdmin(AppointmentTable updateAppoint) { Optional<AppointmentTable> update = apRepo.findById(updateAppoint.getAppointmentId()); System.out.println("gow"+update.get().getAddress()); if(update.get() != null) { Optional<DeliveryPartner> dpupdate = dpRepo.findById(updateAppoint.getPartners().getPartnerId()); update.get().setPartners(dpupdate.get()); // update.get().setActiveIndex(updateAppoint.getActiveIndex()); AppointmentTable updateAP = apRepo.saveAndFlush(update.get()); return updateAP; } return null; } @Override public List<AppointmentTable> getAllAppointments(String userId) { return apRepo.findByUserId(userId)!= null ?apRepo.findByUserId(userId):null ; } }
UTF-8
Java
3,491
java
AppointmentImpl.java
Java
[]
null
[]
package com.ocs.owncarservice.Service; import java.time.LocalDate; import java.time.ZoneId; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ocs.owncarservice.Entity.AppointmentTable; import com.ocs.owncarservice.Entity.DeliveryPartner; import com.ocs.owncarservice.Exception.UserException; import com.ocs.owncarservice.Repo.AppointmentRepo; import com.ocs.owncarservice.Repo.DeliveryPartnerRepo; @Service public class AppointmentImpl implements AppointmentInterface { @Autowired AppointmentRepo apRepo; @Autowired DeliveryPartnerRepo dpRepo; @Override public AppointmentTable CreateAppointment(AppointmentTable appoint) { Date dates = new Date(); LocalDate localDate = dates.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); int year = localDate.getYear(); int month = localDate.getMonthValue(); int day = localDate.getDayOfMonth(); String currentTime = "AP"+dates.getHours()+""+dates.getMinutes()+""+dates.getSeconds(); String AppointId = year+""+month+""+day+""+currentTime; appoint.setAppointmentId(AppointId); AppointmentTable appointment = apRepo.saveAndFlush(appoint); if(appointment != null) { return appointment; } return null; } @Override public List<AppointmentTable> getAppointments(String dates) { List<AppointmentTable> getAppointmentByDates = new ArrayList<>(); List<AppointmentTable> getAllAppointments = apRepo.findAll(); for(AppointmentTable table:getAllAppointments) { if(table.getAppointmentDateTime().split(" ")[0].equals(dates)) { getAppointmentByDates.add(table); } } if(getAppointmentByDates != null) { return getAppointmentByDates; } return null; } @Override public AppointmentTable updateAppointments(AppointmentTable updateAppoint) { Optional<AppointmentTable> update = apRepo.findById(updateAppoint.getAppointmentId()); System.out.println("gow"+update.get().getAddress()); if(update.get() != null) { System.out.println("malini"); System.out.println("hi"+update.get().getPartners().getPartnerId()); Optional<DeliveryPartner> dpupdate = dpRepo.findById(update.get().getPartners().getPartnerId()); update.get().setPartners(dpupdate.get()); update.get().setActiveIndex(updateAppoint.getActiveIndex()); update.get().setStatus(updateAppoint.getStatus()); AppointmentTable updateAP = apRepo.saveAndFlush(update.get()); return updateAP; } return null; } @Override public AppointmentTable updateAppointmentsAdmin(AppointmentTable updateAppoint) { Optional<AppointmentTable> update = apRepo.findById(updateAppoint.getAppointmentId()); System.out.println("gow"+update.get().getAddress()); if(update.get() != null) { Optional<DeliveryPartner> dpupdate = dpRepo.findById(updateAppoint.getPartners().getPartnerId()); update.get().setPartners(dpupdate.get()); // update.get().setActiveIndex(updateAppoint.getActiveIndex()); AppointmentTable updateAP = apRepo.saveAndFlush(update.get()); return updateAP; } return null; } @Override public List<AppointmentTable> getAllAppointments(String userId) { return apRepo.findByUserId(userId)!= null ?apRepo.findByUserId(userId):null ; } }
3,491
0.727299
0.727012
98
33.622448
28.833624
103
false
false
0
0
0
0
0
0
1.72449
false
false
12
73649be8848ae26da4c9580861db9a402931a776
39,376,260,208,388
20c6f893b409ff524ece681cd0398c1abf04f85f
/java/factorial.java
3887a30ef3a00c9298186d429ccec203f2fe8fe9
[]
no_license
Minakami-Yuuki/CSharp-Java
https://github.com/Minakami-Yuuki/CSharp-Java
cae4eb47042fc6a441ad549d5f7c7a1625001869
6a48e23ca06dc0010d6f7cbd739626c8c62709ed
refs/heads/main
2023-02-22T05:56:21.705000
2021-01-27T13:35:12
2021-01-27T13:35:12
331,890,074
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class factorial { public static void main(String [] args) { long a = 1; long result = 0; for(int i = 1; i <= 10; i++) { a *= i; result += a; } System.out.println("result =" + result); } }
UTF-8
Java
222
java
factorial.java
Java
[]
null
[]
public class factorial { public static void main(String [] args) { long a = 1; long result = 0; for(int i = 1; i <= 10; i++) { a *= i; result += a; } System.out.println("result =" + result); } }
222
0.522523
0.5
11
18.363636
14.303672
42
false
false
0
0
0
0
0
0
2.272727
false
false
12
0fa7393c9dc50d7098ee176223f08a41ee200a21
39,487,929,326,718
579fd41da4e232f9b5d7ab9abdb6d7cb7adf49fa
/src/ru/javawebinar/basejava/exception/ExistStorageException.java
021c40eae5d12d280956b9b13c6c4cbd114181fe
[]
no_license
SergJackson/basejava
https://github.com/SergJackson/basejava
787784fd4be2c96d41a0ebcb420786becf706280
053a864fd58320533e31de77c228144a43d3f43f
refs/heads/master
2021-06-13T21:04:27.340000
2021-03-02T19:21:05
2021-03-02T19:21:05
291,239,294
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.javawebinar.basejava.exception; import java.sql.SQLException; public class ExistStorageException extends StorageException { public ExistStorageException(String uuid, SQLException e) { super("Resume " + uuid + " already exist", uuid, e); } public ExistStorageException(String uuid) { super("Resume " + uuid + " already exist", uuid, null); } }
UTF-8
Java
390
java
ExistStorageException.java
Java
[]
null
[]
package ru.javawebinar.basejava.exception; import java.sql.SQLException; public class ExistStorageException extends StorageException { public ExistStorageException(String uuid, SQLException e) { super("Resume " + uuid + " already exist", uuid, e); } public ExistStorageException(String uuid) { super("Resume " + uuid + " already exist", uuid, null); } }
390
0.694872
0.694872
14
26.857143
26.760464
63
false
false
0
0
0
0
0
0
0.642857
false
false
12
3c8112a60e093f6c06963a7999828e9959fb417f
35,278,861,398,263
45718f85ca0a9d574cc0fc35c243d5dcc6f9f84e
/MoneyManager/app/src/main/java/app/wottrich/moneymanager/viewmodel/EvolutionViewModel.java
8e20082fbee8fd1b3f7d39332a1131247aebd149
[]
no_license
Wottrich/MoneyController
https://github.com/Wottrich/MoneyController
faf79101665d5b23dfaf30b12c479ca6cd02ebb2
15dd008d9e32445ea1d76eef6851f81171c4cbc3
refs/heads/master
2018-10-19T09:46:05.865000
2018-08-17T12:53:09
2018-08-17T12:53:09
134,099,303
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.wottrich.moneymanager.viewmodel; import android.content.Context; import java.util.ArrayList; import java.util.List; import app.wottrich.moneymanager.models.Wallet; import app.wottrich.moneymanager.models.controllers.MoneyController; /** * @author lucas.wottrich * @since 23/07/2018 */ public class EvolutionViewModel { private Context context; private MoneyController controller; public EvolutionViewModel(Context context) { this.context = context; this.controller = new MoneyController(this.context); } public List<Wallet> getWallets(){ List<Wallet> wallets = new ArrayList<>(); for (Wallet w : controller.getWallets()) if (!w.isHasLimit()) wallets.add(w); return wallets; } }
UTF-8
Java
796
java
EvolutionViewModel.java
Java
[ { "context": "odels.controllers.MoneyController;\n\n/**\n * @author lucas.wottrich\n * @since 23/07/2018\n */\n\npublic class E", "end": 269, "score": 0.8293018341064453, "start": 264, "tag": "NAME", "value": "lucas" }, { "context": "controllers.MoneyController;\n\n/**\n * @author lucas.wottrich\n * @since 23/07/2018\n */\n\npublic class Ev", "end": 269, "score": 0.6211026906967163, "start": 269, "tag": "USERNAME", "value": "" }, { "context": "ontrollers.MoneyController;\n\n/**\n * @author lucas.wottrich\n * @since 23/07/2018\n */\n\npublic class EvolutionV", "end": 278, "score": 0.8878743648529053, "start": 270, "tag": "NAME", "value": "wottrich" } ]
null
[]
package app.wottrich.moneymanager.viewmodel; import android.content.Context; import java.util.ArrayList; import java.util.List; import app.wottrich.moneymanager.models.Wallet; import app.wottrich.moneymanager.models.controllers.MoneyController; /** * @author lucas.wottrich * @since 23/07/2018 */ public class EvolutionViewModel { private Context context; private MoneyController controller; public EvolutionViewModel(Context context) { this.context = context; this.controller = new MoneyController(this.context); } public List<Wallet> getWallets(){ List<Wallet> wallets = new ArrayList<>(); for (Wallet w : controller.getWallets()) if (!w.isHasLimit()) wallets.add(w); return wallets; } }
796
0.683417
0.673367
36
21.111111
20.302952
68
false
false
0
0
0
0
0
0
0.361111
false
false
12
a7dd0efe4ee5292096f0405b65f031f11138373b
37,357,625,550,595
89497c664b58d615c4a03a7658485e3f218f6bac
/src/main/java/by/epam/store/controller/command/impl/ChangeNewsCommand.java
6b8799a3bd3cd068a7f683ab7c60be04b6c706b1
[]
no_license
NATRi3/store
https://github.com/NATRi3/store
b2b89cfb9056e575778232c9381f6b36be509192
beab4434641d179dd48c5af59cff2ad01ada6f9e
refs/heads/main
2023-04-20T07:01:17.274000
2021-04-27T13:56:15
2021-04-27T13:56:15
334,969,370
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.epam.store.controller.command.impl; import by.epam.store.controller.command.Command; import by.epam.store.controller.Router; import by.epam.store.exception.ServiceException; import by.epam.store.model.service.NewsService; import by.epam.store.annotation.Autowired; import by.epam.store.controller.command.PagePath; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.servlet.http.HttpServletRequest; import java.util.Map; /** * The Change news command. */ public class ChangeNewsCommand implements Command { private final static Logger log = LogManager.getLogger(ChangeNewsCommand.class); private NewsService newsService; @Autowired public void setNewsService(NewsService newsService) { this.newsService = newsService; } @Override public Router execute(HttpServletRequest request) { Router page; Map<String, String[]> parameters = RequestUtil.getAllParametersFrom(request); try { String message = newsService.changeNews(parameters); page = RouterResponseHelper.router(request, message, parameters, PagePath.ADMIN_PANEL_NEWS); } catch (ServiceException e) { log.error(e); page = Router.redirectTo(PagePath.PAGE_500, request); } return page; } }
UTF-8
Java
1,343
java
ChangeNewsCommand.java
Java
[]
null
[]
package by.epam.store.controller.command.impl; import by.epam.store.controller.command.Command; import by.epam.store.controller.Router; import by.epam.store.exception.ServiceException; import by.epam.store.model.service.NewsService; import by.epam.store.annotation.Autowired; import by.epam.store.controller.command.PagePath; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import javax.servlet.http.HttpServletRequest; import java.util.Map; /** * The Change news command. */ public class ChangeNewsCommand implements Command { private final static Logger log = LogManager.getLogger(ChangeNewsCommand.class); private NewsService newsService; @Autowired public void setNewsService(NewsService newsService) { this.newsService = newsService; } @Override public Router execute(HttpServletRequest request) { Router page; Map<String, String[]> parameters = RequestUtil.getAllParametersFrom(request); try { String message = newsService.changeNews(parameters); page = RouterResponseHelper.router(request, message, parameters, PagePath.ADMIN_PANEL_NEWS); } catch (ServiceException e) { log.error(e); page = Router.redirectTo(PagePath.PAGE_500, request); } return page; } }
1,343
0.725242
0.721519
40
32.575001
26.173353
104
false
false
0
0
0
0
0
0
0.65
false
false
12
7e42e9a27f675a6cd1d7fe4b2edd4a815baf1079
38,732,015,113,425
fb35726fe2ffad0462056ab97b694ae1899558c6
/EmployeeDetails/src/main/java/employee/EmployeeDetails.java
a829d6eda095b3b03c1234e0e7b5c6b49e37ca4b
[]
no_license
Eddy-Dubois/javarepo
https://github.com/Eddy-Dubois/javarepo
2eb4fee5dcbb1061fbe33275751a97ceb60299fb
4e0fab49375b40cf802016e321aea0afe62a984d
refs/heads/master
2020-05-01T17:24:39.875000
2019-03-25T14:23:12
2019-03-25T14:23:12
177,598,636
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package employee; final class Personne { public String corpKey ; public String name ; public String tribe ; public String email ; public Personne (String corpKey, String name, String tribe, String email) { this.corpKey = corpKey ; this.name = name ; this.tribe = tribe ; this.email = email ; } } public class EmployeeDetails { public static void main(String[] args) { } }
UTF-8
Java
466
java
EmployeeDetails.java
Java
[]
null
[]
package employee; final class Personne { public String corpKey ; public String name ; public String tribe ; public String email ; public Personne (String corpKey, String name, String tribe, String email) { this.corpKey = corpKey ; this.name = name ; this.tribe = tribe ; this.email = email ; } } public class EmployeeDetails { public static void main(String[] args) { } }
466
0.590129
0.590129
24
17.416666
18.748148
79
false
false
0
0
0
0
0
0
0.5
false
false
12
6d08aadd01874ef4082f5587b59b98694dc38ec4
31,722,628,510,748
21d522d93547cb209b074ca1773bb37d1d399cb3
/app/src/main/java/com/mussieh/recapp/fragment/WebsiteFragment.java
ac0b3dfd7567a41e02a6d7318457df15b80da9e4
[]
no_license
mussieh/RecApp
https://github.com/mussieh/RecApp
1eaa3904b4c4273c411cf3ddfbb954051516274c
b4ecd7e0ced5dac9a6339174bf2aae449ec1401c
refs/heads/master
2021-04-28T16:35:35.150000
2018-04-18T07:02:13
2018-04-18T07:02:13
115,706,900
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mussieh.recapp.fragment; import android.os.Bundle; import android.support.annotation.NonNull; 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 android.widget.ProgressBar; import com.mussieh.recapp.R; import com.mussieh.recapp.adapter.WebsiteListAdapter; import com.mussieh.recapp.data.FirebaseHelper; import com.mussieh.recapp.data.ResourceListItem; import com.mussieh.recapp.data.SharedPreferencesHelper; import java.util.ArrayList; /** * Fragment for hosting and displaying Website data * Note: This Fragment is functional but not complete */ public class WebsiteFragment extends Fragment { private static final String TAG = WebsiteFragment.class.getSimpleName(); private ProgressBar mLoadingIndicator; private RecyclerView mWebsiteRecylcerView; private WebsiteListAdapter mWebsiteListAdapter; private FirebaseHelper firebaseHelper; // Required empty public constructor public WebsiteFragment() { } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_website, container, false); rootView.setTag(TAG); // Get a handle to the RecyclerView mWebsiteRecylcerView = rootView.findViewById(R.id.website_recycler_view); // Get a handle to the ProgressBar mLoadingIndicator = rootView.findViewById(R.id.pb_website_loading_indicator); // Create an adapter mWebsiteListAdapter = new WebsiteListAdapter(getContext()); mWebsiteListAdapter.setLoadingIndicator(mLoadingIndicator); firebaseHelper = new FirebaseHelper(mWebsiteListAdapter); // Connect the adapter with the RecyclerView mWebsiteRecylcerView.setAdapter(mWebsiteListAdapter); // Give the RecyclerView a default layout manager mWebsiteRecylcerView.setLayoutManager(new LinearLayoutManager(getContext())); final SwipeRefreshLayout mySwipeRefreshLayout = rootView.findViewById(R.id.website_swiperefresh); mySwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { SharedPreferencesHelper.loadUserChoice(getContext(), firebaseHelper, FirebaseHelper.KEY_WEBSITES, FirebaseHelper.KEY_WEBSITE_RANK); mySwipeRefreshLayout.setRefreshing(false); } }); // Saves previously loaded data during screen orientation change if (savedInstanceState != null){ ArrayList<ResourceListItem> websites = savedInstanceState.getParcelableArrayList("Websites"); mWebsiteListAdapter.setData(websites); } else { String userChoice = SharedPreferencesHelper.getValue(getContext(), SettingsFragment.KEY_SUMMARY, "None"); firebaseHelper.fetchAppResources(userChoice, FirebaseHelper.KEY_WEBSITES, FirebaseHelper.KEY_WEBSITE_RANK); } Log.d(TAG, "Returning rootview"); return rootView; } /** * Returns a new instance of WebsiteFragment * @return a WebsiteFragment */ public static WebsiteFragment newInstance() { return new WebsiteFragment(); } @Override public void onResume() { super.onResume(); SharedPreferencesHelper.loadUserChoice(getContext(), firebaseHelper, FirebaseHelper.KEY_WEBSITES, FirebaseHelper.KEY_WEBSITE_RANK); } @Override public void onSaveInstanceState(@NonNull Bundle outState) { outState.putParcelableArrayList("Websites", mWebsiteListAdapter.getResources()); super.onSaveInstanceState(outState); } }
UTF-8
Java
4,175
java
WebsiteFragment.java
Java
[]
null
[]
package com.mussieh.recapp.fragment; import android.os.Bundle; import android.support.annotation.NonNull; 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 android.widget.ProgressBar; import com.mussieh.recapp.R; import com.mussieh.recapp.adapter.WebsiteListAdapter; import com.mussieh.recapp.data.FirebaseHelper; import com.mussieh.recapp.data.ResourceListItem; import com.mussieh.recapp.data.SharedPreferencesHelper; import java.util.ArrayList; /** * Fragment for hosting and displaying Website data * Note: This Fragment is functional but not complete */ public class WebsiteFragment extends Fragment { private static final String TAG = WebsiteFragment.class.getSimpleName(); private ProgressBar mLoadingIndicator; private RecyclerView mWebsiteRecylcerView; private WebsiteListAdapter mWebsiteListAdapter; private FirebaseHelper firebaseHelper; // Required empty public constructor public WebsiteFragment() { } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_website, container, false); rootView.setTag(TAG); // Get a handle to the RecyclerView mWebsiteRecylcerView = rootView.findViewById(R.id.website_recycler_view); // Get a handle to the ProgressBar mLoadingIndicator = rootView.findViewById(R.id.pb_website_loading_indicator); // Create an adapter mWebsiteListAdapter = new WebsiteListAdapter(getContext()); mWebsiteListAdapter.setLoadingIndicator(mLoadingIndicator); firebaseHelper = new FirebaseHelper(mWebsiteListAdapter); // Connect the adapter with the RecyclerView mWebsiteRecylcerView.setAdapter(mWebsiteListAdapter); // Give the RecyclerView a default layout manager mWebsiteRecylcerView.setLayoutManager(new LinearLayoutManager(getContext())); final SwipeRefreshLayout mySwipeRefreshLayout = rootView.findViewById(R.id.website_swiperefresh); mySwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { SharedPreferencesHelper.loadUserChoice(getContext(), firebaseHelper, FirebaseHelper.KEY_WEBSITES, FirebaseHelper.KEY_WEBSITE_RANK); mySwipeRefreshLayout.setRefreshing(false); } }); // Saves previously loaded data during screen orientation change if (savedInstanceState != null){ ArrayList<ResourceListItem> websites = savedInstanceState.getParcelableArrayList("Websites"); mWebsiteListAdapter.setData(websites); } else { String userChoice = SharedPreferencesHelper.getValue(getContext(), SettingsFragment.KEY_SUMMARY, "None"); firebaseHelper.fetchAppResources(userChoice, FirebaseHelper.KEY_WEBSITES, FirebaseHelper.KEY_WEBSITE_RANK); } Log.d(TAG, "Returning rootview"); return rootView; } /** * Returns a new instance of WebsiteFragment * @return a WebsiteFragment */ public static WebsiteFragment newInstance() { return new WebsiteFragment(); } @Override public void onResume() { super.onResume(); SharedPreferencesHelper.loadUserChoice(getContext(), firebaseHelper, FirebaseHelper.KEY_WEBSITES, FirebaseHelper.KEY_WEBSITE_RANK); } @Override public void onSaveInstanceState(@NonNull Bundle outState) { outState.putParcelableArrayList("Websites", mWebsiteListAdapter.getResources()); super.onSaveInstanceState(outState); } }
4,175
0.704431
0.703473
114
35.622807
28.251188
105
false
false
0
0
0
0
0
0
0.552632
false
false
12
9e3a9b8ec2f4655ee1978fee5aab5ab36b6a61aa
35,442,070,159,617
c8a8f827d0db22d8e460bb96ad8cb0580ca5f8b0
/src/main/java/edu/ahut/collection/UniqueSortNumber02.java
450fa6dd3a975346a2159f1a2cfa40a15b2c22b7
[]
no_license
189074396/ahut2021Day03
https://github.com/189074396/ahut2021Day03
8c90735f161d99313f531d98415cf606e765fc5b
f22d32ba224b4ebfa86bc72c5c4504fd2cd2587e
refs/heads/master
2023-06-16T15:54:23.877000
2021-07-11T11:17:43
2021-07-11T11:17:43
384,862,174
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.ahut.collection; import java.util.*; /** * @program: ahut2021Day03 * @description:键盘输入个数不确定,对这些数去重排序 * @Package: edu.ahut.collection * @ClassName: UniqueSortNumber00 * @author: wang * @create: 2021/07/11 08:58 * @Version: 1.0 */ public class UniqueSortNumber02 { public static void main(String[] args) { //Set<Integer> a=new HashSet<Integer>(); Set<Integer> a=new TreeSet<Integer>(); while (cin.hasNext()){ int cur=cin.nextInt(); a.add(cur); } for (Integer i:a) { System.out.print(i+" "); } System.out.println("\ntotal m="+a.size()); } static Scanner cin=new Scanner(System.in); }
UTF-8
Java
741
java
UniqueSortNumber02.java
Java
[ { "context": "tion\n * @ClassName: UniqueSortNumber00\n * @author: wang\n * @create: 2021/07/11 08:58\n * @Version: 1.0\n */", "end": 200, "score": 0.7655199766159058, "start": 196, "tag": "USERNAME", "value": "wang" } ]
null
[]
package edu.ahut.collection; import java.util.*; /** * @program: ahut2021Day03 * @description:键盘输入个数不确定,对这些数去重排序 * @Package: edu.ahut.collection * @ClassName: UniqueSortNumber00 * @author: wang * @create: 2021/07/11 08:58 * @Version: 1.0 */ public class UniqueSortNumber02 { public static void main(String[] args) { //Set<Integer> a=new HashSet<Integer>(); Set<Integer> a=new TreeSet<Integer>(); while (cin.hasNext()){ int cur=cin.nextInt(); a.add(cur); } for (Integer i:a) { System.out.print(i+" "); } System.out.println("\ntotal m="+a.size()); } static Scanner cin=new Scanner(System.in); }
741
0.590071
0.556028
28
24.178572
15.563358
50
false
false
0
0
0
0
0
0
0.321429
false
false
12
879532238c6b8b8ba4438af512cbd77ec46ce79d
35,639,638,652,416
1c3afe3e49b3d006a7d8c4f9e50b57e406eca824
/Planos.java
0744881a24761a14942b51b683987c63988ebe09
[]
no_license
danielsoderteixeira/https-git.heroku.com-mysterious-plains-86308
https://github.com/danielsoderteixeira/https-git.heroku.com-mysterious-plains-86308
3bfcf5c4ade4aae7d9e354363439aef35c81ea77
55a39b4400f7c5050237fd4879086776a27a887b
refs/heads/master
2020-04-07T18:50:45.216000
2018-11-22T01:38:08
2018-11-22T01:38:08
158,626,216
0
0
null
false
2018-11-22T01:30:40
2018-11-22T01:26:24
2018-11-22T01:27:36
2018-11-22T01:30:17
0
0
0
0
Java
false
null
package br.upf.ads.appgym.model; public class Planos { public Integer id; public String tipo; public Float valor; public String periodo; }
UTF-8
Java
152
java
Planos.java
Java
[]
null
[]
package br.upf.ads.appgym.model; public class Planos { public Integer id; public String tipo; public Float valor; public String periodo; }
152
0.717105
0.717105
8
17
10.271319
32
false
false
0
0
0
0
0
0
1.125
false
false
12
40ed33589ce7325a99f4026ec8d661c13bed6f13
5,368,709,125,626
8cae7063a0d62b126b2463eb2e06451020cab80b
/src/ContactList/ContactList.java
a5993eda1d2507a571ffe9e0485b39e8c66be844
[]
no_license
vikramsingh7/PhoneBook
https://github.com/vikramsingh7/PhoneBook
b3c219d67f04f0d6a9565809dab5c3db06c215dd
037235db0d51a94f3805b30c0e66c5679c61eba5
refs/heads/master
2021-08-19T10:42:38.929000
2017-11-25T23:40:30
2017-11-25T23:40:30
109,173,787
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ContactList; import java.util.*; import java.util.ArrayList; public class ContactList { Scanner input = new Scanner(System.in); private Contact head; private int size; public void add () { String name; String phoneNumber; String email; String address; Contact current; Contact backCurrent; Contact on; System.out.println("Enter Full Name: "); name = input.nextLine(); System.out.println("Enter Phone Number: "); phoneNumber = input.nextLine(); System.out.println("Enter Email-Id:"); email = input.nextLine(); System.out.println("Enter Address: "); address = input.nextLine(); current = head; if(head == null) { head = new Contact(name,phoneNumber,email,address,head); size++; } else if((head.getNext() == null) && (head.getName().compareTo(name) < 0) ) { on = new Contact(name,phoneNumber,email,address,null); head.setNext(on); size++; } else if(head.getName().compareTo(name) > 0) { head = new Contact(name,phoneNumber,email,address,head); size++; } else { for(int i=0; i<size; i++) { backCurrent = current; current = current.getNext(); String temp = current.getName(); if(current.getNext() == null ) { on = new Contact(name,phoneNumber,email,address,null); current.setNext(on); size++; } else if(name.compareTo(temp) < 0) { on = new Contact(name,phoneNumber,email,address,current); backCurrent.setNext(on); size++; } } } } public void display() { Contact current = head; System.out.println("The Contacts are sorted by name in order of ( a-z):"); head.getAll(); for(int i=0; i<size; i++) { if(current.getNext() != null) { current = current.getNext(); current.getAll(); } } } public void displayParticular() { char o; int counter = 0; String search; System.out.println("'a' Seacrh by Name:"); System.out.println("'b' Seacrh by PhoneNumber:"); o = input.nextLine().charAt(0); if(o=='a') { System.out.println("Enter Name: "); search = input.nextLine(); Contact current = head; for(int i=0; i<size; i++) { if(search.equals(current.getName())) { current.getAll(); counter = 1; } else { counter = 0; } current = current.getNext(); } if(counter == 0) { System.out.println("Error!!! No contact of this Name exists:"); System.out.println(); } } else if(o=='b') { System.out.println("Enter Phonenumber: "); search = input.nextLine(); Contact current = head; for(int i=0; i<size; i++) { if(search.equals(current.getPhoneNumber())) { current.getAll(); counter = 1; } else { counter =0; } current = current.getNext(); } if(counter == 0) { System.out.println("Error!!!!! No contact of this Phonenumber exists:"); System.out.println(); } } } public void remove() { String search ; int counter =0; Contact backCurrent =null; Contact on; System.out.println("Enter name of the contact you want to delete"); search = input.nextLine(); Contact current = head; if( (head.getName().compareTo(search) == 0) && (head.getNext() == null)) { head = null; size--; counter = 1; } else if(head.getName().compareTo(search) == 0) { head = head.getNext(); size--; counter = 1; } else { for(int i=0; i<size;i++) { if(current.getName().compareTo(search) != 0) { counter = 0; } else { counter = 1; on = current.getNext(); backCurrent.setNext(on); current.setNext(null); size--; } backCurrent = current; current = current.getNext(); } } if(counter == 0) { System.out.println("Sorry No name exists"); } else { System.out.println("Name Successfully removed"); } } public void getSize(){ System.out.println(this.size); } }
UTF-8
Java
3,845
java
ContactList.java
Java
[]
null
[]
package ContactList; import java.util.*; import java.util.ArrayList; public class ContactList { Scanner input = new Scanner(System.in); private Contact head; private int size; public void add () { String name; String phoneNumber; String email; String address; Contact current; Contact backCurrent; Contact on; System.out.println("Enter Full Name: "); name = input.nextLine(); System.out.println("Enter Phone Number: "); phoneNumber = input.nextLine(); System.out.println("Enter Email-Id:"); email = input.nextLine(); System.out.println("Enter Address: "); address = input.nextLine(); current = head; if(head == null) { head = new Contact(name,phoneNumber,email,address,head); size++; } else if((head.getNext() == null) && (head.getName().compareTo(name) < 0) ) { on = new Contact(name,phoneNumber,email,address,null); head.setNext(on); size++; } else if(head.getName().compareTo(name) > 0) { head = new Contact(name,phoneNumber,email,address,head); size++; } else { for(int i=0; i<size; i++) { backCurrent = current; current = current.getNext(); String temp = current.getName(); if(current.getNext() == null ) { on = new Contact(name,phoneNumber,email,address,null); current.setNext(on); size++; } else if(name.compareTo(temp) < 0) { on = new Contact(name,phoneNumber,email,address,current); backCurrent.setNext(on); size++; } } } } public void display() { Contact current = head; System.out.println("The Contacts are sorted by name in order of ( a-z):"); head.getAll(); for(int i=0; i<size; i++) { if(current.getNext() != null) { current = current.getNext(); current.getAll(); } } } public void displayParticular() { char o; int counter = 0; String search; System.out.println("'a' Seacrh by Name:"); System.out.println("'b' Seacrh by PhoneNumber:"); o = input.nextLine().charAt(0); if(o=='a') { System.out.println("Enter Name: "); search = input.nextLine(); Contact current = head; for(int i=0; i<size; i++) { if(search.equals(current.getName())) { current.getAll(); counter = 1; } else { counter = 0; } current = current.getNext(); } if(counter == 0) { System.out.println("Error!!! No contact of this Name exists:"); System.out.println(); } } else if(o=='b') { System.out.println("Enter Phonenumber: "); search = input.nextLine(); Contact current = head; for(int i=0; i<size; i++) { if(search.equals(current.getPhoneNumber())) { current.getAll(); counter = 1; } else { counter =0; } current = current.getNext(); } if(counter == 0) { System.out.println("Error!!!!! No contact of this Phonenumber exists:"); System.out.println(); } } } public void remove() { String search ; int counter =0; Contact backCurrent =null; Contact on; System.out.println("Enter name of the contact you want to delete"); search = input.nextLine(); Contact current = head; if( (head.getName().compareTo(search) == 0) && (head.getNext() == null)) { head = null; size--; counter = 1; } else if(head.getName().compareTo(search) == 0) { head = head.getNext(); size--; counter = 1; } else { for(int i=0; i<size;i++) { if(current.getName().compareTo(search) != 0) { counter = 0; } else { counter = 1; on = current.getNext(); backCurrent.setNext(on); current.setNext(null); size--; } backCurrent = current; current = current.getNext(); } } if(counter == 0) { System.out.println("Sorry No name exists"); } else { System.out.println("Name Successfully removed"); } } public void getSize(){ System.out.println(this.size); } }
3,845
0.606242
0.59974
211
17.22275
17.866081
78
false
false
0
0
0
0
0
0
2.14218
false
false
12
a7dc15a1d63b9d12868edb298a1f29d699d11ee0
3,066,606,718,356
06fa94fd00c7c49ac51c413c6bc3883031ef6410
/src/main/java/com/vue/mapper/PacStockMapper.java
f8f7acdc4af64b6ae5b5c7e46b8116830847e7c0
[]
no_license
Skunk911/bos
https://github.com/Skunk911/bos
d8613d8d9bde514e4f69cb66559d7fc1efa6f2b3
a8f39b0026b53cf657a816a96cd48f02f2b71e02
refs/heads/master
2021-06-24T14:34:32.853000
2019-11-18T09:33:12
2019-11-18T09:33:12
222,388,841
0
0
null
false
2021-04-22T18:45:54
2019-11-18T07:33:14
2019-11-18T09:35:10
2021-04-22T18:45:53
86
0
0
1
Java
false
false
package com.vue.mapper; import com.vue.model.PacStock; public interface PacStockMapper { int deleteByPrimaryKey(Short id); int insert(PacStock record); int insertSelective(PacStock record); PacStock selectByPrimaryKey(Short id); int updateByPrimaryKeySelective(PacStock record); int updateByPrimaryKey(PacStock record); }
UTF-8
Java
352
java
PacStockMapper.java
Java
[]
null
[]
package com.vue.mapper; import com.vue.model.PacStock; public interface PacStockMapper { int deleteByPrimaryKey(Short id); int insert(PacStock record); int insertSelective(PacStock record); PacStock selectByPrimaryKey(Short id); int updateByPrimaryKeySelective(PacStock record); int updateByPrimaryKey(PacStock record); }
352
0.761364
0.761364
17
19.764706
19.495186
53
false
false
0
0
0
0
0
0
0.470588
false
false
12
3626722dfc97144dee21ae4b86b2af702e01058c
25,469,156,071,108
fd508c77410c74f559a2b55d5f0253dc736a62c4
/src/main/java/com/conpaytest/desafioestacionamento/entities/Vaga.java
13c41f64dbced3ea59ca347a60d54e0cd9049e75
[]
no_license
wendersonp/desafio-estacionamento
https://github.com/wendersonp/desafio-estacionamento
c561af79d44f3729d7d45c81e5cb6c02ac35ee96
86bc7a2439657ea94e8789c877f69acb3cb38359
refs/heads/master
2020-08-16T20:11:32.403000
2019-10-20T16:03:23
2019-10-20T16:03:23
215,546,477
0
1
null
true
2019-10-20T16:03:24
2019-10-16T12:47:10
2019-10-20T04:30:35
2019-10-20T16:03:24
85
0
0
0
Java
false
false
package com.conpaytest.desafioestacionamento.entities; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Vaga{ //Identificação Unica da vaga @Id private String idVaga; //Determina se a vaga está ocupada @Column(nullable = false) private boolean ocupada = false; private int posicaoX; private int posicaoY; protected Vaga(){} public Vaga(String idVaga, int posicaoX, int posicaoY){ this.idVaga = idVaga; this.posicaoX = posicaoX; this.posicaoY = posicaoY; } public String getIdVaga() { return idVaga; } public void setIdVaga(String idVaga) { this.idVaga = idVaga; } public boolean isOcupada() { return ocupada; } public void setOcupada(boolean ocupada) { this.ocupada = ocupada; } public int getPosicaoX() { return posicaoX; } public void setPosicaoX(int posicaoX) { this.posicaoX = posicaoX; } public int getPosicaoY() { return posicaoY; } public void setPosicaoY(int posicaoY) { this.posicaoY = posicaoY; } }
UTF-8
Java
1,202
java
Vaga.java
Java
[]
null
[]
package com.conpaytest.desafioestacionamento.entities; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Vaga{ //Identificação Unica da vaga @Id private String idVaga; //Determina se a vaga está ocupada @Column(nullable = false) private boolean ocupada = false; private int posicaoX; private int posicaoY; protected Vaga(){} public Vaga(String idVaga, int posicaoX, int posicaoY){ this.idVaga = idVaga; this.posicaoX = posicaoX; this.posicaoY = posicaoY; } public String getIdVaga() { return idVaga; } public void setIdVaga(String idVaga) { this.idVaga = idVaga; } public boolean isOcupada() { return ocupada; } public void setOcupada(boolean ocupada) { this.ocupada = ocupada; } public int getPosicaoX() { return posicaoX; } public void setPosicaoX(int posicaoX) { this.posicaoX = posicaoX; } public int getPosicaoY() { return posicaoY; } public void setPosicaoY(int posicaoY) { this.posicaoY = posicaoY; } }
1,202
0.629691
0.629691
65
17.461538
16.457943
59
false
false
0
0
0
0
0
0
0.323077
false
false
12
fbe9f19bb1b41fd6f8a3a31074d73d2c1878f3ab
14,731,737,844,818
c7148d445e23c1417938795c334c89662a2126fd
/src/test/java/jp/comutt/holidays/HolidaysTest.java
1e4ff72a2a9ffb1854ea6e3121ecf527483c9b95
[]
no_license
comuttun/googlecalendar-holidays
https://github.com/comuttun/googlecalendar-holidays
e7d8f9869a5f9df18f83d91cc84c6a96489bfac1
f2191a19d2618dedd997271245894e2a1c196be3
refs/heads/master
2021-06-09T21:05:06.966000
2016-11-07T17:30:01
2016-11-07T17:30:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jp.comutt.holidays; import org.junit.Before; import org.junit.Test; import java.util.Properties; public class HolidaysTest { private Properties credentialProperties = new Properties(); @Before public void setUp() throws Exception { credentialProperties.load(getClass().getResourceAsStream("/credential.properties")); } @Test public void holidays() throws Exception { Holidays.create() .calendarId("japanese__ja@holiday.calendar.google.com") .apiKey(credentialProperties.getProperty("apiKey")) .holidays(2017).forEach(holiday -> { System.out.println(holiday.getStartDate() + " " + holiday.getName()); }); } }
UTF-8
Java
751
java
HolidaysTest.java
Java
[ { "context": " Holidays.create()\n .calendarId(\"japanese__ja@holiday.calendar.google.com\")\n .apiKey(credentialProperties.ge", "end": 509, "score": 0.9991786479949951, "start": 469, "tag": "EMAIL", "value": "japanese__ja@holiday.calendar.google.com" } ]
null
[]
package jp.comutt.holidays; import org.junit.Before; import org.junit.Test; import java.util.Properties; public class HolidaysTest { private Properties credentialProperties = new Properties(); @Before public void setUp() throws Exception { credentialProperties.load(getClass().getResourceAsStream("/credential.properties")); } @Test public void holidays() throws Exception { Holidays.create() .calendarId("<EMAIL>") .apiKey(credentialProperties.getProperty("apiKey")) .holidays(2017).forEach(holiday -> { System.out.println(holiday.getStartDate() + " " + holiday.getName()); }); } }
718
0.636485
0.631158
28
25.857143
28.156088
92
false
false
0
0
0
0
0
0
0.285714
false
false
12
d58a0a553a5e785f78d96eed16c4c746da9fc2fa
5,531,917,900,565
e5a10ebecd55f93b3983e08563bc2868a316d430
/src/net/cosmologic/inferno/ui/screen/impl/Container.java
c62cc3a7af2525d22360cc819fbddf2c6b55305b
[]
no_license
evrenozcan/inferno
https://github.com/evrenozcan/inferno
460a6452622977a95b3e69fcf642f013eab58ce1
4012e2e5f011763b708fd9328445c78c14409398
refs/heads/master
2021-01-01T15:29:27.734000
2012-01-21T00:05:14
2012-01-21T00:05:14
3,230,647
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * */ package net.cosmologic.inferno.ui.screen.impl; import net.cosmologic.inferno.IContext; import net.cosmologic.inferno.ui.graphics.IBitmapWrapper; import net.cosmologic.inferno.ui.graphics.IBitmapWrapper.BitmapFormat; import net.cosmologic.inferno.ui.graphics.IGraphics; import net.cosmologic.inferno.ui.screen.IContainer; /** * The Class Container. * * @author Evren Ozcan */ public abstract class Container extends Component implements IContainer { /** The context. */ private final IContext context; /** The container local. */ protected IGraphics containerLocal; /** * Instantiates a new container. * * @param context the context * @param id the id * @param bounds the bounds * @param transparent the transparent */ protected Container(final IContext context, final String id, final Bounds bounds, final boolean transparent) { super(id, bounds); this.context = context; if (transparent) { containerLocal = createGraphics(context, bounds.width, bounds.height, BitmapFormat.ARGB8888); } else { containerLocal = createGraphics(context, bounds.width, bounds.height, BitmapFormat.RGB565); } } /** * Creates the graphics. * * @param context the context * @param width the width * @param height the height * @param format the format * @return the i graphics */ protected abstract IGraphics createGraphics(IContext context, int width, int height, BitmapFormat format); /**{@inheritDoc}*/ @Override public IBitmapWrapper getBitmap() { return containerLocal.getFrameBuffer(); } /**{@inheritDoc}*/ @Override public void dispose() { getBitmap().dispose(); } /**{@inheritDoc}*/ @Override public IContext getContext() { return context; } /**{@inheritDoc}*/ @Override public IGraphics getGraphics() { return containerLocal; } /**{@inheritDoc}*/ @Override public int getWidth() { return bounds.width; } /**{@inheritDoc}*/ @Override public int getHeight() { return bounds.height; } /**{@inheritDoc}*/ @Override public boolean onInterrupt() { return false; } }
UTF-8
Java
2,381
java
Container.java
Java
[ { "context": "ainer;\n\n/**\n * The Class Container.\n * \n * @author Evren Ozcan\n */\npublic abstract class Container extends Compo", "end": 388, "score": 0.9998868107795715, "start": 377, "tag": "NAME", "value": "Evren Ozcan" } ]
null
[]
/* * */ package net.cosmologic.inferno.ui.screen.impl; import net.cosmologic.inferno.IContext; import net.cosmologic.inferno.ui.graphics.IBitmapWrapper; import net.cosmologic.inferno.ui.graphics.IBitmapWrapper.BitmapFormat; import net.cosmologic.inferno.ui.graphics.IGraphics; import net.cosmologic.inferno.ui.screen.IContainer; /** * The Class Container. * * @author <NAME> */ public abstract class Container extends Component implements IContainer { /** The context. */ private final IContext context; /** The container local. */ protected IGraphics containerLocal; /** * Instantiates a new container. * * @param context the context * @param id the id * @param bounds the bounds * @param transparent the transparent */ protected Container(final IContext context, final String id, final Bounds bounds, final boolean transparent) { super(id, bounds); this.context = context; if (transparent) { containerLocal = createGraphics(context, bounds.width, bounds.height, BitmapFormat.ARGB8888); } else { containerLocal = createGraphics(context, bounds.width, bounds.height, BitmapFormat.RGB565); } } /** * Creates the graphics. * * @param context the context * @param width the width * @param height the height * @param format the format * @return the i graphics */ protected abstract IGraphics createGraphics(IContext context, int width, int height, BitmapFormat format); /**{@inheritDoc}*/ @Override public IBitmapWrapper getBitmap() { return containerLocal.getFrameBuffer(); } /**{@inheritDoc}*/ @Override public void dispose() { getBitmap().dispose(); } /**{@inheritDoc}*/ @Override public IContext getContext() { return context; } /**{@inheritDoc}*/ @Override public IGraphics getGraphics() { return containerLocal; } /**{@inheritDoc}*/ @Override public int getWidth() { return bounds.width; } /**{@inheritDoc}*/ @Override public int getHeight() { return bounds.height; } /**{@inheritDoc}*/ @Override public boolean onInterrupt() { return false; } }
2,376
0.619488
0.616548
107
21.252337
23.175516
112
false
false
0
0
0
0
0
0
0.308411
false
false
12
e8fcd04e4a67a3d374d89365da2220182fafc348
3,942,779,995,566
481d239ce7301b91282d33727a19ebb97e4778a5
/src/project/thirteenthage/creatures/loaders/SpecialTemplateLoader.java
7ffac53a74daccaadd8fab75152e37b4dbca6119
[]
no_license
gitMarky/Creature-and-Encounter-Designer
https://github.com/gitMarky/Creature-and-Encounter-Designer
3651766e5d3e6f4885064f70f57fe693b255ab19
00a159bb8b4f9a8d4d31fb3a332f2058095e33c2
refs/heads/master
2021-05-15T01:07:48.534000
2017-03-14T16:30:56
2017-03-14T16:30:56
58,853,715
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package project.thirteenthage.creatures.loaders; import project.library.marky.logger.ApplicationLogger; import project.marky.library.xml.BasicXmlFile; import legacy.project.thirteenthage.creatures.internal.Constants; import legacy.project.thirteenthage.creatures.internal.exceptions.LoaderException; import legacy.project.thirteenthage.creatures.internal.interfaces.ISpecial; import legacy.project.thirteenthage.creatures.mechanics.SpecialTemplate; /** * Loads attack templates from a folder. */ public class SpecialTemplateLoader extends AbstractLoader<ISpecial> { private static SpecialTemplateLoader _instance = null; @Override protected boolean checkEntry(final BasicXmlFile template) { if (template == null) { throw new IllegalArgumentException("Parameter 'template' must not be null."); } return "special".equals(template.getRoot().getName()); } @Override protected void addEntry(final BasicXmlFile file) { if (file == null) { throw new IllegalArgumentException("Parameter 'file' must not be null."); } final SpecialTemplate template = new SpecialTemplate(file); final String id = LoaderHelper.getId(file); if (getTemplates().containsKey(id)) { throw new LoaderException("Cannot load from \"" + file.getFile().getAbsolutePath() + "\": the filename already exists"); } getTemplates().put(id, template); } /** * Access the loader. * * @return the loader, if it already exists. Otherwise, * the loader is created and it loads all entries. */ public static SpecialTemplateLoader getInstance() { if (_instance == null) { ApplicationLogger.getLogger().info("Setting up new loader instance"); _instance = new SpecialTemplateLoader(); _instance.load(Constants.RESOURCES); } return _instance; } }
UTF-8
Java
1,793
java
SpecialTemplateLoader.java
Java
[]
null
[]
package project.thirteenthage.creatures.loaders; import project.library.marky.logger.ApplicationLogger; import project.marky.library.xml.BasicXmlFile; import legacy.project.thirteenthage.creatures.internal.Constants; import legacy.project.thirteenthage.creatures.internal.exceptions.LoaderException; import legacy.project.thirteenthage.creatures.internal.interfaces.ISpecial; import legacy.project.thirteenthage.creatures.mechanics.SpecialTemplate; /** * Loads attack templates from a folder. */ public class SpecialTemplateLoader extends AbstractLoader<ISpecial> { private static SpecialTemplateLoader _instance = null; @Override protected boolean checkEntry(final BasicXmlFile template) { if (template == null) { throw new IllegalArgumentException("Parameter 'template' must not be null."); } return "special".equals(template.getRoot().getName()); } @Override protected void addEntry(final BasicXmlFile file) { if (file == null) { throw new IllegalArgumentException("Parameter 'file' must not be null."); } final SpecialTemplate template = new SpecialTemplate(file); final String id = LoaderHelper.getId(file); if (getTemplates().containsKey(id)) { throw new LoaderException("Cannot load from \"" + file.getFile().getAbsolutePath() + "\": the filename already exists"); } getTemplates().put(id, template); } /** * Access the loader. * * @return the loader, if it already exists. Otherwise, * the loader is created and it loads all entries. */ public static SpecialTemplateLoader getInstance() { if (_instance == null) { ApplicationLogger.getLogger().info("Setting up new loader instance"); _instance = new SpecialTemplateLoader(); _instance.load(Constants.RESOURCES); } return _instance; } }
1,793
0.744004
0.744004
67
25.761194
29.58322
123
false
false
0
0
0
0
0
0
1.373134
false
false
12
5e450e7aa42d5bf691a75d99a7235005632fbfe1
13,692,355,785,268
7433c2032df5837c5aba878f87f93b0115c65687
/src/main/java/ru/netology/stats/StatsService.java
0977b1bdc3a23482ffd1ab54e394e899ca444e18
[]
no_license
evgsavelov/5_Maven
https://github.com/evgsavelov/5_Maven
28aea719d05f4e8a14c5c5eef893fd6452096d5e
267d2be855a0fda9d125915efd44063c44d83089
refs/heads/master
2023-02-24T21:50:24.521000
2020-08-28T07:01:31
2020-08-28T07:01:31
290,975,014
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.netology.stats; public class StatsService { public int calculateSum1(int[] month){ int sum = 0; for (int x:month){ sum = sum + x; } return sum; } }
UTF-8
Java
212
java
StatsService.java
Java
[]
null
[]
package ru.netology.stats; public class StatsService { public int calculateSum1(int[] month){ int sum = 0; for (int x:month){ sum = sum + x; } return sum; } }
212
0.518868
0.509434
11
18.272728
12.490658
42
false
false
0
0
0
0
0
0
0.363636
false
false
12
b8844bbcdc197d87424ce4e566965e703d407922
24,567,212,945,597
3fb5956b7ad7fb348d1d8fc8309ae660f0a07d57
/src/test_gral/OOD_TermProject_emptyPlaylist_v2/structuralPattern/AdvancedMediaPlayer.java
d906b81d41d0e6fc13ef79518605e282a9607175
[]
no_license
german-jongewaard/PildorasTest
https://github.com/german-jongewaard/PildorasTest
c9c5fd1125afd85bea0a59c45d123d2bb8d0fc17
ef48ab29e8aef5990a814b28ef89b27aafbeb8c2
refs/heads/master
2021-10-27T05:45:54.566000
2019-04-14T10:22:41
2019-04-14T10:22:41
111,906,672
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test_gral.OOD_TermProject_emptyPlaylist_v2.structuralPattern; import java.io.File; /** * * @author German * */ public interface AdvancedMediaPlayer { public void playMedia(File fileName); public void stopMedia(File fileName); }
UTF-8
Java
248
java
AdvancedMediaPlayer.java
Java
[ { "context": "lPattern;\n\nimport java.io.File;\n\n/**\n *\n * @author German\n * \n */\n\npublic interface AdvancedMediaPlayer {\n\t", "end": 117, "score": 0.9953057169914246, "start": 111, "tag": "NAME", "value": "German" } ]
null
[]
package test_gral.OOD_TermProject_emptyPlaylist_v2.structuralPattern; import java.io.File; /** * * @author German * */ public interface AdvancedMediaPlayer { public void playMedia(File fileName); public void stopMedia(File fileName); }
248
0.745968
0.741935
14
16.714285
20.799824
69
false
false
0
0
0
0
0
0
0.428571
false
false
12
63f3d94ec6355c2595248d6a9b080af7856b7a9f
28,046,136,465,092
c317bbafe3b78a689e717fa8853b9cc34069d752
/app/src/androidTest/java/ch/epfl/sweng/project/SortTaskTest.java
321551ebaf3215d7e400f9a6a6b184f6963435c1
[]
no_license
MatteoGiorla/smart-task-manager
https://github.com/MatteoGiorla/smart-task-manager
3520bcfd2352b5abc5e397a051195d3569f981a1
8274f98b8ddcddb575e929d15f7abd041f7eee98
refs/heads/master
2021-01-13T11:09:00.741000
2017-01-14T07:06:27
2017-01-14T07:06:27
77,286,762
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ch.epfl.sweng.project; import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.UiSelector; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Arrays; import java.util.List; import static android.support.test.InstrumentationRegistry.getInstrumentation; import static android.support.test.espresso.Espresso.onData; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.Espresso.pressBack; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.typeText; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; import static android.support.test.uiautomator.UiDevice.getInstance; import static junit.framework.Assert.fail; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.instanceOf; @RunWith(AndroidJUnit4.class) public final class SortTaskTest extends SuperTest{ private List<String> taskNames; @Rule public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>( MainActivity.class); @Before public void addNewTask() { String taskQuick = "reply mail"; String taskNormal = "withdraw cash"; String taskLong = "homework"; taskNames = Arrays.asList(taskQuick, taskNormal, taskLong); addTask(taskQuick, R.id.energy_low, 1); addTask(taskNormal, R.id.energy_normal, 2); addTask(taskLong, R.id.energy_high, 4); } @Test public void testDynamicSortWithMoreThan2Hours() { //Open task information onView(withId(R.id.list_view_tasks)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); pressBack(); // select more than 2 hours at disposition onView(withId(R.id.time_user)).perform(click()); onData(allOf(is(instanceOf(String.class)))).atPosition(4).perform(click()); // check if sorted correctly onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(0)) .check(matches(hasDescendant(withText(taskNames.get(2))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(1)) .check(matches(hasDescendant(withText(taskNames.get(1))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(2)) .check(matches(hasDescendant(withText(taskNames.get(0))))); } @Test public void testDynamicSortWithMoreThan30Min() { //Open task information onView(withId(R.id.list_view_tasks)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); pressBack(); // select more than 30 minutes at disposition onView(withId(R.id.time_user)).perform(click()); onData(allOf(is(instanceOf(String.class)))).atPosition(2).perform(click()); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(0)) .check(matches(hasDescendant(withText(taskNames.get(1))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(1)) .check(matches(hasDescendant(withText(taskNames.get(0))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(2)) .check(matches(hasDescendant(withText(taskNames.get(2))))); } private void addTask(String taskName, int radioButtonId, int indexDuration) { UiDevice mUiDevice = getInstance(getInstrumentation()); onView(withId(R.id.add_task_button)).perform(click()); onView(withId(R.id.title_task)).perform(typeText(taskName)); pressBack(); //add a due date (today due date) onView(withId(R.id.pick_date)).perform(click()); UiObject okButton = mUiDevice.findObject(new UiSelector().text("OK")); try{ okButton.click(); }catch(UiObjectNotFoundException u){ fail("Could not confirm date selection "+u.getMessage()); } onView(withId(radioButtonId)).perform(click()); // select the duration onView(withId(R.id.durationSpinner)).perform(click()); onData(allOf(is(instanceOf(String.class)))).atPosition(indexDuration).perform(click()); onView(withId(R.id.edit_done_button_toolbar)).perform(click()); } }
UTF-8
Java
5,128
java
SortTaskTest.java
Java
[]
null
[]
package ch.epfl.sweng.project; import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.UiSelector; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Arrays; import java.util.List; import static android.support.test.InstrumentationRegistry.getInstrumentation; import static android.support.test.espresso.Espresso.onData; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.Espresso.pressBack; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.typeText; import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; import static android.support.test.uiautomator.UiDevice.getInstance; import static junit.framework.Assert.fail; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.instanceOf; @RunWith(AndroidJUnit4.class) public final class SortTaskTest extends SuperTest{ private List<String> taskNames; @Rule public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>( MainActivity.class); @Before public void addNewTask() { String taskQuick = "reply mail"; String taskNormal = "withdraw cash"; String taskLong = "homework"; taskNames = Arrays.asList(taskQuick, taskNormal, taskLong); addTask(taskQuick, R.id.energy_low, 1); addTask(taskNormal, R.id.energy_normal, 2); addTask(taskLong, R.id.energy_high, 4); } @Test public void testDynamicSortWithMoreThan2Hours() { //Open task information onView(withId(R.id.list_view_tasks)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); pressBack(); // select more than 2 hours at disposition onView(withId(R.id.time_user)).perform(click()); onData(allOf(is(instanceOf(String.class)))).atPosition(4).perform(click()); // check if sorted correctly onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(0)) .check(matches(hasDescendant(withText(taskNames.get(2))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(1)) .check(matches(hasDescendant(withText(taskNames.get(1))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(2)) .check(matches(hasDescendant(withText(taskNames.get(0))))); } @Test public void testDynamicSortWithMoreThan30Min() { //Open task information onView(withId(R.id.list_view_tasks)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); pressBack(); // select more than 30 minutes at disposition onView(withId(R.id.time_user)).perform(click()); onData(allOf(is(instanceOf(String.class)))).atPosition(2).perform(click()); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(0)) .check(matches(hasDescendant(withText(taskNames.get(1))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(1)) .check(matches(hasDescendant(withText(taskNames.get(0))))); onView(new TestRecyclerViewMatcher(R.id.list_view_tasks) .atPosition(2)) .check(matches(hasDescendant(withText(taskNames.get(2))))); } private void addTask(String taskName, int radioButtonId, int indexDuration) { UiDevice mUiDevice = getInstance(getInstrumentation()); onView(withId(R.id.add_task_button)).perform(click()); onView(withId(R.id.title_task)).perform(typeText(taskName)); pressBack(); //add a due date (today due date) onView(withId(R.id.pick_date)).perform(click()); UiObject okButton = mUiDevice.findObject(new UiSelector().text("OK")); try{ okButton.click(); }catch(UiObjectNotFoundException u){ fail("Could not confirm date selection "+u.getMessage()); } onView(withId(radioButtonId)).perform(click()); // select the duration onView(withId(R.id.durationSpinner)).perform(click()); onData(allOf(is(instanceOf(String.class)))).atPosition(indexDuration).perform(click()); onView(withId(R.id.edit_done_button_toolbar)).perform(click()); } }
5,128
0.696373
0.691108
131
38.145039
28.027555
95
false
false
0
0
0
0
0
0
0.580153
false
false
12
124c1ab38ae482cebd119406611bafe88237f7a0
27,582,279,984,491
fe0cd934b6cf87f373dd6e3ca44ccddef7ddab3d
/src/main/java/com/pmdcodereview/controller/PMDController.java
fab4c1f7cd2798d9b280248b10b9c0b963b5ec33
[]
no_license
Nagendra080389/pmdreview
https://github.com/Nagendra080389/pmdreview
aa65ffb5d05f8b9ad81c11458e5a68c079a3089a
01a430e8bfac52b002e417fb5f3cdb0f3f418a91
refs/heads/master
2020-03-29T07:45:35.679000
2018-06-11T07:17:59
2018-06-11T07:17:59
94,663,893
0
0
null
false
2017-09-24T03:23:30
2017-06-18T04:00:22
2017-09-10T15:31:15
2017-09-24T03:19:48
3,599
0
0
1
Java
null
null
package com.pmdcodereview.controller; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.pmdcodereview.algo.MetadataLoginUtil; import com.pmdcodereview.model.PMDMainWrapper; import com.pmdcodereview.model.PMDStructure; import com.pmdcodereview.model.PMDStructureWrapper; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.io.IOUtils; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; /** * Created by Nagendra on 18-06-2017. */ @RestController public class PMDController { private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(PMDController.class); @Autowired MetadataLoginUtil metadataLoginUtil; @Autowired Gson gson; @Value("${partnerURL}") volatile String partnerURL; @Value("${toolingURL}") volatile String toolingURL; @RequestMapping(value = "/getPMDResultsByDateAndSeverity", method = RequestMethod.GET) public String getPMDResultByDate(HttpServletResponse response, HttpServletRequest request) throws Exception { PMDMainWrapper pmdMainWrapper = new PMDMainWrapper(); Map<String, PMDStructureWrapper> codeReviewByClass = new HashMap<>(); String partnerURL = this.partnerURL; String toolingURL = this.toolingURL; Cookie[] cookies = request.getCookies(); List<PMDStructure> violationStructure = metadataLoginUtil.startReviewer(partnerURL, toolingURL, cookies, null); PMDStructureWrapper pmdStructureWrapper = null; List<PMDStructure> pmdStructureList = null; List<PMDStructure> pmdDuplicatesList = new ArrayList<>(); int size = violationStructure.size(); long start = System.currentTimeMillis(); for (int i = 0; i < size; i++) { if (codeReviewByClass.containsKey(violationStructure.get(i).getName())) { PMDStructureWrapper pmdStructureWrapper1 = codeReviewByClass.get(violationStructure.get(i).getName()); List<PMDStructure> pmdStructures = pmdStructureWrapper1.getPmdStructures(); pmdStructures.add(violationStructure.get(i)); pmdStructureWrapper1.setPmdStructures(pmdStructures); } else { pmdStructureList = new ArrayList<>(); pmdStructureList.add(violationStructure.get(i)); pmdStructureWrapper = new PMDStructureWrapper(); pmdStructureWrapper.setPmdStructures(pmdStructureList); codeReviewByClass.put(violationStructure.get(i).getName(), pmdStructureWrapper); } } long stop = System.currentTimeMillis(); LOGGER.info("Total Time Taken from PMDController " + String.valueOf(stop - start)); if (!codeReviewByClass.isEmpty()) { pmdMainWrapper.setPmdStructureWrapper(codeReviewByClass); pmdMainWrapper.setPmdDuplicates(pmdDuplicatesList); Gson gson = new GsonBuilder().create(); return gson.toJson(pmdMainWrapper); } return null; } @RequestMapping(value = "/authenticate", method = RequestMethod.GET, params = {"code","state"}) public void auth(@RequestParam String code, @RequestParam String state, ServletResponse response, ServletRequest request) throws Exception { String environment = null; if (state.equals("b")) { environment = "https://login.salesforce.com/services/oauth2/token"; } else { environment = "https://test.salesforce.com/services/oauth2/token"; } HttpClient httpClient = new HttpClient(); PostMethod post = new PostMethod(environment); post.addParameter("code", code); post.addParameter("grant_type", "authorization_code"); post.addParameter("redirect_uri", "https://pmdreview.herokuapp.com/authenticate"); post.addParameter("client_id", "3MVG9d8..z.hDcPLDlm9QqJ3hRRkbesRhgIapRxy_yGlA3L7SXXkdyKkMPlkDMTkI72s88K2wdS3efdHJV2Ou"); post.addParameter("client_secret", "138027180311283534"); httpClient.executeMethod(post); String responseBody = post.getResponseBodyAsString(); String accessToken = null; String issuedAt = null; String signature = null; String id_token = null; String instance_url = null; JsonParser parser = new JsonParser(); JsonObject jsonObject = null; jsonObject = parser.parse(responseBody).getAsJsonObject(); try { accessToken = jsonObject.get("access_token") != null ? jsonObject.get("access_token").getAsString() : null; issuedAt = jsonObject.get("issued_at") != null ? jsonObject.get("issued_at").getAsString() : null; signature = jsonObject.get("signature") != null ? jsonObject.get("signature").getAsString() : null; id_token = jsonObject.get("id_token") != null ? jsonObject.get("id_token").getAsString() : null; instance_url = jsonObject.get("instance_url") != null ? jsonObject.get("instance_url").getAsString() : null; } catch (Exception e) { e.printStackTrace(); } finally { post.releaseConnection(); } HttpServletResponse httpResponse = (HttpServletResponse) response; Cookie session1 = new Cookie("ACCESS_TOKEN", accessToken); Cookie session2 = new Cookie("INSTANCE_URL", instance_url); Cookie session3 = new Cookie("ID_TOKEN", id_token); LOGGER.info("Access Token "+ accessToken); LOGGER.info("INSTANCE_URL "+instance_url); session1.setMaxAge(-1); //cookie not persistent, destroyed on browser exit httpResponse.addCookie(session1); httpResponse.addCookie(session2); httpResponse.addCookie(session3); httpResponse.sendRedirect("/html/pmdReview.html"); } @RequestMapping(value = "/authenticate", method = RequestMethod.GET, params = {"error", "error_description","state"}) public void authErrorHandle(@RequestParam String error, @RequestParam String error_description, @RequestParam String state, HttpServletResponse response, HttpServletRequest request) throws Exception { Cookie errorCookie = new Cookie("ERROROAUTH", URLEncoder.encode(error, "UTF-8")); Cookie errorDescCookie = new Cookie("ERROROAUTHDESC", URLEncoder.encode(error_description, "UTF-8")); response.addCookie(errorCookie); response.addCookie(errorDescCookie); response.sendRedirect("/index.html"); } @RequestMapping(value = "/logout", method = RequestMethod.GET) public void logout(ServletResponse response, ServletRequest request) throws Exception { HttpServletResponse httpResponse = (HttpServletResponse) response; HttpServletRequest httpRequest = (HttpServletRequest) request; eraseCookie(httpRequest, httpResponse); httpResponse.sendRedirect("/index.html"); } private void eraseCookie(HttpServletRequest req, HttpServletResponse resp) { Cookie[] cookies = req.getCookies(); if (cookies != null) for (Cookie cookie : cookies) { cookie.setValue(""); cookie.setMaxAge(0); resp.addCookie(cookie); } } @RequestMapping("/utilities/longProcess") public CompletableFuture<String> asyncLongProcess(HttpServletResponse response, HttpServletRequest request) { HttpSession session = request.getSession(); return CompletableFuture.supplyAsync(() -> session.getAttribute("CACHED_RESULT")) .thenComposeAsync(obj -> { if (obj == null) { if(session.getAttribute("BACKGROUND_PROCESSING") == null) { session.setAttribute("BACKGROUND_PROCESSING", true); CompletableFuture.supplyAsync(() -> callURL(response, request, null)) .thenAccept(result -> session.setAttribute("CACHED_RESULT", result)); } return CompletableFuture.completedFuture("Still Processing"); } return CompletableFuture.completedFuture(obj.toString()); }); } @RequestMapping("/utilities/longProcessStream") public StreamingResponseBody asyncLongProcessStream(HttpServletResponse response, HttpServletRequest request) { response.addHeader("Content-Type", MediaType.APPLICATION_JSON); return new StreamingResponseBody() { @Override public void writeTo(OutputStream outputStream) throws IOException { try { PMDController.this.callURL(response, request, outputStream); }finally { LOGGER.info("Closed Connection"); IOUtils.closeQuietly(outputStream); } } }; } private String callURL(HttpServletResponse response, HttpServletRequest request, OutputStream outputStream) { PMDMainWrapper pmdMainWrapper = new PMDMainWrapper(); Map<String, PMDStructureWrapper> codeReviewByClass = new HashMap<>(); String partnerURL = this.partnerURL; String toolingURL = this.toolingURL; Cookie[] cookies = request.getCookies(); List<PMDStructure> violationStructure = null; try { metadataLoginUtil.startReviewer(partnerURL, toolingURL, cookies, outputStream); } catch (Exception e) { e.printStackTrace(); } /*if(outputStream == null) { PMDStructureWrapper pmdStructureWrapper = null; List<PMDStructure> pmdStructureList = null; List<PMDStructure> pmdDuplicatesList = new ArrayList<>(); int size = violationStructure.size(); long start = System.currentTimeMillis(); for (int i = 0; i < size; i++) { if (codeReviewByClass.containsKey(violationStructure.get(i).getName())) { PMDStructureWrapper pmdStructureWrapper1 = codeReviewByClass.get(violationStructure.get(i).getName()); List<PMDStructure> pmdStructures = pmdStructureWrapper1.getPmdStructures(); pmdStructures.add(violationStructure.get(i)); pmdStructureWrapper1.setPmdStructures(pmdStructures); } else { pmdStructureList = new ArrayList<>(); pmdStructureList.add(violationStructure.get(i)); pmdStructureWrapper = new PMDStructureWrapper(); pmdStructureWrapper.setPmdStructures(pmdStructureList); codeReviewByClass.put(violationStructure.get(i).getName(), pmdStructureWrapper); } } long stop = System.currentTimeMillis(); LOGGER.info("Total Time Taken from PMDController " + String.valueOf(stop - start)); if (!codeReviewByClass.isEmpty()) { pmdMainWrapper.setPmdStructureWrapper(codeReviewByClass); pmdMainWrapper.setPmdDuplicates(pmdDuplicatesList); return gson.toJson(pmdMainWrapper); } }*/ return ""; } }
UTF-8
Java
12,472
java
PMDController.java
Java
[ { "context": "l.concurrent.CompletableFuture;\n\n/**\n * Created by Nagendra on 18-06-2017.\n */\n@RestController\npublic ", "end": 1645, "score": 0.6501261591911316, "start": 1644, "tag": "USERNAME", "value": "N" }, { "context": "concurrent.CompletableFuture;\n\n/**\n * Created by Nagendra on 18-06-2017.\n */\n@RestController\npublic class P", "end": 1652, "score": 0.8885764479637146, "start": 1645, "tag": "NAME", "value": "agendra" }, { "context": "Ou\");\n post.addParameter(\"client_secret\", \"138027180311283534\");\n\n httpClient.executeMethod(post);\n ", "end": 5224, "score": 0.9993590116500854, "start": 5206, "tag": "KEY", "value": "138027180311283534" } ]
null
[]
package com.pmdcodereview.controller; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.pmdcodereview.algo.MetadataLoginUtil; import com.pmdcodereview.model.PMDMainWrapper; import com.pmdcodereview.model.PMDStructure; import com.pmdcodereview.model.PMDStructureWrapper; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.io.IOUtils; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; /** * Created by Nagendra on 18-06-2017. */ @RestController public class PMDController { private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(PMDController.class); @Autowired MetadataLoginUtil metadataLoginUtil; @Autowired Gson gson; @Value("${partnerURL}") volatile String partnerURL; @Value("${toolingURL}") volatile String toolingURL; @RequestMapping(value = "/getPMDResultsByDateAndSeverity", method = RequestMethod.GET) public String getPMDResultByDate(HttpServletResponse response, HttpServletRequest request) throws Exception { PMDMainWrapper pmdMainWrapper = new PMDMainWrapper(); Map<String, PMDStructureWrapper> codeReviewByClass = new HashMap<>(); String partnerURL = this.partnerURL; String toolingURL = this.toolingURL; Cookie[] cookies = request.getCookies(); List<PMDStructure> violationStructure = metadataLoginUtil.startReviewer(partnerURL, toolingURL, cookies, null); PMDStructureWrapper pmdStructureWrapper = null; List<PMDStructure> pmdStructureList = null; List<PMDStructure> pmdDuplicatesList = new ArrayList<>(); int size = violationStructure.size(); long start = System.currentTimeMillis(); for (int i = 0; i < size; i++) { if (codeReviewByClass.containsKey(violationStructure.get(i).getName())) { PMDStructureWrapper pmdStructureWrapper1 = codeReviewByClass.get(violationStructure.get(i).getName()); List<PMDStructure> pmdStructures = pmdStructureWrapper1.getPmdStructures(); pmdStructures.add(violationStructure.get(i)); pmdStructureWrapper1.setPmdStructures(pmdStructures); } else { pmdStructureList = new ArrayList<>(); pmdStructureList.add(violationStructure.get(i)); pmdStructureWrapper = new PMDStructureWrapper(); pmdStructureWrapper.setPmdStructures(pmdStructureList); codeReviewByClass.put(violationStructure.get(i).getName(), pmdStructureWrapper); } } long stop = System.currentTimeMillis(); LOGGER.info("Total Time Taken from PMDController " + String.valueOf(stop - start)); if (!codeReviewByClass.isEmpty()) { pmdMainWrapper.setPmdStructureWrapper(codeReviewByClass); pmdMainWrapper.setPmdDuplicates(pmdDuplicatesList); Gson gson = new GsonBuilder().create(); return gson.toJson(pmdMainWrapper); } return null; } @RequestMapping(value = "/authenticate", method = RequestMethod.GET, params = {"code","state"}) public void auth(@RequestParam String code, @RequestParam String state, ServletResponse response, ServletRequest request) throws Exception { String environment = null; if (state.equals("b")) { environment = "https://login.salesforce.com/services/oauth2/token"; } else { environment = "https://test.salesforce.com/services/oauth2/token"; } HttpClient httpClient = new HttpClient(); PostMethod post = new PostMethod(environment); post.addParameter("code", code); post.addParameter("grant_type", "authorization_code"); post.addParameter("redirect_uri", "https://pmdreview.herokuapp.com/authenticate"); post.addParameter("client_id", "3MVG9d8..z.hDcPLDlm9QqJ3hRRkbesRhgIapRxy_yGlA3L7SXXkdyKkMPlkDMTkI72s88K2wdS3efdHJV2Ou"); post.addParameter("client_secret", "138027180311283534"); httpClient.executeMethod(post); String responseBody = post.getResponseBodyAsString(); String accessToken = null; String issuedAt = null; String signature = null; String id_token = null; String instance_url = null; JsonParser parser = new JsonParser(); JsonObject jsonObject = null; jsonObject = parser.parse(responseBody).getAsJsonObject(); try { accessToken = jsonObject.get("access_token") != null ? jsonObject.get("access_token").getAsString() : null; issuedAt = jsonObject.get("issued_at") != null ? jsonObject.get("issued_at").getAsString() : null; signature = jsonObject.get("signature") != null ? jsonObject.get("signature").getAsString() : null; id_token = jsonObject.get("id_token") != null ? jsonObject.get("id_token").getAsString() : null; instance_url = jsonObject.get("instance_url") != null ? jsonObject.get("instance_url").getAsString() : null; } catch (Exception e) { e.printStackTrace(); } finally { post.releaseConnection(); } HttpServletResponse httpResponse = (HttpServletResponse) response; Cookie session1 = new Cookie("ACCESS_TOKEN", accessToken); Cookie session2 = new Cookie("INSTANCE_URL", instance_url); Cookie session3 = new Cookie("ID_TOKEN", id_token); LOGGER.info("Access Token "+ accessToken); LOGGER.info("INSTANCE_URL "+instance_url); session1.setMaxAge(-1); //cookie not persistent, destroyed on browser exit httpResponse.addCookie(session1); httpResponse.addCookie(session2); httpResponse.addCookie(session3); httpResponse.sendRedirect("/html/pmdReview.html"); } @RequestMapping(value = "/authenticate", method = RequestMethod.GET, params = {"error", "error_description","state"}) public void authErrorHandle(@RequestParam String error, @RequestParam String error_description, @RequestParam String state, HttpServletResponse response, HttpServletRequest request) throws Exception { Cookie errorCookie = new Cookie("ERROROAUTH", URLEncoder.encode(error, "UTF-8")); Cookie errorDescCookie = new Cookie("ERROROAUTHDESC", URLEncoder.encode(error_description, "UTF-8")); response.addCookie(errorCookie); response.addCookie(errorDescCookie); response.sendRedirect("/index.html"); } @RequestMapping(value = "/logout", method = RequestMethod.GET) public void logout(ServletResponse response, ServletRequest request) throws Exception { HttpServletResponse httpResponse = (HttpServletResponse) response; HttpServletRequest httpRequest = (HttpServletRequest) request; eraseCookie(httpRequest, httpResponse); httpResponse.sendRedirect("/index.html"); } private void eraseCookie(HttpServletRequest req, HttpServletResponse resp) { Cookie[] cookies = req.getCookies(); if (cookies != null) for (Cookie cookie : cookies) { cookie.setValue(""); cookie.setMaxAge(0); resp.addCookie(cookie); } } @RequestMapping("/utilities/longProcess") public CompletableFuture<String> asyncLongProcess(HttpServletResponse response, HttpServletRequest request) { HttpSession session = request.getSession(); return CompletableFuture.supplyAsync(() -> session.getAttribute("CACHED_RESULT")) .thenComposeAsync(obj -> { if (obj == null) { if(session.getAttribute("BACKGROUND_PROCESSING") == null) { session.setAttribute("BACKGROUND_PROCESSING", true); CompletableFuture.supplyAsync(() -> callURL(response, request, null)) .thenAccept(result -> session.setAttribute("CACHED_RESULT", result)); } return CompletableFuture.completedFuture("Still Processing"); } return CompletableFuture.completedFuture(obj.toString()); }); } @RequestMapping("/utilities/longProcessStream") public StreamingResponseBody asyncLongProcessStream(HttpServletResponse response, HttpServletRequest request) { response.addHeader("Content-Type", MediaType.APPLICATION_JSON); return new StreamingResponseBody() { @Override public void writeTo(OutputStream outputStream) throws IOException { try { PMDController.this.callURL(response, request, outputStream); }finally { LOGGER.info("Closed Connection"); IOUtils.closeQuietly(outputStream); } } }; } private String callURL(HttpServletResponse response, HttpServletRequest request, OutputStream outputStream) { PMDMainWrapper pmdMainWrapper = new PMDMainWrapper(); Map<String, PMDStructureWrapper> codeReviewByClass = new HashMap<>(); String partnerURL = this.partnerURL; String toolingURL = this.toolingURL; Cookie[] cookies = request.getCookies(); List<PMDStructure> violationStructure = null; try { metadataLoginUtil.startReviewer(partnerURL, toolingURL, cookies, outputStream); } catch (Exception e) { e.printStackTrace(); } /*if(outputStream == null) { PMDStructureWrapper pmdStructureWrapper = null; List<PMDStructure> pmdStructureList = null; List<PMDStructure> pmdDuplicatesList = new ArrayList<>(); int size = violationStructure.size(); long start = System.currentTimeMillis(); for (int i = 0; i < size; i++) { if (codeReviewByClass.containsKey(violationStructure.get(i).getName())) { PMDStructureWrapper pmdStructureWrapper1 = codeReviewByClass.get(violationStructure.get(i).getName()); List<PMDStructure> pmdStructures = pmdStructureWrapper1.getPmdStructures(); pmdStructures.add(violationStructure.get(i)); pmdStructureWrapper1.setPmdStructures(pmdStructures); } else { pmdStructureList = new ArrayList<>(); pmdStructureList.add(violationStructure.get(i)); pmdStructureWrapper = new PMDStructureWrapper(); pmdStructureWrapper.setPmdStructures(pmdStructureList); codeReviewByClass.put(violationStructure.get(i).getName(), pmdStructureWrapper); } } long stop = System.currentTimeMillis(); LOGGER.info("Total Time Taken from PMDController " + String.valueOf(stop - start)); if (!codeReviewByClass.isEmpty()) { pmdMainWrapper.setPmdStructureWrapper(codeReviewByClass); pmdMainWrapper.setPmdDuplicates(pmdDuplicatesList); return gson.toJson(pmdMainWrapper); } }*/ return ""; } }
12,472
0.665972
0.66092
286
42.608391
33.857792
144
false
false
0
0
0
0
0
0
0.762238
false
false
12
ca54342edbc657078cd6849100e28b946087776f
24,859,270,756,386
9d98b6bacb816407fb880eebb08009db925930b9
/provider-api-learn/src/main/java/com/sxdubboapi/learn/service/UserTestService.java
543e68707d93b6743e7a188cc51916e6fdc1b4e0
[]
no_license
xiaobinf/imooc_springBoot
https://github.com/xiaobinf/imooc_springBoot
f37e17e6e6f9d3419513db97114885302ba84645
4eaba396e790663a5f746749caa357e7ca8ee596
refs/heads/master
2020-03-08T21:11:13.750000
2018-04-06T14:00:20
2018-04-06T14:00:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sxdubboapi.learn.service; import com.sxdubboapi.learn.domain.Course; import com.sxdubboapi.learn.domain.TestPaper; import com.sxdubboapi.learn.domain.User; import com.sxdubboapi.learn.domain.UserTest; import java.util.List; /** * created by luwei * 2018-03-05 13:21. **/ public interface UserTestService { public List<UserTest> findByCourse(Course course); public List<UserTest> findByUser(User user); public UserTest findByTest(TestPaper testPaper); public UserTest findByCourseAndUser(Course course,User user); public UserTest findById(Integer id); public UserTest addUserTest(UserTest userTest); public void deleteUserTest(Integer userTestId); }
UTF-8
Java
718
java
UserTestService.java
Java
[ { "context": ";\r\n\r\nimport java.util.List;\r\n\r\n/**\r\n * created by luwei\r\n * 2018-03-05 13:21.\r\n **/\r\npublic interface Use", "end": 273, "score": 0.9996553659439087, "start": 268, "tag": "USERNAME", "value": "luwei" } ]
null
[]
package com.sxdubboapi.learn.service; import com.sxdubboapi.learn.domain.Course; import com.sxdubboapi.learn.domain.TestPaper; import com.sxdubboapi.learn.domain.User; import com.sxdubboapi.learn.domain.UserTest; import java.util.List; /** * created by luwei * 2018-03-05 13:21. **/ public interface UserTestService { public List<UserTest> findByCourse(Course course); public List<UserTest> findByUser(User user); public UserTest findByTest(TestPaper testPaper); public UserTest findByCourseAndUser(Course course,User user); public UserTest findById(Integer id); public UserTest addUserTest(UserTest userTest); public void deleteUserTest(Integer userTestId); }
718
0.750696
0.733983
22
30.636364
20.827311
65
false
false
0
0
0
0
0
0
0.636364
false
false
12
f3cb0a9598f803f6f0c23c41db8eaea238d94c77
21,930,103,057,683
15e5db5eb16016ab4373662dd0b7ff16c41ffbc7
/app/dgi/soap/consultas/ConsultaRUCEmisores.java
139bd0dda338c08aead81b3f5944c904f63a3253
[ "MIT" ]
permissive
nicoribeiro/java_efactura_uy
https://github.com/nicoribeiro/java_efactura_uy
ac5b1b805207241c097d9513acd3a1958fd88f71
e3f057b0fce33171cf3b24ad31faf8f00b4d540c
refs/heads/master
2023-08-16T03:44:25.844000
2023-08-08T15:28:55
2023-08-08T15:28:55
36,691,277
6
5
MIT
false
2021-03-31T23:07:10
2015-06-01T21:54:35
2021-03-26T19:37:58
2021-03-31T23:07:09
8,866
4
2
4
Java
false
false
package dgi.soap.consultas; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for ConsultaRUCEmisores complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ConsultaRUCEmisores"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;all&gt; * &lt;element name="Filtro_eFacDocNro" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Filtro_eFacDenominacion" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Filtro_eFacRUCEmisorAudFchHora" type="{http://www.w3.org/2001/XMLSchema}dateTime"/&gt; * &lt;/all&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ConsultaRUCEmisores", propOrder = { }) public class ConsultaRUCEmisores { @XmlElement(name = "Filtro_eFacDocNro", required = true) protected String filtroEFacDocNro; @XmlElement(name = "Filtro_eFacDenominacion", required = true) protected String filtroEFacDenominacion; @XmlElement(name = "Filtro_eFacRUCEmisorAudFchHora", required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar filtroEFacRUCEmisorAudFchHora; /** * Gets the value of the filtroEFacDocNro property. * * @return * possible object is * {@link String } * */ public String getFiltroEFacDocNro() { return filtroEFacDocNro; } /** * Sets the value of the filtroEFacDocNro property. * * @param value * allowed object is * {@link String } * */ public void setFiltroEFacDocNro(String value) { this.filtroEFacDocNro = value; } /** * Gets the value of the filtroEFacDenominacion property. * * @return * possible object is * {@link String } * */ public String getFiltroEFacDenominacion() { return filtroEFacDenominacion; } /** * Sets the value of the filtroEFacDenominacion property. * * @param value * allowed object is * {@link String } * */ public void setFiltroEFacDenominacion(String value) { this.filtroEFacDenominacion = value; } /** * Gets the value of the filtroEFacRUCEmisorAudFchHora property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFiltroEFacRUCEmisorAudFchHora() { return filtroEFacRUCEmisorAudFchHora; } /** * Sets the value of the filtroEFacRUCEmisorAudFchHora property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFiltroEFacRUCEmisorAudFchHora(XMLGregorianCalendar value) { this.filtroEFacRUCEmisorAudFchHora = value; } }
UTF-8
Java
3,339
java
ConsultaRUCEmisores.java
Java
[]
null
[]
package dgi.soap.consultas; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for ConsultaRUCEmisores complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ConsultaRUCEmisores"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;all&gt; * &lt;element name="Filtro_eFacDocNro" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Filtro_eFacDenominacion" type="{http://www.w3.org/2001/XMLSchema}string"/&gt; * &lt;element name="Filtro_eFacRUCEmisorAudFchHora" type="{http://www.w3.org/2001/XMLSchema}dateTime"/&gt; * &lt;/all&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ConsultaRUCEmisores", propOrder = { }) public class ConsultaRUCEmisores { @XmlElement(name = "Filtro_eFacDocNro", required = true) protected String filtroEFacDocNro; @XmlElement(name = "Filtro_eFacDenominacion", required = true) protected String filtroEFacDenominacion; @XmlElement(name = "Filtro_eFacRUCEmisorAudFchHora", required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar filtroEFacRUCEmisorAudFchHora; /** * Gets the value of the filtroEFacDocNro property. * * @return * possible object is * {@link String } * */ public String getFiltroEFacDocNro() { return filtroEFacDocNro; } /** * Sets the value of the filtroEFacDocNro property. * * @param value * allowed object is * {@link String } * */ public void setFiltroEFacDocNro(String value) { this.filtroEFacDocNro = value; } /** * Gets the value of the filtroEFacDenominacion property. * * @return * possible object is * {@link String } * */ public String getFiltroEFacDenominacion() { return filtroEFacDenominacion; } /** * Sets the value of the filtroEFacDenominacion property. * * @param value * allowed object is * {@link String } * */ public void setFiltroEFacDenominacion(String value) { this.filtroEFacDenominacion = value; } /** * Gets the value of the filtroEFacRUCEmisorAudFchHora property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getFiltroEFacRUCEmisorAudFchHora() { return filtroEFacRUCEmisorAudFchHora; } /** * Sets the value of the filtroEFacRUCEmisorAudFchHora property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setFiltroEFacRUCEmisorAudFchHora(XMLGregorianCalendar value) { this.filtroEFacRUCEmisorAudFchHora = value; } }
3,339
0.643007
0.637017
118
27.288136
25.892248
115
false
false
0
0
0
0
0
0
0.355932
false
false
12
41c5c0b555512925dbb36f81b2ad03fd7bba9012
6,803,228,202,877
f91a5b92df78bdd2df55a841a777c4b16d2938a6
/AlexBaz/Lesson_26/strategy/StrategyClient.java
fa511b9e2be202ea52178ba0a37b19bb275b8dff
[]
no_license
rubfan/java-elementary-0804
https://github.com/rubfan/java-elementary-0804
a3f2209c8e616c96df0a684a69b02786adf33cbc
1cea7b2f1cd3a68d49972562498e991d5ad985f0
refs/heads/master
2023-03-11T14:45:47.823000
2020-08-20T00:09:05
2020-08-20T00:09:05
255,116,046
0
17
null
false
2020-12-29T02:27:41
2020-04-12T15:46:24
2020-08-20T00:09:08
2020-10-14T00:16:55
743
0
13
17
Java
false
false
package strategy; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) { StrategyClient strategyClient = new StrategyClient(); List<FootballPlayerBombardier> playerBombardiers = new ArrayList<FootballPlayerBombardier>(); playerBombardiers.add(new FootballPlayerBombardier("Александр Филиппов", "Десна", 16, 30)); playerBombardiers.add(new FootballPlayerBombardier("Владислав Супряга", "Днепр-1", 14, 24)); playerBombardiers.add(new FootballPlayerBombardier("Жуниор Мораес", "Шахтер", 20, 27)); playerBombardiers.add(new FootballPlayerBombardier("Виктор Цыганков", "Динамо ", 14, 27)); playerBombardiers.add(new FootballPlayerBombardier("Богдан Леднев", "Заря", 10, 25)); playerBombardiers.add(new FootballPlayerBombardier("Марлос", "Шахтер", 13, 24)); playerBombardiers.add(new FootballPlayerBombardier("Беньямин Вербич", "Динамо Киев", 11, 25)); playerBombardiers.add(new FootballPlayerBombardier("Виталий Буяльский", "Динамо Киев", 9, 27)); playerBombardiers.add(new FootballPlayerBombardier("Тайсон", "Шахтер", 10, 25)); playerBombardiers.add(new FootballPlayerBombardier("Максим Третьяков", "Александрия", 10, 28)); strategyClient.setStrategy(new SortGames()); strategyClient.executeStrategy(playerBombardiers); System.out.println("__________________________________________________________________________"); strategyClient.setStrategy(new SortGoals()); strategyClient.executeStrategy(playerBombardiers); } } interface Sorting { public void sort(List<FootballPlayerBombardier> playerBombardiers); } public class StrategyClient { Sorting strategy; public void setStrategy(Sorting strategy) { this.strategy = strategy; } public void executeStrategy(List<FootballPlayerBombardier> playerBombardiers) { strategy.sort(playerBombardiers); } } class SortGames implements Sorting { public void sort(List<FootballPlayerBombardier> players) { List<FootballPlayerBombardier> playerBombardiers = players; boolean isSorted = false; FootballPlayerBombardier buf; while (!isSorted) { isSorted = true; for (int i = 0; i < playerBombardiers.size() - 1; i++) { if (playerBombardiers.get(i).getGames() < playerBombardiers.get(i + 1).getGames()) { isSorted = false; buf = playerBombardiers.get(i); playerBombardiers.set(i, playerBombardiers.get(i + 1)); playerBombardiers.set(i + 1, buf); } } } for (FootballPlayerBombardier item : playerBombardiers) { System.out.println(item.toString()); } } } class SortGoals implements Sorting { public void sort(List<FootballPlayerBombardier> players) { List<FootballPlayerBombardier> playerBombardiers = players; boolean isSorted = false; FootballPlayerBombardier buf; while (!isSorted) { isSorted = true; for (int i = 0; i < playerBombardiers.size() - 1; i++) { if (playerBombardiers.get(i).getGoals() < playerBombardiers.get(i + 1).getGoals()) { isSorted = false; buf = playerBombardiers.get(i); playerBombardiers.set(i, playerBombardiers.get(i + 1)); playerBombardiers.set(i + 1, buf); } } } for (FootballPlayerBombardier item : playerBombardiers) { System.out.println(item.toString()); } } }
UTF-8
Java
3,910
java
StrategyClient.java
Java
[ { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Александр Филиппов\", \"Десна\", 16, 30));\n playerBombardiers.ad", "end": 373, "score": 0.9998900294303894, "start": 355, "tag": "NAME", "value": "Александр Филиппов" }, { "context": "w FootballPlayerBombardier(\"Александр Филиппов\", \"Десна\", 16, 30));\n playerBombardiers.add(new Foo", "end": 382, "score": 0.9998237490653992, "start": 377, "tag": "NAME", "value": "Десна" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Владислав Супряга\", \"Днепр-1\", 14, 24));\n playerBombardiers.", "end": 472, "score": 0.9998888969421387, "start": 455, "tag": "NAME", "value": "Владислав Супряга" }, { "context": "w FootballPlayerBombardier(\"Владислав Супряга\", \"Днепр-1\", 14, 24));\n playerBombardiers.add(new F", "end": 481, "score": 0.7442030310630798, "start": 477, "tag": "NAME", "value": "непр" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Жуниор Мораес\", \"Шахтер\", 20, 27));\n playerBombardiers.a", "end": 569, "score": 0.9998319149017334, "start": 556, "tag": "NAME", "value": "Жуниор Мораес" }, { "context": "dd(new FootballPlayerBombardier(\"Жуниор Мораес\", \"Шахтер\", 20, 27));\n playerBombardiers.add(new Foo", "end": 579, "score": 0.9997208118438721, "start": 573, "tag": "NAME", "value": "Шахтер" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Виктор Цыганков\", \"Динамо \", 14, 27));\n playerBombardiers.", "end": 667, "score": 0.9998756051063538, "start": 652, "tag": "NAME", "value": "Виктор Цыганков" }, { "context": "(new FootballPlayerBombardier(\"Виктор Цыганков\", \"Динамо \", 14, 27));\n playerBombardiers.add(new Fo", "end": 677, "score": 0.999859094619751, "start": 671, "tag": "NAME", "value": "Динамо" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Богдан Леднев\", \"Заря\", 10, 25));\n playerBombardiers.add", "end": 764, "score": 0.9998828172683716, "start": 751, "tag": "NAME", "value": "Богдан Леднев" }, { "context": "dd(new FootballPlayerBombardier(\"Богдан Леднев\", \"Заря\", 10, 25));\n playerBombardiers.add(new Foo", "end": 772, "score": 0.9998683333396912, "start": 768, "tag": "NAME", "value": "Заря" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Марлос\", \"Шахтер\", 13, 24));\n playerBombardiers.a", "end": 851, "score": 0.9998796582221985, "start": 845, "tag": "NAME", "value": "Марлос" }, { "context": "diers.add(new FootballPlayerBombardier(\"Марлос\", \"Шахтер\", 13, 24));\n playerBombardiers.add(new Foo", "end": 861, "score": 0.9996310472488403, "start": 855, "tag": "NAME", "value": "Шахтер" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Беньямин Вербич\", \"Динамо Киев\", 11, 25));\n playerBombardi", "end": 949, "score": 0.9998816251754761, "start": 934, "tag": "NAME", "value": "Беньямин Вербич" }, { "context": "(new FootballPlayerBombardier(\"Беньямин Вербич\", \"Динамо Киев\", 11, 25));\n playerBombardiers.add(new Foo", "end": 964, "score": 0.9998836517333984, "start": 953, "tag": "NAME", "value": "Динамо Киев" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Виталий Буяльский\", \"Динамо Киев\", 9, 27));\n playerBombardie", "end": 1054, "score": 0.9998833537101746, "start": 1037, "tag": "NAME", "value": "Виталий Буяльский" }, { "context": "ew FootballPlayerBombardier(\"Виталий Буяльский\", \"Динамо Киев\", 9, 27));\n playerBombardiers.add(new Foot", "end": 1069, "score": 0.9998695254325867, "start": 1058, "tag": "NAME", "value": "Динамо Киев" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Тайсон\", \"Шахтер\", 10, 25));\n playerBombardiers.a", "end": 1147, "score": 0.9998749494552612, "start": 1141, "tag": "NAME", "value": "Тайсон" }, { "context": "diers.add(new FootballPlayerBombardier(\"Тайсон\", \"Шахтер\", 10, 25));\n playerBombardiers.add(new Foo", "end": 1157, "score": 0.9997653365135193, "start": 1151, "tag": "NAME", "value": "Шахтер" }, { "context": "ayerBombardiers.add(new FootballPlayerBombardier(\"Максим Третьяков\", \"Александрия\", 10, 28));\n\n strategyClien", "end": 1246, "score": 0.9998641014099121, "start": 1230, "tag": "NAME", "value": "Максим Третьяков" }, { "context": "new FootballPlayerBombardier(\"Максим Третьяков\", \"Александрия\", 10, 28));\n\n strategyClient.setStrategy(n", "end": 1261, "score": 0.9998658299446106, "start": 1250, "tag": "NAME", "value": "Александрия" } ]
null
[]
package strategy; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) { StrategyClient strategyClient = new StrategyClient(); List<FootballPlayerBombardier> playerBombardiers = new ArrayList<FootballPlayerBombardier>(); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "Десна", 16, 30)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "Днепр-1", 14, 24)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "Шахтер", 20, 27)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "Динамо ", 14, 27)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "Заря", 10, 25)); playerBombardiers.add(new FootballPlayerBombardier("Марлос", "Шахтер", 13, 24)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "<NAME>", 11, 25)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "<NAME>", 9, 27)); playerBombardiers.add(new FootballPlayerBombardier("Тайсон", "Шахтер", 10, 25)); playerBombardiers.add(new FootballPlayerBombardier("<NAME>", "Александрия", 10, 28)); strategyClient.setStrategy(new SortGames()); strategyClient.executeStrategy(playerBombardiers); System.out.println("__________________________________________________________________________"); strategyClient.setStrategy(new SortGoals()); strategyClient.executeStrategy(playerBombardiers); } } interface Sorting { public void sort(List<FootballPlayerBombardier> playerBombardiers); } public class StrategyClient { Sorting strategy; public void setStrategy(Sorting strategy) { this.strategy = strategy; } public void executeStrategy(List<FootballPlayerBombardier> playerBombardiers) { strategy.sort(playerBombardiers); } } class SortGames implements Sorting { public void sort(List<FootballPlayerBombardier> players) { List<FootballPlayerBombardier> playerBombardiers = players; boolean isSorted = false; FootballPlayerBombardier buf; while (!isSorted) { isSorted = true; for (int i = 0; i < playerBombardiers.size() - 1; i++) { if (playerBombardiers.get(i).getGames() < playerBombardiers.get(i + 1).getGames()) { isSorted = false; buf = playerBombardiers.get(i); playerBombardiers.set(i, playerBombardiers.get(i + 1)); playerBombardiers.set(i + 1, buf); } } } for (FootballPlayerBombardier item : playerBombardiers) { System.out.println(item.toString()); } } } class SortGoals implements Sorting { public void sort(List<FootballPlayerBombardier> players) { List<FootballPlayerBombardier> playerBombardiers = players; boolean isSorted = false; FootballPlayerBombardier buf; while (!isSorted) { isSorted = true; for (int i = 0; i < playerBombardiers.size() - 1; i++) { if (playerBombardiers.get(i).getGoals() < playerBombardiers.get(i + 1).getGoals()) { isSorted = false; buf = playerBombardiers.get(i); playerBombardiers.set(i, playerBombardiers.get(i + 1)); playerBombardiers.set(i + 1, buf); } } } for (FootballPlayerBombardier item : playerBombardiers) { System.out.println(item.toString()); } } }
3,688
0.629141
0.615675
89
40.719101
33.810108
105
false
false
0
0
0
0
0
0
0.898876
false
false
12
10a5b03ff551c24248be15f88bdea39638ed01f9
14,688,788,157,486
864377046c3a497f056bfd1431a4e4e55f828163
/library/src/androidTest/java/com/baasbox/android/test/common/TestBase.java
cc9f578f62b8bd7227093507840e606c343ae858
[ "Apache-2.0" ]
permissive
nicomon24/Android-SDK
https://github.com/nicomon24/Android-SDK
8c8df0a8fac413153a2adaad5b406983048225c5
6bb2203246b885b2ad63a7bfaf37c83caf15e0d8
refs/heads/master
2018-01-16T15:03:45.708000
2015-12-14T08:48:42
2015-12-14T08:48:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2014. BaasBox * * 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.baasbox.android.test.common; import android.content.Context; import android.test.AndroidTestCase; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * Created by Andrea Tortorella on 01/02/14. */ public class TestBase extends AndroidTestCase { private static final Method TEST_CONTEXT_METHOD; static { Method m; try { m = AndroidTestCase.class.getMethod("getTestContext"); } catch (NoSuchMethodException e) { m = null; } TEST_CONTEXT_METHOD = m; } private int totalTests; private boolean first = true; public Context getTest(){ try { Object invoke = TEST_CONTEXT_METHOD.invoke(this); return (Context)invoke; } catch (NullPointerException e){ return null; }catch (IllegalAccessException e) { return null; } catch (InvocationTargetException e) { return null; } } public TestBase(){ Method[] methods = getClass().getDeclaredMethods(); int tests = 0; for(Method m:methods){ boolean test = m.getName().startsWith("test"); if(test) tests++; } totalTests=tests; } protected <T> void assertIsOneOf(T check,T ... values){ for(T v:values){ if(v.equals(check)) return; } fail(); } @Override protected final void setUp() throws Exception { super.setUp(); if(first){ first=false; beforeClass(); } beforeTest(); } protected void beforeTest() throws Exception{} protected void beforeClass() throws Exception{} protected void afterTest() throws Exception{} protected void afterClass() throws Exception{} @Override protected final void tearDown() throws Exception { super.tearDown(); afterTest(); totalTests--; if (totalTests==0){ afterClass(); } } }
UTF-8
Java
2,656
java
TestBase.java
Java
[ { "context": "mport java.lang.reflect.Method;\n\n/**\n * Created by Andrea Tortorella on 01/02/14.\n */\npublic class TestBase extends An", "end": 829, "score": 0.9998458027839661, "start": 812, "tag": "NAME", "value": "Andrea Tortorella" } ]
null
[]
/* * Copyright (C) 2014. BaasBox * * 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.baasbox.android.test.common; import android.content.Context; import android.test.AndroidTestCase; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * Created by <NAME> on 01/02/14. */ public class TestBase extends AndroidTestCase { private static final Method TEST_CONTEXT_METHOD; static { Method m; try { m = AndroidTestCase.class.getMethod("getTestContext"); } catch (NoSuchMethodException e) { m = null; } TEST_CONTEXT_METHOD = m; } private int totalTests; private boolean first = true; public Context getTest(){ try { Object invoke = TEST_CONTEXT_METHOD.invoke(this); return (Context)invoke; } catch (NullPointerException e){ return null; }catch (IllegalAccessException e) { return null; } catch (InvocationTargetException e) { return null; } } public TestBase(){ Method[] methods = getClass().getDeclaredMethods(); int tests = 0; for(Method m:methods){ boolean test = m.getName().startsWith("test"); if(test) tests++; } totalTests=tests; } protected <T> void assertIsOneOf(T check,T ... values){ for(T v:values){ if(v.equals(check)) return; } fail(); } @Override protected final void setUp() throws Exception { super.setUp(); if(first){ first=false; beforeClass(); } beforeTest(); } protected void beforeTest() throws Exception{} protected void beforeClass() throws Exception{} protected void afterTest() throws Exception{} protected void afterClass() throws Exception{} @Override protected final void tearDown() throws Exception { super.tearDown(); afterTest(); totalTests--; if (totalTests==0){ afterClass(); } } }
2,645
0.613705
0.607681
103
24.786407
22.468382
101
false
false
0
0
0
0
0
0
0.368932
false
false
12