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
f36ba7b10d2abb865c41da43a13d15e6fa342ac2
39,264,591,053,773
d7075ca7af2997ebf9ed21f1104c1d3e008ae155
/demo/src/main/java/com/weixin/demo/service/orderService/OrderServiceImp.java
59b4548c8929d2214dee81ee5f8866347749111d
[]
no_license
QQ502063237/wx-repository
https://github.com/QQ502063237/wx-repository
4e45234d14ae742fc74e2d1d0f809d3ff3435746
52679d50eb66896291ddf4cbf22a478f866803fb
refs/heads/master
2022-06-22T16:09:59.181000
2020-02-09T10:02:13
2020-02-09T10:02:13
233,325,859
1
0
null
false
2022-02-01T01:01:20
2020-01-12T02:13:53
2020-02-09T10:04:22
2022-02-01T01:01:18
53,908
0
0
3
Roff
false
false
package com.weixin.demo.service.orderService; import com.weixin.demo.entity.order.Order; import com.weixin.demo.mapper.OrderMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class OrderServiceImp implements OrderService { @Autowired OrderMapper orderMapper; @Override public int insertOrder(Order order) { int flag = orderMapper.insert(order); return flag; } }
UTF-8
Java
484
java
OrderServiceImp.java
Java
[]
null
[]
package com.weixin.demo.service.orderService; import com.weixin.demo.entity.order.Order; import com.weixin.demo.mapper.OrderMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class OrderServiceImp implements OrderService { @Autowired OrderMapper orderMapper; @Override public int insertOrder(Order order) { int flag = orderMapper.insert(order); return flag; } }
484
0.762397
0.762397
18
25.888889
20.695917
62
false
false
0
0
0
0
0
0
0.444444
false
false
13
eb9a8c2f7d0b3d8f5e445c672f5b87f15024a7da
36,112,085,059,927
4192a090f26a92e7a4c504b95157f926453535b9
/Banda/src/banda/Maracas.java
c1d6c67ea5261e3668733ce0b37e50fe6f19bff1
[]
no_license
GabrielaAntolinez/Modelos-1
https://github.com/GabrielaAntolinez/Modelos-1
1f676a58314bcaca59c9ea69bdc14b5d6fd9d241
be8b81e34f6c53c3cc33fac8662cc9243ae7127a
refs/heads/master
2020-03-25T18:46:19.382000
2018-10-09T22:26:46
2018-10-09T22:26:46
144,047,211
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package banda; /** * * @author angiegabrielaantolinezsegura */ public class Maracas extends Instrumen { public Maracas() { Nombre= "Maracas"; Tipo = "Percusion"; afinacion = "- Las maracas no se afinan."; } }
UTF-8
Java
446
java
Maracas.java
Java
[ { "context": " the editor.\n */\npackage banda;\n\n/**\n *\n * @author angiegabrielaantolinezsegura\n */\npublic class Maracas extends Instrumen {\n\n ", "end": 247, "score": 0.964874267578125, "start": 219, "tag": "USERNAME", "value": "angiegabrielaantolinezsegura" }, { "context": "trumen {\n\n public Maracas() {\n Nombre= \"Maracas\";\n Tipo = \"Percusion\";\n afinacion =", "end": 341, "score": 0.9991485476493835, "start": 334, "tag": "NAME", "value": "Maracas" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package banda; /** * * @author angiegabrielaantolinezsegura */ public class Maracas extends Instrumen { public Maracas() { Nombre= "Maracas"; Tipo = "Percusion"; afinacion = "- Las maracas no se afinan."; } }
446
0.639013
0.639013
22
19.272728
22.006573
79
false
false
0
0
0
0
0
0
0.318182
false
false
13
abf58f9af2fc4114e8f9f1ef54bcec36711f0e9d
37,366,215,499,729
451327c1a93b386ede582e5e56e79e946285da09
/app/src/main/java/com/inspur/electric/model/Tasks.java
a05ad03d623b25b820634121d38a87c90117dd62
[]
no_license
lixujiayou/Electric
https://github.com/lixujiayou/Electric
86941cc3363fc456c52d36a9c91070953b4039ff
ae5d909fd4aaeabdcdb980f76d060781f38d46ec
refs/heads/master
2019-04-30T08:14:14.566000
2017-07-14T11:40:52
2017-07-14T11:40:52
94,416,343
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.inspur.electric.model; import java.io.Serializable; import java.util.List; /** * Created by Administrator on 2016/12/3 0003. */ public class Tasks implements Serializable{ /** * runSuccess : true * isValid : true * message : 查找待办任务列表 * totalCount : 1 * items : [{"INT_ID":3,"jz_name":"辽阳市区尚村西" * ,"phy_site_no":"410711700000120604" * ,"sy_ds":"沈阳市","sy_qx":"铁西区" * ,"db_num":"11" * ,"sccb_time":"2016-10-04" * ,"sc_bm":"1111" * ,"scjy_dl":1111 * ,"bccb_time":"2016-12-15" * ,"bc_bm":null * ,"sh_dl":null,"cbr":"admin" * ,"gd_zt":0,"cb_end_time":null * ,"jd_time":null,"is_wrong":0 * ,"wrong_info":"" * ,"TIME_STAMP":null * ,"CREATE_TIME":null * ,"CREATOR":"admin" * ,"STATEFLAG":0}] */ private boolean runSuccess; private boolean isValid; private String message; private int totalCount; private List<ItemsBean> items; public boolean isRunSuccess() { return runSuccess; } public void setRunSuccess(boolean runSuccess) { this.runSuccess = runSuccess; } public boolean isIsValid() { return isValid; } public void setIsValid(boolean isValid) { this.isValid = isValid; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public List<ItemsBean> getItems() { return items; } public void setItems(List<ItemsBean> items) { this.items = items; } public static class ItemsBean implements Serializable{ /** * INT_ID : 3 * jz_name : 辽阳市区尚村西 * phy_site_no : 410711700000120604 * sy_ds : 沈阳市 * sy_qx : 铁西区 * db_num : 11 * sccb_time : 2016-10-04 //上次抄表时间 * sc_bm : 1111 * scjy_dl : 1111 * bccb_time : 2016-12-15 //本次抄表时间 * bc_bm : null // * sh_dl : null * cbr : admin // * gd_zt : 0 * cb_end_time : null * jd_time : null * is_wrong : 0 * wrong_info : * TIME_STAMP : null * CREATE_TIME : null * CREATOR : admin * STATEFLAG : 0 */ private int INT_ID; private String jz_name; private String phy_site_no; private String sy_ds; private String sy_qx; private String db_num; private String sccb_time; private String sc_bm; private int scjy_dl; private String bccb_time; private Object bc_bm; private Object sh_dl; private String cbr; private int gd_zt; private Object cb_end_time; private Object jd_time; private int is_wrong; private String wrong_info; private Object TIME_STAMP; private Object CREATE_TIME; private String CREATOR; private int STATEFLAG; public int getINT_ID() { return INT_ID; } public void setINT_ID(int INT_ID) { this.INT_ID = INT_ID; } public String getJz_name() { return jz_name; } public void setJz_name(String jz_name) { this.jz_name = jz_name; } public String getPhy_site_no() { return phy_site_no; } public void setPhy_site_no(String phy_site_no) { this.phy_site_no = phy_site_no; } public String getSy_ds() { return sy_ds; } public void setSy_ds(String sy_ds) { this.sy_ds = sy_ds; } public String getSy_qx() { return sy_qx; } public void setSy_qx(String sy_qx) { this.sy_qx = sy_qx; } public String getDb_num() { return db_num; } public void setDb_num(String db_num) { this.db_num = db_num; } public String getSccb_time() { return sccb_time; } public void setSccb_time(String sccb_time) { this.sccb_time = sccb_time; } public String getSc_bm() { return sc_bm; } public void setSc_bm(String sc_bm) { this.sc_bm = sc_bm; } public int getScjy_dl() { return scjy_dl; } public void setScjy_dl(int scjy_dl) { this.scjy_dl = scjy_dl; } public String getBccb_time() { return bccb_time; } public void setBccb_time(String bccb_time) { this.bccb_time = bccb_time; } public Object getBc_bm() { return bc_bm; } public void setBc_bm(Object bc_bm) { this.bc_bm = bc_bm; } public Object getSh_dl() { return sh_dl; } public void setSh_dl(Object sh_dl) { this.sh_dl = sh_dl; } public String getCbr() { return cbr; } public void setCbr(String cbr) { this.cbr = cbr; } public int getGd_zt() { return gd_zt; } public void setGd_zt(int gd_zt) { this.gd_zt = gd_zt; } public Object getCb_end_time() { return cb_end_time; } public void setCb_end_time(Object cb_end_time) { this.cb_end_time = cb_end_time; } public Object getJd_time() { return jd_time; } public void setJd_time(Object jd_time) { this.jd_time = jd_time; } public int getIs_wrong() { return is_wrong; } public void setIs_wrong(int is_wrong) { this.is_wrong = is_wrong; } public String getWrong_info() { return wrong_info; } public void setWrong_info(String wrong_info) { this.wrong_info = wrong_info; } public Object getTIME_STAMP() { return TIME_STAMP; } public void setTIME_STAMP(Object TIME_STAMP) { this.TIME_STAMP = TIME_STAMP; } public Object getCREATE_TIME() { return CREATE_TIME; } public void setCREATE_TIME(Object CREATE_TIME) { this.CREATE_TIME = CREATE_TIME; } public String getCREATOR() { return CREATOR; } public void setCREATOR(String CREATOR) { this.CREATOR = CREATOR; } public int getSTATEFLAG() { return STATEFLAG; } public void setSTATEFLAG(int STATEFLAG) { this.STATEFLAG = STATEFLAG; } } }
UTF-8
Java
7,059
java
Tasks.java
Java
[ { "context": "lizable;\nimport java.util.List;\n\n/**\n * Created by Administrator on 2016/12/3 0003.\n */\n\npublic class Tasks implem", "end": 120, "score": 0.8353381156921387, "start": 107, "tag": "NAME", "value": "Administrator" }, { "context": "ull\n * ,\"CREATE_TIME\":null\n * ,\"CREATOR\":\"admin\"\n * ,\"STATEFLAG\":0}]\n */\n\n private boo", "end": 783, "score": 0.9471399784088135, "start": 778, "tag": "USERNAME", "value": "admin" } ]
null
[]
package com.inspur.electric.model; import java.io.Serializable; import java.util.List; /** * Created by Administrator on 2016/12/3 0003. */ public class Tasks implements Serializable{ /** * runSuccess : true * isValid : true * message : 查找待办任务列表 * totalCount : 1 * items : [{"INT_ID":3,"jz_name":"辽阳市区尚村西" * ,"phy_site_no":"410711700000120604" * ,"sy_ds":"沈阳市","sy_qx":"铁西区" * ,"db_num":"11" * ,"sccb_time":"2016-10-04" * ,"sc_bm":"1111" * ,"scjy_dl":1111 * ,"bccb_time":"2016-12-15" * ,"bc_bm":null * ,"sh_dl":null,"cbr":"admin" * ,"gd_zt":0,"cb_end_time":null * ,"jd_time":null,"is_wrong":0 * ,"wrong_info":"" * ,"TIME_STAMP":null * ,"CREATE_TIME":null * ,"CREATOR":"admin" * ,"STATEFLAG":0}] */ private boolean runSuccess; private boolean isValid; private String message; private int totalCount; private List<ItemsBean> items; public boolean isRunSuccess() { return runSuccess; } public void setRunSuccess(boolean runSuccess) { this.runSuccess = runSuccess; } public boolean isIsValid() { return isValid; } public void setIsValid(boolean isValid) { this.isValid = isValid; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public List<ItemsBean> getItems() { return items; } public void setItems(List<ItemsBean> items) { this.items = items; } public static class ItemsBean implements Serializable{ /** * INT_ID : 3 * jz_name : 辽阳市区尚村西 * phy_site_no : 410711700000120604 * sy_ds : 沈阳市 * sy_qx : 铁西区 * db_num : 11 * sccb_time : 2016-10-04 //上次抄表时间 * sc_bm : 1111 * scjy_dl : 1111 * bccb_time : 2016-12-15 //本次抄表时间 * bc_bm : null // * sh_dl : null * cbr : admin // * gd_zt : 0 * cb_end_time : null * jd_time : null * is_wrong : 0 * wrong_info : * TIME_STAMP : null * CREATE_TIME : null * CREATOR : admin * STATEFLAG : 0 */ private int INT_ID; private String jz_name; private String phy_site_no; private String sy_ds; private String sy_qx; private String db_num; private String sccb_time; private String sc_bm; private int scjy_dl; private String bccb_time; private Object bc_bm; private Object sh_dl; private String cbr; private int gd_zt; private Object cb_end_time; private Object jd_time; private int is_wrong; private String wrong_info; private Object TIME_STAMP; private Object CREATE_TIME; private String CREATOR; private int STATEFLAG; public int getINT_ID() { return INT_ID; } public void setINT_ID(int INT_ID) { this.INT_ID = INT_ID; } public String getJz_name() { return jz_name; } public void setJz_name(String jz_name) { this.jz_name = jz_name; } public String getPhy_site_no() { return phy_site_no; } public void setPhy_site_no(String phy_site_no) { this.phy_site_no = phy_site_no; } public String getSy_ds() { return sy_ds; } public void setSy_ds(String sy_ds) { this.sy_ds = sy_ds; } public String getSy_qx() { return sy_qx; } public void setSy_qx(String sy_qx) { this.sy_qx = sy_qx; } public String getDb_num() { return db_num; } public void setDb_num(String db_num) { this.db_num = db_num; } public String getSccb_time() { return sccb_time; } public void setSccb_time(String sccb_time) { this.sccb_time = sccb_time; } public String getSc_bm() { return sc_bm; } public void setSc_bm(String sc_bm) { this.sc_bm = sc_bm; } public int getScjy_dl() { return scjy_dl; } public void setScjy_dl(int scjy_dl) { this.scjy_dl = scjy_dl; } public String getBccb_time() { return bccb_time; } public void setBccb_time(String bccb_time) { this.bccb_time = bccb_time; } public Object getBc_bm() { return bc_bm; } public void setBc_bm(Object bc_bm) { this.bc_bm = bc_bm; } public Object getSh_dl() { return sh_dl; } public void setSh_dl(Object sh_dl) { this.sh_dl = sh_dl; } public String getCbr() { return cbr; } public void setCbr(String cbr) { this.cbr = cbr; } public int getGd_zt() { return gd_zt; } public void setGd_zt(int gd_zt) { this.gd_zt = gd_zt; } public Object getCb_end_time() { return cb_end_time; } public void setCb_end_time(Object cb_end_time) { this.cb_end_time = cb_end_time; } public Object getJd_time() { return jd_time; } public void setJd_time(Object jd_time) { this.jd_time = jd_time; } public int getIs_wrong() { return is_wrong; } public void setIs_wrong(int is_wrong) { this.is_wrong = is_wrong; } public String getWrong_info() { return wrong_info; } public void setWrong_info(String wrong_info) { this.wrong_info = wrong_info; } public Object getTIME_STAMP() { return TIME_STAMP; } public void setTIME_STAMP(Object TIME_STAMP) { this.TIME_STAMP = TIME_STAMP; } public Object getCREATE_TIME() { return CREATE_TIME; } public void setCREATE_TIME(Object CREATE_TIME) { this.CREATE_TIME = CREATE_TIME; } public String getCREATOR() { return CREATOR; } public void setCREATOR(String CREATOR) { this.CREATOR = CREATOR; } public int getSTATEFLAG() { return STATEFLAG; } public void setSTATEFLAG(int STATEFLAG) { this.STATEFLAG = STATEFLAG; } } }
7,059
0.501364
0.485862
308
21.620131
16.160372
58
false
false
0
0
0
0
0
0
0.340909
false
false
13
075dad7eb96a29edb959932e78c014fceb0e6f70
35,948,876,301,086
e1fec6abb189335feb14bd0885bd1862783d3376
/src/duoxiancheng/TimedRun.java
b51e0c35b193662e72029ad97621d0d6a599dc27
[]
no_license
jk0929/xukai1992.10201
https://github.com/jk0929/xukai1992.10201
80dc7ac084313b0f91d63ca9e006736026473f36
b1752eab12fc706fad4a437104cf07c9f5836d2a
refs/heads/master
2020-03-22T02:42:46.648000
2018-11-13T10:51:52
2018-11-13T10:51:52
139,388,551
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package duoxiancheng; import java.util.concurrent.*; import static duoxiancheng.LaunderThrowable.launderThrowable; /** * @Author: xk * @Date: 2018/9/16 * @Version 1.0 */ public class TimedRun { private static final ExecutorService taskExec = Executors.newCachedThreadPool(); public static void timedRun(Runnable r, long timeout, TimeUnit unit) throws InterruptedException { Future<?> task = taskExec.submit(r); try { task.get(timeout, unit); } catch (TimeoutException e) { // 接下来任务将会被取消 } catch (ExecutionException e) { // 如果在任务汇总抛出异常,那么重新抛出该异常 throw launderThrowable(e.getCause()); } finally { // 如果任务已经结束,那么执行取消操作也不会带来任何影响 task.cancel(true); // 如果任务正在运行,那么将被中断 } } }
UTF-8
Java
965
java
TimedRun.java
Java
[ { "context": "aunderThrowable.launderThrowable;\n\n/**\n * @Author: xk\n * @Date: 2018/9/16\n * @Version 1.0\n */\npublic cl", "end": 136, "score": 0.9995447397232056, "start": 134, "tag": "USERNAME", "value": "xk" } ]
null
[]
package duoxiancheng; import java.util.concurrent.*; import static duoxiancheng.LaunderThrowable.launderThrowable; /** * @Author: xk * @Date: 2018/9/16 * @Version 1.0 */ public class TimedRun { private static final ExecutorService taskExec = Executors.newCachedThreadPool(); public static void timedRun(Runnable r, long timeout, TimeUnit unit) throws InterruptedException { Future<?> task = taskExec.submit(r); try { task.get(timeout, unit); } catch (TimeoutException e) { // 接下来任务将会被取消 } catch (ExecutionException e) { // 如果在任务汇总抛出异常,那么重新抛出该异常 throw launderThrowable(e.getCause()); } finally { // 如果任务已经结束,那么执行取消操作也不会带来任何影响 task.cancel(true); // 如果任务正在运行,那么将被中断 } } }
965
0.619976
0.609013
30
26.366667
22.190813
84
false
false
0
0
0
0
0
0
0.366667
false
false
13
c64df34405fcdda2db4517041abb92f623731630
34,102,040,378,304
35c594cf409b834ab6013d2f97c3c0e350d6174d
/src/com/javarush/test/level07/lesson12/home02/Solution.java
dac0f71d5c20354fb5f1fe96b980558a358d8203
[]
no_license
Paul25/JavaRushHomeWork
https://github.com/Paul25/JavaRushHomeWork
ca486a6d6ce48386c29c84d42e7541eb6fa86c48
2104c568af0a68f851f57f18ab7ad22f8cd4f282
refs/heads/master
2021-01-10T16:03:03.142000
2017-01-24T17:36:16
2017-01-24T17:36:17
52,203,943
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javarush.test.level07.lesson12.home02; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /* Переставить M первых строк в конец списка Ввести с клавиатуры 2 числа N и M. Ввести N строк и заполнить ими список. Переставить M первых строк в конец списка. Вывести список на экран, каждое значение с новой строки. */ public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); //напишите тут ваш код ArrayList<String> listS = new ArrayList<String>(); int N=Integer.parseInt(reader.readLine()); int M=Integer.parseInt(reader.readLine()); for (int j = 0; j < N; j++) { String s=reader.readLine(); listS.add(s); } for (int k = 0; k < M; k++) { listS.add(listS.get(0)); listS.remove(0); } for (int c = 0; c < listS.size(); c++) { System.out.println(listS.get(c)); } } }
UTF-8
Java
1,321
java
Solution.java
Java
[]
null
[]
package com.javarush.test.level07.lesson12.home02; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /* Переставить M первых строк в конец списка Ввести с клавиатуры 2 числа N и M. Ввести N строк и заполнить ими список. Переставить M первых строк в конец списка. Вывести список на экран, каждое значение с новой строки. */ public class Solution { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); //напишите тут ваш код ArrayList<String> listS = new ArrayList<String>(); int N=Integer.parseInt(reader.readLine()); int M=Integer.parseInt(reader.readLine()); for (int j = 0; j < N; j++) { String s=reader.readLine(); listS.add(s); } for (int k = 0; k < M; k++) { listS.add(listS.get(0)); listS.remove(0); } for (int c = 0; c < listS.size(); c++) { System.out.println(listS.get(c)); } } }
1,321
0.610378
0.599824
43
25.44186
21.365374
85
false
false
0
0
0
0
0
0
0.488372
false
false
13
b7827c0c30a2b60d4e255613bb6e3c651ee39a0d
23,003,844,889,215
122bb09b5f24c997c48c755a53cf53a82ca3d412
/app/src/main/java/com/beginagain/yourthinking/MainActivity.java
09a7f0f54bd266d5e3d7c17f84790c3fbbad86c3
[]
no_license
KingPiggy/YourThinking
https://github.com/KingPiggy/YourThinking
5d6a0be1dfd6909f8130cbb36f021e9159d2d172
3243480210db0c0e77ade467539fc9f0cbfebed6
refs/heads/master
2022-03-06T03:39:02.019000
2019-10-27T10:16:40
2019-10-27T10:16:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.beginagain.yourthinking; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.os.Build; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.beginagain.yourthinking.Board.SearchBoardActivity; import com.beginagain.yourthinking.MenuFragment.Menu1Fragment; import com.beginagain.yourthinking.MenuFragment.Menu2Fragment; import com.beginagain.yourthinking.MenuFragment.Menu3Fragment; import com.beginagain.yourthinking.MenuFragment.Menu4Fragment; import com.beginagain.yourthinking.MenuFragment.MenuTop1Fragment; import com.google.firebase.auth.FirebaseAuth; public class MainActivity extends AppCompatActivity { private FragmentManager fragmentManager = getSupportFragmentManager(); private Menu1Fragment menu1Fragment = new Menu1Fragment(); private Menu2Fragment menu2Fragment = new Menu2Fragment(); private Menu3Fragment menu3Fragment = new Menu3Fragment(); private Menu4Fragment menu4Fragment = new Menu4Fragment(); private MenuTop1Fragment menuTop1Fragment = new MenuTop1Fragment(); Toolbar up_toolbar; TextView mToolbarText; String page = null; String mPage = null; private FirebaseAuth mAuth; public BottomNavigationView bottomNavigationView, topNavigationView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 만들 툴바를 가져와 셋팅한다 up_toolbar = (Toolbar) findViewById(R.id.up_toolbar); mToolbarText = (TextView)findViewById(R.id.text_view_pageTitle); MenuItem item = up_toolbar.findViewById(R.id.recommend_icon); setSupportActionBar(up_toolbar); mAuth = FirebaseAuth.getInstance(); fragmentManager.popBackStack(); if (Build.VERSION.SDK_INT >= 21) { getWindow().setStatusBarColor(Color.parseColor("#82b3c9")); // deep } bottomNavigationView = findViewById(R.id.bottom_navigation_view); // 첫 화면 지정 topNavigationView = findViewById(R.id.top_navigation_view); FragmentTransaction transaction = fragmentManager.beginTransaction(); Intent intent = getIntent(); page = intent.getStringExtra("page"); if (page != null) { if (page.equals("Chat")) { onFragmentChange(2); } else if (page.equals("Board")) { onFragmentChange(3); } else if (page.equals("Recommend")) { onFragmentChange(1); } else if (page.equals("MaratonPage")) { onFragmentChange(4); }else if(page.equals("MaratonStatics")){ onFragmentChange(5); } } else { transaction.replace(R.id.layout_main_frame, menu1Fragment).commitAllowingStateLoss(); } topNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { FragmentTransaction transaction = fragmentManager.beginTransaction(); switch (menuItem.getItemId()) { case R.id.navigation_top_menu1: { transaction.replace(R.id.layout_main_frame,menu4Fragment).commitAllowingStateLoss(); mToolbarText.setText("독서마라톤"); mPage = "MaratonPage"; topNavigationView.setVisibility(View.VISIBLE); up_toolbar.getMenu().hasVisibleItems(); break; } case R.id.navigation_top_menu2:{ transaction.replace(R.id.layout_main_frame,menuTop1Fragment).commitAllowingStateLoss(); mToolbarText.setText("독서마라톤"); mPage = "MaratonStatics"; topNavigationView.setVisibility(View.VISIBLE); } } return true; } }); // bottomNavigationView의 아이템이 선택될 때 호출될 리스너 등록 bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { FragmentTransaction transaction = fragmentManager.beginTransaction(); switch (item.getItemId()) { case R.id.navigation_menu1: { transaction.replace(R.id.layout_main_frame, menu1Fragment).commitAllowingStateLoss(); mToolbarText.setText("도서추천"); mPage = "Recommend"; item.setVisible(true); topNavigationView.setVisibility(View.INVISIBLE); break; } case R.id.navigation_menu2: { transaction.replace(R.id.layout_main_frame, menu2Fragment).commitAllowingStateLoss(); mToolbarText.setText("채팅방"); mPage = "Chat"; topNavigationView.setVisibility(View.INVISIBLE); break; } case R.id.navigation_menu3: { transaction.replace(R.id.layout_main_frame, menu3Fragment).commitAllowingStateLoss(); mToolbarText.setText("게시판"); mPage = "Board"; topNavigationView.setVisibility(View.INVISIBLE); break; } case R.id.navigation_menu4: { if(mAuth.getCurrentUser()!=null) { transaction.replace(R.id.layout_main_frame, menu4Fragment).commitAllowingStateLoss(); mToolbarText.setText("독서마라톤"); mPage = "MaratonPage"; topNavigationView.setVisibility(View.VISIBLE); }else{ AlertDialog.Builder alert_ex = new AlertDialog.Builder(MainActivity.this); alert_ex.setMessage("로그인 후 사용가능합니다. 로그인 하시겠습니까?"); alert_ex.setPositiveButton("로그인", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent accountIntent = new Intent(getApplication(), LoginActivity.class); startActivity(accountIntent); finish(); } }); alert_ex.setNegativeButton("취소", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onFragmentChange(1); } }); alert_ex.setTitle("Your Thinking"); AlertDialog alert = alert_ex.create(); alert.show(); } break; } } return true; } }); } public void onFragmentChange(int index) { if(index==1){ getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu1Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu1); } if (index == 2) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu2Fragment).commit(); mToolbarText.setText("채팅방"); bottomNavigationView.setSelectedItemId(R.id.navigation_menu2); } if (index == 3) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu3Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu3); } if (index == 4) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu4Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu4); topNavigationView.setVisibility(View.VISIBLE); } if (index == 5) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menuTop1Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu4); topNavigationView.setVisibility(View.VISIBLE); } } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_toolbar, menu); return true; } // 툴바에 삽입된 메뉴에 대해서 이벤트 처리 @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.account_icon: if(mAuth.getCurrentUser()!=null) { Toast.makeText(getApplicationContext(), "사용자관리", Toast.LENGTH_SHORT).show(); Intent accountIntent = new Intent(getApplication(), AccountActivity.class); accountIntent.putExtra("page",mPage); startActivity(accountIntent); }else{ AlertDialog.Builder alert_ex = new AlertDialog.Builder(this); alert_ex.setMessage("로그인 후 사용가능합니다. 로그인 하시겠습니까?"); alert_ex.setPositiveButton("로그인", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent accountIntent = new Intent(getApplication(), LoginActivity.class); startActivity(accountIntent); finish(); } }); alert_ex.setNegativeButton("취소", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert_ex.setTitle("Your Thinking"); AlertDialog alert = alert_ex.create(); alert.show(); } return true; case R.id.notice_icon: // Toast.makeText(getApplicationContext(), "공지사항", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, NoticeActivity.class); if(mAuth.getCurrentUser()!=null) intent.putExtra("user", "1"); else intent.putExtra("user","0"); startActivity(intent); finish(); return true; case R.id.recommend_icon: /** Intent searchintent = new Intent(this, NoticeActivity.class); if(mAuth.getCurrentUser()!=null) searchintent.putExtra("user", "1"); else intent.putExtra("user","0"); startActivity(intent); finish(); **/ return true; } return false; } @Override public void onBackPressed() { AlertDialog.Builder alert_ex = new AlertDialog.Builder(this); alert_ex.setMessage("정말로 종료하시겠습니까?"); alert_ex.setPositiveButton("종료", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finishAffinity(); } }); alert_ex.setNegativeButton("취소", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert_ex.setTitle("Your Thinking"); AlertDialog alert = alert_ex.create(); alert.show(); } }
UTF-8
Java
13,258
java
MainActivity.java
Java
[]
null
[]
package com.beginagain.yourthinking; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.os.Build; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.beginagain.yourthinking.Board.SearchBoardActivity; import com.beginagain.yourthinking.MenuFragment.Menu1Fragment; import com.beginagain.yourthinking.MenuFragment.Menu2Fragment; import com.beginagain.yourthinking.MenuFragment.Menu3Fragment; import com.beginagain.yourthinking.MenuFragment.Menu4Fragment; import com.beginagain.yourthinking.MenuFragment.MenuTop1Fragment; import com.google.firebase.auth.FirebaseAuth; public class MainActivity extends AppCompatActivity { private FragmentManager fragmentManager = getSupportFragmentManager(); private Menu1Fragment menu1Fragment = new Menu1Fragment(); private Menu2Fragment menu2Fragment = new Menu2Fragment(); private Menu3Fragment menu3Fragment = new Menu3Fragment(); private Menu4Fragment menu4Fragment = new Menu4Fragment(); private MenuTop1Fragment menuTop1Fragment = new MenuTop1Fragment(); Toolbar up_toolbar; TextView mToolbarText; String page = null; String mPage = null; private FirebaseAuth mAuth; public BottomNavigationView bottomNavigationView, topNavigationView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 만들 툴바를 가져와 셋팅한다 up_toolbar = (Toolbar) findViewById(R.id.up_toolbar); mToolbarText = (TextView)findViewById(R.id.text_view_pageTitle); MenuItem item = up_toolbar.findViewById(R.id.recommend_icon); setSupportActionBar(up_toolbar); mAuth = FirebaseAuth.getInstance(); fragmentManager.popBackStack(); if (Build.VERSION.SDK_INT >= 21) { getWindow().setStatusBarColor(Color.parseColor("#82b3c9")); // deep } bottomNavigationView = findViewById(R.id.bottom_navigation_view); // 첫 화면 지정 topNavigationView = findViewById(R.id.top_navigation_view); FragmentTransaction transaction = fragmentManager.beginTransaction(); Intent intent = getIntent(); page = intent.getStringExtra("page"); if (page != null) { if (page.equals("Chat")) { onFragmentChange(2); } else if (page.equals("Board")) { onFragmentChange(3); } else if (page.equals("Recommend")) { onFragmentChange(1); } else if (page.equals("MaratonPage")) { onFragmentChange(4); }else if(page.equals("MaratonStatics")){ onFragmentChange(5); } } else { transaction.replace(R.id.layout_main_frame, menu1Fragment).commitAllowingStateLoss(); } topNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { FragmentTransaction transaction = fragmentManager.beginTransaction(); switch (menuItem.getItemId()) { case R.id.navigation_top_menu1: { transaction.replace(R.id.layout_main_frame,menu4Fragment).commitAllowingStateLoss(); mToolbarText.setText("독서마라톤"); mPage = "MaratonPage"; topNavigationView.setVisibility(View.VISIBLE); up_toolbar.getMenu().hasVisibleItems(); break; } case R.id.navigation_top_menu2:{ transaction.replace(R.id.layout_main_frame,menuTop1Fragment).commitAllowingStateLoss(); mToolbarText.setText("독서마라톤"); mPage = "MaratonStatics"; topNavigationView.setVisibility(View.VISIBLE); } } return true; } }); // bottomNavigationView의 아이템이 선택될 때 호출될 리스너 등록 bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { FragmentTransaction transaction = fragmentManager.beginTransaction(); switch (item.getItemId()) { case R.id.navigation_menu1: { transaction.replace(R.id.layout_main_frame, menu1Fragment).commitAllowingStateLoss(); mToolbarText.setText("도서추천"); mPage = "Recommend"; item.setVisible(true); topNavigationView.setVisibility(View.INVISIBLE); break; } case R.id.navigation_menu2: { transaction.replace(R.id.layout_main_frame, menu2Fragment).commitAllowingStateLoss(); mToolbarText.setText("채팅방"); mPage = "Chat"; topNavigationView.setVisibility(View.INVISIBLE); break; } case R.id.navigation_menu3: { transaction.replace(R.id.layout_main_frame, menu3Fragment).commitAllowingStateLoss(); mToolbarText.setText("게시판"); mPage = "Board"; topNavigationView.setVisibility(View.INVISIBLE); break; } case R.id.navigation_menu4: { if(mAuth.getCurrentUser()!=null) { transaction.replace(R.id.layout_main_frame, menu4Fragment).commitAllowingStateLoss(); mToolbarText.setText("독서마라톤"); mPage = "MaratonPage"; topNavigationView.setVisibility(View.VISIBLE); }else{ AlertDialog.Builder alert_ex = new AlertDialog.Builder(MainActivity.this); alert_ex.setMessage("로그인 후 사용가능합니다. 로그인 하시겠습니까?"); alert_ex.setPositiveButton("로그인", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent accountIntent = new Intent(getApplication(), LoginActivity.class); startActivity(accountIntent); finish(); } }); alert_ex.setNegativeButton("취소", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { onFragmentChange(1); } }); alert_ex.setTitle("Your Thinking"); AlertDialog alert = alert_ex.create(); alert.show(); } break; } } return true; } }); } public void onFragmentChange(int index) { if(index==1){ getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu1Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu1); } if (index == 2) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu2Fragment).commit(); mToolbarText.setText("채팅방"); bottomNavigationView.setSelectedItemId(R.id.navigation_menu2); } if (index == 3) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu3Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu3); } if (index == 4) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menu4Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu4); topNavigationView.setVisibility(View.VISIBLE); } if (index == 5) { getSupportFragmentManager().beginTransaction().replace(R.id.layout_main_frame, menuTop1Fragment).commit(); bottomNavigationView.setSelectedItemId(R.id.navigation_menu4); topNavigationView.setVisibility(View.VISIBLE); } } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_toolbar, menu); return true; } // 툴바에 삽입된 메뉴에 대해서 이벤트 처리 @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.account_icon: if(mAuth.getCurrentUser()!=null) { Toast.makeText(getApplicationContext(), "사용자관리", Toast.LENGTH_SHORT).show(); Intent accountIntent = new Intent(getApplication(), AccountActivity.class); accountIntent.putExtra("page",mPage); startActivity(accountIntent); }else{ AlertDialog.Builder alert_ex = new AlertDialog.Builder(this); alert_ex.setMessage("로그인 후 사용가능합니다. 로그인 하시겠습니까?"); alert_ex.setPositiveButton("로그인", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent accountIntent = new Intent(getApplication(), LoginActivity.class); startActivity(accountIntent); finish(); } }); alert_ex.setNegativeButton("취소", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert_ex.setTitle("Your Thinking"); AlertDialog alert = alert_ex.create(); alert.show(); } return true; case R.id.notice_icon: // Toast.makeText(getApplicationContext(), "공지사항", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, NoticeActivity.class); if(mAuth.getCurrentUser()!=null) intent.putExtra("user", "1"); else intent.putExtra("user","0"); startActivity(intent); finish(); return true; case R.id.recommend_icon: /** Intent searchintent = new Intent(this, NoticeActivity.class); if(mAuth.getCurrentUser()!=null) searchintent.putExtra("user", "1"); else intent.putExtra("user","0"); startActivity(intent); finish(); **/ return true; } return false; } @Override public void onBackPressed() { AlertDialog.Builder alert_ex = new AlertDialog.Builder(this); alert_ex.setMessage("정말로 종료하시겠습니까?"); alert_ex.setPositiveButton("종료", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { finishAffinity(); } }); alert_ex.setNegativeButton("취소", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert_ex.setTitle("Your Thinking"); AlertDialog alert = alert_ex.create(); alert.show(); } }
13,258
0.56555
0.5603
291
43.508591
29.437378
126
false
false
0
0
0
0
0
0
0.690722
false
false
13
4c2729efcc2a35cbf8a314cb47839e21446c358b
23,003,844,887,213
d489a9a702591a09198be60abe921fbe4386141f
/src/main/java/ast/VariableDefinitionStatement.java
f4846954f6f41a59e3985911fedf39bd2d3def6c
[]
no_license
GeoVa19/simple-language-compiler
https://github.com/GeoVa19/simple-language-compiler
2a3f1a56693c077ceb076b397768f32e0928aa1d
f7418674c72b2a6792d4f4c762b00509ec0d6d52
refs/heads/master
2021-06-10T10:23:47.085000
2019-09-18T20:58:31
2019-09-18T20:58:31
187,105,662
3
1
null
false
2021-06-07T18:27:09
2019-05-16T21:47:35
2020-04-17T22:58:47
2021-06-07T18:27:08
49
1
0
3
Java
false
false
package ast; public class VariableDefinitionStatement extends Statement { private VariableDefinition variableDefinition; public VariableDefinitionStatement(VariableDefinition variableDefinition) { this.variableDefinition = variableDefinition; } public VariableDefinition getVariableDefinition() { return variableDefinition; } public void setVariableDefinition(VariableDefinition variableDefinition) { this.variableDefinition = variableDefinition; } @Override public void accept(ASTVisitor visitor) throws ASTVisitorException { visitor.visit(this); } }
UTF-8
Java
653
java
VariableDefinitionStatement.java
Java
[]
null
[]
package ast; public class VariableDefinitionStatement extends Statement { private VariableDefinition variableDefinition; public VariableDefinitionStatement(VariableDefinition variableDefinition) { this.variableDefinition = variableDefinition; } public VariableDefinition getVariableDefinition() { return variableDefinition; } public void setVariableDefinition(VariableDefinition variableDefinition) { this.variableDefinition = variableDefinition; } @Override public void accept(ASTVisitor visitor) throws ASTVisitorException { visitor.visit(this); } }
653
0.725881
0.725881
23
26.391304
28.317669
79
false
false
0
0
0
0
0
0
0.26087
false
false
13
ada02a97cf0e801f434e8c7e25b0d87b5212f689
39,041,252,756,023
b2d7fa5e610d39b40ee7b8f8a66e4cab6c1161e9
/cust_java_code/cust_java_code/top_admin/src/main/java/com/topjet/manage/service/CollocationInfoService.java
7a8dd4823d7b858c3653abfdeeee2dea197c257f
[]
no_license
zhaocj/topjet_java_code
https://github.com/zhaocj/topjet_java_code
8a3a23194f79e4db8803a2e02ef47a313f781c19
7f905b9dd03b72b1ba7337ea30244ea45dbe7c59
refs/heads/master
2020-03-18T18:53:21.562000
2018-11-13T13:32:20
2018-11-13T13:32:20
135,121,144
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.topjet.manage.service; import com.topjet.common.ResultBaseMsg; import com.topjet.manage.domain.bean.CollocationInfoBean; import com.topjet.manage.domain.bean.NameBean; import com.topjet.manage.domain.model.CollocationInfoModel; import com.topjet.manage.domain.model.ResourceFileVersionInfoModel; import java.util.List; /** * Created by liyj on 2017/9/20. */ public interface CollocationInfoService { /** * 货源配置列表 */ public List<CollocationInfoBean> getCollocationList(CollocationInfoBean collocationInfoBean); /** * 货源配置页数 */ public Integer getCollocationCount(CollocationInfoBean collocationInfoBean); /** * 新增货源配置 */ public Integer createCollocationInfo(CollocationInfoBean collocationInfoBean); /** * 修改货源配置 */ public Integer updateCollocationInfo(CollocationInfoBean collocationInfoBean); /** * 删除货源配置 */ public Integer deleteCollocationInfo(CollocationInfoBean collocationInfoBean); /** * 更新资源配置文件 */ public void updateResource(ResourceFileVersionInfoModel resourceFileVersionInfomodel); /** 获取该类型资源 */ List<NameBean> getResourceByType(Integer resourceType); /** * 获取匹配中心电话 */ public CollocationInfoModel getMatchCenterPhone(); /** * 编辑匹配中心电话 */ public ResultBaseMsg updateOrAdd(String mobile); }
UTF-8
Java
1,495
java
CollocationInfoService.java
Java
[ { "context": "oModel;\n\nimport java.util.List;\n\n/**\n * Created by liyj on 2017/9/20.\n */\npublic interface CollocationInf", "end": 356, "score": 0.9993714094161987, "start": 352, "tag": "USERNAME", "value": "liyj" } ]
null
[]
package com.topjet.manage.service; import com.topjet.common.ResultBaseMsg; import com.topjet.manage.domain.bean.CollocationInfoBean; import com.topjet.manage.domain.bean.NameBean; import com.topjet.manage.domain.model.CollocationInfoModel; import com.topjet.manage.domain.model.ResourceFileVersionInfoModel; import java.util.List; /** * Created by liyj on 2017/9/20. */ public interface CollocationInfoService { /** * 货源配置列表 */ public List<CollocationInfoBean> getCollocationList(CollocationInfoBean collocationInfoBean); /** * 货源配置页数 */ public Integer getCollocationCount(CollocationInfoBean collocationInfoBean); /** * 新增货源配置 */ public Integer createCollocationInfo(CollocationInfoBean collocationInfoBean); /** * 修改货源配置 */ public Integer updateCollocationInfo(CollocationInfoBean collocationInfoBean); /** * 删除货源配置 */ public Integer deleteCollocationInfo(CollocationInfoBean collocationInfoBean); /** * 更新资源配置文件 */ public void updateResource(ResourceFileVersionInfoModel resourceFileVersionInfomodel); /** 获取该类型资源 */ List<NameBean> getResourceByType(Integer resourceType); /** * 获取匹配中心电话 */ public CollocationInfoModel getMatchCenterPhone(); /** * 编辑匹配中心电话 */ public ResultBaseMsg updateOrAdd(String mobile); }
1,495
0.719592
0.714494
51
25.921568
28.270988
97
false
false
0
0
0
0
0
0
0.313726
false
false
13
fdc983f0af8c60dafe9d3e39b888d515762a49bf
31,963,146,640,933
70d1c268b077ce8fe970fc566708b0049c16cf23
/src/app/Model/WizytaView.java
29669462dcac663a0d92b5f9a81006e157d35084
[]
no_license
maciekwu/Hospital
https://github.com/maciekwu/Hospital
2e43acfa9cd5deb5df686152fd6e9de1d723d2ef
ea9dcc0c24031b5b5d91cee31e392abbaf74482b
refs/heads/master
2021-05-06T06:50:50.354000
2017-12-12T16:00:57
2017-12-12T16:00:57
113,908,362
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.Model; import java.sql.Date; import java.sql.Time; public class WizytaView { private Integer id; private Integer id_l; private Integer id_p; private Date data_w; private Time godzina_w; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getId_l() { return id_l; } public void setId_l(Integer id_l) { this.id_l = id_l; } public Integer getId_p() { return id_p; } public void setId_p(Integer id_p) { this.id_p = id_p; } public Date getData_w() { return data_w; } public void setData_w(Date data_w) { this.data_w = data_w; } public Time getGodzina_w() { return godzina_w; } public void setGodzina_w(Time godzina_w) { this.godzina_w = godzina_w; } public WizytaView(Integer id, Integer id_l, Integer id_p, Date data_w, Time godzina_w) { super(); this.id = id; this.id_l = id_l; this.id_p = id_p; this.data_w = data_w; this.godzina_w = godzina_w; } public WizytaView(Date data_w, Time godzina_w) { super(); this.data_w = data_w; this.godzina_w = godzina_w; } }
UTF-8
Java
1,151
java
WizytaView.java
Java
[]
null
[]
package app.Model; import java.sql.Date; import java.sql.Time; public class WizytaView { private Integer id; private Integer id_l; private Integer id_p; private Date data_w; private Time godzina_w; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getId_l() { return id_l; } public void setId_l(Integer id_l) { this.id_l = id_l; } public Integer getId_p() { return id_p; } public void setId_p(Integer id_p) { this.id_p = id_p; } public Date getData_w() { return data_w; } public void setData_w(Date data_w) { this.data_w = data_w; } public Time getGodzina_w() { return godzina_w; } public void setGodzina_w(Time godzina_w) { this.godzina_w = godzina_w; } public WizytaView(Integer id, Integer id_l, Integer id_p, Date data_w, Time godzina_w) { super(); this.id = id; this.id_l = id_l; this.id_p = id_p; this.data_w = data_w; this.godzina_w = godzina_w; } public WizytaView(Date data_w, Time godzina_w) { super(); this.data_w = data_w; this.godzina_w = godzina_w; } }
1,151
0.615117
0.615117
58
17.844828
15.48726
89
false
false
0
0
0
0
0
0
1.758621
false
false
13
a0b3a609912e214b7fdda9d57a19b8e498592a9f
15,874,199,148,026
e1b65d30b26a7a00576deaab0d6e9c50efa6c2c3
/09-spring-mvc-data-security-with-JPA-V13/src/main/java/com/bolsadeideas/springboot/app/controlles/LoginController.java
506189d530c3e8a486582a2f2e24a05779a0edd0
[]
no_license
barcvilla/spring5
https://github.com/barcvilla/spring5
e0ce677af3139d9c04b545f8bdf30ddada4bfacc
ed1c67e328d7ba9f5286ddfe25afabdc467e4fec
refs/heads/master
2020-03-27T13:42:19.265000
2018-09-26T18:52:17
2018-09-26T18:52:17
146,623,718
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bolsadeideas.springboot.app.controlles; import java.security.Principal; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller public class LoginController { Logger log = LoggerFactory.getLogger(getClass()); /** * * @param error : Es un parametro que nos envia Spring security automaticamente cuando se produce un error en el log in * @param model * @param principal * @param flash * @return */ @GetMapping("/login") public String login(@RequestParam(value="error", required = false) String error, @RequestParam(value="logout", required = false) String logout, Model model, Principal principal, RedirectAttributes flash) { //Si principal es distinto a null, el usuario ya esta loggin if(principal != null) { flash.addFlashAttribute("info", "El usuario ya ha iniciado session"); return "redirect:/"; } if(error != null) { //pasamos un mensaje de error a la vista model.addAttribute("error", "error en el login: Nombre de usuario o password incorrecto"); } if(logout != null) { model.addAttribute("success", "Ha cerrado sesion exitosamente"); } return "login"; } }
UTF-8
Java
1,467
java
LoginController.java
Java
[]
null
[]
package com.bolsadeideas.springboot.app.controlles; import java.security.Principal; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller public class LoginController { Logger log = LoggerFactory.getLogger(getClass()); /** * * @param error : Es un parametro que nos envia Spring security automaticamente cuando se produce un error en el log in * @param model * @param principal * @param flash * @return */ @GetMapping("/login") public String login(@RequestParam(value="error", required = false) String error, @RequestParam(value="logout", required = false) String logout, Model model, Principal principal, RedirectAttributes flash) { //Si principal es distinto a null, el usuario ya esta loggin if(principal != null) { flash.addFlashAttribute("info", "El usuario ya ha iniciado session"); return "redirect:/"; } if(error != null) { //pasamos un mensaje de error a la vista model.addAttribute("error", "error en el login: Nombre de usuario o password incorrecto"); } if(logout != null) { model.addAttribute("success", "Ha cerrado sesion exitosamente"); } return "login"; } }
1,467
0.735515
0.734151
51
27.764706
28.731747
120
false
false
0
0
0
0
0
0
1.745098
false
false
13
9e0cc2e4edc4dcc0a670ed2d91fe61e33a2ba53a
8,512,625,244,603
d5a9181563128a066cd20e52056b80b0341d86ff
/r3-activity-red/src/com/jfixby/r3/activity/red/RedActivityExecutor.java
1d00e8a50416cc7e67cc470636eefc5809035177
[]
no_license
RedTriplane/R3
https://github.com/RedTriplane/R3
551f033259cfd8311042b04a0c4251feb708db32
86f2f8a756b7108dbbda6f396c8c58af348faa94
refs/heads/master
2022-02-28T04:18:05.434000
2019-08-27T08:18:40
2019-08-27T08:18:40
44,493,313
0
0
null
false
2019-08-26T12:53:28
2015-10-18T19:40:35
2019-08-26T11:06:34
2019-08-26T12:53:28
14,635
3
1
14
Java
false
false
package com.jfixby.r3.activity.red; import com.jfixby.r3.activity.api.act.UIEventsManager; import com.jfixby.r3.activity.api.spawn.ActivitySpawningException; import com.jfixby.r3.activity.red.act.RedUIManager; import com.jfixby.r3.engine.api.EngineAssembler; import com.jfixby.r3.engine.api.RedTriplane; import com.jfixby.r3.engine.api.exe.EngineExecutor; import com.jfixby.r3.engine.api.exe.EngineState; import com.jfixby.r3.engine.api.render.RenderMachine; import com.jfixby.r3.engine.api.sound.SoundMachine; import com.jfixby.scarabei.api.debug.Debug; import com.jfixby.scarabei.api.err.Err; import com.jfixby.scarabei.api.log.L; import com.jfixby.scarabei.api.names.ID; import com.jfixby.scarabei.api.sys.settings.SystemSettings; import com.jfixby.scarabei.api.ver.Version; public class RedActivityExecutor implements EngineExecutor { final private EngineAssembler engine_assembler; ActivityManager units_manager; public RedActivityExecutor (final EngineAssembler engine_assembler) { this.engine_assembler = engine_assembler; } @Override public void doDeploy () { if (this.engine_assembler != null) { this.engine_assembler.assembleEngine(); } final String applicationPackageName = (SystemSettings.getStringParameter(Version.Tags.PackageName, "")); final String versionCode = SystemSettings.getStringParameter(Version.Tags.VersionCode, ""); final String versionName = SystemSettings.getStringParameter(Version.Tags.VersionName, ""); Debug.checkNull("SystemSettings :: " + Version.Tags.PackageName, applicationPackageName); Debug.checkEmpty("SystemSettings :: " + Version.Tags.PackageName, applicationPackageName); Debug.checkNull("SystemSettings :: " + Version.Tags.VersionCode, versionCode); Debug.checkEmpty("SystemSettings :: " + Version.Tags.VersionCode, versionCode); Debug.checkNull("SystemSettings :: " + Version.Tags.VersionName, versionName); Debug.checkEmpty("SystemSettings :: " + Version.Tags.VersionName, versionName); L.d("------[RedTriplane Engine Start]---------------------------------------------------------"); L.d(" version - " + RedTriplane.VERSION().getName()); L.d(" build id - " + RedTriplane.VERSION().getBuildID()); L.d(" homepage - " + RedTriplane.VERSION().getHomePage()); L.d(); L.d(" application - " + applicationPackageName); L.d(" version - " + versionName); L.d(" v. code - " + versionCode); L.d(); L.d(" starter - " + RedTriplane.getGameStarter()); L.d(); RedTriplane.VERSION().printDetails(" v. code".length()); L.d("-----------------------------------------------------------------------------------------"); // Sys.exit(); this.units_manager = new ActivityManager(); UIEventsManager.installComponent(new RedUIManager(this.units_manager)); RenderMachine.deploy(); SoundMachine.deploy(); final ID starter = RedTriplane.getGameStarter(); if (starter == null) { Err.reportError("RedTriplane.GameStarter is not set"); } try { RedActivityExecutor.this.units_manager.pushNextActivity(starter); } catch (final ActivitySpawningException e) { e.printStackTrace(); Err.reportError(e); } UIEventsManager.startEventsMachine(); } @Override public void doDispose () { if (this.units_manager.isIdle()) { return; } RenderMachine.destroy(); SoundMachine.destroy(); } @Override public void doPause () { if (this.units_manager.isIdle()) { return; } this.units_manager.suspend(); } @Override public void doRender (final EngineState engine_state) { // if (this.queue.hasMore()) { // final Intent intent = this.queue.pop().intent(); // this.units_namager.loadNext(intent); // return; // } if (this.units_manager.isIdle()) { return; } this.units_manager.render(engine_state); } @Override public void doResume () { if (this.units_manager.isIdle()) { return; } this.units_manager.resume(); } @Override public void doUpdate (final EngineState engine_state) { // if (this.queue.hasMore()) { // final Intent intent = this.queue.dequeue().intent(); // this.units_manager.loadNext(intent); // return; // } if (this.units_manager.isIdle()) { return; } this.units_manager.update(engine_state); } }
UTF-8
Java
4,268
java
RedActivityExecutor.java
Java
[]
null
[]
package com.jfixby.r3.activity.red; import com.jfixby.r3.activity.api.act.UIEventsManager; import com.jfixby.r3.activity.api.spawn.ActivitySpawningException; import com.jfixby.r3.activity.red.act.RedUIManager; import com.jfixby.r3.engine.api.EngineAssembler; import com.jfixby.r3.engine.api.RedTriplane; import com.jfixby.r3.engine.api.exe.EngineExecutor; import com.jfixby.r3.engine.api.exe.EngineState; import com.jfixby.r3.engine.api.render.RenderMachine; import com.jfixby.r3.engine.api.sound.SoundMachine; import com.jfixby.scarabei.api.debug.Debug; import com.jfixby.scarabei.api.err.Err; import com.jfixby.scarabei.api.log.L; import com.jfixby.scarabei.api.names.ID; import com.jfixby.scarabei.api.sys.settings.SystemSettings; import com.jfixby.scarabei.api.ver.Version; public class RedActivityExecutor implements EngineExecutor { final private EngineAssembler engine_assembler; ActivityManager units_manager; public RedActivityExecutor (final EngineAssembler engine_assembler) { this.engine_assembler = engine_assembler; } @Override public void doDeploy () { if (this.engine_assembler != null) { this.engine_assembler.assembleEngine(); } final String applicationPackageName = (SystemSettings.getStringParameter(Version.Tags.PackageName, "")); final String versionCode = SystemSettings.getStringParameter(Version.Tags.VersionCode, ""); final String versionName = SystemSettings.getStringParameter(Version.Tags.VersionName, ""); Debug.checkNull("SystemSettings :: " + Version.Tags.PackageName, applicationPackageName); Debug.checkEmpty("SystemSettings :: " + Version.Tags.PackageName, applicationPackageName); Debug.checkNull("SystemSettings :: " + Version.Tags.VersionCode, versionCode); Debug.checkEmpty("SystemSettings :: " + Version.Tags.VersionCode, versionCode); Debug.checkNull("SystemSettings :: " + Version.Tags.VersionName, versionName); Debug.checkEmpty("SystemSettings :: " + Version.Tags.VersionName, versionName); L.d("------[RedTriplane Engine Start]---------------------------------------------------------"); L.d(" version - " + RedTriplane.VERSION().getName()); L.d(" build id - " + RedTriplane.VERSION().getBuildID()); L.d(" homepage - " + RedTriplane.VERSION().getHomePage()); L.d(); L.d(" application - " + applicationPackageName); L.d(" version - " + versionName); L.d(" v. code - " + versionCode); L.d(); L.d(" starter - " + RedTriplane.getGameStarter()); L.d(); RedTriplane.VERSION().printDetails(" v. code".length()); L.d("-----------------------------------------------------------------------------------------"); // Sys.exit(); this.units_manager = new ActivityManager(); UIEventsManager.installComponent(new RedUIManager(this.units_manager)); RenderMachine.deploy(); SoundMachine.deploy(); final ID starter = RedTriplane.getGameStarter(); if (starter == null) { Err.reportError("RedTriplane.GameStarter is not set"); } try { RedActivityExecutor.this.units_manager.pushNextActivity(starter); } catch (final ActivitySpawningException e) { e.printStackTrace(); Err.reportError(e); } UIEventsManager.startEventsMachine(); } @Override public void doDispose () { if (this.units_manager.isIdle()) { return; } RenderMachine.destroy(); SoundMachine.destroy(); } @Override public void doPause () { if (this.units_manager.isIdle()) { return; } this.units_manager.suspend(); } @Override public void doRender (final EngineState engine_state) { // if (this.queue.hasMore()) { // final Intent intent = this.queue.pop().intent(); // this.units_namager.loadNext(intent); // return; // } if (this.units_manager.isIdle()) { return; } this.units_manager.render(engine_state); } @Override public void doResume () { if (this.units_manager.isIdle()) { return; } this.units_manager.resume(); } @Override public void doUpdate (final EngineState engine_state) { // if (this.queue.hasMore()) { // final Intent intent = this.queue.dequeue().intent(); // this.units_manager.loadNext(intent); // return; // } if (this.units_manager.isIdle()) { return; } this.units_manager.update(engine_state); } }
4,268
0.685801
0.683458
135
30.607407
28.218485
106
false
false
0
0
0
0
0
0
1.755556
false
false
13
68bad5a764637d4690d53a27c92e59dc91c6cb82
29,712,583,812,159
eadabb480744af2f9c41fcbb226147e71bdf2fed
/src/FirstAttempt/ExpressionAddOperators.java
5934911e8a1fabca27e1dd59874e6d07b2ef6aee
[]
no_license
wangyaolin/LeetcodeEverdayByJava2016
https://github.com/wangyaolin/LeetcodeEverdayByJava2016
78cafa9b7add34628232ce2ccda9f75b58e2f2be
b778b55f00d49a2ddeba29be72fa9435253270c3
refs/heads/master
2021-05-22T08:10:02.789000
2018-04-27T02:17:27
2018-04-27T02:17:27
50,165,198
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FirstAttempt; import java.util.ArrayList; import java.util.List; public class ExpressionAddOperators { // https://segmentfault.com/a/1190000003797204 /** * 因为要输出所有可能的情况,必定是用深度优先搜索。问题在于如何将问题拆分成多次搜索。 * 加减法很好处理,每当我们截出一段数字时,将之前计算的结果加上或者减去这个数,就可以将剩余的数字字符串和新的计算结果代入下一次搜索中了,直到我们的计算结果和目标一样,就完成了一次搜索。 * 然而,乘法如何处理呢?这里我们需要用一个变量记录乘法当前累乘的值,直到累乘完了,遇到下一个加号或减号再将其算入计算结果中。这里有两种情况: * (1) 乘号之前是加号或减号,例如2+3*4,我们在2那里算出来的结果,到3的时候会加上3,计算结果变为5。 * 在到4的时候,因为4之前我们选择的是乘号,这里3就应该和4相乘,而不是和2相加, * 所以在计算结果时,要将5先减去刚才加的3得到2,然后再加上3乘以4,得到2+12=14,这样14就是到4为止时的计算结果。 * (2) 另外一种情况是乘号之前也是乘号,如果2+3*4*5,这里我们到4为止计算的结果是14了, * 然后我们到5的时候又是乘号,这时候我们要把刚才加的3*4给去掉,然后再加上3*4*5,也就是14-3*4+3*4*5=62。这样5的计算结果就是62。 * * 因为要解决上述几种情况,我们需要这么几个变量,一个是记录上次的计算结果currRes,一个是记录上次被加或者被减的数prevNum,一个是当前准备处理的数currNum。 * 当下一轮搜索是加减法时,prevNum就是简单换成currNum,当下一轮搜索是乘法时,prevNum是prevNum乘以currNum。 * * 注意 * (1) 第一次搜索不添加运算符,只添加数字,就不会出现+1+2这种表达式了。 * (2) 我们截出的数字不能包含0001这种前面有0的数字,但是一个0是可以的。 * 这里一旦截出的数字前导为0,就可以return了,因为说明前面就截的不对,从这之后都是开始为0的,后面也不可能了, 所以直接return。 * */ public List<String> addOperators(String num, int target) { List<String> res = new ArrayList<String>(); dfs(num, target, 0, 0, "", res); return res; } private void dfs(String num, int target, long curVal, long preNum, String tmp, List<String> res) { if (curVal == target && num.length() == 0) { res.add(tmp); return; } for (int i = 1; i <= num.length(); i++) { String cur = num.substring(0, i); if (cur.length() > 1 && cur.charAt(0) == '0') { return; // 对于前导为0的数予以排除, 这里是return不是continue } long curNum = Long.parseLong(cur); String next = num.substring(i); // 如果不是第一个字母时,可以加运算符,否则只加数字 if(tmp.length() != 0){ // 乘法 dfs(next, target, (curVal-preNum)+preNum*curNum, preNum * curNum, tmp+"*"+cur, res); // 加法 dfs(next, target, curVal+curNum, curNum, tmp+"+"+cur, res); // 减法 dfs(next, target, curVal-curNum, -curNum, tmp+"-"+cur, res); } else { // 第一个数 dfs(next, target, curNum, curNum, cur, res); } } } }
UTF-8
Java
3,530
java
ExpressionAddOperators.java
Java
[]
null
[]
package FirstAttempt; import java.util.ArrayList; import java.util.List; public class ExpressionAddOperators { // https://segmentfault.com/a/1190000003797204 /** * 因为要输出所有可能的情况,必定是用深度优先搜索。问题在于如何将问题拆分成多次搜索。 * 加减法很好处理,每当我们截出一段数字时,将之前计算的结果加上或者减去这个数,就可以将剩余的数字字符串和新的计算结果代入下一次搜索中了,直到我们的计算结果和目标一样,就完成了一次搜索。 * 然而,乘法如何处理呢?这里我们需要用一个变量记录乘法当前累乘的值,直到累乘完了,遇到下一个加号或减号再将其算入计算结果中。这里有两种情况: * (1) 乘号之前是加号或减号,例如2+3*4,我们在2那里算出来的结果,到3的时候会加上3,计算结果变为5。 * 在到4的时候,因为4之前我们选择的是乘号,这里3就应该和4相乘,而不是和2相加, * 所以在计算结果时,要将5先减去刚才加的3得到2,然后再加上3乘以4,得到2+12=14,这样14就是到4为止时的计算结果。 * (2) 另外一种情况是乘号之前也是乘号,如果2+3*4*5,这里我们到4为止计算的结果是14了, * 然后我们到5的时候又是乘号,这时候我们要把刚才加的3*4给去掉,然后再加上3*4*5,也就是14-3*4+3*4*5=62。这样5的计算结果就是62。 * * 因为要解决上述几种情况,我们需要这么几个变量,一个是记录上次的计算结果currRes,一个是记录上次被加或者被减的数prevNum,一个是当前准备处理的数currNum。 * 当下一轮搜索是加减法时,prevNum就是简单换成currNum,当下一轮搜索是乘法时,prevNum是prevNum乘以currNum。 * * 注意 * (1) 第一次搜索不添加运算符,只添加数字,就不会出现+1+2这种表达式了。 * (2) 我们截出的数字不能包含0001这种前面有0的数字,但是一个0是可以的。 * 这里一旦截出的数字前导为0,就可以return了,因为说明前面就截的不对,从这之后都是开始为0的,后面也不可能了, 所以直接return。 * */ public List<String> addOperators(String num, int target) { List<String> res = new ArrayList<String>(); dfs(num, target, 0, 0, "", res); return res; } private void dfs(String num, int target, long curVal, long preNum, String tmp, List<String> res) { if (curVal == target && num.length() == 0) { res.add(tmp); return; } for (int i = 1; i <= num.length(); i++) { String cur = num.substring(0, i); if (cur.length() > 1 && cur.charAt(0) == '0') { return; // 对于前导为0的数予以排除, 这里是return不是continue } long curNum = Long.parseLong(cur); String next = num.substring(i); // 如果不是第一个字母时,可以加运算符,否则只加数字 if(tmp.length() != 0){ // 乘法 dfs(next, target, (curVal-preNum)+preNum*curNum, preNum * curNum, tmp+"*"+cur, res); // 加法 dfs(next, target, curVal+curNum, curNum, tmp+"+"+cur, res); // 减法 dfs(next, target, curVal-curNum, -curNum, tmp+"-"+cur, res); } else { // 第一个数 dfs(next, target, curNum, curNum, cur, res); } } } }
3,530
0.640127
0.599181
62
34.451614
28.821295
100
false
false
0
0
0
0
0
0
2.209677
false
false
13
80f6a70886269fc2e5696d6027c0234f06303e67
29,463,475,709,271
2ada0497b9e620e6e652221dd89c4b02b5aaeb57
/Programação 1/Exercicios/Acc.java
d9bc66ce6a7606aef8fbe09499112a98488dadbe
[]
no_license
SirCocas/Ano-1-Semestre-1
https://github.com/SirCocas/Ano-1-Semestre-1
a58eb60115986ff0b3e9e9e020a66c4835ee44be
89644b48c4521ce18f1b73a0a1c72277f30cce59
refs/heads/master
2020-04-28T17:41:29.855000
2019-03-13T17:04:41
2019-03-13T17:04:41
175,454,893
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class Acc { static final Scanner kb = new Scanner(System.in); public static void main(String[] args) { String frase = new String(); frase="nao nulo"; boolean leitura=true; while (leitura) { System.out.print("Insira uma frase para ser acronizada:"); frase=kb.nextLine(); if (frase.length()==0) { leitura=false; System.out.println("O programa vai fechar."); } else { if (acronimo(frase).length()!=0) { System.out.println("Acronimo:"+acronimo(frase)); } else { System.out.println("Para a frase ser acronizada e necessario que haja maiusculas"); } } } } public static String acronimo(String sentence) { String acronimo=new String(); for (int i=0;i<sentence.length();i++) { char caracter=sentence.charAt(i); if (Character.isUpperCase(caracter)) { acronimo=acronimo+caracter; } } return acronimo; } }
UTF-8
Java
943
java
Acc.java
Java
[]
null
[]
import java.util.Scanner; public class Acc { static final Scanner kb = new Scanner(System.in); public static void main(String[] args) { String frase = new String(); frase="nao nulo"; boolean leitura=true; while (leitura) { System.out.print("Insira uma frase para ser acronizada:"); frase=kb.nextLine(); if (frase.length()==0) { leitura=false; System.out.println("O programa vai fechar."); } else { if (acronimo(frase).length()!=0) { System.out.println("Acronimo:"+acronimo(frase)); } else { System.out.println("Para a frase ser acronizada e necessario que haja maiusculas"); } } } } public static String acronimo(String sentence) { String acronimo=new String(); for (int i=0;i<sentence.length();i++) { char caracter=sentence.charAt(i); if (Character.isUpperCase(caracter)) { acronimo=acronimo+caracter; } } return acronimo; } }
943
0.637328
0.634146
45
19.955555
19.676218
86
false
false
0
0
0
0
0
0
1.844444
false
false
13
740e553e7be761f501480a984ecc67dd20b4322e
16,819,091,989,656
096c8bfacb0ee902ca3fec70474c047074153b6e
/src/main/java/skyproc/SubStringNonNull.java
f691275c458044ca4a68afecd90ec888c99fc148
[]
no_license
mrudat/skyproc
https://github.com/mrudat/skyproc
4ada30aa80366e460984f7477205a00797a35522
610237669def557b437a47967a0f61c7364ed362
refs/heads/master
2022-07-09T04:58:34.330000
2021-02-11T06:48:46
2021-02-11T06:48:46
34,159,633
1
2
null
false
2021-04-26T16:22:40
2015-04-18T09:10:28
2021-02-11T06:48:52
2021-04-26T16:22:40
27,836
0
1
10
HTML
false
false
package skyproc; import java.io.IOException; import java.util.zip.DataFormatException; import lev.LImport; import lev.LOutFile; import lev.Ln; import skyproc.exceptions.BadParameter; import skyproc.exceptions.BadRecord; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Justin Swanson */ public class SubStringNonNull extends SubString { SubStringNonNull(String t) { super(t); } @Override void parseData(LImport in, Mod srcMod) throws BadRecord, DataFormatException, BadParameter { in.skip(getIdentifierLength() + getSizeLength()); string = Ln.arrayToString(in.extractInts(in.available())); if (logging()) { logMod(srcMod, getType().toString(), "Setting " + toString() + " to " + print()); } } @Override int getContentLength(ModExporter out) { return string.length(); } @Override void export(ModExporter out) throws IOException { out.write(getType().toString()); out.write(getContentLength(out), 2); out.write(string); } @Override SubStringNonNull getNew(String type_) { return new SubStringNonNull(type_); } }
UTF-8
Java
1,174
java
SubStringNonNull.java
Java
[ { "context": " template in the editor.\r\n */\r\n/**\r\n *\r\n * @author Justin Swanson\r\n */\r\npublic class SubStringNonNull extends SubSt", "end": 370, "score": 0.9994783401489258, "start": 356, "tag": "NAME", "value": "Justin Swanson" } ]
null
[]
package skyproc; import java.io.IOException; import java.util.zip.DataFormatException; import lev.LImport; import lev.LOutFile; import lev.Ln; import skyproc.exceptions.BadParameter; import skyproc.exceptions.BadRecord; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author <NAME> */ public class SubStringNonNull extends SubString { SubStringNonNull(String t) { super(t); } @Override void parseData(LImport in, Mod srcMod) throws BadRecord, DataFormatException, BadParameter { in.skip(getIdentifierLength() + getSizeLength()); string = Ln.arrayToString(in.extractInts(in.available())); if (logging()) { logMod(srcMod, getType().toString(), "Setting " + toString() + " to " + print()); } } @Override int getContentLength(ModExporter out) { return string.length(); } @Override void export(ModExporter out) throws IOException { out.write(getType().toString()); out.write(getContentLength(out), 2); out.write(string); } @Override SubStringNonNull getNew(String type_) { return new SubStringNonNull(type_); } }
1,166
0.691652
0.690801
50
21.48
22.34837
93
false
false
0
0
0
0
0
0
1.24
false
false
13
2f17b160769d245c28918fe03b1ba3577745db28
16,819,091,988,422
6e6d67aeb19c2a4864fc43d57a4000a0d8bfb2a2
/src/main/java/org/zerock/practice/Main.java
654f75702da405559fff419e3e34beec1cd032d3
[]
no_license
leeseungcheol90/kang_day1
https://github.com/leeseungcheol90/kang_day1
1e2beb6c1d13e94d6d440a0b8de4b4e8a5c8958e
57ca0be3364db3fd501e533b09b70a53d039bbd6
refs/heads/master
2023-07-02T06:11:21.673000
2021-07-29T13:20:54
2021-07-29T13:20:54
390,309,894
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.zerock.practice; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int rand1=(int)(Math.random()*100)+1; int rand2=(int)(Math.random()*100)+1; Problem p=new Problem(rand1,rand2); ProblemUI ui=new ProblemUI(sc,p); ui.show(); } }
UTF-8
Java
371
java
Main.java
Java
[]
null
[]
package org.zerock.practice; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int rand1=(int)(Math.random()*100)+1; int rand2=(int)(Math.random()*100)+1; Problem p=new Problem(rand1,rand2); ProblemUI ui=new ProblemUI(sc,p); ui.show(); } }
371
0.61186
0.579515
15
23.733334
18.167614
45
false
false
0
0
0
0
0
0
0.666667
false
false
13
24db87d13e657d3b57c5afff2da5a9ed85abe4d6
8,804,683,018,439
f0e8bb5d3123f282fc1d47b02f4ed37144e0248a
/bootstrap-core/src/test/java/de/agilecoders/wicket/core/request/resource/caching/version/ChecksumResourceVersionTest.java
2337272b79eb5525941659d67f2793e5577c1c23
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
l0rdn1kk0n/wicket-bootstrap
https://github.com/l0rdn1kk0n/wicket-bootstrap
b510fac18218e19905b252504aa4a13a6c5e6fb1
11ad1e53a3fdf5e16195e2b794d7bfabf550ee91
refs/heads/wicket-9.x
2023-09-01T12:30:05.200000
2022-11-03T12:54:31
2022-11-03T12:54:31
3,431,492
138
147
null
false
2023-08-29T16:04:05
2012-02-13T16:04:53
2023-08-25T13:52:31
2023-08-29T16:04:05
25,632
290
164
22
Java
false
false
package de.agilecoders.wicket.core.request.resource.caching.version; import com.google.common.base.Charsets; import java.io.ByteArrayInputStream; import java.io.IOException; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; /** * helper class for {@link ChecksumResourceVersion} tests. * * @author miha */ abstract class ChecksumResourceVersionTest { protected abstract ChecksumResourceVersion newChecksumResourceVersion(); void check(final String input, final String expected) { final ChecksumResourceVersion version = newChecksumResourceVersion(); try { final byte[] versionAsByteArray = version.computeDigest(new ByteArrayInputStream(input.getBytes(Charsets.UTF_8))); assertThat("checksum(" + input + "): " + expected + "; is: " + new String(versionAsByteArray), versionAsByteArray, is(equalTo(expected.getBytes(Charsets.UTF_8)))); } catch (IOException e) { throw new RuntimeException(e); } } }
UTF-8
Java
1,133
java
ChecksumResourceVersionTest.java
Java
[ { "context": "link ChecksumResourceVersion} tests.\n *\n * @author miha\n */\nabstract class ChecksumResourceVersionTest {\n", "end": 405, "score": 0.9988951086997986, "start": 401, "tag": "USERNAME", "value": "miha" } ]
null
[]
package de.agilecoders.wicket.core.request.resource.caching.version; import com.google.common.base.Charsets; import java.io.ByteArrayInputStream; import java.io.IOException; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; /** * helper class for {@link ChecksumResourceVersion} tests. * * @author miha */ abstract class ChecksumResourceVersionTest { protected abstract ChecksumResourceVersion newChecksumResourceVersion(); void check(final String input, final String expected) { final ChecksumResourceVersion version = newChecksumResourceVersion(); try { final byte[] versionAsByteArray = version.computeDigest(new ByteArrayInputStream(input.getBytes(Charsets.UTF_8))); assertThat("checksum(" + input + "): " + expected + "; is: " + new String(versionAsByteArray), versionAsByteArray, is(equalTo(expected.getBytes(Charsets.UTF_8)))); } catch (IOException e) { throw new RuntimeException(e); } } }
1,133
0.700794
0.699029
35
31.371429
33.105965
126
false
false
0
0
0
0
0
0
0.457143
false
false
13
788614ca321e762fc1f364ef59ed0a6ffdb26caf
28,157,805,596,715
56100239fefa02124d4988b493476b4cc004a2df
/src/java/db/DBConnection.java
154576a8b8b93166eb45801b7d10affc322f3ab2
[]
no_license
Violinistae/pedidossmc-ws
https://github.com/Violinistae/pedidossmc-ws
7656df6bccddf0331a7193f456c461255c69c323
762463acefc053afd5a6f2e6967a93a1f48b2972
refs/heads/master
2020-03-25T22:34:12.697000
2020-03-25T02:32:04
2020-03-25T02:32:04
144,229,707
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package db; import db.controllers.LogMessages; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * * @author Emiliano */ public class DBConnection { private Connection con; private LogMessages LogSms; public DBConnection () { try { Class.forName("com.mysql.jdbc.Driver"); String server = "jdbc:mysql://localhost:3306/pedidossmc"; String user = "root"; String pswd = ""; //Cambiar por datos del servidor donde se hospedará la BD /* String server = ""; String user = "" String pswd = ""; */ this.con = DriverManager.getConnection(server, user, pswd); } catch (ClassNotFoundException ex) { System.out.println(ex); } catch (SQLException ex) { LogSms.write_DBException("Error al intentar conectar con el" + " servidor de BD"); } } public Connection getCon () { return this.con; } }
UTF-8
Java
1,354
java
DBConnection.java
Java
[ { "context": ";\nimport java.sql.SQLException;\n\n/**\n *\n * @author Emiliano\n */\npublic class DBConnection {\n \n private ", "end": 348, "score": 0.9996773600578308, "start": 340, "tag": "NAME", "value": "Emiliano" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package db; import db.controllers.LogMessages; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * * @author Emiliano */ public class DBConnection { private Connection con; private LogMessages LogSms; public DBConnection () { try { Class.forName("com.mysql.jdbc.Driver"); String server = "jdbc:mysql://localhost:3306/pedidossmc"; String user = "root"; String pswd = ""; //Cambiar por datos del servidor donde se hospedará la BD /* String server = ""; String user = "" String pswd = ""; */ this.con = DriverManager.getConnection(server, user, pswd); } catch (ClassNotFoundException ex) { System.out.println(ex); } catch (SQLException ex) { LogSms.write_DBException("Error al intentar conectar con el" + " servidor de BD"); } } public Connection getCon () { return this.con; } }
1,354
0.545455
0.542498
49
26.612246
21.028471
79
false
false
0
0
0
0
0
0
0.44898
false
false
13
ff49bd86c630380b001c883469ca8675ad1d2f5b
12,515,534,703,892
879dc64348e7bf4bc03ca221d497479d4fb7756c
/src/main/java/selenium_AdvancedConcepts/StreamConcept.java
d5ed35d9b6bfb0497afb2dfc17346db02829f464
[]
no_license
Manesshakumar/April2021_SeleniumConcepts
https://github.com/Manesshakumar/April2021_SeleniumConcepts
ec5d35ae71e9df7da9a97a94b41211e320334e90
aa05cc329e6cc62a2f6f6dbfd2ba495594a8f56e
refs/heads/master
2023-04-24T10:37:43.699000
2021-05-03T08:59:18
2021-05-03T08:59:18
363,870,698
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package selenium_AdvancedConcepts; import java.util.List; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import io.github.bonigarcia.wdm.WebDriverManager; public class StreamConcept { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("https://www.rediff.com/"); driver.manage().window().maximize(); driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.name("proceed")).click(); Alert alert = driver.switchTo().alert(); alert.accept(); driver.switchTo().defaultContent(); List<WebElement> headLineList = driver.findElements(By.xpath("//div[@id = 'top_news_container']/ul/li[2]/a")); System.out.println(headLineList.size()); //Seq Stream System.out.println(System.currentTimeMillis()); headLineList.stream().forEach(x-> System.out.println(x.getText())); System.out.println(System.currentTimeMillis()); System.out.println("**********************"); //Parallel Stream System.out.println(System.currentTimeMillis()); headLineList.parallelStream().forEach(x-> System.out.println(x.getText())); System.out.println(System.currentTimeMillis()); } }
UTF-8
Java
1,533
java
StreamConcept.java
Java
[ { "context": "a.selenium.chrome.ChromeDriver;\n\nimport io.github.bonigarcia.wdm.WebDriverManager;\n\npublic class StreamConcept", "end": 278, "score": 0.9987289905548096, "start": 268, "tag": "USERNAME", "value": "bonigarcia" } ]
null
[]
package selenium_AdvancedConcepts; import java.util.List; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import io.github.bonigarcia.wdm.WebDriverManager; public class StreamConcept { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); driver.get("https://www.rediff.com/"); driver.manage().window().maximize(); driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.name("proceed")).click(); Alert alert = driver.switchTo().alert(); alert.accept(); driver.switchTo().defaultContent(); List<WebElement> headLineList = driver.findElements(By.xpath("//div[@id = 'top_news_container']/ul/li[2]/a")); System.out.println(headLineList.size()); //Seq Stream System.out.println(System.currentTimeMillis()); headLineList.stream().forEach(x-> System.out.println(x.getText())); System.out.println(System.currentTimeMillis()); System.out.println("**********************"); //Parallel Stream System.out.println(System.currentTimeMillis()); headLineList.parallelStream().forEach(x-> System.out.println(x.getText())); System.out.println(System.currentTimeMillis()); } }
1,533
0.635356
0.634703
46
32.326088
27.167
112
false
false
0
0
0
0
0
0
1.130435
false
false
13
f4df576d941606ea5a67fba823fa2eaf5b76bea8
5,463,198,459,062
0865ff27886b098d09f222b137490f938b78d9d6
/src/Lect4HV/Foursquare.java
fe4266fdfbe847245cc86c736616af4d2fbe1965
[]
no_license
Svasiuta/HomeWork
https://github.com/Svasiuta/HomeWork
5652fa5cfcbfbbf0f9d85a29954e60ecda63cfc9
a93a83a4fd16e7087b4046ebf9008d1e9c14cf1a
refs/heads/master
2021-01-11T21:50:31.749000
2016-12-30T14:17:32
2016-12-30T14:17:32
78,864,449
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Lect4HV; public class Foursquare extends Polygon { //храним одну сторону, квадрат же int side; public Foursquare(int side) { super("Foursquare"); this.side = side; } @Override public double getSquare() { return side * side; } }
UTF-8
Java
318
java
Foursquare.java
Java
[]
null
[]
package Lect4HV; public class Foursquare extends Polygon { //храним одну сторону, квадрат же int side; public Foursquare(int side) { super("Foursquare"); this.side = side; } @Override public double getSquare() { return side * side; } }
318
0.599315
0.59589
17
16.17647
14.213644
41
false
false
0
0
0
0
0
0
0.352941
false
false
13
40c2c4bb77da2c87c5707a4534831c6eb7459ebd
28,741,921,171,651
36d2025759fdc15886d403b7657e627ee99df07b
/equipe15-log720-A16-lab1/idl/src/main/idl/ca/etsmtl/log720/lab1/CollectionDossierOperations.java
f72e97de499e2841245dab240777e254fd52003b
[]
no_license
abdoul2007/log720-lab1
https://github.com/abdoul2007/log720-lab1
d3bf4a947c3e59a1216bf80ef49f1d7f4baedff8
8351c153156769d167d3cf482bbf1d96c4fec422
refs/heads/master
2021-01-12T13:25:39.970000
2016-10-13T05:06:21
2016-10-13T05:06:21
69,805,565
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.etsmtl.log720.lab1; /** * ca/etsmtl/log720/lab1/CollectionDossierOperations.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from Dossier.idl * Wednesday, October 12, 2016 5:43:37 PM PDT */ public interface CollectionDossierOperations { ca.etsmtl.log720.lab1.Dossier getDossier (int index); int size (); } // interface CollectionDossierOperations
UTF-8
Java
392
java
CollectionDossierOperations.java
Java
[]
null
[]
package ca.etsmtl.log720.lab1; /** * ca/etsmtl/log720/lab1/CollectionDossierOperations.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from Dossier.idl * Wednesday, October 12, 2016 5:43:37 PM PDT */ public interface CollectionDossierOperations { ca.etsmtl.log720.lab1.Dossier getDossier (int index); int size (); } // interface CollectionDossierOperations
392
0.755102
0.691327
15
25.133333
23.519827
65
false
false
0
0
0
0
0
0
0.4
false
false
13
ff95508bceb00008b87666c4675561708d8e8860
3,917,010,222,407
9c717bf635f994cac440cff7153b9f92b605c831
/src/main/java/org/mycontroller/standalone/api/jaxrs/exception/mappers/ExceptionMapperUtils.java
2037cafbb95ca3565ed1c7ea28bc3ad205c88467
[ "Apache-2.0" ]
permissive
arturmon/mycontroller
https://github.com/arturmon/mycontroller
c3122254fe3abdb7552b03fe1a78a24718bbef61
8a945c4f15cdebaec0a26137f2a631f6e6cfae17
refs/heads/master
2020-12-25T23:56:39.588000
2015-11-22T00:49:30
2015-11-22T00:49:30
43,523,710
2
0
null
true
2016-12-06T07:53:16
2015-10-01T22:05:09
2016-06-24T20:23:29
2016-12-06T07:53:16
2,594
1
0
0
Java
null
null
/** * Copyright (C) 2015 Jeeva Kandasamy (jkandasa@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mycontroller.standalone.api.jaxrs.exception.mappers; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.mycontroller.standalone.api.jaxrs.mapper.ApiError; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Jeeva Kandasamy (jkandasa) * @since 0.0.1 */ public class ExceptionMapperUtils { private ExceptionMapperUtils() { } private static final Logger _logger = LoggerFactory.getLogger(NotFoundExceptionMapper.class); public static Response buildResponse(Throwable exception, Status status) { _logger.trace("RestEasy exception,", exception); return Response.status(status) .entity(new ApiError(exception.getMessage())) .type(MediaType.APPLICATION_JSON_TYPE) .build(); } public static Response buildResponseWithCors(Throwable exception, Status status) { _logger.trace("RestEasy exception,", exception); return Response .status(status) .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Headers", "origin, content-type, accept, authorization") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD") .header("Access-Control-Max-Age", "1209600") .entity(new ApiError(exception.getMessage())) .type(MediaType.APPLICATION_JSON_TYPE) .build(); } }
UTF-8
Java
2,233
java
ExceptionMapperUtils.java
Java
[ { "context": "/**\n * Copyright (C) 2015 Jeeva Kandasamy (jkandasa@gmail.com)\n *\n * Licensed under the Apa", "end": 41, "score": 0.9998870491981506, "start": 26, "tag": "NAME", "value": "Jeeva Kandasamy" }, { "context": "/**\n * Copyright (C) 2015 Jeeva Kandasamy (jkandasa@gmail.com)\n *\n * Licensed under the Apache License, Version", "end": 61, "score": 0.9999307990074158, "start": 43, "tag": "EMAIL", "value": "jkandasa@gmail.com" }, { "context": "r;\nimport org.slf4j.LoggerFactory;\n\n/**\n * @author Jeeva Kandasamy (jkandasa)\n * @since 0.0.1\n */\npublic class Excep", "end": 956, "score": 0.9998860955238342, "start": 941, "tag": "NAME", "value": "Jeeva Kandasamy" }, { "context": "j.LoggerFactory;\n\n/**\n * @author Jeeva Kandasamy (jkandasa)\n * @since 0.0.1\n */\npublic class ExceptionMapper", "end": 966, "score": 0.9997121691703796, "start": 958, "tag": "USERNAME", "value": "jkandasa" } ]
null
[]
/** * Copyright (C) 2015 <NAME> (<EMAIL>) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mycontroller.standalone.api.jaxrs.exception.mappers; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.mycontroller.standalone.api.jaxrs.mapper.ApiError; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author <NAME> (jkandasa) * @since 0.0.1 */ public class ExceptionMapperUtils { private ExceptionMapperUtils() { } private static final Logger _logger = LoggerFactory.getLogger(NotFoundExceptionMapper.class); public static Response buildResponse(Throwable exception, Status status) { _logger.trace("RestEasy exception,", exception); return Response.status(status) .entity(new ApiError(exception.getMessage())) .type(MediaType.APPLICATION_JSON_TYPE) .build(); } public static Response buildResponseWithCors(Throwable exception, Status status) { _logger.trace("RestEasy exception,", exception); return Response .status(status) .header("Access-Control-Allow-Origin", "*") .header("Access-Control-Allow-Headers", "origin, content-type, accept, authorization") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD") .header("Access-Control-Max-Age", "1209600") .entity(new ApiError(exception.getMessage())) .type(MediaType.APPLICATION_JSON_TYPE) .build(); } }
2,204
0.67622
0.667264
58
37.5
29.828388
102
false
false
0
0
0
0
0
0
0.62069
false
false
13
c0fbc331fa531b06159a260e20d6d81f7f080a3f
9,268,539,458,731
8b67e499db517f2668db6ea3dbcd95dc84a42115
/net/minecraft/server/v1_7_R4/ItemStack.java
ad35fb8f724a9e7cab710572fcfc0440ad0e975a
[]
no_license
seria2/DragoNet
https://github.com/seria2/DragoNet
991de923f0810cc367612190fee05f865189ee82
22a987bda0a02ede15f2285bf64ab50a8a7f9c61
refs/heads/master
2016-08-04T05:05:33.562000
2014-11-01T20:38:47
2014-11-01T20:38:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* 1: */ package net.minecraft.server.v1_7_R4; /* 2: */ /* 3: */ import java.text.DecimalFormat; /* 4: */ import java.util.ArrayList; /* 5: */ import java.util.List; /* 6: */ import java.util.Random; /* 7: */ import java.util.UUID; /* 8: */ import net.minecraft.util.com.google.common.collect.HashMultimap; /* 9: */ import net.minecraft.util.com.google.common.collect.Multimap; /* 10: */ import org.bukkit.Bukkit; /* 11: */ import org.bukkit.Location; /* 12: */ import org.bukkit.Material; /* 13: */ import org.bukkit.TreeType; /* 14: */ import org.bukkit.block.BlockState; /* 15: */ import org.bukkit.craftbukkit.v1_7_R4.block.CraftBlockState; /* 16: */ import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; /* 17: */ import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; /* 18: */ import org.bukkit.entity.Player; /* 19: */ import org.bukkit.event.block.BlockPlaceEvent; /* 20: */ import org.bukkit.event.world.StructureGrowEvent; /* 21: */ import org.bukkit.plugin.PluginManager; /* 22: */ /* 23: */ public final class ItemStack /* 24: */ { /* 25: 23 */ public static final DecimalFormat a = new DecimalFormat("#.###"); /* 26: */ public int count; /* 27: */ public int c; /* 28: */ private Item item; /* 29: */ public NBTTagCompound tag; /* 30: */ private int damage; /* 31: */ private EntityItemFrame g; /* 32: */ /* 33: */ public ItemStack(Block block) /* 34: */ { /* 35: 32 */ this(block, 1); /* 36: */ } /* 37: */ /* 38: */ public ItemStack(Block block, int i) /* 39: */ { /* 40: 36 */ this(block, i, 0); /* 41: */ } /* 42: */ /* 43: */ public ItemStack(Block block, int i, int j) /* 44: */ { /* 45: 40 */ this(Item.getItemOf(block), i, j); /* 46: */ } /* 47: */ /* 48: */ public ItemStack(Item item) /* 49: */ { /* 50: 44 */ this(item, 1); /* 51: */ } /* 52: */ /* 53: */ public ItemStack(Item item, int i) /* 54: */ { /* 55: 48 */ this(item, i, 0); /* 56: */ } /* 57: */ /* 58: */ public ItemStack(Item item, int i, int j) /* 59: */ { /* 60: 52 */ this.item = item; /* 61: 53 */ this.count = i; /* 62: */ /* 63: 55 */ setData(j); /* 64: */ } /* 65: */ /* 66: */ public static ItemStack createStack(NBTTagCompound nbttagcompound) /* 67: */ { /* 68: 64 */ ItemStack itemstack = new ItemStack(); /* 69: */ /* 70: 66 */ itemstack.c(nbttagcompound); /* 71: 67 */ return itemstack.getItem() != null ? itemstack : null; /* 72: */ } /* 73: */ /* 74: */ private ItemStack() {} /* 75: */ /* 76: */ public ItemStack a(int i) /* 77: */ { /* 78: 73 */ ItemStack itemstack = new ItemStack(this.item, i, this.damage); /* 79: 75 */ if (this.tag != null) { /* 80: 76 */ itemstack.tag = ((NBTTagCompound)this.tag.clone()); /* 81: */ } /* 82: 79 */ this.count -= i; /* 83: 80 */ return itemstack; /* 84: */ } /* 85: */ /* 86: */ public Item getItem() /* 87: */ { /* 88: 84 */ return this.item; /* 89: */ } /* 90: */ /* 91: */ public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) /* 92: */ { /* 93: 89 */ int data = getData(); /* 94: 90 */ int count = this.count; /* 95: 92 */ if (!(getItem() instanceof ItemBucket)) /* 96: */ { /* 97: 93 */ world.captureBlockStates = true; /* 98: 95 */ if (((getItem() instanceof ItemDye)) && (getData() == 15)) /* 99: */ { /* 100: 96 */ Block block = world.getType(i, j, k); /* 101: 97 */ if ((block == Blocks.SAPLING) || ((block instanceof BlockMushroom))) { /* 102: 98 */ world.captureTreeGeneration = true; /* 103: */ } /* 104: */ } /* 105: */ } /* 106:102 */ boolean flag = getItem().interactWith(this, entityhuman, world, i, j, k, l, f, f1, f2); /* 107:103 */ int newData = getData(); /* 108:104 */ int newCount = this.count; /* 109:105 */ this.count = count; /* 110:106 */ setData(data); /* 111:107 */ world.captureBlockStates = false; /* 112:108 */ if ((flag) && (world.captureTreeGeneration) && (world.capturedBlockStates.size() > 0)) /* 113: */ { /* 114:109 */ world.captureTreeGeneration = false; /* 115:110 */ Location location = new Location(world.getWorld(), i, j, k); /* 116:111 */ TreeType treeType = BlockSapling.treeType; /* 117:112 */ BlockSapling.treeType = null; /* 118:113 */ List<BlockState> blocks = (List)world.capturedBlockStates.clone(); /* 119:114 */ world.capturedBlockStates.clear(); /* 120:115 */ StructureGrowEvent event = null; /* 121:116 */ if (treeType != null) /* 122: */ { /* 123:117 */ event = new StructureGrowEvent(location, treeType, false, (Player)entityhuman.getBukkitEntity(), blocks); /* 124:118 */ Bukkit.getPluginManager().callEvent(event); /* 125: */ } /* 126:120 */ if ((event == null) || (!event.isCancelled())) /* 127: */ { /* 128:122 */ if ((this.count == count) && (getData() == data)) /* 129: */ { /* 130:123 */ setData(newData); /* 131:124 */ this.count = newCount; /* 132: */ } /* 133:126 */ for (BlockState blockstate : blocks) { /* 134:127 */ blockstate.update(true); /* 135: */ } /* 136: */ } /* 137:131 */ return flag; /* 138: */ } /* 139:133 */ world.captureTreeGeneration = false; /* 140:135 */ if (flag) /* 141: */ { /* 142:136 */ BlockPlaceEvent placeEvent = null; /* 143:137 */ List<BlockState> blocks = (List)world.capturedBlockStates.clone(); /* 144:138 */ world.capturedBlockStates.clear(); /* 145:139 */ if (blocks.size() > 1) { /* 146:140 */ placeEvent = CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, blocks, i, j, k); /* 147:141 */ } else if (blocks.size() == 1) { /* 148:142 */ placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, (BlockState)blocks.get(0), i, j, k); /* 149: */ } /* 150:145 */ if ((placeEvent != null) && ((placeEvent.isCancelled()) || (!placeEvent.canBuild()))) /* 151: */ { /* 152:146 */ flag = false; /* 153:148 */ for (BlockState blockstate : blocks) { /* 154:149 */ blockstate.update(true, false); /* 155: */ } /* 156: */ } /* 157: */ else /* 158: */ { /* 159:153 */ if ((this.count == count) && (getData() == data)) /* 160: */ { /* 161:154 */ setData(newData); /* 162:155 */ this.count = newCount; /* 163: */ } /* 164:157 */ for (BlockState blockstate : blocks) /* 165: */ { /* 166:158 */ int x = blockstate.getX(); /* 167:159 */ int y = blockstate.getY(); /* 168:160 */ int z = blockstate.getZ(); /* 169:161 */ int updateFlag = ((CraftBlockState)blockstate).getFlag(); /* 170:162 */ Material mat = blockstate.getType(); /* 171:163 */ Block oldBlock = CraftMagicNumbers.getBlock(mat); /* 172:164 */ Block block = world.getType(x, y, z); /* 173:166 */ if ((block != null) && (!(block instanceof BlockContainer))) { /* 174:167 */ block.onPlace(world, x, y, z); /* 175: */ } /* 176:170 */ world.notifyAndUpdatePhysics(x, y, z, null, oldBlock, block, updateFlag); /* 177: */ } /* 178:172 */ entityhuman.a(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)], 1); /* 179: */ } /* 180: */ } /* 181:175 */ world.capturedBlockStates.clear(); /* 182: */ /* 183: */ /* 184:178 */ return flag; /* 185: */ } /* 186: */ /* 187: */ public float a(Block block) /* 188: */ { /* 189:182 */ return getItem().getDestroySpeed(this, block); /* 190: */ } /* 191: */ /* 192: */ public ItemStack a(World world, EntityHuman entityhuman) /* 193: */ { /* 194:186 */ return getItem().a(this, world, entityhuman); /* 195: */ } /* 196: */ /* 197: */ public ItemStack b(World world, EntityHuman entityhuman) /* 198: */ { /* 199:190 */ return getItem().b(this, world, entityhuman); /* 200: */ } /* 201: */ /* 202: */ public NBTTagCompound save(NBTTagCompound nbttagcompound) /* 203: */ { /* 204:194 */ nbttagcompound.setShort("id", (short)Item.getId(this.item)); /* 205:195 */ nbttagcompound.setByte("Count", (byte)this.count); /* 206:196 */ nbttagcompound.setShort("Damage", (short)this.damage); /* 207:197 */ if (this.tag != null) { /* 208:198 */ nbttagcompound.set("tag", this.tag.clone()); /* 209: */ } /* 210:201 */ return nbttagcompound; /* 211: */ } /* 212: */ /* 213: */ public void c(NBTTagCompound nbttagcompound) /* 214: */ { /* 215:205 */ this.item = Item.getById(nbttagcompound.getShort("id")); /* 216:206 */ this.count = nbttagcompound.getByte("Count"); /* 217: */ /* 218: */ /* 219: */ /* 220: */ /* 221: */ /* 222: */ /* 223:213 */ setData(nbttagcompound.getShort("Damage")); /* 224:216 */ if (nbttagcompound.hasKeyOfType("tag", 10)) { /* 225:218 */ this.tag = ((NBTTagCompound)nbttagcompound.getCompound("tag").clone()); /* 226: */ } /* 227: */ } /* 228: */ /* 229: */ public int getMaxStackSize() /* 230: */ { /* 231:223 */ return getItem().getMaxStackSize(); /* 232: */ } /* 233: */ /* 234: */ public boolean isStackable() /* 235: */ { /* 236:227 */ return (getMaxStackSize() > 1) && ((!g()) || (!i())); /* 237: */ } /* 238: */ /* 239: */ public boolean g() /* 240: */ { /* 241:231 */ return this.item.getMaxDurability() > 0; /* 242: */ } /* 243: */ /* 244: */ public boolean usesData() /* 245: */ { /* 246:235 */ return this.item.n(); /* 247: */ } /* 248: */ /* 249: */ public boolean i() /* 250: */ { /* 251:239 */ return (g()) && (this.damage > 0); /* 252: */ } /* 253: */ /* 254: */ public int j() /* 255: */ { /* 256:243 */ return this.damage; /* 257: */ } /* 258: */ /* 259: */ public int getData() /* 260: */ { /* 261:247 */ return this.damage; /* 262: */ } /* 263: */ /* 264: */ public void setData(int i) /* 265: */ { /* 266:253 */ if (i == 32767) /* 267: */ { /* 268:254 */ this.damage = i; /* 269:255 */ return; /* 270: */ } /* 271:259 */ if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(getItem())) != Blocks.AIR) { /* 272:261 */ if ((!usesData()) && (!getItem().usesDurability())) { /* 273:262 */ i = 0; /* 274: */ } /* 275: */ } /* 276:267 */ if ((CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(getItem())) == Blocks.DOUBLE_PLANT) && ((i > 5) || (i < 0))) { /* 277:268 */ i = 0; /* 278: */ } /* 279:272 */ this.damage = i; /* 280:273 */ if (this.damage < -1) { /* 281:274 */ this.damage = 0; /* 282: */ } /* 283: */ } /* 284: */ /* 285: */ public int l() /* 286: */ { /* 287:279 */ return this.item.getMaxDurability(); /* 288: */ } /* 289: */ /* 290: */ public boolean isDamaged(int i, Random random) /* 291: */ { /* 292:283 */ if (!g()) { /* 293:284 */ return false; /* 294: */ } /* 295:286 */ if (i > 0) /* 296: */ { /* 297:287 */ int j = EnchantmentManager.getEnchantmentLevel(Enchantment.DURABILITY.id, this); /* 298:288 */ int k = 0; /* 299:290 */ for (int l = 0; (j > 0) && (l < i); l++) { /* 300:291 */ if (EnchantmentDurability.a(this, j, random)) { /* 301:292 */ k++; /* 302: */ } /* 303: */ } /* 304:296 */ i -= k; /* 305:297 */ if (i <= 0) { /* 306:298 */ return false; /* 307: */ } /* 308: */ } /* 309:302 */ this.damage += i; /* 310:303 */ return this.damage > l(); /* 311: */ } /* 312: */ /* 313: */ public void damage(int i, EntityLiving entityliving) /* 314: */ { /* 315:308 */ if (((!(entityliving instanceof EntityHuman)) || (!((EntityHuman)entityliving).abilities.canInstantlyBuild)) && /* 316:309 */ (g()) && /* 317:310 */ (isDamaged(i, entityliving.aI()))) /* 318: */ { /* 319:311 */ entityliving.a(this); /* 320:312 */ this.count -= 1; /* 321:313 */ if ((entityliving instanceof EntityHuman)) /* 322: */ { /* 323:314 */ EntityHuman entityhuman = (EntityHuman)entityliving; /* 324: */ /* 325:316 */ entityhuman.a(StatisticList.BREAK_ITEM_COUNT[Item.getId(this.item)], 1); /* 326:317 */ if ((this.count == 0) && ((getItem() instanceof ItemBow))) { /* 327:318 */ entityhuman.bG(); /* 328: */ } /* 329: */ } /* 330:322 */ if (this.count < 0) { /* 331:323 */ this.count = 0; /* 332: */ } /* 333:327 */ if ((this.count == 0) && ((entityliving instanceof EntityHuman))) { /* 334:328 */ CraftEventFactory.callPlayerItemBreakEvent((EntityHuman)entityliving, this); /* 335: */ } /* 336:332 */ this.damage = 0; /* 337: */ } /* 338: */ } /* 339: */ /* 340: */ public void a(EntityLiving entityliving, EntityHuman entityhuman) /* 341: */ { /* 342:339 */ boolean flag = this.item.a(this, entityliving, entityhuman); /* 343:341 */ if (flag) { /* 344:342 */ entityhuman.a(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)], 1); /* 345: */ } /* 346: */ } /* 347: */ /* 348: */ public void a(World world, Block block, int i, int j, int k, EntityHuman entityhuman) /* 349: */ { /* 350:347 */ boolean flag = this.item.a(this, world, block, i, j, k, entityhuman); /* 351:349 */ if (flag) { /* 352:350 */ entityhuman.a(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)], 1); /* 353: */ } /* 354: */ } /* 355: */ /* 356: */ public boolean b(Block block) /* 357: */ { /* 358:355 */ return this.item.canDestroySpecialBlock(block); /* 359: */ } /* 360: */ /* 361: */ public boolean a(EntityHuman entityhuman, EntityLiving entityliving) /* 362: */ { /* 363:359 */ return this.item.a(this, entityhuman, entityliving); /* 364: */ } /* 365: */ /* 366: */ public ItemStack cloneItemStack() /* 367: */ { /* 368:363 */ ItemStack itemstack = new ItemStack(this.item, this.count, this.damage); /* 369:365 */ if (this.tag != null) { /* 370:366 */ itemstack.tag = ((NBTTagCompound)this.tag.clone()); /* 371: */ } /* 372:369 */ return itemstack; /* 373: */ } /* 374: */ /* 375: */ public static boolean equals(ItemStack itemstack, ItemStack itemstack1) /* 376: */ { /* 377:373 */ return (itemstack == null) && (itemstack1 == null); /* 378: */ } /* 379: */ /* 380: */ public static boolean matches(ItemStack itemstack, ItemStack itemstack1) /* 381: */ { /* 382:377 */ return (itemstack == null) && (itemstack1 == null); /* 383: */ } /* 384: */ /* 385: */ private boolean d(ItemStack itemstack) /* 386: */ { /* 387:381 */ return this.count == itemstack.count; /* 388: */ } /* 389: */ /* 390: */ public boolean doMaterialsMatch(ItemStack itemstack) /* 391: */ { /* 392:385 */ return (this.item == itemstack.item) && (this.damage == itemstack.damage); /* 393: */ } /* 394: */ /* 395: */ public String a() /* 396: */ { /* 397:389 */ return this.item.a(this); /* 398: */ } /* 399: */ /* 400: */ public static ItemStack b(ItemStack itemstack) /* 401: */ { /* 402:393 */ return itemstack == null ? null : itemstack.cloneItemStack(); /* 403: */ } /* 404: */ /* 405: */ public String toString() /* 406: */ { /* 407:397 */ return this.count + "x" + this.item.getName() + "@" + this.damage; /* 408: */ } /* 409: */ /* 410: */ public void a(World world, Entity entity, int i, boolean flag) /* 411: */ { /* 412:401 */ if (this.c > 0) { /* 413:402 */ this.c -= 1; /* 414: */ } /* 415:405 */ this.item.a(this, world, entity, i, flag); /* 416: */ } /* 417: */ /* 418: */ public void a(World world, EntityHuman entityhuman, int i) /* 419: */ { /* 420:409 */ entityhuman.a(StatisticList.CRAFT_BLOCK_COUNT[Item.getId(this.item)], i); /* 421:410 */ this.item.d(this, world, entityhuman); /* 422: */ } /* 423: */ /* 424: */ public int n() /* 425: */ { /* 426:414 */ return getItem().d_(this); /* 427: */ } /* 428: */ /* 429: */ public EnumAnimation o() /* 430: */ { /* 431:418 */ return getItem().d(this); /* 432: */ } /* 433: */ /* 434: */ public void b(World world, EntityHuman entityhuman, int i) /* 435: */ { /* 436:422 */ getItem().a(this, world, entityhuman, i); /* 437: */ } /* 438: */ /* 439: */ public boolean hasTag() /* 440: */ { /* 441:426 */ return this.tag != null; /* 442: */ } /* 443: */ /* 444: */ public NBTTagCompound getTag() /* 445: */ { /* 446:430 */ return this.tag; /* 447: */ } /* 448: */ /* 449: */ public NBTTagList getEnchantments() /* 450: */ { /* 451:434 */ return this.tag == null ? null : this.tag.getList("ench", 10); /* 452: */ } /* 453: */ /* 454: */ public void setTag(NBTTagCompound nbttagcompound) /* 455: */ { /* 456:438 */ this.tag = nbttagcompound; /* 457: */ } /* 458: */ /* 459: */ public String getName() /* 460: */ { /* 461:442 */ String s = getItem().n(this); /* 462:444 */ if ((this.tag != null) && (this.tag.hasKeyOfType("display", 10))) /* 463: */ { /* 464:445 */ NBTTagCompound nbttagcompound = this.tag.getCompound("display"); /* 465:447 */ if (nbttagcompound.hasKeyOfType("Name", 8)) { /* 466:448 */ s = nbttagcompound.getString("Name"); /* 467: */ } /* 468: */ } /* 469:452 */ return s; /* 470: */ } /* 471: */ /* 472: */ public ItemStack c(String s) /* 473: */ { /* 474:456 */ if (this.tag == null) { /* 475:457 */ this.tag = new NBTTagCompound(); /* 476: */ } /* 477:460 */ if (!this.tag.hasKeyOfType("display", 10)) { /* 478:461 */ this.tag.set("display", new NBTTagCompound()); /* 479: */ } /* 480:464 */ this.tag.getCompound("display").setString("Name", s); /* 481:465 */ return this; /* 482: */ } /* 483: */ /* 484: */ public void t() /* 485: */ { /* 486:469 */ if ((this.tag != null) && /* 487:470 */ (this.tag.hasKeyOfType("display", 10))) /* 488: */ { /* 489:471 */ NBTTagCompound nbttagcompound = this.tag.getCompound("display"); /* 490: */ /* 491:473 */ nbttagcompound.remove("Name"); /* 492:474 */ if (nbttagcompound.isEmpty()) /* 493: */ { /* 494:475 */ this.tag.remove("display"); /* 495:476 */ if (this.tag.isEmpty()) { /* 496:477 */ setTag((NBTTagCompound)null); /* 497: */ } /* 498: */ } /* 499: */ } /* 500: */ } /* 501: */ /* 502: */ public boolean hasName() /* 503: */ { /* 504:485 */ return !this.tag.hasKeyOfType("display", 10) ? false : this.tag == null ? false : this.tag.getCompound("display").hasKeyOfType("Name", 8); /* 505: */ } /* 506: */ /* 507: */ public EnumItemRarity w() /* 508: */ { /* 509:489 */ return getItem().f(this); /* 510: */ } /* 511: */ /* 512: */ public boolean x() /* 513: */ { /* 514:493 */ return getItem().e_(this); /* 515: */ } /* 516: */ /* 517: */ public void addEnchantment(Enchantment enchantment, int i) /* 518: */ { /* 519:497 */ if (this.tag == null) { /* 520:498 */ setTag(new NBTTagCompound()); /* 521: */ } /* 522:501 */ if (!this.tag.hasKeyOfType("ench", 9)) { /* 523:502 */ this.tag.set("ench", new NBTTagList()); /* 524: */ } /* 525:505 */ NBTTagList nbttaglist = this.tag.getList("ench", 10); /* 526:506 */ NBTTagCompound nbttagcompound = new NBTTagCompound(); /* 527: */ /* 528:508 */ nbttagcompound.setShort("id", (short)enchantment.id); /* 529:509 */ nbttagcompound.setShort("lvl", (short)(byte)i); /* 530:510 */ nbttaglist.add(nbttagcompound); /* 531: */ } /* 532: */ /* 533: */ public boolean hasEnchantments() /* 534: */ { /* 535:514 */ return (this.tag != null) && (this.tag.hasKeyOfType("ench", 9)); /* 536: */ } /* 537: */ /* 538: */ public void a(String s, NBTBase nbtbase) /* 539: */ { /* 540:518 */ if (this.tag == null) { /* 541:519 */ setTag(new NBTTagCompound()); /* 542: */ } /* 543:522 */ this.tag.set(s, nbtbase); /* 544: */ } /* 545: */ /* 546: */ public boolean z() /* 547: */ { /* 548:526 */ return getItem().v(); /* 549: */ } /* 550: */ /* 551: */ public boolean A() /* 552: */ { /* 553:530 */ return this.g != null; /* 554: */ } /* 555: */ /* 556: */ public void a(EntityItemFrame entityitemframe) /* 557: */ { /* 558:534 */ this.g = entityitemframe; /* 559: */ } /* 560: */ /* 561: */ public EntityItemFrame B() /* 562: */ { /* 563:538 */ return this.g; /* 564: */ } /* 565: */ /* 566: */ public int getRepairCost() /* 567: */ { /* 568:542 */ return (hasTag()) && (this.tag.hasKeyOfType("RepairCost", 3)) ? this.tag.getInt("RepairCost") : 0; /* 569: */ } /* 570: */ /* 571: */ public void setRepairCost(int i) /* 572: */ { /* 573:546 */ if (!hasTag()) { /* 574:547 */ this.tag = new NBTTagCompound(); /* 575: */ } /* 576:550 */ this.tag.setInt("RepairCost", i); /* 577: */ } /* 578: */ /* 579: */ public Multimap D() /* 580: */ { /* 581: */ Object object; /* 582:556 */ if ((hasTag()) && (this.tag.hasKeyOfType("AttributeModifiers", 9))) /* 583: */ { /* 584:557 */ Object object = HashMultimap.create(); /* 585:558 */ NBTTagList nbttaglist = this.tag.getList("AttributeModifiers", 10); /* 586:560 */ for (int i = 0; i < nbttaglist.size(); i++) /* 587: */ { /* 588:561 */ NBTTagCompound nbttagcompound = nbttaglist.get(i); /* 589:562 */ AttributeModifier attributemodifier = GenericAttributes.a(nbttagcompound); /* 590:564 */ if ((attributemodifier.a().getLeastSignificantBits() != 0L) && (attributemodifier.a().getMostSignificantBits() != 0L)) { /* 591:565 */ ((Multimap)object).put(nbttagcompound.getString("AttributeName"), attributemodifier); /* 592: */ } /* 593: */ } /* 594: */ } /* 595: */ else /* 596: */ { /* 597:569 */ object = getItem().k(); /* 598: */ } /* 599:572 */ return (Multimap)object; /* 600: */ } /* 601: */ /* 602: */ public void setItem(Item item) /* 603: */ { /* 604:576 */ this.item = item; /* 605:577 */ setData(getData()); /* 606: */ } /* 607: */ /* 608: */ public IChatBaseComponent E() /* 609: */ { /* 610:581 */ IChatBaseComponent ichatbasecomponent = new ChatComponentText("[").a(getName()).a("]"); /* 611:583 */ if (this.item != null) /* 612: */ { /* 613:584 */ NBTTagCompound nbttagcompound = new NBTTagCompound(); /* 614: */ /* 615:586 */ save(nbttagcompound); /* 616:587 */ ichatbasecomponent.getChatModifier().a(new ChatHoverable(EnumHoverAction.SHOW_ITEM, new ChatComponentText(nbttagcompound.toString()))); /* 617:588 */ ichatbasecomponent.getChatModifier().setColor(w().e); /* 618: */ } /* 619:591 */ return ichatbasecomponent; /* 620: */ } /* 621: */ } /* Location: C:\Users\ek1fox\Desktop\dragonet-0.0.3_R2-SNAPSHOT-PE0.9.5_PC1.7.10.jar * Qualified Name: net.minecraft.server.v1_7_R4.ItemStack * JD-Core Version: 0.7.0.1 */
UTF-8
Java
25,321
java
ItemStack.java
Java
[ { "context": "21: */ }\r\n\r\n\r\r\n/* Location: C:\\Users\\ek1fox\\Desktop\\dragonet-0.0.3_R2-SNAPSHOT-PE0.9.5_PC1.7.", "end": 25162, "score": 0.9991745352745056, "start": 25156, "tag": "USERNAME", "value": "ek1fox" } ]
null
[]
/* 1: */ package net.minecraft.server.v1_7_R4; /* 2: */ /* 3: */ import java.text.DecimalFormat; /* 4: */ import java.util.ArrayList; /* 5: */ import java.util.List; /* 6: */ import java.util.Random; /* 7: */ import java.util.UUID; /* 8: */ import net.minecraft.util.com.google.common.collect.HashMultimap; /* 9: */ import net.minecraft.util.com.google.common.collect.Multimap; /* 10: */ import org.bukkit.Bukkit; /* 11: */ import org.bukkit.Location; /* 12: */ import org.bukkit.Material; /* 13: */ import org.bukkit.TreeType; /* 14: */ import org.bukkit.block.BlockState; /* 15: */ import org.bukkit.craftbukkit.v1_7_R4.block.CraftBlockState; /* 16: */ import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; /* 17: */ import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; /* 18: */ import org.bukkit.entity.Player; /* 19: */ import org.bukkit.event.block.BlockPlaceEvent; /* 20: */ import org.bukkit.event.world.StructureGrowEvent; /* 21: */ import org.bukkit.plugin.PluginManager; /* 22: */ /* 23: */ public final class ItemStack /* 24: */ { /* 25: 23 */ public static final DecimalFormat a = new DecimalFormat("#.###"); /* 26: */ public int count; /* 27: */ public int c; /* 28: */ private Item item; /* 29: */ public NBTTagCompound tag; /* 30: */ private int damage; /* 31: */ private EntityItemFrame g; /* 32: */ /* 33: */ public ItemStack(Block block) /* 34: */ { /* 35: 32 */ this(block, 1); /* 36: */ } /* 37: */ /* 38: */ public ItemStack(Block block, int i) /* 39: */ { /* 40: 36 */ this(block, i, 0); /* 41: */ } /* 42: */ /* 43: */ public ItemStack(Block block, int i, int j) /* 44: */ { /* 45: 40 */ this(Item.getItemOf(block), i, j); /* 46: */ } /* 47: */ /* 48: */ public ItemStack(Item item) /* 49: */ { /* 50: 44 */ this(item, 1); /* 51: */ } /* 52: */ /* 53: */ public ItemStack(Item item, int i) /* 54: */ { /* 55: 48 */ this(item, i, 0); /* 56: */ } /* 57: */ /* 58: */ public ItemStack(Item item, int i, int j) /* 59: */ { /* 60: 52 */ this.item = item; /* 61: 53 */ this.count = i; /* 62: */ /* 63: 55 */ setData(j); /* 64: */ } /* 65: */ /* 66: */ public static ItemStack createStack(NBTTagCompound nbttagcompound) /* 67: */ { /* 68: 64 */ ItemStack itemstack = new ItemStack(); /* 69: */ /* 70: 66 */ itemstack.c(nbttagcompound); /* 71: 67 */ return itemstack.getItem() != null ? itemstack : null; /* 72: */ } /* 73: */ /* 74: */ private ItemStack() {} /* 75: */ /* 76: */ public ItemStack a(int i) /* 77: */ { /* 78: 73 */ ItemStack itemstack = new ItemStack(this.item, i, this.damage); /* 79: 75 */ if (this.tag != null) { /* 80: 76 */ itemstack.tag = ((NBTTagCompound)this.tag.clone()); /* 81: */ } /* 82: 79 */ this.count -= i; /* 83: 80 */ return itemstack; /* 84: */ } /* 85: */ /* 86: */ public Item getItem() /* 87: */ { /* 88: 84 */ return this.item; /* 89: */ } /* 90: */ /* 91: */ public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) /* 92: */ { /* 93: 89 */ int data = getData(); /* 94: 90 */ int count = this.count; /* 95: 92 */ if (!(getItem() instanceof ItemBucket)) /* 96: */ { /* 97: 93 */ world.captureBlockStates = true; /* 98: 95 */ if (((getItem() instanceof ItemDye)) && (getData() == 15)) /* 99: */ { /* 100: 96 */ Block block = world.getType(i, j, k); /* 101: 97 */ if ((block == Blocks.SAPLING) || ((block instanceof BlockMushroom))) { /* 102: 98 */ world.captureTreeGeneration = true; /* 103: */ } /* 104: */ } /* 105: */ } /* 106:102 */ boolean flag = getItem().interactWith(this, entityhuman, world, i, j, k, l, f, f1, f2); /* 107:103 */ int newData = getData(); /* 108:104 */ int newCount = this.count; /* 109:105 */ this.count = count; /* 110:106 */ setData(data); /* 111:107 */ world.captureBlockStates = false; /* 112:108 */ if ((flag) && (world.captureTreeGeneration) && (world.capturedBlockStates.size() > 0)) /* 113: */ { /* 114:109 */ world.captureTreeGeneration = false; /* 115:110 */ Location location = new Location(world.getWorld(), i, j, k); /* 116:111 */ TreeType treeType = BlockSapling.treeType; /* 117:112 */ BlockSapling.treeType = null; /* 118:113 */ List<BlockState> blocks = (List)world.capturedBlockStates.clone(); /* 119:114 */ world.capturedBlockStates.clear(); /* 120:115 */ StructureGrowEvent event = null; /* 121:116 */ if (treeType != null) /* 122: */ { /* 123:117 */ event = new StructureGrowEvent(location, treeType, false, (Player)entityhuman.getBukkitEntity(), blocks); /* 124:118 */ Bukkit.getPluginManager().callEvent(event); /* 125: */ } /* 126:120 */ if ((event == null) || (!event.isCancelled())) /* 127: */ { /* 128:122 */ if ((this.count == count) && (getData() == data)) /* 129: */ { /* 130:123 */ setData(newData); /* 131:124 */ this.count = newCount; /* 132: */ } /* 133:126 */ for (BlockState blockstate : blocks) { /* 134:127 */ blockstate.update(true); /* 135: */ } /* 136: */ } /* 137:131 */ return flag; /* 138: */ } /* 139:133 */ world.captureTreeGeneration = false; /* 140:135 */ if (flag) /* 141: */ { /* 142:136 */ BlockPlaceEvent placeEvent = null; /* 143:137 */ List<BlockState> blocks = (List)world.capturedBlockStates.clone(); /* 144:138 */ world.capturedBlockStates.clear(); /* 145:139 */ if (blocks.size() > 1) { /* 146:140 */ placeEvent = CraftEventFactory.callBlockMultiPlaceEvent(world, entityhuman, blocks, i, j, k); /* 147:141 */ } else if (blocks.size() == 1) { /* 148:142 */ placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, (BlockState)blocks.get(0), i, j, k); /* 149: */ } /* 150:145 */ if ((placeEvent != null) && ((placeEvent.isCancelled()) || (!placeEvent.canBuild()))) /* 151: */ { /* 152:146 */ flag = false; /* 153:148 */ for (BlockState blockstate : blocks) { /* 154:149 */ blockstate.update(true, false); /* 155: */ } /* 156: */ } /* 157: */ else /* 158: */ { /* 159:153 */ if ((this.count == count) && (getData() == data)) /* 160: */ { /* 161:154 */ setData(newData); /* 162:155 */ this.count = newCount; /* 163: */ } /* 164:157 */ for (BlockState blockstate : blocks) /* 165: */ { /* 166:158 */ int x = blockstate.getX(); /* 167:159 */ int y = blockstate.getY(); /* 168:160 */ int z = blockstate.getZ(); /* 169:161 */ int updateFlag = ((CraftBlockState)blockstate).getFlag(); /* 170:162 */ Material mat = blockstate.getType(); /* 171:163 */ Block oldBlock = CraftMagicNumbers.getBlock(mat); /* 172:164 */ Block block = world.getType(x, y, z); /* 173:166 */ if ((block != null) && (!(block instanceof BlockContainer))) { /* 174:167 */ block.onPlace(world, x, y, z); /* 175: */ } /* 176:170 */ world.notifyAndUpdatePhysics(x, y, z, null, oldBlock, block, updateFlag); /* 177: */ } /* 178:172 */ entityhuman.a(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)], 1); /* 179: */ } /* 180: */ } /* 181:175 */ world.capturedBlockStates.clear(); /* 182: */ /* 183: */ /* 184:178 */ return flag; /* 185: */ } /* 186: */ /* 187: */ public float a(Block block) /* 188: */ { /* 189:182 */ return getItem().getDestroySpeed(this, block); /* 190: */ } /* 191: */ /* 192: */ public ItemStack a(World world, EntityHuman entityhuman) /* 193: */ { /* 194:186 */ return getItem().a(this, world, entityhuman); /* 195: */ } /* 196: */ /* 197: */ public ItemStack b(World world, EntityHuman entityhuman) /* 198: */ { /* 199:190 */ return getItem().b(this, world, entityhuman); /* 200: */ } /* 201: */ /* 202: */ public NBTTagCompound save(NBTTagCompound nbttagcompound) /* 203: */ { /* 204:194 */ nbttagcompound.setShort("id", (short)Item.getId(this.item)); /* 205:195 */ nbttagcompound.setByte("Count", (byte)this.count); /* 206:196 */ nbttagcompound.setShort("Damage", (short)this.damage); /* 207:197 */ if (this.tag != null) { /* 208:198 */ nbttagcompound.set("tag", this.tag.clone()); /* 209: */ } /* 210:201 */ return nbttagcompound; /* 211: */ } /* 212: */ /* 213: */ public void c(NBTTagCompound nbttagcompound) /* 214: */ { /* 215:205 */ this.item = Item.getById(nbttagcompound.getShort("id")); /* 216:206 */ this.count = nbttagcompound.getByte("Count"); /* 217: */ /* 218: */ /* 219: */ /* 220: */ /* 221: */ /* 222: */ /* 223:213 */ setData(nbttagcompound.getShort("Damage")); /* 224:216 */ if (nbttagcompound.hasKeyOfType("tag", 10)) { /* 225:218 */ this.tag = ((NBTTagCompound)nbttagcompound.getCompound("tag").clone()); /* 226: */ } /* 227: */ } /* 228: */ /* 229: */ public int getMaxStackSize() /* 230: */ { /* 231:223 */ return getItem().getMaxStackSize(); /* 232: */ } /* 233: */ /* 234: */ public boolean isStackable() /* 235: */ { /* 236:227 */ return (getMaxStackSize() > 1) && ((!g()) || (!i())); /* 237: */ } /* 238: */ /* 239: */ public boolean g() /* 240: */ { /* 241:231 */ return this.item.getMaxDurability() > 0; /* 242: */ } /* 243: */ /* 244: */ public boolean usesData() /* 245: */ { /* 246:235 */ return this.item.n(); /* 247: */ } /* 248: */ /* 249: */ public boolean i() /* 250: */ { /* 251:239 */ return (g()) && (this.damage > 0); /* 252: */ } /* 253: */ /* 254: */ public int j() /* 255: */ { /* 256:243 */ return this.damage; /* 257: */ } /* 258: */ /* 259: */ public int getData() /* 260: */ { /* 261:247 */ return this.damage; /* 262: */ } /* 263: */ /* 264: */ public void setData(int i) /* 265: */ { /* 266:253 */ if (i == 32767) /* 267: */ { /* 268:254 */ this.damage = i; /* 269:255 */ return; /* 270: */ } /* 271:259 */ if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(getItem())) != Blocks.AIR) { /* 272:261 */ if ((!usesData()) && (!getItem().usesDurability())) { /* 273:262 */ i = 0; /* 274: */ } /* 275: */ } /* 276:267 */ if ((CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(getItem())) == Blocks.DOUBLE_PLANT) && ((i > 5) || (i < 0))) { /* 277:268 */ i = 0; /* 278: */ } /* 279:272 */ this.damage = i; /* 280:273 */ if (this.damage < -1) { /* 281:274 */ this.damage = 0; /* 282: */ } /* 283: */ } /* 284: */ /* 285: */ public int l() /* 286: */ { /* 287:279 */ return this.item.getMaxDurability(); /* 288: */ } /* 289: */ /* 290: */ public boolean isDamaged(int i, Random random) /* 291: */ { /* 292:283 */ if (!g()) { /* 293:284 */ return false; /* 294: */ } /* 295:286 */ if (i > 0) /* 296: */ { /* 297:287 */ int j = EnchantmentManager.getEnchantmentLevel(Enchantment.DURABILITY.id, this); /* 298:288 */ int k = 0; /* 299:290 */ for (int l = 0; (j > 0) && (l < i); l++) { /* 300:291 */ if (EnchantmentDurability.a(this, j, random)) { /* 301:292 */ k++; /* 302: */ } /* 303: */ } /* 304:296 */ i -= k; /* 305:297 */ if (i <= 0) { /* 306:298 */ return false; /* 307: */ } /* 308: */ } /* 309:302 */ this.damage += i; /* 310:303 */ return this.damage > l(); /* 311: */ } /* 312: */ /* 313: */ public void damage(int i, EntityLiving entityliving) /* 314: */ { /* 315:308 */ if (((!(entityliving instanceof EntityHuman)) || (!((EntityHuman)entityliving).abilities.canInstantlyBuild)) && /* 316:309 */ (g()) && /* 317:310 */ (isDamaged(i, entityliving.aI()))) /* 318: */ { /* 319:311 */ entityliving.a(this); /* 320:312 */ this.count -= 1; /* 321:313 */ if ((entityliving instanceof EntityHuman)) /* 322: */ { /* 323:314 */ EntityHuman entityhuman = (EntityHuman)entityliving; /* 324: */ /* 325:316 */ entityhuman.a(StatisticList.BREAK_ITEM_COUNT[Item.getId(this.item)], 1); /* 326:317 */ if ((this.count == 0) && ((getItem() instanceof ItemBow))) { /* 327:318 */ entityhuman.bG(); /* 328: */ } /* 329: */ } /* 330:322 */ if (this.count < 0) { /* 331:323 */ this.count = 0; /* 332: */ } /* 333:327 */ if ((this.count == 0) && ((entityliving instanceof EntityHuman))) { /* 334:328 */ CraftEventFactory.callPlayerItemBreakEvent((EntityHuman)entityliving, this); /* 335: */ } /* 336:332 */ this.damage = 0; /* 337: */ } /* 338: */ } /* 339: */ /* 340: */ public void a(EntityLiving entityliving, EntityHuman entityhuman) /* 341: */ { /* 342:339 */ boolean flag = this.item.a(this, entityliving, entityhuman); /* 343:341 */ if (flag) { /* 344:342 */ entityhuman.a(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)], 1); /* 345: */ } /* 346: */ } /* 347: */ /* 348: */ public void a(World world, Block block, int i, int j, int k, EntityHuman entityhuman) /* 349: */ { /* 350:347 */ boolean flag = this.item.a(this, world, block, i, j, k, entityhuman); /* 351:349 */ if (flag) { /* 352:350 */ entityhuman.a(StatisticList.USE_ITEM_COUNT[Item.getId(this.item)], 1); /* 353: */ } /* 354: */ } /* 355: */ /* 356: */ public boolean b(Block block) /* 357: */ { /* 358:355 */ return this.item.canDestroySpecialBlock(block); /* 359: */ } /* 360: */ /* 361: */ public boolean a(EntityHuman entityhuman, EntityLiving entityliving) /* 362: */ { /* 363:359 */ return this.item.a(this, entityhuman, entityliving); /* 364: */ } /* 365: */ /* 366: */ public ItemStack cloneItemStack() /* 367: */ { /* 368:363 */ ItemStack itemstack = new ItemStack(this.item, this.count, this.damage); /* 369:365 */ if (this.tag != null) { /* 370:366 */ itemstack.tag = ((NBTTagCompound)this.tag.clone()); /* 371: */ } /* 372:369 */ return itemstack; /* 373: */ } /* 374: */ /* 375: */ public static boolean equals(ItemStack itemstack, ItemStack itemstack1) /* 376: */ { /* 377:373 */ return (itemstack == null) && (itemstack1 == null); /* 378: */ } /* 379: */ /* 380: */ public static boolean matches(ItemStack itemstack, ItemStack itemstack1) /* 381: */ { /* 382:377 */ return (itemstack == null) && (itemstack1 == null); /* 383: */ } /* 384: */ /* 385: */ private boolean d(ItemStack itemstack) /* 386: */ { /* 387:381 */ return this.count == itemstack.count; /* 388: */ } /* 389: */ /* 390: */ public boolean doMaterialsMatch(ItemStack itemstack) /* 391: */ { /* 392:385 */ return (this.item == itemstack.item) && (this.damage == itemstack.damage); /* 393: */ } /* 394: */ /* 395: */ public String a() /* 396: */ { /* 397:389 */ return this.item.a(this); /* 398: */ } /* 399: */ /* 400: */ public static ItemStack b(ItemStack itemstack) /* 401: */ { /* 402:393 */ return itemstack == null ? null : itemstack.cloneItemStack(); /* 403: */ } /* 404: */ /* 405: */ public String toString() /* 406: */ { /* 407:397 */ return this.count + "x" + this.item.getName() + "@" + this.damage; /* 408: */ } /* 409: */ /* 410: */ public void a(World world, Entity entity, int i, boolean flag) /* 411: */ { /* 412:401 */ if (this.c > 0) { /* 413:402 */ this.c -= 1; /* 414: */ } /* 415:405 */ this.item.a(this, world, entity, i, flag); /* 416: */ } /* 417: */ /* 418: */ public void a(World world, EntityHuman entityhuman, int i) /* 419: */ { /* 420:409 */ entityhuman.a(StatisticList.CRAFT_BLOCK_COUNT[Item.getId(this.item)], i); /* 421:410 */ this.item.d(this, world, entityhuman); /* 422: */ } /* 423: */ /* 424: */ public int n() /* 425: */ { /* 426:414 */ return getItem().d_(this); /* 427: */ } /* 428: */ /* 429: */ public EnumAnimation o() /* 430: */ { /* 431:418 */ return getItem().d(this); /* 432: */ } /* 433: */ /* 434: */ public void b(World world, EntityHuman entityhuman, int i) /* 435: */ { /* 436:422 */ getItem().a(this, world, entityhuman, i); /* 437: */ } /* 438: */ /* 439: */ public boolean hasTag() /* 440: */ { /* 441:426 */ return this.tag != null; /* 442: */ } /* 443: */ /* 444: */ public NBTTagCompound getTag() /* 445: */ { /* 446:430 */ return this.tag; /* 447: */ } /* 448: */ /* 449: */ public NBTTagList getEnchantments() /* 450: */ { /* 451:434 */ return this.tag == null ? null : this.tag.getList("ench", 10); /* 452: */ } /* 453: */ /* 454: */ public void setTag(NBTTagCompound nbttagcompound) /* 455: */ { /* 456:438 */ this.tag = nbttagcompound; /* 457: */ } /* 458: */ /* 459: */ public String getName() /* 460: */ { /* 461:442 */ String s = getItem().n(this); /* 462:444 */ if ((this.tag != null) && (this.tag.hasKeyOfType("display", 10))) /* 463: */ { /* 464:445 */ NBTTagCompound nbttagcompound = this.tag.getCompound("display"); /* 465:447 */ if (nbttagcompound.hasKeyOfType("Name", 8)) { /* 466:448 */ s = nbttagcompound.getString("Name"); /* 467: */ } /* 468: */ } /* 469:452 */ return s; /* 470: */ } /* 471: */ /* 472: */ public ItemStack c(String s) /* 473: */ { /* 474:456 */ if (this.tag == null) { /* 475:457 */ this.tag = new NBTTagCompound(); /* 476: */ } /* 477:460 */ if (!this.tag.hasKeyOfType("display", 10)) { /* 478:461 */ this.tag.set("display", new NBTTagCompound()); /* 479: */ } /* 480:464 */ this.tag.getCompound("display").setString("Name", s); /* 481:465 */ return this; /* 482: */ } /* 483: */ /* 484: */ public void t() /* 485: */ { /* 486:469 */ if ((this.tag != null) && /* 487:470 */ (this.tag.hasKeyOfType("display", 10))) /* 488: */ { /* 489:471 */ NBTTagCompound nbttagcompound = this.tag.getCompound("display"); /* 490: */ /* 491:473 */ nbttagcompound.remove("Name"); /* 492:474 */ if (nbttagcompound.isEmpty()) /* 493: */ { /* 494:475 */ this.tag.remove("display"); /* 495:476 */ if (this.tag.isEmpty()) { /* 496:477 */ setTag((NBTTagCompound)null); /* 497: */ } /* 498: */ } /* 499: */ } /* 500: */ } /* 501: */ /* 502: */ public boolean hasName() /* 503: */ { /* 504:485 */ return !this.tag.hasKeyOfType("display", 10) ? false : this.tag == null ? false : this.tag.getCompound("display").hasKeyOfType("Name", 8); /* 505: */ } /* 506: */ /* 507: */ public EnumItemRarity w() /* 508: */ { /* 509:489 */ return getItem().f(this); /* 510: */ } /* 511: */ /* 512: */ public boolean x() /* 513: */ { /* 514:493 */ return getItem().e_(this); /* 515: */ } /* 516: */ /* 517: */ public void addEnchantment(Enchantment enchantment, int i) /* 518: */ { /* 519:497 */ if (this.tag == null) { /* 520:498 */ setTag(new NBTTagCompound()); /* 521: */ } /* 522:501 */ if (!this.tag.hasKeyOfType("ench", 9)) { /* 523:502 */ this.tag.set("ench", new NBTTagList()); /* 524: */ } /* 525:505 */ NBTTagList nbttaglist = this.tag.getList("ench", 10); /* 526:506 */ NBTTagCompound nbttagcompound = new NBTTagCompound(); /* 527: */ /* 528:508 */ nbttagcompound.setShort("id", (short)enchantment.id); /* 529:509 */ nbttagcompound.setShort("lvl", (short)(byte)i); /* 530:510 */ nbttaglist.add(nbttagcompound); /* 531: */ } /* 532: */ /* 533: */ public boolean hasEnchantments() /* 534: */ { /* 535:514 */ return (this.tag != null) && (this.tag.hasKeyOfType("ench", 9)); /* 536: */ } /* 537: */ /* 538: */ public void a(String s, NBTBase nbtbase) /* 539: */ { /* 540:518 */ if (this.tag == null) { /* 541:519 */ setTag(new NBTTagCompound()); /* 542: */ } /* 543:522 */ this.tag.set(s, nbtbase); /* 544: */ } /* 545: */ /* 546: */ public boolean z() /* 547: */ { /* 548:526 */ return getItem().v(); /* 549: */ } /* 550: */ /* 551: */ public boolean A() /* 552: */ { /* 553:530 */ return this.g != null; /* 554: */ } /* 555: */ /* 556: */ public void a(EntityItemFrame entityitemframe) /* 557: */ { /* 558:534 */ this.g = entityitemframe; /* 559: */ } /* 560: */ /* 561: */ public EntityItemFrame B() /* 562: */ { /* 563:538 */ return this.g; /* 564: */ } /* 565: */ /* 566: */ public int getRepairCost() /* 567: */ { /* 568:542 */ return (hasTag()) && (this.tag.hasKeyOfType("RepairCost", 3)) ? this.tag.getInt("RepairCost") : 0; /* 569: */ } /* 570: */ /* 571: */ public void setRepairCost(int i) /* 572: */ { /* 573:546 */ if (!hasTag()) { /* 574:547 */ this.tag = new NBTTagCompound(); /* 575: */ } /* 576:550 */ this.tag.setInt("RepairCost", i); /* 577: */ } /* 578: */ /* 579: */ public Multimap D() /* 580: */ { /* 581: */ Object object; /* 582:556 */ if ((hasTag()) && (this.tag.hasKeyOfType("AttributeModifiers", 9))) /* 583: */ { /* 584:557 */ Object object = HashMultimap.create(); /* 585:558 */ NBTTagList nbttaglist = this.tag.getList("AttributeModifiers", 10); /* 586:560 */ for (int i = 0; i < nbttaglist.size(); i++) /* 587: */ { /* 588:561 */ NBTTagCompound nbttagcompound = nbttaglist.get(i); /* 589:562 */ AttributeModifier attributemodifier = GenericAttributes.a(nbttagcompound); /* 590:564 */ if ((attributemodifier.a().getLeastSignificantBits() != 0L) && (attributemodifier.a().getMostSignificantBits() != 0L)) { /* 591:565 */ ((Multimap)object).put(nbttagcompound.getString("AttributeName"), attributemodifier); /* 592: */ } /* 593: */ } /* 594: */ } /* 595: */ else /* 596: */ { /* 597:569 */ object = getItem().k(); /* 598: */ } /* 599:572 */ return (Multimap)object; /* 600: */ } /* 601: */ /* 602: */ public void setItem(Item item) /* 603: */ { /* 604:576 */ this.item = item; /* 605:577 */ setData(getData()); /* 606: */ } /* 607: */ /* 608: */ public IChatBaseComponent E() /* 609: */ { /* 610:581 */ IChatBaseComponent ichatbasecomponent = new ChatComponentText("[").a(getName()).a("]"); /* 611:583 */ if (this.item != null) /* 612: */ { /* 613:584 */ NBTTagCompound nbttagcompound = new NBTTagCompound(); /* 614: */ /* 615:586 */ save(nbttagcompound); /* 616:587 */ ichatbasecomponent.getChatModifier().a(new ChatHoverable(EnumHoverAction.SHOW_ITEM, new ChatComponentText(nbttagcompound.toString()))); /* 617:588 */ ichatbasecomponent.getChatModifier().setColor(w().e); /* 618: */ } /* 619:591 */ return ichatbasecomponent; /* 620: */ } /* 621: */ } /* Location: C:\Users\ek1fox\Desktop\dragonet-0.0.3_R2-SNAPSHOT-PE0.9.5_PC1.7.10.jar * Qualified Name: net.minecraft.server.v1_7_R4.ItemStack * JD-Core Version: 0.7.0.1 */
25,321
0.483472
0.38316
631
38.137875
26.288687
156
false
false
0
0
0
0
0
0
0.587956
false
false
13
6a58b0b75951307cd010b37d257277999c783d4b
28,982,439,377,573
e2508905d318a23fc252d4796b56c7f8d2a316d7
/web-server/src/main/java/hr/unizg/fer/rassus/grupa5/WebEvaluationsService.java
014e4708fd449db6096e0870ccf6ee8421c7508f
[]
no_license
htamburic/RassusProjekt
https://github.com/htamburic/RassusProjekt
639ecc1674d0c1e70d9c5a32ffeb2e93fef16d02
16971c5b07889f7ca774bc895975bf83d5ba9ae3
refs/heads/master
2021-01-01T17:49:17.531000
2017-02-15T15:08:19
2017-02-15T15:08:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hr.unizg.fer.rassus.grupa5; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @Service public class WebEvaluationsService { @Autowired @LoadBalanced protected RestTemplate restTemplate; protected String evalsServiceUrl; public WebEvaluationsService(String evalsServiceUrl) { this.evalsServiceUrl = evalsServiceUrl.startsWith("http") ? evalsServiceUrl : "http://" + evalsServiceUrl; } List<Evaluation> findAll() { Evaluation[] evals = null; List<Evaluation> listEvals = new ArrayList<Evaluation>(); evals = restTemplate.getForObject(evalsServiceUrl + "/all", Evaluation[].class); System.out.println("sve ev" + evals); if (evals == null || evals.length == 0) { System.out.println("nema dohvacenih ev"); Evaluation emptyreg = new Evaluation(); listEvals.add(emptyreg); } else { listEvals.addAll(Arrays.asList(evals)); } return listEvals; } List<Evaluation> findByOwnerId(Long ownerId) { Evaluation[] ev = null; ev = restTemplate.getForObject(evalsServiceUrl + "/owner/{ownerId}", Evaluation[].class, ownerId); if (ev == null || ev.length == 0) return null; else return Arrays.asList(ev); } List<Evaluation> findByWalkerId(Long walkerId) { Evaluation[] ev = null; ev = restTemplate.getForObject(evalsServiceUrl + "/walker/{walkerId}", Evaluation[].class, walkerId); if (ev == null || ev.length == 0) return null; else return Arrays.asList(ev); } Evaluation checkExisting(Long walkerId, Long dogId) { Evaluation evaluation = new Evaluation(); evaluation.setDogId(dogId); evaluation.setWalkerId(walkerId); Evaluation ev = restTemplate.postForObject(evalsServiceUrl + "/check", evaluation, Evaluation.class); return ev; } List<Evaluation> findByDogId(Long dogId) { Evaluation[] ev = null; ev = restTemplate.getForObject(evalsServiceUrl + "/dog/{dogId}", Evaluation[].class, dogId); if (ev == null || ev.length == 0) return null; else { return Arrays.asList(ev); } } public Evaluation save(Evaluation evaluation) { return restTemplate.postForObject(evalsServiceUrl + "/save", evaluation, Evaluation.class); } }
UTF-8
Java
2,382
java
WebEvaluationsService.java
Java
[]
null
[]
package hr.unizg.fer.rassus.grupa5; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; @Service public class WebEvaluationsService { @Autowired @LoadBalanced protected RestTemplate restTemplate; protected String evalsServiceUrl; public WebEvaluationsService(String evalsServiceUrl) { this.evalsServiceUrl = evalsServiceUrl.startsWith("http") ? evalsServiceUrl : "http://" + evalsServiceUrl; } List<Evaluation> findAll() { Evaluation[] evals = null; List<Evaluation> listEvals = new ArrayList<Evaluation>(); evals = restTemplate.getForObject(evalsServiceUrl + "/all", Evaluation[].class); System.out.println("sve ev" + evals); if (evals == null || evals.length == 0) { System.out.println("nema dohvacenih ev"); Evaluation emptyreg = new Evaluation(); listEvals.add(emptyreg); } else { listEvals.addAll(Arrays.asList(evals)); } return listEvals; } List<Evaluation> findByOwnerId(Long ownerId) { Evaluation[] ev = null; ev = restTemplate.getForObject(evalsServiceUrl + "/owner/{ownerId}", Evaluation[].class, ownerId); if (ev == null || ev.length == 0) return null; else return Arrays.asList(ev); } List<Evaluation> findByWalkerId(Long walkerId) { Evaluation[] ev = null; ev = restTemplate.getForObject(evalsServiceUrl + "/walker/{walkerId}", Evaluation[].class, walkerId); if (ev == null || ev.length == 0) return null; else return Arrays.asList(ev); } Evaluation checkExisting(Long walkerId, Long dogId) { Evaluation evaluation = new Evaluation(); evaluation.setDogId(dogId); evaluation.setWalkerId(walkerId); Evaluation ev = restTemplate.postForObject(evalsServiceUrl + "/check", evaluation, Evaluation.class); return ev; } List<Evaluation> findByDogId(Long dogId) { Evaluation[] ev = null; ev = restTemplate.getForObject(evalsServiceUrl + "/dog/{dogId}", Evaluation[].class, dogId); if (ev == null || ev.length == 0) return null; else { return Arrays.asList(ev); } } public Evaluation save(Evaluation evaluation) { return restTemplate.postForObject(evalsServiceUrl + "/save", evaluation, Evaluation.class); } }
2,382
0.731318
0.729219
79
29.151899
28.18119
108
false
false
0
0
0
0
0
0
2.050633
false
false
13
8a39d8467e9909386727402ddc2eb7d00cee39c9
2,980,707,308,772
23d1dad7e189e65ed47f9e5a528e1e015abbb584
/src/main/java/com/omnirio/catalog/beans/CategoryAttribute.java
333f627084d755f3e7d9bb1161f93e05447a036d
[]
no_license
suman4545/omniriocatalog
https://github.com/suman4545/omniriocatalog
8e76b77c0e736a51cc3860805b731d7d5c76ae25
cf6bba6f84bb0191df94c091fc8238c1db247a04
refs/heads/main
2023-06-25T22:50:05.837000
2021-08-01T19:25:19
2021-08-01T19:25:19
391,401,428
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.omnirio.catalog.beans; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.NotEmpty; @Entity public class CategoryAttribute { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="attr_id",unique=true,nullable=false) private int id; @NotEmpty(message = "attributename may not be empty") @Column String attributename; public String getAttributename() { return attributename; } public void setAttributename(String attributename) { this.attributename = attributename; } public String getAttributevalue() { return attributevalue; } public void setAttributevalue(String attributevalue) { this.attributevalue = attributevalue; } @NotEmpty(message = "attributevalue may not be empty") @Column String attributevalue; public int getId() { return id; } public void setId(int id) { this.id = id; } }
UTF-8
Java
1,107
java
CategoryAttribute.java
Java
[]
null
[]
package com.omnirio.catalog.beans; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.validation.constraints.NotEmpty; @Entity public class CategoryAttribute { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="attr_id",unique=true,nullable=false) private int id; @NotEmpty(message = "attributename may not be empty") @Column String attributename; public String getAttributename() { return attributename; } public void setAttributename(String attributename) { this.attributename = attributename; } public String getAttributevalue() { return attributevalue; } public void setAttributevalue(String attributevalue) { this.attributevalue = attributevalue; } @NotEmpty(message = "attributevalue may not be empty") @Column String attributevalue; public int getId() { return id; } public void setId(int id) { this.id = id; } }
1,107
0.710027
0.710027
60
16.450001
18.570967
55
false
false
0
0
0
0
0
0
1.066667
false
false
13
b54b62e89d460a19953c5b57d82b435f81839c01
6,107,443,565,377
23923c67ccf0255cf65cfea9f624fb4fc31483a6
/src/main/java/com/investment/apiinvestiment/forms/ProjetoForm.java
ce8e01423c57b206f3bdc290b60c5b6a6b0b449b
[]
no_license
diogo-feitosa/api-investiment
https://github.com/diogo-feitosa/api-investiment
5482ddd845c875bdd8ad63a93ad569ab8e01fa06
95564cfd3375800599a6000d21f59077d13fd7d0
refs/heads/main
2023-08-27T04:01:42.696000
2021-11-08T06:06:51
2021-11-08T06:06:51
425,710,855
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.investment.apiinvestiment.forms; import com.investment.apiinvestiment.models.Projeto; import com.investment.apiinvestiment.models.enums.RiskEnum; import com.investment.apiinvestiment.repositories.ProjetoRepository; import lombok.Getter; import lombok.Setter; import org.hibernate.validator.constraints.Length; import org.springframework.stereotype.Component; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; import java.util.Date; @Getter @Setter @Component public class ProjetoForm { private Long id; @Pattern(regexp = "[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÊÍÏÓÔÕÖÚÇÑ ]+", message = "Não deve conter números e caracteres especiais.") @NotBlank(message = "Este campo não pode estar vazio") @Length(min = 3, max = 60, message = "Este campo requer no mínimo 3 caracteres e no máximo 60 caracteres.") private String name; private Date startDate; private Date finalDate; private Double value; private RiskEnum risk; public Projeto converterNew() { Projeto projeto = new Projeto(); projeto.setName(name); projeto.setStartDate(startDate); projeto.setFinalDate(finalDate); projeto.setValue(value); projeto.setRisk(risk); return projeto; } public Projeto converterUpdate( ProjetoRepository projetoRepository ) { Projeto projeto = projetoRepository.getById(id); if (!projeto.getName().equalsIgnoreCase(name)) { projeto.setName(name); } if (!projeto.getStartDate().equals(startDate)) { projeto.setStartDate(startDate); } if (!projeto.getFinalDate().equals(finalDate)) { projeto.setFinalDate(finalDate); } if (!projeto.getValue().equals(value)) { projeto.setValue(value); } if (!projeto.getRisk().equals(risk)) { projeto.setRisk(risk); } return projeto; } }
UTF-8
Java
2,018
java
ProjetoForm.java
Java
[]
null
[]
package com.investment.apiinvestiment.forms; import com.investment.apiinvestiment.models.Projeto; import com.investment.apiinvestiment.models.enums.RiskEnum; import com.investment.apiinvestiment.repositories.ProjetoRepository; import lombok.Getter; import lombok.Setter; import org.hibernate.validator.constraints.Length; import org.springframework.stereotype.Component; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Pattern; import java.util.Date; @Getter @Setter @Component public class ProjetoForm { private Long id; @Pattern(regexp = "[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÊÍÏÓÔÕÖÚÇÑ ]+", message = "Não deve conter números e caracteres especiais.") @NotBlank(message = "Este campo não pode estar vazio") @Length(min = 3, max = 60, message = "Este campo requer no mínimo 3 caracteres e no máximo 60 caracteres.") private String name; private Date startDate; private Date finalDate; private Double value; private RiskEnum risk; public Projeto converterNew() { Projeto projeto = new Projeto(); projeto.setName(name); projeto.setStartDate(startDate); projeto.setFinalDate(finalDate); projeto.setValue(value); projeto.setRisk(risk); return projeto; } public Projeto converterUpdate( ProjetoRepository projetoRepository ) { Projeto projeto = projetoRepository.getById(id); if (!projeto.getName().equalsIgnoreCase(name)) { projeto.setName(name); } if (!projeto.getStartDate().equals(startDate)) { projeto.setStartDate(startDate); } if (!projeto.getFinalDate().equals(finalDate)) { projeto.setFinalDate(finalDate); } if (!projeto.getValue().equals(value)) { projeto.setValue(value); } if (!projeto.getRisk().equals(risk)) { projeto.setRisk(risk); } return projeto; } }
2,018
0.679455
0.676426
66
29.015152
25.279345
129
false
false
0
0
0
0
0
0
0.515152
false
false
13
e88da9de9cde95fa5d0515a6f777fd980da81e21
32,615,981,684,242
d0d3c7a60571f3423143d31c586880ca0df08d32
/litho-it/src/test/java/com/facebook/litho/MountStateRemountInPlaceTest.java
58b0e7fa51220573bcf713b723f9f559b4afa2ea
[ "Apache-2.0" ]
permissive
SergeiMeza/litho
https://github.com/SergeiMeza/litho
573be83eee5ff052b46cdce38ce5b06750568cb8
8542b33669d055e827fd11da6e1db7453134995a
refs/heads/master
2022-12-25T02:38:07.829000
2022-10-10T11:10:32
2022-10-10T11:10:32
217,142,624
1
0
Apache-2.0
true
2019-10-23T19:59:13
2019-10-23T19:59:13
2019-10-23T17:46:14
2019-10-23T17:46:11
355,152
0
0
0
null
false
false
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * 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.facebook.litho; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.graphics.Color.BLACK; import static android.graphics.Color.WHITE; import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static com.facebook.litho.SizeSpec.makeSizeSpec; import static com.facebook.litho.testing.MeasureSpecTestingUtilsKt.atMost; import static com.facebook.litho.testing.MeasureSpecTestingUtilsKt.exactly; import static com.facebook.litho.testing.TestDrawableComponent.create; import static com.facebook.litho.testing.helper.ComponentTestHelper.mountComponent; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; import android.graphics.Color; import com.facebook.litho.testing.LegacyLithoViewRule; import com.facebook.litho.testing.TestComponent; import com.facebook.litho.testing.logging.TestComponentsLogger; import com.facebook.litho.testing.testrunner.LithoTestRunner; import com.facebook.litho.widget.MountSpecLifecycleTester; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(LithoTestRunner.class) public class MountStateRemountInPlaceTest { public final @Rule LegacyLithoViewRule mLegacyLithoViewRule = new LegacyLithoViewRule(); private ComponentContext mContext; private TestComponentsLogger mComponentsLogger; @Before public void setup() { mComponentsLogger = new TestComponentsLogger(); mContext = new ComponentContext(getApplicationContext(), "tag", mComponentsLogger); } @Test public void testMountUnmountWithShouldUpdate() { final TestComponent firstComponent = create(mContext).color(Color.RED).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(Color.BLUE).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testRebindWithNoShouldUpdate() { final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNewOrientation() { final LifecycleTracker tracker = new LifecycleTracker(); final Component root = MountSpecLifecycleTester.create(mContext).lifecycleTracker(tracker).build(); mLegacyLithoViewRule .setRoot(root) .attachToWindow() .setSizeSpecs(makeSizeSpec(10, SizeSpec.EXACTLY), makeSizeSpec(20, SizeSpec.EXACTLY)) .measure() .layout(); assertThat(tracker.getSteps()) .describedAs("Should call lifecycle methods") .contains(LifecycleStep.ON_BIND, LifecycleStep.ON_MOUNT) .doesNotContain(LifecycleStep.ON_UNMOUNT); tracker.reset(); mLegacyLithoViewRule .setRootAndSizeSpecSync( root, makeSizeSpec(20, SizeSpec.EXACTLY), makeSizeSpec(10, SizeSpec.EXACTLY)) .measure() .layout(); assertThat(tracker.getSteps()) .describedAs("Should call lifecycle methods") .contains( LifecycleStep.ON_UNBIND, LifecycleStep.ON_UNMOUNT, LifecycleStep.ON_MOUNT, LifecycleStep.ON_BIND); } @Test public void mountState_onNoForceShouldUpdateAndNewOrientation_shouldNotRemount() { mContext.getResources().getConfiguration().orientation = ORIENTATION_PORTRAIT; final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); mContext.getResources().getConfiguration().orientation = ORIENTATION_LANDSCAPE; final TestComponent secondComponent = create(mContext).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnbindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void mountState_onNoForceShouldUpdateAndNewOrientationAndSameSize_shouldNotRemount() { mContext.getResources().getConfiguration().orientation = ORIENTATION_PORTRAIT; final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); mContext.getResources().getConfiguration().orientation = ORIENTATION_LANDSCAPE; final TestComponent secondComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnbindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNoShouldUpdateAndDifferentSize() { final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(11) .build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testMountUnmountWithNoShouldUpdateAndSameSize() { final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNoShouldUpdateAndDifferentMeasures() { final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent( new LithoView(mContext), ComponentTree.create(mContext, Column.create(mContext).child(firstComponent).build()) .build(), atMost(100), atMost(100)); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).build(); lithoView .getComponentTree() .setRoot(Column.create(mContext).child(secondComponent).widthPx(10).heightPx(10).build()); assertThat(lithoView.isLayoutRequested()).isTrue(); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isFalse(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNoShouldUpdateAndSameMeasures() { final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true).color(Color.GRAY).build(); final LithoView lithoView = mountComponent( new LithoView(mContext), ComponentTree.create(mContext, Column.create(mContext).child(firstComponent).build()) .build(), exactly(100), exactly(100)); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(Color.RED).build(); lithoView .getComponentTree() .setRoot(Column.create(mContext).child(secondComponent).widthPx(10).heightPx(10).build()); assertThat(lithoView.isLayoutRequested()).isFalse(); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testRebindWithNoShouldUpdateAndSameMeasures() { final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent( new LithoView(mContext), ComponentTree.create(mContext, Column.create(mContext).child(firstComponent).build()) .build(), exactly(100), exactly(100)); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).build(); lithoView .getComponentTree() .setRoot(Column.create(mContext).child(secondComponent).widthPx(10).heightPx(10).build()); assertThat(lithoView.isLayoutRequested()).isFalse(); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithSkipShouldUpdate() { final TestComponent firstComponent = create(mContext).color(BLACK).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(BLACK).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithSkipShouldUpdateAndRemount() { final TestComponent firstComponent = create(mContext).color(BLACK).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(WHITE).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testMountUnmountDoesNotSkipShouldUpdateAndRemount() { final TestComponent firstComponent = create(mContext).color(Color.RED).build(); final LithoView firstLithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(Color.BLUE).build(); final ComponentTree secondTree = ComponentTree.create(mContext, Column.create(mContext).child(secondComponent).build()) .build(); secondTree.setSizeSpec(100, 100); final TestComponent thirdComponent = spy(create(mContext).build()); doReturn(thirdComponent).when(thirdComponent).makeShallowCopy(); secondTree.setRoot(Column.create(mContext).child(thirdComponent).build()); mountComponent(firstLithoView, secondTree); assertThat(thirdComponent.wasOnMountCalled()).isTrue(); assertThat(thirdComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } }
UTF-8
Java
15,523
java
MountStateRemountInPlaceTest.java
Java
[]
null
[]
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * 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.facebook.litho; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.graphics.Color.BLACK; import static android.graphics.Color.WHITE; import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static com.facebook.litho.SizeSpec.makeSizeSpec; import static com.facebook.litho.testing.MeasureSpecTestingUtilsKt.atMost; import static com.facebook.litho.testing.MeasureSpecTestingUtilsKt.exactly; import static com.facebook.litho.testing.TestDrawableComponent.create; import static com.facebook.litho.testing.helper.ComponentTestHelper.mountComponent; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; import android.graphics.Color; import com.facebook.litho.testing.LegacyLithoViewRule; import com.facebook.litho.testing.TestComponent; import com.facebook.litho.testing.logging.TestComponentsLogger; import com.facebook.litho.testing.testrunner.LithoTestRunner; import com.facebook.litho.widget.MountSpecLifecycleTester; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(LithoTestRunner.class) public class MountStateRemountInPlaceTest { public final @Rule LegacyLithoViewRule mLegacyLithoViewRule = new LegacyLithoViewRule(); private ComponentContext mContext; private TestComponentsLogger mComponentsLogger; @Before public void setup() { mComponentsLogger = new TestComponentsLogger(); mContext = new ComponentContext(getApplicationContext(), "tag", mComponentsLogger); } @Test public void testMountUnmountWithShouldUpdate() { final TestComponent firstComponent = create(mContext).color(Color.RED).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(Color.BLUE).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testRebindWithNoShouldUpdate() { final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNewOrientation() { final LifecycleTracker tracker = new LifecycleTracker(); final Component root = MountSpecLifecycleTester.create(mContext).lifecycleTracker(tracker).build(); mLegacyLithoViewRule .setRoot(root) .attachToWindow() .setSizeSpecs(makeSizeSpec(10, SizeSpec.EXACTLY), makeSizeSpec(20, SizeSpec.EXACTLY)) .measure() .layout(); assertThat(tracker.getSteps()) .describedAs("Should call lifecycle methods") .contains(LifecycleStep.ON_BIND, LifecycleStep.ON_MOUNT) .doesNotContain(LifecycleStep.ON_UNMOUNT); tracker.reset(); mLegacyLithoViewRule .setRootAndSizeSpecSync( root, makeSizeSpec(20, SizeSpec.EXACTLY), makeSizeSpec(10, SizeSpec.EXACTLY)) .measure() .layout(); assertThat(tracker.getSteps()) .describedAs("Should call lifecycle methods") .contains( LifecycleStep.ON_UNBIND, LifecycleStep.ON_UNMOUNT, LifecycleStep.ON_MOUNT, LifecycleStep.ON_BIND); } @Test public void mountState_onNoForceShouldUpdateAndNewOrientation_shouldNotRemount() { mContext.getResources().getConfiguration().orientation = ORIENTATION_PORTRAIT; final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); mContext.getResources().getConfiguration().orientation = ORIENTATION_LANDSCAPE; final TestComponent secondComponent = create(mContext).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnbindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void mountState_onNoForceShouldUpdateAndNewOrientationAndSameSize_shouldNotRemount() { mContext.getResources().getConfiguration().orientation = ORIENTATION_PORTRAIT; final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); mContext.getResources().getConfiguration().orientation = ORIENTATION_LANDSCAPE; final TestComponent secondComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnbindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNoShouldUpdateAndDifferentSize() { final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(11) .build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testMountUnmountWithNoShouldUpdateAndSameSize() { final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext, 0, 0, true, true, false, true /*isMountSizeDependent*/) .measuredHeight(10) .build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNoShouldUpdateAndDifferentMeasures() { final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent( new LithoView(mContext), ComponentTree.create(mContext, Column.create(mContext).child(firstComponent).build()) .build(), atMost(100), atMost(100)); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).build(); lithoView .getComponentTree() .setRoot(Column.create(mContext).child(secondComponent).widthPx(10).heightPx(10).build()); assertThat(lithoView.isLayoutRequested()).isTrue(); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isFalse(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithNoShouldUpdateAndSameMeasures() { final TestComponent firstComponent = create(mContext, 0, 0, true, true, false, true).color(Color.GRAY).build(); final LithoView lithoView = mountComponent( new LithoView(mContext), ComponentTree.create(mContext, Column.create(mContext).child(firstComponent).build()) .build(), exactly(100), exactly(100)); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(Color.RED).build(); lithoView .getComponentTree() .setRoot(Column.create(mContext).child(secondComponent).widthPx(10).heightPx(10).build()); assertThat(lithoView.isLayoutRequested()).isFalse(); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testRebindWithNoShouldUpdateAndSameMeasures() { final TestComponent firstComponent = create(mContext).build(); final LithoView lithoView = mountComponent( new LithoView(mContext), ComponentTree.create(mContext, Column.create(mContext).child(firstComponent).build()) .build(), exactly(100), exactly(100)); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).build(); lithoView .getComponentTree() .setRoot(Column.create(mContext).child(secondComponent).widthPx(10).heightPx(10).build()); assertThat(lithoView.isLayoutRequested()).isFalse(); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithSkipShouldUpdate() { final TestComponent firstComponent = create(mContext).color(BLACK).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(BLACK).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isFalse(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); } @Test public void testMountUnmountWithSkipShouldUpdateAndRemount() { final TestComponent firstComponent = create(mContext).color(BLACK).build(); final LithoView lithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(WHITE).build(); lithoView.getComponentTree().setRoot(Column.create(mContext).child(secondComponent).build()); assertThat(secondComponent.wasOnMountCalled()).isTrue(); assertThat(secondComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } @Test public void testMountUnmountDoesNotSkipShouldUpdateAndRemount() { final TestComponent firstComponent = create(mContext).color(Color.RED).build(); final LithoView firstLithoView = mountComponent(mContext, Column.create(mContext).child(firstComponent).build()); assertThat(firstComponent.wasOnMountCalled()).isTrue(); assertThat(firstComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isFalse(); final TestComponent secondComponent = create(mContext).color(Color.BLUE).build(); final ComponentTree secondTree = ComponentTree.create(mContext, Column.create(mContext).child(secondComponent).build()) .build(); secondTree.setSizeSpec(100, 100); final TestComponent thirdComponent = spy(create(mContext).build()); doReturn(thirdComponent).when(thirdComponent).makeShallowCopy(); secondTree.setRoot(Column.create(mContext).child(thirdComponent).build()); mountComponent(firstLithoView, secondTree); assertThat(thirdComponent.wasOnMountCalled()).isTrue(); assertThat(thirdComponent.wasOnBindCalled()).isTrue(); assertThat(firstComponent.wasOnUnmountCalled()).isTrue(); } }
15,523
0.737357
0.73259
393
38.498726
31.28561
98
false
false
0
0
0
0
0
0
0.648855
false
false
13
6df99eece769944b7c51ef11c9205ab68ef801d8
32,916,629,392,613
a2f7d6a312c048d9fa9aed24c0cce58433e454b3
/beautiful-ui/src/main/java/com/beautiful/ui/core/model/DataNodeType.java
f72cf1f22d3aef53a86a9eb99afc4596d3d019e9
[ "Apache-2.0" ]
permissive
xlzwhboy/flowml
https://github.com/xlzwhboy/flowml
72b25e55e8ce54f08c4294ab4479278438b31bd3
2181bf1ae01b09a2fa90a204421a33d34c8c41f0
refs/heads/master
2020-03-13T22:19:34.371000
2018-06-03T07:44:50
2018-06-03T07:44:50
131,313,999
0
0
Apache-2.0
true
2018-06-03T07:44:51
2018-04-27T15:27:50
2018-05-11T09:37:29
2018-06-03T07:44:51
2,535
0
0
0
Java
false
null
package com.beautiful.ui.core.model; /** * @description: ${description} * @author: zhuyuping * @create: 2018-05-16 18:26 **/ public enum DataNodeType { START, NEXT,//下一步 CONDITION,//条件阻塞 JOIN,//聚合节点 REPEAT,//重复节点 FORK,//分散 ROUTER,//转发 SUBSCRIBE,//发布订阅 同一份数据消费多次 END; }
UTF-8
Java
377
java
DataNodeType.java
Java
[ { "context": ";\n\n/**\n * @description: ${description}\n * @author: zhuyuping\n * @create: 2018-05-16 18:26\n **/\npublic enum Dat", "end": 95, "score": 0.9986720085144043, "start": 86, "tag": "USERNAME", "value": "zhuyuping" } ]
null
[]
package com.beautiful.ui.core.model; /** * @description: ${description} * @author: zhuyuping * @create: 2018-05-16 18:26 **/ public enum DataNodeType { START, NEXT,//下一步 CONDITION,//条件阻塞 JOIN,//聚合节点 REPEAT,//重复节点 FORK,//分散 ROUTER,//转发 SUBSCRIBE,//发布订阅 同一份数据消费多次 END; }
377
0.603834
0.565495
21
13.904762
11.321723
36
false
false
0
0
0
0
0
0
0.47619
false
false
13
8f172581338df3815b62d581fe568ff586934233
20,675,972,604,225
d2845579ea6aa51a2e150f0ffe6ccfda85d035ce
/board/board-service/src/main/java/com/welab/wefe/board/service/api/dataset_task/DetailApi.java
39c006508425ad2714b8b5b6e1a1980f506e6896
[ "Apache-2.0" ]
permissive
as23187/WeFe
https://github.com/as23187/WeFe
d8de9ff626f9f3e5d98e0850b0b717a80fd73e72
ba92871d4b1d2eef6c606c34795f4575e84703bd
refs/heads/main
2023-08-22T12:01:06.718000
2021-10-28T01:54:05
2021-10-28T01:54:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright 2021 Tianmian Tech. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.welab.wefe.board.service.api.dataset_task; import com.welab.wefe.board.service.database.entity.data_set.DataSetTaskMysqlModel; import com.welab.wefe.board.service.service.dataset.DataSetTaskService; import com.welab.wefe.common.exception.StatusCodeWithException; import com.welab.wefe.common.fieldvalidate.annotation.Check; import com.welab.wefe.common.web.api.base.AbstractApi; import com.welab.wefe.common.web.api.base.Api; import com.welab.wefe.common.web.dto.AbstractApiInput; import com.welab.wefe.common.web.dto.ApiResult; import org.springframework.beans.factory.annotation.Autowired; /** * @author lonnie */ @Api(path = "data_set_task/detail", name = "get a data set upload task info") public class DetailApi extends AbstractApi<DetailApi.Input, DataSetTaskMysqlModel> { @Autowired private DataSetTaskService dataSetTaskService; @Override protected ApiResult<DataSetTaskMysqlModel> handle(Input input) throws StatusCodeWithException { return success(dataSetTaskService.findById(input.getId())); } public static class Input extends AbstractApiInput { @Check(name = "id唯一标识", require = true) private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } } }
UTF-8
Java
1,967
java
DetailApi.java
Java
[ { "context": "eans.factory.annotation.Autowired;\n\n/**\n * @author lonnie\n */\n@Api(path = \"data_set_task/detail\", name = \"g", "end": 1251, "score": 0.9919427633285522, "start": 1245, "tag": "USERNAME", "value": "lonnie" } ]
null
[]
/** * Copyright 2021 Tianmian Tech. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.welab.wefe.board.service.api.dataset_task; import com.welab.wefe.board.service.database.entity.data_set.DataSetTaskMysqlModel; import com.welab.wefe.board.service.service.dataset.DataSetTaskService; import com.welab.wefe.common.exception.StatusCodeWithException; import com.welab.wefe.common.fieldvalidate.annotation.Check; import com.welab.wefe.common.web.api.base.AbstractApi; import com.welab.wefe.common.web.api.base.Api; import com.welab.wefe.common.web.dto.AbstractApiInput; import com.welab.wefe.common.web.dto.ApiResult; import org.springframework.beans.factory.annotation.Autowired; /** * @author lonnie */ @Api(path = "data_set_task/detail", name = "get a data set upload task info") public class DetailApi extends AbstractApi<DetailApi.Input, DataSetTaskMysqlModel> { @Autowired private DataSetTaskService dataSetTaskService; @Override protected ApiResult<DataSetTaskMysqlModel> handle(Input input) throws StatusCodeWithException { return success(dataSetTaskService.findById(input.getId())); } public static class Input extends AbstractApiInput { @Check(name = "id唯一标识", require = true) private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } } }
1,967
0.735069
0.730985
56
33.982143
29.563787
99
false
false
0
0
0
0
0
0
0.410714
false
false
13
81cbe2030f3d7a62f4e31a633a7d852da599aa7e
21,449,066,745,558
136e5bc3a436595426e9d51684118eb385d8a577
/src/main/java/br/com/sistema/controller/bean/CadastrarCarroBean.java
a8d0c2bb9888eae4fb709b3be9273635b992c888
[]
no_license
zucoloto/LocadoraVeiculo
https://github.com/zucoloto/LocadoraVeiculo
24d0f549d419b6ef8eaeb4dbd14a4c41bff41710
cb2b31e64a20c6eeeae88eb16ad39af850f38a79
refs/heads/master
2021-01-10T01:51:43.294000
2015-11-29T14:39:07
2015-11-29T14:39:07
43,985,956
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.sistema.controller.bean; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.view.ViewScoped; import javax.inject.Inject; import javax.inject.Named; import org.primefaces.model.UploadedFile; import br.com.sistema.model.dao.AcessorioDAO; import br.com.sistema.model.dao.ModeloCarroDAO; import br.com.sistema.model.entity.Acessorio; import br.com.sistema.model.entity.Carro; import br.com.sistema.model.entity.ModeloCarro; import br.com.sistema.model.service.CarroService; import br.com.sistema.model.service.exception.NegocioException; import br.com.sistema.util.jsf.FacesUtil; @Named @ViewScoped public class CadastrarCarroBean implements Serializable { private static final long serialVersionUID = 1L; @Inject private CarroService carroService; private Carro carro; @Inject private ModeloCarroDAO modeloDAO; private List<ModeloCarro> modelos; @Inject private AcessorioDAO acessorioDAO; private List<Acessorio> acessorios; private UploadedFile uploadedFile; @PostConstruct public void init() { limpar(); carregarModelos(); carregarAcessorios(); } public void limpar() { this.carro = new Carro(); this.carro.setAcessorios(new ArrayList<Acessorio>()); } public void salvar() { try { if (this.uploadedFile != null) { this.carro.setFoto(this.uploadedFile.getContents()); } this.carroService.salvar(this.carro); FacesUtil.addSuccessMessage("Registro salvo com sucesso!"); } catch (NegocioException e) { FacesUtil.addErrorMessage(e.getMessage()); } catch (Exception e) { e.printStackTrace(); FacesUtil.addErrorMessage("Erro desconhecido. Contatar o administrador!"); } limpar(); } public void carregarModelos() { this.modelos = this.modeloDAO.buscarTodos(); } public void carregarAcessorios() { this.acessorios = this.acessorioDAO.buscarTodos(); } public Carro getCarro() { return carro; } public void setCarro(Carro carro) { this.carro = carro; } public List<ModeloCarro> getModelos() { return modelos; } public List<Acessorio> getAcessorios() { return acessorios; } public UploadedFile getUploadedFile() { return uploadedFile; } public void setUploadedFile(UploadedFile uploadedFile) { this.uploadedFile = uploadedFile; } }
UTF-8
Java
2,341
java
CadastrarCarroBean.java
Java
[]
null
[]
package br.com.sistema.controller.bean; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.view.ViewScoped; import javax.inject.Inject; import javax.inject.Named; import org.primefaces.model.UploadedFile; import br.com.sistema.model.dao.AcessorioDAO; import br.com.sistema.model.dao.ModeloCarroDAO; import br.com.sistema.model.entity.Acessorio; import br.com.sistema.model.entity.Carro; import br.com.sistema.model.entity.ModeloCarro; import br.com.sistema.model.service.CarroService; import br.com.sistema.model.service.exception.NegocioException; import br.com.sistema.util.jsf.FacesUtil; @Named @ViewScoped public class CadastrarCarroBean implements Serializable { private static final long serialVersionUID = 1L; @Inject private CarroService carroService; private Carro carro; @Inject private ModeloCarroDAO modeloDAO; private List<ModeloCarro> modelos; @Inject private AcessorioDAO acessorioDAO; private List<Acessorio> acessorios; private UploadedFile uploadedFile; @PostConstruct public void init() { limpar(); carregarModelos(); carregarAcessorios(); } public void limpar() { this.carro = new Carro(); this.carro.setAcessorios(new ArrayList<Acessorio>()); } public void salvar() { try { if (this.uploadedFile != null) { this.carro.setFoto(this.uploadedFile.getContents()); } this.carroService.salvar(this.carro); FacesUtil.addSuccessMessage("Registro salvo com sucesso!"); } catch (NegocioException e) { FacesUtil.addErrorMessage(e.getMessage()); } catch (Exception e) { e.printStackTrace(); FacesUtil.addErrorMessage("Erro desconhecido. Contatar o administrador!"); } limpar(); } public void carregarModelos() { this.modelos = this.modeloDAO.buscarTodos(); } public void carregarAcessorios() { this.acessorios = this.acessorioDAO.buscarTodos(); } public Carro getCarro() { return carro; } public void setCarro(Carro carro) { this.carro = carro; } public List<ModeloCarro> getModelos() { return modelos; } public List<Acessorio> getAcessorios() { return acessorios; } public UploadedFile getUploadedFile() { return uploadedFile; } public void setUploadedFile(UploadedFile uploadedFile) { this.uploadedFile = uploadedFile; } }
2,341
0.756087
0.75566
106
21.084906
19.686274
77
false
false
0
0
0
0
0
0
1.320755
false
false
13
b97dafa9c3d9281a86c1c27da74a92c276812e61
5,592,047,486,844
b42fd38fd3b0faac98a0c641847559858f742b22
/HomeWAV/Source Code/Android App Version 2005007/sources/com/forasoft/homewavvisitor/presentation/presenter/auth/VerifyMethodPresenter$onSendClicked$$inlined$let$lambda$2.java
e54dfa203e48236d359b4308477f374f63c39a90
[]
no_license
zuiaixiaobai/twilio-prison-video-visitation
https://github.com/zuiaixiaobai/twilio-prison-video-visitation
c8b300be9001c8b846ac4d1c1a46b3a720ee4f8a
c172ba4679b14e28d1922847309c3a86388c9957
refs/heads/main
2023-04-20T18:14:11.035000
2021-05-14T13:47:39
2021-05-14T13:47:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.forasoft.homewavvisitor.presentation.presenter.auth; import air.HomeWAV.R; import com.forasoft.homewavvisitor.presentation.view.auth.VerifyMethodView; import io.reactivex.functions.Consumer; import kotlin.Metadata; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\b\u0003\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u0003H\n¢\u0006\u0002\b\u0005¨\u0006\u0006"}, d2 = {"<anonymous>", "", "it", "", "kotlin.jvm.PlatformType", "accept", "com/forasoft/homewavvisitor/presentation/presenter/auth/VerifyMethodPresenter$onSendClicked$1$2"}, k = 3, mv = {1, 1, 16}) /* compiled from: VerifyMethodPresenter.kt */ final class VerifyMethodPresenter$onSendClicked$$inlined$let$lambda$2<T> implements Consumer<Throwable> { final /* synthetic */ String $channel$inlined; final /* synthetic */ VerifyMethodPresenter this$0; VerifyMethodPresenter$onSendClicked$$inlined$let$lambda$2(VerifyMethodPresenter verifyMethodPresenter, String str) { this.this$0 = verifyMethodPresenter; this.$channel$inlined = str; } public final void accept(Throwable th) { ((VerifyMethodView) this.this$0.getViewState()).showMessage((int) R.string.label_server_error); } }
UTF-8
Java
1,326
java
VerifyMethodPresenter$onSendClicked$$inlined$let$lambda$2.java
Java
[]
null
[]
package com.forasoft.homewavvisitor.presentation.presenter.auth; import air.HomeWAV.R; import com.forasoft.homewavvisitor.presentation.view.auth.VerifyMethodView; import io.reactivex.functions.Consumer; import kotlin.Metadata; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0003\n\u0002\b\u0002\n\u0002\b\u0003\u0010\u0000\u001a\u00020\u00012\u000e\u0010\u0002\u001a\n \u0004*\u0004\u0018\u00010\u00030\u0003H\n¢\u0006\u0002\b\u0005¨\u0006\u0006"}, d2 = {"<anonymous>", "", "it", "", "kotlin.jvm.PlatformType", "accept", "com/forasoft/homewavvisitor/presentation/presenter/auth/VerifyMethodPresenter$onSendClicked$1$2"}, k = 3, mv = {1, 1, 16}) /* compiled from: VerifyMethodPresenter.kt */ final class VerifyMethodPresenter$onSendClicked$$inlined$let$lambda$2<T> implements Consumer<Throwable> { final /* synthetic */ String $channel$inlined; final /* synthetic */ VerifyMethodPresenter this$0; VerifyMethodPresenter$onSendClicked$$inlined$let$lambda$2(VerifyMethodPresenter verifyMethodPresenter, String str) { this.this$0 = verifyMethodPresenter; this.$channel$inlined = str; } public final void accept(Throwable th) { ((VerifyMethodView) this.this$0.getViewState()).showMessage((int) R.string.label_server_error); } }
1,326
0.745468
0.629154
22
59.18182
95.833488
467
false
false
0
0
30
0.040785
77
0.058157
1.136364
false
false
13
0fc5665508f3a7f99dbd9654eba0e6349c29114c
4,664,334,526,850
0d476c39888e4ab5225e8565954fc019c42c6835
/src/main/java/com/vectorprint/configuration/binding/parameters/AbstractParamBindingHelperDecorator.java
8fc9ef7c29020f8db15aa8534ee963684f7636ec
[ "Apache-2.0" ]
permissive
eduarddrenth/Configuration
https://github.com/eduarddrenth/Configuration
977cb4bf8b53f6a45f7723a337a23bf6ff31a89a
c7c793d07d12afb20b20c23a6c3a0e9ba090a280
refs/heads/master
2023-08-07T14:58:41.524000
2023-07-21T20:35:09
2023-07-21T20:35:09
32,132,970
2
0
Apache-2.0
false
2021-03-27T15:52:35
2015-03-13T06:03:00
2021-03-27T15:42:42
2021-03-27T15:52:35
668
1
0
2
Java
false
false
package com.vectorprint.configuration.binding.parameters; /*- * #%L * Config * %% * Copyright (C) 2015 - 2018 VectorPrint * %% * 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. * #L% */ import com.vectorprint.configuration.binding.AbstractBindingHelperDecorator; import com.vectorprint.configuration.parameters.Parameter; import java.io.Serializable; public class AbstractParamBindingHelperDecorator extends AbstractBindingHelperDecorator<ParamBindingHelper> implements ParamBindingHelper { public AbstractParamBindingHelperDecorator(ParamBindingHelper bindingHelper) { super(bindingHelper); } @Override public <TYPE extends Serializable> void setValueOrDefault(Parameter<TYPE> parameter, TYPE value, boolean setDefault) { bindingHelper.setValueOrDefault(parameter, value, setDefault); } @Override public <TYPE extends Serializable> TYPE getValueToSerialize(Parameter<TYPE> p, boolean useDefault) { return bindingHelper.getValueToSerialize(p, useDefault); } }
UTF-8
Java
1,530
java
AbstractParamBindingHelperDecorator.java
Java
[]
null
[]
package com.vectorprint.configuration.binding.parameters; /*- * #%L * Config * %% * Copyright (C) 2015 - 2018 VectorPrint * %% * 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. * #L% */ import com.vectorprint.configuration.binding.AbstractBindingHelperDecorator; import com.vectorprint.configuration.parameters.Parameter; import java.io.Serializable; public class AbstractParamBindingHelperDecorator extends AbstractBindingHelperDecorator<ParamBindingHelper> implements ParamBindingHelper { public AbstractParamBindingHelperDecorator(ParamBindingHelper bindingHelper) { super(bindingHelper); } @Override public <TYPE extends Serializable> void setValueOrDefault(Parameter<TYPE> parameter, TYPE value, boolean setDefault) { bindingHelper.setValueOrDefault(parameter, value, setDefault); } @Override public <TYPE extends Serializable> TYPE getValueToSerialize(Parameter<TYPE> p, boolean useDefault) { return bindingHelper.getValueToSerialize(p, useDefault); } }
1,530
0.764052
0.756209
44
33.727272
36.891342
139
false
false
0
0
0
0
0
0
0.409091
false
false
13
f12f4734a3d8470bc0553115425fc26a42170330
21,242,908,265,143
d32412bf9c9b037aace703810bba9ccaedf2875c
/buiness/src/main/java/com/netmi/workerbusiness/data/entity/mine/ContentEntity.java
1623402a8605a2e7d44bf1ded997983070d63bdd
[]
no_license
wangscript007/HaobeiBuiness
https://github.com/wangscript007/HaobeiBuiness
d071deaa3b822246d5d64ebe284797b40ca5b15c
888afb16e36da3f9ac283ea714ff75d80f6860d8
refs/heads/master
2023-01-19T06:55:41.428000
2020-11-25T07:47:27
2020-11-25T07:47:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.netmi.workerbusiness.data.entity.mine; import com.netmi.baselibrary.data.entity.BaseEntity; /** * 类描述: * 创建人:Leo * 创建时间:2019/9/18 * 修改备注: */ public class ContentEntity extends BaseEntity { /** * id : 22 * title : 测试服务协议 * remark : 3413243124132 * link_type : 1 * param : /content/content/info?id=22 * content : <p>412342314123</p> * type : 40 * action_id : 0 */ private String id; private String title; private String remark; private String link_type; private String param; private String content; private String type; private String action_id; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getLink_type() { return link_type; } public void setLink_type(String link_type) { this.link_type = link_type; } public String getParam() { return param; } public void setParam(String param) { this.param = param; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getAction_id() { return action_id; } public void setAction_id(String action_id) { this.action_id = action_id; } }
UTF-8
Java
1,827
java
ContentEntity.java
Java
[ { "context": "brary.data.entity.BaseEntity;\n\n/**\n * 类描述:\n * 创建人:Leo\n * 创建时间:2019/9/18\n * 修改备注:\n */\npublic class Conte", "end": 128, "score": 0.9845472574234009, "start": 125, "tag": "NAME", "value": "Leo" } ]
null
[]
package com.netmi.workerbusiness.data.entity.mine; import com.netmi.baselibrary.data.entity.BaseEntity; /** * 类描述: * 创建人:Leo * 创建时间:2019/9/18 * 修改备注: */ public class ContentEntity extends BaseEntity { /** * id : 22 * title : 测试服务协议 * remark : 3413243124132 * link_type : 1 * param : /content/content/info?id=22 * content : <p>412342314123</p> * type : 40 * action_id : 0 */ private String id; private String title; private String remark; private String link_type; private String param; private String content; private String type; private String action_id; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getLink_type() { return link_type; } public void setLink_type(String link_type) { this.link_type = link_type; } public String getParam() { return param; } public void setParam(String param) { this.param = param; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getAction_id() { return action_id; } public void setAction_id(String action_id) { this.action_id = action_id; } }
1,827
0.578977
0.556492
96
17.53125
15.254066
52
false
false
0
0
0
0
0
0
0.270833
false
false
13
cf532894497d55d916d57102e025a6886b7d6219
9,560,597,231,684
36838dfcd53c4d2c73b9a6b0b7a8a28e4a331517
/cn/com/smartdevices/bracelet/gps/g/j.java
cad1865d7665116696a36e6e92f92bda4f0e45c0
[]
no_license
ShahmanTeh/MiFit-Java
https://github.com/ShahmanTeh/MiFit-Java
fbb2fd578727131b9ac7150b86c4045791368fe8
93bdf88d39423893b294dec2f5bf54708617b5d0
refs/heads/master
2021-01-20T13:05:10.408000
2016-02-03T21:02:55
2016-02-03T21:02:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.smartdevices.bracelet.gps.g; import android.content.Context; import android.content.res.AssetManager; import android.text.TextUtils; import cn.com.smartdevices.bracelet.C0596r; import cn.com.smartdevices.bracelet.gps.c.a.g; import cn.com.smartdevices.bracelet.ui.AlarmActivity; import com.activeandroid.b; import com.d.a.a.C1012a; import com.tencent.connect.common.Constants; import com.xiaomi.account.openauth.h; import com.xiaomi.hm.health.dataprocess.HeartRateInfo; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.SequenceInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; class j { private HashMap<String, String> a; public j() { this.a = null; this.a = d(); } private List<String> a(String str) { char[] toCharArray = str.toCharArray(); List<String> arrayList = new ArrayList(); for (char valueOf : toCharArray) { arrayList.add(this.a.get(String.valueOf(valueOf))); } return arrayList; } private List<String> b(String str) { List<String> arrayList = new ArrayList(); int parseInt = Integer.parseInt(str); int i = parseInt / C1012a.b; if (i > 0) { arrayList.add(this.a.get(String.valueOf(i))); arrayList.add(this.a.get("10000")); } i = (parseInt % C1012a.b) / h.E; if (i > 0) { arrayList.add(this.a.get(String.valueOf(i))); arrayList.add(this.a.get(Constants.DEFAULT_UIN)); } i = (parseInt % h.E) / 100; if (i > 0) { arrayList.add(this.a.get(String.valueOf(i))); arrayList.add(this.a.get("100")); } int i2 = ((parseInt % h.E) % 100) / 10; parseInt = ((parseInt % h.E) % 100) % 10; if (i2 <= 0) { if (i > 0) { arrayList.add(this.a.get(Constants.VIA_RESULT_SUCCESS)); } if (parseInt > 0) { arrayList.add(this.a.get(String.valueOf(parseInt))); } } else if (i2 == 1) { if (i > 0) { arrayList.add(this.a.get(Constants.VIA_TO_TYPE_QQ_GROUP)); } arrayList.add(this.a.get(Constants.VIA_REPORT_TYPE_SHARE_TO_QQ)); if (parseInt != 0) { arrayList.add(this.a.get(String.valueOf(parseInt))); } } else { arrayList.add(this.a.get(String.valueOf(i2))); arrayList.add(this.a.get(Constants.VIA_REPORT_TYPE_SHARE_TO_QQ)); if (parseInt > 0) { arrayList.add(this.a.get(String.valueOf(parseInt))); } } return arrayList; } private List<String> c(String str) { List<String> arrayList = new ArrayList(); int parseInt = Integer.parseInt(str); int i = parseInt / 3600; if (i > 0) { arrayList.addAll(b(String.valueOf(i))); arrayList.add(this.a.get(AlarmActivity.c)); } i = (parseInt % 3600) / 60; if (i > 0) { arrayList.addAll(b(String.valueOf(i))); arrayList.add(this.a.get("minute")); } parseInt = (parseInt % 3600) % 60; if (parseInt > 0) { arrayList.addAll(b(String.valueOf(parseInt))); arrayList.add(this.a.get("second")); } return arrayList; } private HashMap<String, String> d() { HashMap<String, String> hashMap = new HashMap(); hashMap.put(Constants.VIA_RESULT_SUCCESS, "voice/0.mp3"); hashMap.put(Constants.VIA_TO_TYPE_QQ_GROUP, "voice/1.mp3"); hashMap.put(Constants.VIA_SSO_LOGIN, "voice/2.mp3"); hashMap.put(Constants.VIA_TO_TYPE_QQ_DISCUSS_GROUP, "voice/3.mp3"); hashMap.put(Constants.VIA_TO_TYPE_QZONE, "voice/4.mp3"); hashMap.put(Constants.VIA_SHARE_TYPE_TEXT, "voice/5.mp3"); hashMap.put(Constants.VIA_SHARE_TYPE_INFO, "voice/6.mp3"); hashMap.put("7", "voice/7.mp3"); hashMap.put("8", "voice/8.mp3"); hashMap.put("9", "voice/9.mp3"); hashMap.put(Constants.VIA_REPORT_TYPE_SHARE_TO_QQ, "voice/10.mp3"); hashMap.put("100", "voice/100.mp3"); hashMap.put(Constants.DEFAULT_UIN, "voice/1000.mp3"); hashMap.put("10000", "voice/10000.mp3"); hashMap.put("dot", "voice/dot.mp3"); hashMap.put("kilometer", "voice/kilometer.mp3"); hashMap.put("near_kilometer_spent", "voice/near_kilometer_spent.mp3"); hashMap.put("second", "voice/second.mp3"); hashMap.put("minute", "voice/minute.mp3"); hashMap.put(AlarmActivity.c, "voice/hour.mp3"); hashMap.put("time_spent", "voice/time_spent.mp3"); hashMap.put("already_run", "voice/already_run.mp3"); hashMap.put("gps_lost", "voice/gps_lost.mp3"); hashMap.put("gps_regained", "voice/gps_regained.mp3"); hashMap.put("great", "voice/great.mp3"); hashMap.put("hr_high", "voice/hr_high.mp3"); hashMap.put("current_hr", "voice/current_hr.mp3"); hashMap.put("per_minute", "voice/per_minute.mp3"); hashMap.put(g.f, "voice/time.mp3"); return hashMap; } File a(Context context, List<String> list) { SequenceInputStream sequenceInputStream; FileOutputStream fileOutputStream; Exception e; Throwable th; FileOutputStream fileOutputStream2 = null; String str = context.getFilesDir() + File.separator + "sound.mp3"; File file = new File(str); if (file.exists()) { file.delete(); } AssetManager assets = context.getResources().getAssets(); try { Collection arrayList = new ArrayList(); for (String str2 : list) { if (!TextUtils.isEmpty(str2)) { arrayList.add(assets.open(str2)); } } sequenceInputStream = new SequenceInputStream(Collections.enumeration(arrayList)); try { fileOutputStream = new FileOutputStream(str); try { byte[] bArr = new byte[b.a]; while (true) { int read = sequenceInputStream.read(bArr); if (read == -1) { break; } fileOutputStream.write(bArr, 0, read); fileOutputStream.flush(); } fileOutputStream.flush(); file = new File(str); if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e2) { } } if (sequenceInputStream == null) { return file; } try { sequenceInputStream.close(); return file; } catch (IOException e3) { return file; } } catch (Exception e4) { e = e4; try { C0596r.a("Player", e.getMessage()); if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e5) { } } if (sequenceInputStream != null) { try { sequenceInputStream.close(); } catch (IOException e6) { } } return null; } catch (Throwable th2) { th = th2; fileOutputStream2 = fileOutputStream; if (fileOutputStream2 != null) { try { fileOutputStream2.close(); } catch (IOException e7) { } } if (sequenceInputStream != null) { try { sequenceInputStream.close(); } catch (IOException e8) { } } throw th; } } } catch (Exception e9) { e = e9; fileOutputStream = null; C0596r.a("Player", e.getMessage()); if (fileOutputStream != null) { fileOutputStream.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } return null; } catch (Throwable th3) { th = th3; if (fileOutputStream2 != null) { fileOutputStream2.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } throw th; } } catch (Exception e10) { e = e10; fileOutputStream = null; sequenceInputStream = null; C0596r.a("Player", e.getMessage()); if (fileOutputStream != null) { fileOutputStream.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } return null; } catch (Throwable th4) { th = th4; sequenceInputStream = null; if (fileOutputStream2 != null) { fileOutputStream2.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } throw th; } } List<String> a(int i) { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("hr_high")); arrayList.addAll(b(i)); return arrayList; } List<String> a(h hVar) { String valueOf; List<String> arrayList = new ArrayList(); if (hVar.a > 0.0f) { arrayList.add(this.a.get("already_run")); valueOf = String.valueOf((int) hVar.a); if (valueOf.indexOf(".") > 0) { String[] split = valueOf.split("\\."); if (split.length == 2) { String str = split[0]; valueOf = split[1]; arrayList.addAll(b(str)); arrayList.add(this.a.get("dot")); arrayList.addAll(a(valueOf)); } } else { arrayList.addAll(b(valueOf)); } arrayList.add(this.a.get("kilometer")); } if (hVar.c > 0) { valueOf = String.valueOf(hVar.c); arrayList.add(this.a.get("time_spent")); arrayList.addAll(c(valueOf)); } if (hVar.b > 0.0f) { arrayList.add(this.a.get("near_kilometer_spent")); arrayList.addAll(c(String.valueOf((long) hVar.b))); } int i = hVar.e; if (HeartRateInfo.isHRValueValid(i)) { arrayList.addAll(b(i)); } if (hVar.b <= 360.0f) { arrayList.add(this.a.get("great")); } return arrayList; } public void a() { if (this.a != null) { this.a.clear(); } } List<String> b() { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("gps_lost")); return arrayList; } List<String> b(int i) { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("current_hr")); arrayList.add(this.a.get("per_minute")); arrayList.addAll(b(String.valueOf(i))); arrayList.add(this.a.get(g.f)); return arrayList; } List<String> c() { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("gps_regained")); return arrayList; } }
UTF-8
Java
12,486
java
j.java
Java
[]
null
[]
package cn.com.smartdevices.bracelet.gps.g; import android.content.Context; import android.content.res.AssetManager; import android.text.TextUtils; import cn.com.smartdevices.bracelet.C0596r; import cn.com.smartdevices.bracelet.gps.c.a.g; import cn.com.smartdevices.bracelet.ui.AlarmActivity; import com.activeandroid.b; import com.d.a.a.C1012a; import com.tencent.connect.common.Constants; import com.xiaomi.account.openauth.h; import com.xiaomi.hm.health.dataprocess.HeartRateInfo; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.SequenceInputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; class j { private HashMap<String, String> a; public j() { this.a = null; this.a = d(); } private List<String> a(String str) { char[] toCharArray = str.toCharArray(); List<String> arrayList = new ArrayList(); for (char valueOf : toCharArray) { arrayList.add(this.a.get(String.valueOf(valueOf))); } return arrayList; } private List<String> b(String str) { List<String> arrayList = new ArrayList(); int parseInt = Integer.parseInt(str); int i = parseInt / C1012a.b; if (i > 0) { arrayList.add(this.a.get(String.valueOf(i))); arrayList.add(this.a.get("10000")); } i = (parseInt % C1012a.b) / h.E; if (i > 0) { arrayList.add(this.a.get(String.valueOf(i))); arrayList.add(this.a.get(Constants.DEFAULT_UIN)); } i = (parseInt % h.E) / 100; if (i > 0) { arrayList.add(this.a.get(String.valueOf(i))); arrayList.add(this.a.get("100")); } int i2 = ((parseInt % h.E) % 100) / 10; parseInt = ((parseInt % h.E) % 100) % 10; if (i2 <= 0) { if (i > 0) { arrayList.add(this.a.get(Constants.VIA_RESULT_SUCCESS)); } if (parseInt > 0) { arrayList.add(this.a.get(String.valueOf(parseInt))); } } else if (i2 == 1) { if (i > 0) { arrayList.add(this.a.get(Constants.VIA_TO_TYPE_QQ_GROUP)); } arrayList.add(this.a.get(Constants.VIA_REPORT_TYPE_SHARE_TO_QQ)); if (parseInt != 0) { arrayList.add(this.a.get(String.valueOf(parseInt))); } } else { arrayList.add(this.a.get(String.valueOf(i2))); arrayList.add(this.a.get(Constants.VIA_REPORT_TYPE_SHARE_TO_QQ)); if (parseInt > 0) { arrayList.add(this.a.get(String.valueOf(parseInt))); } } return arrayList; } private List<String> c(String str) { List<String> arrayList = new ArrayList(); int parseInt = Integer.parseInt(str); int i = parseInt / 3600; if (i > 0) { arrayList.addAll(b(String.valueOf(i))); arrayList.add(this.a.get(AlarmActivity.c)); } i = (parseInt % 3600) / 60; if (i > 0) { arrayList.addAll(b(String.valueOf(i))); arrayList.add(this.a.get("minute")); } parseInt = (parseInt % 3600) % 60; if (parseInt > 0) { arrayList.addAll(b(String.valueOf(parseInt))); arrayList.add(this.a.get("second")); } return arrayList; } private HashMap<String, String> d() { HashMap<String, String> hashMap = new HashMap(); hashMap.put(Constants.VIA_RESULT_SUCCESS, "voice/0.mp3"); hashMap.put(Constants.VIA_TO_TYPE_QQ_GROUP, "voice/1.mp3"); hashMap.put(Constants.VIA_SSO_LOGIN, "voice/2.mp3"); hashMap.put(Constants.VIA_TO_TYPE_QQ_DISCUSS_GROUP, "voice/3.mp3"); hashMap.put(Constants.VIA_TO_TYPE_QZONE, "voice/4.mp3"); hashMap.put(Constants.VIA_SHARE_TYPE_TEXT, "voice/5.mp3"); hashMap.put(Constants.VIA_SHARE_TYPE_INFO, "voice/6.mp3"); hashMap.put("7", "voice/7.mp3"); hashMap.put("8", "voice/8.mp3"); hashMap.put("9", "voice/9.mp3"); hashMap.put(Constants.VIA_REPORT_TYPE_SHARE_TO_QQ, "voice/10.mp3"); hashMap.put("100", "voice/100.mp3"); hashMap.put(Constants.DEFAULT_UIN, "voice/1000.mp3"); hashMap.put("10000", "voice/10000.mp3"); hashMap.put("dot", "voice/dot.mp3"); hashMap.put("kilometer", "voice/kilometer.mp3"); hashMap.put("near_kilometer_spent", "voice/near_kilometer_spent.mp3"); hashMap.put("second", "voice/second.mp3"); hashMap.put("minute", "voice/minute.mp3"); hashMap.put(AlarmActivity.c, "voice/hour.mp3"); hashMap.put("time_spent", "voice/time_spent.mp3"); hashMap.put("already_run", "voice/already_run.mp3"); hashMap.put("gps_lost", "voice/gps_lost.mp3"); hashMap.put("gps_regained", "voice/gps_regained.mp3"); hashMap.put("great", "voice/great.mp3"); hashMap.put("hr_high", "voice/hr_high.mp3"); hashMap.put("current_hr", "voice/current_hr.mp3"); hashMap.put("per_minute", "voice/per_minute.mp3"); hashMap.put(g.f, "voice/time.mp3"); return hashMap; } File a(Context context, List<String> list) { SequenceInputStream sequenceInputStream; FileOutputStream fileOutputStream; Exception e; Throwable th; FileOutputStream fileOutputStream2 = null; String str = context.getFilesDir() + File.separator + "sound.mp3"; File file = new File(str); if (file.exists()) { file.delete(); } AssetManager assets = context.getResources().getAssets(); try { Collection arrayList = new ArrayList(); for (String str2 : list) { if (!TextUtils.isEmpty(str2)) { arrayList.add(assets.open(str2)); } } sequenceInputStream = new SequenceInputStream(Collections.enumeration(arrayList)); try { fileOutputStream = new FileOutputStream(str); try { byte[] bArr = new byte[b.a]; while (true) { int read = sequenceInputStream.read(bArr); if (read == -1) { break; } fileOutputStream.write(bArr, 0, read); fileOutputStream.flush(); } fileOutputStream.flush(); file = new File(str); if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e2) { } } if (sequenceInputStream == null) { return file; } try { sequenceInputStream.close(); return file; } catch (IOException e3) { return file; } } catch (Exception e4) { e = e4; try { C0596r.a("Player", e.getMessage()); if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e5) { } } if (sequenceInputStream != null) { try { sequenceInputStream.close(); } catch (IOException e6) { } } return null; } catch (Throwable th2) { th = th2; fileOutputStream2 = fileOutputStream; if (fileOutputStream2 != null) { try { fileOutputStream2.close(); } catch (IOException e7) { } } if (sequenceInputStream != null) { try { sequenceInputStream.close(); } catch (IOException e8) { } } throw th; } } } catch (Exception e9) { e = e9; fileOutputStream = null; C0596r.a("Player", e.getMessage()); if (fileOutputStream != null) { fileOutputStream.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } return null; } catch (Throwable th3) { th = th3; if (fileOutputStream2 != null) { fileOutputStream2.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } throw th; } } catch (Exception e10) { e = e10; fileOutputStream = null; sequenceInputStream = null; C0596r.a("Player", e.getMessage()); if (fileOutputStream != null) { fileOutputStream.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } return null; } catch (Throwable th4) { th = th4; sequenceInputStream = null; if (fileOutputStream2 != null) { fileOutputStream2.close(); } if (sequenceInputStream != null) { sequenceInputStream.close(); } throw th; } } List<String> a(int i) { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("hr_high")); arrayList.addAll(b(i)); return arrayList; } List<String> a(h hVar) { String valueOf; List<String> arrayList = new ArrayList(); if (hVar.a > 0.0f) { arrayList.add(this.a.get("already_run")); valueOf = String.valueOf((int) hVar.a); if (valueOf.indexOf(".") > 0) { String[] split = valueOf.split("\\."); if (split.length == 2) { String str = split[0]; valueOf = split[1]; arrayList.addAll(b(str)); arrayList.add(this.a.get("dot")); arrayList.addAll(a(valueOf)); } } else { arrayList.addAll(b(valueOf)); } arrayList.add(this.a.get("kilometer")); } if (hVar.c > 0) { valueOf = String.valueOf(hVar.c); arrayList.add(this.a.get("time_spent")); arrayList.addAll(c(valueOf)); } if (hVar.b > 0.0f) { arrayList.add(this.a.get("near_kilometer_spent")); arrayList.addAll(c(String.valueOf((long) hVar.b))); } int i = hVar.e; if (HeartRateInfo.isHRValueValid(i)) { arrayList.addAll(b(i)); } if (hVar.b <= 360.0f) { arrayList.add(this.a.get("great")); } return arrayList; } public void a() { if (this.a != null) { this.a.clear(); } } List<String> b() { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("gps_lost")); return arrayList; } List<String> b(int i) { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("current_hr")); arrayList.add(this.a.get("per_minute")); arrayList.addAll(b(String.valueOf(i))); arrayList.add(this.a.get(g.f)); return arrayList; } List<String> c() { List<String> arrayList = new ArrayList(); arrayList.add(this.a.get("gps_regained")); return arrayList; } }
12,486
0.482621
0.467163
343
35.402332
18.829794
94
false
false
0
0
0
0
0
0
0.658892
false
false
13
06dc09e268c00054636a734cb7ee472d83d02820
4,269,197,496,375
4dd35aa94641084e41f0122bf55601220a12861d
/springboot/src/main/java/com/springboot/LoggingAspect.java
7186db209818c24cae0491267eef83e40e3b125c
[]
no_license
rahulgangwar/Bootcamp
https://github.com/rahulgangwar/Bootcamp
c675fb4d65b77b4a2b7a3937ee165b7000061a85
d3616009bfcd80496bdd716fa5e853c1c7331e96
refs/heads/master
2018-12-26T14:48:48.132000
2018-12-22T21:33:37
2018-12-22T21:33:37
112,948,312
0
0
null
false
2018-09-10T07:48:59
2017-12-03T17:28:59
2018-09-10T05:49:51
2018-09-10T07:48:59
7,734
0
0
0
Java
false
null
package com.springboot; import lombok.extern.log4j.Log4j2; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.context.annotation.Configuration; @Log4j2 @Configuration //Cross cutting application concerns ex. logging controller methods here @Aspect public class LoggingAspect { //one or more JoinPoint where an advice should be executed //Join point is a point in program execution usually a method execution @Pointcut("execution(* com.springboot.controller.*.*(..))") private void selectAll() { } //Advice is what should be done when match is found @Before("selectAll()") public void before(JoinPoint joinPoint) { log.info(" Executing {} with params {}", joinPoint.getSignature(), joinPoint.getArgs()); } }
UTF-8
Java
897
java
LoggingAspect.java
Java
[]
null
[]
package com.springboot; import lombok.extern.log4j.Log4j2; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.context.annotation.Configuration; @Log4j2 @Configuration //Cross cutting application concerns ex. logging controller methods here @Aspect public class LoggingAspect { //one or more JoinPoint where an advice should be executed //Join point is a point in program execution usually a method execution @Pointcut("execution(* com.springboot.controller.*.*(..))") private void selectAll() { } //Advice is what should be done when match is found @Before("selectAll()") public void before(JoinPoint joinPoint) { log.info(" Executing {} with params {}", joinPoint.getSignature(), joinPoint.getArgs()); } }
897
0.745819
0.740245
27
32.222221
26.849834
96
false
false
0
0
0
0
0
0
0.37037
false
false
13
643e0e524086edd6d5e172a7bf6293cc897b9a77
3,118,146,265,239
c06b8e3a879f8ae2aa0d1f930ce6589678879a38
/src/main/java/POM/ProfilePage.java
dfba3d29adbe3a1b3a248261c65cd9e315f96021
[]
no_license
Sergiy1987/Selenium_tests_Java
https://github.com/Sergiy1987/Selenium_tests_Java
3f04cc413b8deff91331676a16b057b093f526df
2d066c2ffdb335569ed2e5ed9745c9236f9b8a14
refs/heads/master
2021-05-14T08:50:39.847000
2018-03-11T20:58:24
2018-03-11T20:58:24
116,307,069
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package POM; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class ProfilePage extends AbstractPage { public static final String USER_PROFILE_LINK = "//*[@id=\"login-block\"]/div/ul/li[1]/a"; public static final String USER_SIGNOUT_MENU = ".login-button__menu-icon"; public static final String USER_SIGNOUT_LINK = "login__logout"; public static final String BUTTON_WRITE_EMAIL = "//div[@id='content']/aside/button"; public static final String SEND_TO = "toInput"; public static final String SUBJECT_MAIL = "subject"; public static final String EMAIL = "nedved198725@gmail.com"; public static final String SUBJECT_TEXT = "PageObjectPattern_Test"; public static final String FRAME_ID = "mce_0_ifr"; public static final String BODY_MAIL = "tinymce"; public static final String BODY_TEXT = "UkrNet_Test_Message_FromPageObjectPattern"; public static final String BUTTON_SEND_EMAIL = "//div[@id='screens']/div/div/div/button"; public static final String LINK_TEXT_SEND = "лист"; public ProfilePage(WebDriver webDriver) { super(webDriver); } public ProfilePage goToProfilePage() { webDriver.findElement(By.xpath(USER_PROFILE_LINK)).click(); return new ProfilePage(webDriver); } public ProfilePage exit(){ webDriver.findElement(By.cssSelector(USER_SIGNOUT_MENU)).click(); webDriver.findElement(By.id(USER_SIGNOUT_LINK)).click(); return new ProfilePage(webDriver); } public ProfilePage SendEmail (){ webDriver.findElement(By.xpath(BUTTON_WRITE_EMAIL)).click(); webDriver.findElement(By.name(SEND_TO)).sendKeys(EMAIL); webDriver.findElement(By.name(SUBJECT_MAIL)).sendKeys(SUBJECT_TEXT); webDriver.switchTo().frame(FRAME_ID); webDriver.findElement(By.id(BODY_MAIL)).sendKeys(BODY_TEXT); webDriver.switchTo().defaultContent(); webDriver.findElement(By.xpath(BUTTON_SEND_EMAIL)).click(); return new ProfilePage(webDriver); } }
UTF-8
Java
1,903
java
ProfilePage.java
Java
[ { "context": "= \"subject\";\n\tpublic static final String EMAIL = \"nedved198725@gmail.com\";\n\tpublic static final String SUBJECT_TEXT = \"Pag", "end": 613, "score": 0.9996411204338074, "start": 591, "tag": "EMAIL", "value": "nedved198725@gmail.com" } ]
null
[]
package POM; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class ProfilePage extends AbstractPage { public static final String USER_PROFILE_LINK = "//*[@id=\"login-block\"]/div/ul/li[1]/a"; public static final String USER_SIGNOUT_MENU = ".login-button__menu-icon"; public static final String USER_SIGNOUT_LINK = "login__logout"; public static final String BUTTON_WRITE_EMAIL = "//div[@id='content']/aside/button"; public static final String SEND_TO = "toInput"; public static final String SUBJECT_MAIL = "subject"; public static final String EMAIL = "<EMAIL>"; public static final String SUBJECT_TEXT = "PageObjectPattern_Test"; public static final String FRAME_ID = "mce_0_ifr"; public static final String BODY_MAIL = "tinymce"; public static final String BODY_TEXT = "UkrNet_Test_Message_FromPageObjectPattern"; public static final String BUTTON_SEND_EMAIL = "//div[@id='screens']/div/div/div/button"; public static final String LINK_TEXT_SEND = "лист"; public ProfilePage(WebDriver webDriver) { super(webDriver); } public ProfilePage goToProfilePage() { webDriver.findElement(By.xpath(USER_PROFILE_LINK)).click(); return new ProfilePage(webDriver); } public ProfilePage exit(){ webDriver.findElement(By.cssSelector(USER_SIGNOUT_MENU)).click(); webDriver.findElement(By.id(USER_SIGNOUT_LINK)).click(); return new ProfilePage(webDriver); } public ProfilePage SendEmail (){ webDriver.findElement(By.xpath(BUTTON_WRITE_EMAIL)).click(); webDriver.findElement(By.name(SEND_TO)).sendKeys(EMAIL); webDriver.findElement(By.name(SUBJECT_MAIL)).sendKeys(SUBJECT_TEXT); webDriver.switchTo().frame(FRAME_ID); webDriver.findElement(By.id(BODY_MAIL)).sendKeys(BODY_TEXT); webDriver.switchTo().defaultContent(); webDriver.findElement(By.xpath(BUTTON_SEND_EMAIL)).click(); return new ProfilePage(webDriver); } }
1,888
0.750922
0.746709
44
42.18182
26.890581
90
false
false
0
0
0
0
0
0
1.840909
false
false
13
5503c4ffd900aa70d87c96aee034dff6a51ea3f9
24,051,816,885,234
6c4505fe813d33f1967e711542c84d0587e4ad5f
/src/freecell_framewell/Card.java
0f7bcd4ab15f89d78dc777276368c52b2f26eb9f
[]
no_license
tlframe2/Freecell
https://github.com/tlframe2/Freecell
1b147b734f87b97ed2964df6e859658cca717bf4
cbff84dd94d5c833d8acae7959ea7de4da41c146
refs/heads/master
2020-04-06T20:01:33.772000
2018-12-12T04:27:29
2018-12-12T04:27:29
157,758,004
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package freecell_framewell; /** * Creates Card object that represents standard playing card * @author Tyrell Frame and Alex Sidwell */ public class Card { // Instance variables private int value; private Suit suit; private boolean visible; private String name; private String color; /** * Default Card constructor; initializes with default values */ public Card() { value = 0; suit = null; visible = false; name = null; color = null; } /** * Overloaded Card constructor; initializes with defined values * @param startValue numerical value of card * @param startSuit suit of card */ public Card(int startValue, Suit startSuit) { value = startValue; suit = startSuit; visible = true; setName(); setColor(); } /** * Value accessor method * @return value of card */ protected int getValue() { return value; } /** * Suit accessor method * @return suit of card */ protected Suit getSuit() { return suit; } /** * Name accessor method * @return name of card */ protected String getName() { return name; } protected String getColor() { return color; } /** * Value mutator method * @param newValue value of card */ protected void setValue(int newValue) { value = newValue; setName(); // renames card } /** * Suit mutator method * @param newSuit suit of card */ protected void setSuit(Suit newSuit) { suit = newSuit; } protected void setColor() { color = (suit == Suit.Clubs || suit == Suit.Spades) ? "black" : "red"; } /** * Sets name based on value */ private void setName() { if (value == 1) { name = "Ace"; } else if (value == 11) { name = "Jack"; } else if (value == 12) { name = "Queen"; } else if (value == 13) { name = "King"; } else { name = String.valueOf(value); } } /** * Returns card's visibility * @return boolean representing card's visibility */ protected boolean isVisible() { return visible; } /** * Changes card's visibility to true */ public void show() { visible = true; } /** * Changes card's visibility to false */ public void hide() { visible = false; } /** * Returns String of Card attributes * @return card's suit and value if visible or 'Hidden Card' if not visible */ public String toString() { if (visible) { return name + " of " + suit; } else { return "Hidden Card"; } } }
UTF-8
Java
2,443
java
Card.java
Java
[ { "context": "t that represents standard playing card\n * @author Tyrell Frame and Alex Sidwell\n */\npublic class Card {\n\t\n\t// In", "end": 117, "score": 0.9998818039894104, "start": 105, "tag": "NAME", "value": "Tyrell Frame" }, { "context": " standard playing card\n * @author Tyrell Frame and Alex Sidwell\n */\npublic class Card {\n\t\n\t// Instance variables\n", "end": 134, "score": 0.9998811483383179, "start": 122, "tag": "NAME", "value": "Alex Sidwell" }, { "context": "oid setName() {\n\t\t\n\t\tif (value == 1) {\n\t\t\tname = \"Ace\";\n\t\t} else if (value == 11) {\n\t\t\tname = \"Jack\";\n\t", "end": 1662, "score": 0.9870724678039551, "start": 1659, "tag": "NAME", "value": "Ace" }, { "context": "e = \"Ace\";\n\t\t} else if (value == 11) {\n\t\t\tname = \"Jack\";\n\t\t} else if (value == 12) {\n\t\t\tname = \"Queen\";\n", "end": 1708, "score": 0.999779999256134, "start": 1704, "tag": "NAME", "value": "Jack" } ]
null
[]
package freecell_framewell; /** * Creates Card object that represents standard playing card * @author <NAME> and <NAME> */ public class Card { // Instance variables private int value; private Suit suit; private boolean visible; private String name; private String color; /** * Default Card constructor; initializes with default values */ public Card() { value = 0; suit = null; visible = false; name = null; color = null; } /** * Overloaded Card constructor; initializes with defined values * @param startValue numerical value of card * @param startSuit suit of card */ public Card(int startValue, Suit startSuit) { value = startValue; suit = startSuit; visible = true; setName(); setColor(); } /** * Value accessor method * @return value of card */ protected int getValue() { return value; } /** * Suit accessor method * @return suit of card */ protected Suit getSuit() { return suit; } /** * Name accessor method * @return name of card */ protected String getName() { return name; } protected String getColor() { return color; } /** * Value mutator method * @param newValue value of card */ protected void setValue(int newValue) { value = newValue; setName(); // renames card } /** * Suit mutator method * @param newSuit suit of card */ protected void setSuit(Suit newSuit) { suit = newSuit; } protected void setColor() { color = (suit == Suit.Clubs || suit == Suit.Spades) ? "black" : "red"; } /** * Sets name based on value */ private void setName() { if (value == 1) { name = "Ace"; } else if (value == 11) { name = "Jack"; } else if (value == 12) { name = "Queen"; } else if (value == 13) { name = "King"; } else { name = String.valueOf(value); } } /** * Returns card's visibility * @return boolean representing card's visibility */ protected boolean isVisible() { return visible; } /** * Changes card's visibility to true */ public void show() { visible = true; } /** * Changes card's visibility to false */ public void hide() { visible = false; } /** * Returns String of Card attributes * @return card's suit and value if visible or 'Hidden Card' if not visible */ public String toString() { if (visible) { return name + " of " + suit; } else { return "Hidden Card"; } } }
2,431
0.616865
0.61359
147
15.619047
15.594057
76
false
false
0
0
0
0
0
0
1.55102
false
false
13
84fd8a790c10187c0a54070f68c3119d933c84c3
23,459,111,424,951
290e599cbeafc69e8ea12b77d36474365c9e11f7
/src/project/tour/management_GUI/GUI_Category_Management.java
a7adf781b8d74e1832e4ada631431a91c66fac7d
[]
no_license
LuongTuLinh/Project-Tour-Management
https://github.com/LuongTuLinh/Project-Tour-Management
eea116fb8f1435b430fec8693b82930d901c0c4c
43e9b4cb9c9d1119c4ea2f5e8c290fd4d322ab94
refs/heads/master
2023-01-12T23:10:19.505000
2020-11-16T07:32:36
2020-11-16T07:32:36
298,095,927
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package project.tour.management_GUI; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.plaf.basic.BasicScrollBarUI; import javax.swing.table.DefaultTableModel; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import project.tour.management_API.APIRequester; import project.tour.management_DTO.Tour_Attraction_DTO; import project.tour.management_DTO.Tour_Category_DTO; import project.tour.management_DTO.User_DTO; import project.tour.management_Handle_API.Handle_API_Get_Tour; import project.tour.management_Handle_API.Handle_API_Tour_Attractions; import project.tour.management_Handle_API.Handle_API_Tour_Category; /** * * @author DELL */ public class GUI_Category_Management extends JPanel{ Tour_Category_DTO category_dto ; Tour_Attraction_DTO tour_attraction_dto; private JTabbedPane tabbedPane; /*************************DECLARE OF TABBED PANEL*********************************/ /*---------------DECLARE PANEL CATEGORY TOUR--------------------*/ private JPanel panelCategoryTour; private JPanel panelFieldCategory; private JPanel panelTableCategory; private JLabel labelNameCategory; private JTextField txtNameCategory; private JSeparator sptNameCategory; private JButton buttonAddCategory; private JButton buttonClearFieldCategory; private JButton buttonSaveCategory; private JButton buttonCancelCategory; public JTable tableCategoryTour; public DefaultTableModel modelTableCategoryTour; private JScrollPane scrollPaneCategory; private JLabel labelSearchCategory; private JTextField txtSearchCategory; private JLabel labelIconSearchCategory; private JLabel labelIconRefreshCategory; private JButton buttonEditCategory; private JButton buttonDeleteCategory; /*--------------END DECLARE PANEL CATEGORY TOUR-----------------------*/ /************************END DECLARE OF TABBED PANEL******************************/ public GUI_Category_Management(){ init(); } public void init(){ setLayout(null); setBounds(0, 0, 990, 590); setBackground(Color.white); /*========================================= TABBED PANEL ====================================================*/ tabbedPane = new JTabbedPane(); tabbedPane.setBounds(5, 5, 980, 580); tabbedPane.setBackground(new Color(0,77,64)); tabbedPane.setForeground(Color.white); /*========================PANEL CATEGORY TOUR====================================*/ panelCategoryTour = new JPanel(); panelCategoryTour.setLayout(null); panelCategoryTour.setBounds(5,5,970,570); panelCategoryTour.setBackground(Color.white); /*===================PANEL FIELD CATEGORY TOUR========================*/ panelFieldCategory = new JPanel(); panelFieldCategory.setLayout(null); panelFieldCategory.setBackground(Color.white); panelFieldCategory.setBounds(0,0,400,580); //**************TEXTFIELD NAME CATEGORY*******************// labelNameCategory = new JLabel("TÊN THỂ LOẠI :",JLabel.CENTER); labelNameCategory.setFont(new Font("Segoe",Font.BOLD,12)); labelNameCategory.setBounds(40,130,120,30); txtNameCategory = new JTextField(); txtNameCategory.setBounds(145,128,200,30); txtNameCategory.setBorder(null); txtNameCategory.setFont(new Font(Font.SERIF, Font.PLAIN, 15)); sptNameCategory = new JSeparator(); sptNameCategory.setBounds(145,158,200,10); sptNameCategory.setBackground(new Color(0,0,0)); //**************END TEXTFIELD NAME CATEGORY*******************// buttonAddCategory = new JButton("Thêm Thể Loại"); buttonAddCategory.setBackground(new Color(41, 149, 85)); buttonAddCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonAddCategory.setForeground(Color.WHITE); buttonAddCategory.setBounds(50,305,150,30); buttonAddCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonClearFieldCategory = new JButton("Làm Mới"); buttonClearFieldCategory.setBackground(new Color(255, 255, 255)); buttonClearFieldCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonClearFieldCategory.setForeground(Color.BLACK); buttonClearFieldCategory.setBounds(250,305,105,30); buttonClearFieldCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonSaveCategory = new JButton("Lưu"); buttonSaveCategory.setBackground(new Color(32, 171, 214)); buttonSaveCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonSaveCategory.setForeground(Color.WHITE); buttonSaveCategory.setBounds(50,305,105,30); buttonSaveCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonCancelCategory = new JButton("Huỷ Bỏ"); buttonCancelCategory.setBackground(new Color(219, 50, 54)); buttonCancelCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonCancelCategory.setForeground(Color.WHITE); buttonCancelCategory.setBounds(250,305,105,30); buttonCancelCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); /**************ADD ELEMENT FOR PANEL FIELD CATEGORY TOUR*********************/ panelFieldCategory.add(labelNameCategory); panelFieldCategory.add(txtNameCategory); panelFieldCategory.add(sptNameCategory); panelFieldCategory.add(buttonAddCategory); panelFieldCategory.add(buttonClearFieldCategory); panelFieldCategory.add(buttonSaveCategory); panelFieldCategory.add(buttonCancelCategory); buttonSaveCategory.setVisible(false); buttonCancelCategory.setVisible(false); /**************END ADD ELEMENT FOR PANEL FIELD CATEGORY TOUR*******************/ /*===================END PANEL FIELD CATEGORY TOUR========================*/ /*===================PANEL TABLE CATEGORY TOUR========================*/ panelTableCategory = new JPanel(); panelTableCategory.setLayout(null); panelTableCategory.setBounds(400,0,580,570); panelTableCategory.setBackground(Color.white); labelSearchCategory = new JLabel("Tìm kiếm:"); labelSearchCategory.setBounds(80,21,80,25); txtSearchCategory = new JTextField(); txtSearchCategory.setBounds(145,21,250,25); labelIconSearchCategory = new JLabel(); labelIconSearchCategory.setBounds(410,20,25,25); labelIconSearchCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); labelIconSearchCategory.setIcon(new ImageIcon(getClass().getResource("/image/icons8_search_property_25px.png"))); labelIconRefreshCategory = new JLabel(); labelIconRefreshCategory.setBounds(443,20,25,25); labelIconRefreshCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); labelIconRefreshCategory.setIcon(new ImageIcon(getClass().getResource("/image/icons8_repeat_25px_1.png"))); Vector<String> columnName = new Vector<>(); columnName.add("Mã Thể Loại"); columnName.add("Tên Thể Loại"); modelTableCategoryTour = new DefaultTableModel(columnName, 0); tableCategoryTour = new JTable(modelTableCategoryTour); LoadDataTableCategory(); tableCategoryTour.setRowHeight(25); tableCategoryTour.setSelectionBackground(new java.awt.Color(0,105,92, 180)); tableCategoryTour.getTableHeader().setReorderingAllowed(false); tableCategoryTour.getTableHeader().setFont(new Font("Times New Roman",Font.BOLD,15)); tableCategoryTour.getTableHeader().setOpaque(false); tableCategoryTour.getTableHeader().setBackground(new Color(0,77,64)); tableCategoryTour.getTableHeader().setForeground(new Color(255,255,255)); tableCategoryTour.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableCategoryTour.setDefaultEditor(Object.class, null); // DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); // rightRenderer.setHorizontalAlignment(JLabel.CENTER); /****************SET SIZE COLUMN OF TABLE***********************/ tableCategoryTour.getColumnModel().getColumn(0).setPreferredWidth(100); tableCategoryTour.getColumnModel().getColumn(1).setPreferredWidth(460); /****************SET SIZE COLUMN OF TABLE***********************/ tableCategoryTour.setFont(new Font("Times New Roman",Font.PLAIN,15)); scrollPaneCategory = new JScrollPane(tableCategoryTour); scrollPaneCategory.getVerticalScrollBar().setUI(new BasicScrollBarUI() { @Override protected void configureScrollBarColors() { this.thumbColor = new Color(19, 113, 106); } }); scrollPaneCategory.setBounds(10,60,560,400); buttonEditCategory = new JButton("Sửa Thể Loại"); buttonEditCategory.setBackground(new Color(194, 98, 14)); buttonEditCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonEditCategory.setForeground(Color.WHITE); buttonEditCategory.setBounds(100,485,150,30); buttonEditCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonDeleteCategory = new JButton("Xoá Thể Loại"); buttonDeleteCategory.setBackground(new Color(219, 50, 54)); buttonDeleteCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonDeleteCategory.setForeground(Color.WHITE); buttonDeleteCategory.setBounds(300,485,150,30); buttonDeleteCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); /**************ADD ELEMENT FOR PANEL TABLE CATEGORY TOUR*******************/ panelTableCategory.add(scrollPaneCategory); panelTableCategory.add(buttonEditCategory); panelTableCategory.add(buttonDeleteCategory); panelTableCategory.add(labelSearchCategory); panelTableCategory.add(txtSearchCategory); panelTableCategory.add(labelIconSearchCategory); panelTableCategory.add(labelIconRefreshCategory); /**************END ADD ELEMENT FOR PANEL TABLE ATTRACTION TOUR*******************/ /*===================END PANEL TABLE ATTRACTION TOUR========================*/ /**************ADD PANEL FOR PANEL ATTRACTION TOUR*********************/ panelCategoryTour.add(panelFieldCategory); panelCategoryTour.add(panelTableCategory); /**************END ADD PANEL FOR PANEL ATTRACTION TOUR*********************/ /*========================END PANEL CATEGORY TOUR====================================*/ /**************ADD PANEL FOR TABBED PANEL*********************/ tabbedPane.addTab("Thể Loại Tour", panelCategoryTour); /**************END ADD PANEL FOR TABBED PANEL*********************/ /*======================================== END TABBED PANEL =================================================*/ add(tabbedPane); /*========================HANDLE CLICK BUTTON OF CATEGORY====================================*/ labelIconRefreshCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { LoadDataTableCategory(); } }); labelIconSearchCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String nameCategory = txtSearchCategory.getText(); if(!empty(nameCategory)){ nameCategory = encodeValue(nameCategory); } String parameter = "&Filters[Name]=\""+nameCategory+"\"&FilterConditions[Name]=like"; LoadDataTableCategoryAfterSearch(parameter); } }); buttonClearFieldCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { clearTextFieldCategory(); } }); buttonAddCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String nameCategory = txtNameCategory.getText(); if(!empty( nameCategory ) ) { User_DTO user = new User_DTO(); String parameter = "{\"name\":\""+nameCategory+"\"}"; //APIRequester.sendPOST(parameter, "tourCategories", user.getToken()); String response = Handle_API_Tour_Category.sendPost_Add_CategoryTour(parameter, "tourCategories", user.getToken()); if(response.equals("success")==true){ LoadDataTableCategory(); JOptionPane.showMessageDialog(null, "Thêm thành công"); clearTextFieldCategory(); } }else { JOptionPane.showMessageDialog(null, "Lỗi! Vui lòng nhập đầy đủ thông tin"); } } }); buttonDeleteCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = tableCategoryTour.getSelectedRow(); if( row == -1 ){ JOptionPane.showMessageDialog(null, "Vui lòng chọn thể loại tour cần xoá"); } else { int result = JOptionPane.showConfirmDialog(null,"Bạn có chắc muốn xoá thể loại tour này?", "Thông báo", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if(result == JOptionPane.YES_OPTION){ User_DTO user = new User_DTO(); String tourId = (tableCategoryTour.getModel().getValueAt(row, 0).toString()); //APIRequester.sendDelete("","tourCategories/"+tourId, user.getToken()); String response = Handle_API_Tour_Category.sendDeleteCategoryTour("","tourCategories/"+tourId, user.getToken()); if(response.equals("success") == true){ LoadDataTableCategory(); JOptionPane.showMessageDialog(null, "Xoá thể loại thành công"); } }else if (result == JOptionPane.NO_OPTION){ }else { } } } }); buttonEditCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = tableCategoryTour.getSelectedRow(); if( row == -1 ){ JOptionPane.showMessageDialog(null, "Vui lòng chọn thể loại cần sửa"); }else { String tourId = (tableCategoryTour.getModel().getValueAt(row, 0).toString()); String name = (tableCategoryTour.getModel().getValueAt(row, 1).toString()); buttonAddCategory.setVisible(false); buttonClearFieldCategory.setVisible(false); buttonSaveCategory.setVisible(true); buttonCancelCategory.setVisible(true); txtNameCategory.setText(name); category_dto = new Tour_Category_DTO(tourId, name); } } }); buttonCancelCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { clearTextFieldCategory(); buttonSaveCategory.setVisible(false); buttonCancelCategory.setVisible(false); buttonAddCategory.setVisible(true); buttonClearFieldCategory.setVisible(true); } }); buttonSaveCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String name = txtNameCategory.getText(); if(checkDifferent(name, category_dto)==false){ User_DTO user = new User_DTO(); String parameter = "{\"id\":"+category_dto.getCategoryId()+",\"name\":\""+name+"\"}"; System.out.println(parameter); APIRequester.sendPUT(parameter, "tourCategories/"+category_dto.getCategoryId(), user.getToken()); clearTextFieldCategory(); LoadDataTableCategory(); buttonSaveCategory.setVisible(false); buttonCancelCategory.setVisible(false); buttonAddCategory.setVisible(true); buttonClearFieldCategory.setVisible(true); JOptionPane.showMessageDialog(null, "Sửa thành công"); }else { JOptionPane.showMessageDialog(null, "Thể loại không có thay đổi"); } } }); /*========================END HANDLE CLICK BUTTON OF CATEGORY====================================*/ } public void LoadDataTableCategory(){ User_DTO user = new User_DTO(); JSONArray json = new JSONArray(Handle_API_Tour_Category.Fetch_API_Tour_Category("tourCategories?Page=1&Limit=100", user.getToken())); // Vector<Vector<String>> dataList = new Vector<>(); modelTableCategoryTour.setRowCount(0); for (int i = 0; i < json.length(); i++) { JSONObject jsonObj; try { jsonObj = json.getJSONObject(i); Vector<String> data = new Vector<>(); data.add(jsonObj.get("id").toString()); data.add(jsonObj.get("name").toString()); modelTableCategoryTour.addRow(data); } catch (JSONException ex) { Logger.getLogger(GUI_Table_Tour_Management.class.getName()).log(Level.SEVERE, null, ex); } } tableCategoryTour.setModel(modelTableCategoryTour); } public void LoadDataTableCategoryAfterSearch(String parameter){ User_DTO user = new User_DTO(); JSONArray json = new JSONArray(Handle_API_Tour_Category.Fetch_API_Tour_Category("tourCategories?Page=1&Limit=100"+parameter, user.getToken())); if(json.length() >= 1) { modelTableCategoryTour.setRowCount(0); for (int i = 0; i < json.length(); i++) { JSONObject jsonObj; try { jsonObj = json.getJSONObject(i); Vector<String> data = new Vector<>(); data.add(jsonObj.get("id").toString()); data.add(jsonObj.get("name").toString()); modelTableCategoryTour.addRow(data); } catch (JSONException ex) { Logger.getLogger(GUI_Table_Tour_Management.class.getName()).log(Level.SEVERE, null, ex); } } tableCategoryTour.setModel(modelTableCategoryTour); }else { JOptionPane.showMessageDialog(null, "Không tìm thấy thể loại cần tìm"); } } public static boolean empty( final String s ) { // Null-safe, short-circuit evaluation. return s == null || s.trim().isEmpty(); } public static boolean checkDifferent(String name, Tour_Category_DTO category_dto){ if(name.equals(category_dto.getCategoryName())== true ){ return true; } return false; } public void clearTextFieldCategory(){ txtNameCategory.setText(""); } public static String encodeValue(String value) { try { return URLEncoder.encode(value, StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex.getCause()); } } }
UTF-8
Java
21,041
java
GUI_Category_Management.java
Java
[ { "context": "e_API.Handle_API_Tour_Category;\n\n/**\n *\n * @author DELL\n */\npublic class GUI_Category_Management extends ", "end": 1575, "score": 0.7370420098304749, "start": 1571, "tag": "USERNAME", "value": "DELL" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package project.tour.management_GUI; import java.awt.Color; import java.awt.Cursor; import java.awt.Font; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.plaf.basic.BasicScrollBarUI; import javax.swing.table.DefaultTableModel; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import project.tour.management_API.APIRequester; import project.tour.management_DTO.Tour_Attraction_DTO; import project.tour.management_DTO.Tour_Category_DTO; import project.tour.management_DTO.User_DTO; import project.tour.management_Handle_API.Handle_API_Get_Tour; import project.tour.management_Handle_API.Handle_API_Tour_Attractions; import project.tour.management_Handle_API.Handle_API_Tour_Category; /** * * @author DELL */ public class GUI_Category_Management extends JPanel{ Tour_Category_DTO category_dto ; Tour_Attraction_DTO tour_attraction_dto; private JTabbedPane tabbedPane; /*************************DECLARE OF TABBED PANEL*********************************/ /*---------------DECLARE PANEL CATEGORY TOUR--------------------*/ private JPanel panelCategoryTour; private JPanel panelFieldCategory; private JPanel panelTableCategory; private JLabel labelNameCategory; private JTextField txtNameCategory; private JSeparator sptNameCategory; private JButton buttonAddCategory; private JButton buttonClearFieldCategory; private JButton buttonSaveCategory; private JButton buttonCancelCategory; public JTable tableCategoryTour; public DefaultTableModel modelTableCategoryTour; private JScrollPane scrollPaneCategory; private JLabel labelSearchCategory; private JTextField txtSearchCategory; private JLabel labelIconSearchCategory; private JLabel labelIconRefreshCategory; private JButton buttonEditCategory; private JButton buttonDeleteCategory; /*--------------END DECLARE PANEL CATEGORY TOUR-----------------------*/ /************************END DECLARE OF TABBED PANEL******************************/ public GUI_Category_Management(){ init(); } public void init(){ setLayout(null); setBounds(0, 0, 990, 590); setBackground(Color.white); /*========================================= TABBED PANEL ====================================================*/ tabbedPane = new JTabbedPane(); tabbedPane.setBounds(5, 5, 980, 580); tabbedPane.setBackground(new Color(0,77,64)); tabbedPane.setForeground(Color.white); /*========================PANEL CATEGORY TOUR====================================*/ panelCategoryTour = new JPanel(); panelCategoryTour.setLayout(null); panelCategoryTour.setBounds(5,5,970,570); panelCategoryTour.setBackground(Color.white); /*===================PANEL FIELD CATEGORY TOUR========================*/ panelFieldCategory = new JPanel(); panelFieldCategory.setLayout(null); panelFieldCategory.setBackground(Color.white); panelFieldCategory.setBounds(0,0,400,580); //**************TEXTFIELD NAME CATEGORY*******************// labelNameCategory = new JLabel("TÊN THỂ LOẠI :",JLabel.CENTER); labelNameCategory.setFont(new Font("Segoe",Font.BOLD,12)); labelNameCategory.setBounds(40,130,120,30); txtNameCategory = new JTextField(); txtNameCategory.setBounds(145,128,200,30); txtNameCategory.setBorder(null); txtNameCategory.setFont(new Font(Font.SERIF, Font.PLAIN, 15)); sptNameCategory = new JSeparator(); sptNameCategory.setBounds(145,158,200,10); sptNameCategory.setBackground(new Color(0,0,0)); //**************END TEXTFIELD NAME CATEGORY*******************// buttonAddCategory = new JButton("Thêm Thể Loại"); buttonAddCategory.setBackground(new Color(41, 149, 85)); buttonAddCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonAddCategory.setForeground(Color.WHITE); buttonAddCategory.setBounds(50,305,150,30); buttonAddCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonClearFieldCategory = new JButton("Làm Mới"); buttonClearFieldCategory.setBackground(new Color(255, 255, 255)); buttonClearFieldCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonClearFieldCategory.setForeground(Color.BLACK); buttonClearFieldCategory.setBounds(250,305,105,30); buttonClearFieldCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonSaveCategory = new JButton("Lưu"); buttonSaveCategory.setBackground(new Color(32, 171, 214)); buttonSaveCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonSaveCategory.setForeground(Color.WHITE); buttonSaveCategory.setBounds(50,305,105,30); buttonSaveCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonCancelCategory = new JButton("Huỷ Bỏ"); buttonCancelCategory.setBackground(new Color(219, 50, 54)); buttonCancelCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonCancelCategory.setForeground(Color.WHITE); buttonCancelCategory.setBounds(250,305,105,30); buttonCancelCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); /**************ADD ELEMENT FOR PANEL FIELD CATEGORY TOUR*********************/ panelFieldCategory.add(labelNameCategory); panelFieldCategory.add(txtNameCategory); panelFieldCategory.add(sptNameCategory); panelFieldCategory.add(buttonAddCategory); panelFieldCategory.add(buttonClearFieldCategory); panelFieldCategory.add(buttonSaveCategory); panelFieldCategory.add(buttonCancelCategory); buttonSaveCategory.setVisible(false); buttonCancelCategory.setVisible(false); /**************END ADD ELEMENT FOR PANEL FIELD CATEGORY TOUR*******************/ /*===================END PANEL FIELD CATEGORY TOUR========================*/ /*===================PANEL TABLE CATEGORY TOUR========================*/ panelTableCategory = new JPanel(); panelTableCategory.setLayout(null); panelTableCategory.setBounds(400,0,580,570); panelTableCategory.setBackground(Color.white); labelSearchCategory = new JLabel("Tìm kiếm:"); labelSearchCategory.setBounds(80,21,80,25); txtSearchCategory = new JTextField(); txtSearchCategory.setBounds(145,21,250,25); labelIconSearchCategory = new JLabel(); labelIconSearchCategory.setBounds(410,20,25,25); labelIconSearchCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); labelIconSearchCategory.setIcon(new ImageIcon(getClass().getResource("/image/icons8_search_property_25px.png"))); labelIconRefreshCategory = new JLabel(); labelIconRefreshCategory.setBounds(443,20,25,25); labelIconRefreshCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); labelIconRefreshCategory.setIcon(new ImageIcon(getClass().getResource("/image/icons8_repeat_25px_1.png"))); Vector<String> columnName = new Vector<>(); columnName.add("Mã Thể Loại"); columnName.add("Tên Thể Loại"); modelTableCategoryTour = new DefaultTableModel(columnName, 0); tableCategoryTour = new JTable(modelTableCategoryTour); LoadDataTableCategory(); tableCategoryTour.setRowHeight(25); tableCategoryTour.setSelectionBackground(new java.awt.Color(0,105,92, 180)); tableCategoryTour.getTableHeader().setReorderingAllowed(false); tableCategoryTour.getTableHeader().setFont(new Font("Times New Roman",Font.BOLD,15)); tableCategoryTour.getTableHeader().setOpaque(false); tableCategoryTour.getTableHeader().setBackground(new Color(0,77,64)); tableCategoryTour.getTableHeader().setForeground(new Color(255,255,255)); tableCategoryTour.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableCategoryTour.setDefaultEditor(Object.class, null); // DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); // rightRenderer.setHorizontalAlignment(JLabel.CENTER); /****************SET SIZE COLUMN OF TABLE***********************/ tableCategoryTour.getColumnModel().getColumn(0).setPreferredWidth(100); tableCategoryTour.getColumnModel().getColumn(1).setPreferredWidth(460); /****************SET SIZE COLUMN OF TABLE***********************/ tableCategoryTour.setFont(new Font("Times New Roman",Font.PLAIN,15)); scrollPaneCategory = new JScrollPane(tableCategoryTour); scrollPaneCategory.getVerticalScrollBar().setUI(new BasicScrollBarUI() { @Override protected void configureScrollBarColors() { this.thumbColor = new Color(19, 113, 106); } }); scrollPaneCategory.setBounds(10,60,560,400); buttonEditCategory = new JButton("Sửa Thể Loại"); buttonEditCategory.setBackground(new Color(194, 98, 14)); buttonEditCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonEditCategory.setForeground(Color.WHITE); buttonEditCategory.setBounds(100,485,150,30); buttonEditCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); buttonDeleteCategory = new JButton("Xoá Thể Loại"); buttonDeleteCategory.setBackground(new Color(219, 50, 54)); buttonDeleteCategory.setFont(new Font("Segoe",Font.BOLD,13)); buttonDeleteCategory.setForeground(Color.WHITE); buttonDeleteCategory.setBounds(300,485,150,30); buttonDeleteCategory.setCursor(new Cursor(Cursor.HAND_CURSOR)); /**************ADD ELEMENT FOR PANEL TABLE CATEGORY TOUR*******************/ panelTableCategory.add(scrollPaneCategory); panelTableCategory.add(buttonEditCategory); panelTableCategory.add(buttonDeleteCategory); panelTableCategory.add(labelSearchCategory); panelTableCategory.add(txtSearchCategory); panelTableCategory.add(labelIconSearchCategory); panelTableCategory.add(labelIconRefreshCategory); /**************END ADD ELEMENT FOR PANEL TABLE ATTRACTION TOUR*******************/ /*===================END PANEL TABLE ATTRACTION TOUR========================*/ /**************ADD PANEL FOR PANEL ATTRACTION TOUR*********************/ panelCategoryTour.add(panelFieldCategory); panelCategoryTour.add(panelTableCategory); /**************END ADD PANEL FOR PANEL ATTRACTION TOUR*********************/ /*========================END PANEL CATEGORY TOUR====================================*/ /**************ADD PANEL FOR TABBED PANEL*********************/ tabbedPane.addTab("Thể Loại Tour", panelCategoryTour); /**************END ADD PANEL FOR TABBED PANEL*********************/ /*======================================== END TABBED PANEL =================================================*/ add(tabbedPane); /*========================HANDLE CLICK BUTTON OF CATEGORY====================================*/ labelIconRefreshCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { LoadDataTableCategory(); } }); labelIconSearchCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String nameCategory = txtSearchCategory.getText(); if(!empty(nameCategory)){ nameCategory = encodeValue(nameCategory); } String parameter = "&Filters[Name]=\""+nameCategory+"\"&FilterConditions[Name]=like"; LoadDataTableCategoryAfterSearch(parameter); } }); buttonClearFieldCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { clearTextFieldCategory(); } }); buttonAddCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String nameCategory = txtNameCategory.getText(); if(!empty( nameCategory ) ) { User_DTO user = new User_DTO(); String parameter = "{\"name\":\""+nameCategory+"\"}"; //APIRequester.sendPOST(parameter, "tourCategories", user.getToken()); String response = Handle_API_Tour_Category.sendPost_Add_CategoryTour(parameter, "tourCategories", user.getToken()); if(response.equals("success")==true){ LoadDataTableCategory(); JOptionPane.showMessageDialog(null, "Thêm thành công"); clearTextFieldCategory(); } }else { JOptionPane.showMessageDialog(null, "Lỗi! Vui lòng nhập đầy đủ thông tin"); } } }); buttonDeleteCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = tableCategoryTour.getSelectedRow(); if( row == -1 ){ JOptionPane.showMessageDialog(null, "Vui lòng chọn thể loại tour cần xoá"); } else { int result = JOptionPane.showConfirmDialog(null,"Bạn có chắc muốn xoá thể loại tour này?", "Thông báo", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if(result == JOptionPane.YES_OPTION){ User_DTO user = new User_DTO(); String tourId = (tableCategoryTour.getModel().getValueAt(row, 0).toString()); //APIRequester.sendDelete("","tourCategories/"+tourId, user.getToken()); String response = Handle_API_Tour_Category.sendDeleteCategoryTour("","tourCategories/"+tourId, user.getToken()); if(response.equals("success") == true){ LoadDataTableCategory(); JOptionPane.showMessageDialog(null, "Xoá thể loại thành công"); } }else if (result == JOptionPane.NO_OPTION){ }else { } } } }); buttonEditCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int row = tableCategoryTour.getSelectedRow(); if( row == -1 ){ JOptionPane.showMessageDialog(null, "Vui lòng chọn thể loại cần sửa"); }else { String tourId = (tableCategoryTour.getModel().getValueAt(row, 0).toString()); String name = (tableCategoryTour.getModel().getValueAt(row, 1).toString()); buttonAddCategory.setVisible(false); buttonClearFieldCategory.setVisible(false); buttonSaveCategory.setVisible(true); buttonCancelCategory.setVisible(true); txtNameCategory.setText(name); category_dto = new Tour_Category_DTO(tourId, name); } } }); buttonCancelCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { clearTextFieldCategory(); buttonSaveCategory.setVisible(false); buttonCancelCategory.setVisible(false); buttonAddCategory.setVisible(true); buttonClearFieldCategory.setVisible(true); } }); buttonSaveCategory.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String name = txtNameCategory.getText(); if(checkDifferent(name, category_dto)==false){ User_DTO user = new User_DTO(); String parameter = "{\"id\":"+category_dto.getCategoryId()+",\"name\":\""+name+"\"}"; System.out.println(parameter); APIRequester.sendPUT(parameter, "tourCategories/"+category_dto.getCategoryId(), user.getToken()); clearTextFieldCategory(); LoadDataTableCategory(); buttonSaveCategory.setVisible(false); buttonCancelCategory.setVisible(false); buttonAddCategory.setVisible(true); buttonClearFieldCategory.setVisible(true); JOptionPane.showMessageDialog(null, "Sửa thành công"); }else { JOptionPane.showMessageDialog(null, "Thể loại không có thay đổi"); } } }); /*========================END HANDLE CLICK BUTTON OF CATEGORY====================================*/ } public void LoadDataTableCategory(){ User_DTO user = new User_DTO(); JSONArray json = new JSONArray(Handle_API_Tour_Category.Fetch_API_Tour_Category("tourCategories?Page=1&Limit=100", user.getToken())); // Vector<Vector<String>> dataList = new Vector<>(); modelTableCategoryTour.setRowCount(0); for (int i = 0; i < json.length(); i++) { JSONObject jsonObj; try { jsonObj = json.getJSONObject(i); Vector<String> data = new Vector<>(); data.add(jsonObj.get("id").toString()); data.add(jsonObj.get("name").toString()); modelTableCategoryTour.addRow(data); } catch (JSONException ex) { Logger.getLogger(GUI_Table_Tour_Management.class.getName()).log(Level.SEVERE, null, ex); } } tableCategoryTour.setModel(modelTableCategoryTour); } public void LoadDataTableCategoryAfterSearch(String parameter){ User_DTO user = new User_DTO(); JSONArray json = new JSONArray(Handle_API_Tour_Category.Fetch_API_Tour_Category("tourCategories?Page=1&Limit=100"+parameter, user.getToken())); if(json.length() >= 1) { modelTableCategoryTour.setRowCount(0); for (int i = 0; i < json.length(); i++) { JSONObject jsonObj; try { jsonObj = json.getJSONObject(i); Vector<String> data = new Vector<>(); data.add(jsonObj.get("id").toString()); data.add(jsonObj.get("name").toString()); modelTableCategoryTour.addRow(data); } catch (JSONException ex) { Logger.getLogger(GUI_Table_Tour_Management.class.getName()).log(Level.SEVERE, null, ex); } } tableCategoryTour.setModel(modelTableCategoryTour); }else { JOptionPane.showMessageDialog(null, "Không tìm thấy thể loại cần tìm"); } } public static boolean empty( final String s ) { // Null-safe, short-circuit evaluation. return s == null || s.trim().isEmpty(); } public static boolean checkDifferent(String name, Tour_Category_DTO category_dto){ if(name.equals(category_dto.getCategoryName())== true ){ return true; } return false; } public void clearTextFieldCategory(){ txtNameCategory.setText(""); } public static String encodeValue(String value) { try { return URLEncoder.encode(value, StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex.getCause()); } } }
21,041
0.602018
0.586477
474
43.120255
30.072632
151
false
false
0
0
0
0
0
0
0.892405
false
false
13
40b88333615acbaad2726597f94ad9e621379e1d
14,250,701,496,119
664094627a5921cf6cfee49823ec78c17227316f
/src/main/java/com/hwangfantasy/config/OauthConfigFactory.java
05b39c05b84216096dfb9cae9fcd4b973c43c0c2
[ "Apache-2.0" ]
permissive
hwangfantasy/octopus
https://github.com/hwangfantasy/octopus
5392c65512c7fcd5a9ce026e18265209b651355a
ece905bf4380fbaaca9c2b765a663708fb381290
refs/heads/master
2021-01-24T18:46:40.921000
2018-02-28T08:23:18
2018-02-28T08:23:18
123,237,711
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hwangfantasy.config; import com.hwangfantasy.service.MainService; import com.hwangfantasy.service.QqService; import com.hwangfantasy.service.impl.MainServiceImpl; import com.hwangfantasy.service.impl.QqServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author hwangfantasy * @since 2018/2/28 */ @Configuration public class OauthConfigFactory { @Autowired private OauthQqProperties qqProperties; @Bean public OauthQqConfig qqConfig() { return OauthQqConfig.OauthQqConfigBuilder.anOauthQqConfig() .withOpenId(this.qqProperties.getOpenId()) .withOpenKey(this.qqProperties.getOpenKey()) .withRedirect(this.qqProperties.getRedirect()) .withAuthorizeUrl("https://graph.qq.com/oauth2.0/authorize") .withTokenUrl("https://graph.qq.com/oauth2.0/token") .withMeUrl("https://graph.qq.com/oauth2.0/me") .withUserInfoUrl("https://graph.qq.com/user/get_user_info") .build(); } @Bean public QqService qqService() { QqService qqService = new QqServiceImpl(); qqService.setConfig(qqConfig()); return qqService; } @Bean public MainService mainService() { return new MainServiceImpl(); } }
UTF-8
Java
1,449
java
OauthConfigFactory.java
Java
[ { "context": ".context.annotation.Configuration;\n\n/**\n * @author hwangfantasy\n * @since 2018/2/28\n */\n@Configuration\npublic cla", "end": 432, "score": 0.9996510148048401, "start": 420, "tag": "USERNAME", "value": "hwangfantasy" } ]
null
[]
package com.hwangfantasy.config; import com.hwangfantasy.service.MainService; import com.hwangfantasy.service.QqService; import com.hwangfantasy.service.impl.MainServiceImpl; import com.hwangfantasy.service.impl.QqServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * @author hwangfantasy * @since 2018/2/28 */ @Configuration public class OauthConfigFactory { @Autowired private OauthQqProperties qqProperties; @Bean public OauthQqConfig qqConfig() { return OauthQqConfig.OauthQqConfigBuilder.anOauthQqConfig() .withOpenId(this.qqProperties.getOpenId()) .withOpenKey(this.qqProperties.getOpenKey()) .withRedirect(this.qqProperties.getRedirect()) .withAuthorizeUrl("https://graph.qq.com/oauth2.0/authorize") .withTokenUrl("https://graph.qq.com/oauth2.0/token") .withMeUrl("https://graph.qq.com/oauth2.0/me") .withUserInfoUrl("https://graph.qq.com/user/get_user_info") .build(); } @Bean public QqService qqService() { QqService qqService = new QqServiceImpl(); qqService.setConfig(qqConfig()); return qqService; } @Bean public MainService mainService() { return new MainServiceImpl(); } }
1,449
0.68392
0.674948
45
31.200001
24.397268
76
false
false
0
0
0
0
0
0
0.311111
false
false
13
ba03c2ef36490c08f5ac5184d1d3a73dbb7a23bc
14,250,701,498,383
4939a0ba3ff6e387c23e4928a7a5b707a2b41244
/com/client/glowclient/Vb.java
df2c56a969abeb23acbb5924d902332f9cd0b630
[]
no_license
XeonLyfe/Glow-1.0.4-Deobf-Source-Leak
https://github.com/XeonLyfe/Glow-1.0.4-Deobf-Source-Leak
39356b4e9ec35d6631aa811ec65005a2ae1a95ab
fd3b7315a80ec56bc86dfa9db87bde35327dde5d
refs/heads/master
2022-03-29T03:51:08.343000
2019-11-30T01:58:05
2019-11-30T01:58:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.client.glowclient; import net.minecraft.nbt.*; import net.minecraft.entity.*; import net.minecraft.util.math.*; import net.minecraft.world.gen.structure.template.*; import net.minecraft.tileentity.*; import java.util.*; import net.minecraft.item.*; public class vb extends Sd { @Override public String D() { return "schematica.format.structure"; } @Override public String M() { return ".nbt"; } @Override public boolean M(final NBTTagCompound nbtTagCompound, final J j) { final Template template2; final Template template = template2 = new Template(); template2.size = new BlockPos(j.D(), j.M(), j.A()); template2.setAuthor(j.M()); final BlockPos origin = BlockPos.ORIGIN; final BlockPos size = template.size; final int n = -1; final Iterator iterator2; Iterator<BlockPos> iterator = (Iterator<BlockPos>)(iterator2 = BlockPos.getAllInBox(origin, size.add(n, n, n)).iterator()); while (iterator.hasNext()) { final BlockPos blockPos = iterator2.next(); final TileEntity m; NBTTagCompound i; Template template3; if ((m = j.M(blockPos)) != null) { i = KA.M(m); template3 = template; final String s = "M"; final NBTTagCompound nbtTagCompound2 = i; final String s2 = "Z"; i.removeTag("x"); nbtTagCompound2.removeTag(kb.M(s2)); nbtTagCompound2.removeTag(Ea.M(s)); } else { i = null; template3 = template; } final List blocks = template3.blocks; final BlockPos blockPos2 = blockPos; blocks.add(new Template$BlockInfo(blockPos2, j.M(blockPos2), i)); iterator = (Iterator<BlockPos>)iterator2; } for (final Entity entity : j.D()) { try { final Vec3d vec3d = new Vec3d(entity.posX, entity.posY, entity.posZ); final NBTTagCompound nbtTagCompound3 = new NBTTagCompound(); entity.writeToNBTOptional(nbtTagCompound3); template.entities.add(new Template$EntityInfo(vec3d, new BlockPos(vec3d), nbtTagCompound3)); } catch (Throwable t) { ld.H.error("Entity {} failed to save, skipping!", (Object)entity, (Object)t); } } template.writeToNBT(nbtTagCompound); return true; } public vb() { super(); } @Override public J M(NBTTagCompound nbtTagCompound) { final ItemStack m = Pd.M(nbtTagCompound); final Template template2; final Template template = template2 = new Template(); template.read(nbtTagCompound); nbtTagCompound = (NBTTagCompound)new Id(m, template2.size.getX(), template2.size.getY(), template2.size.getZ(), template2.getAuthor()); final Iterator iterator = template.blocks.iterator(); Label_0062: while (true) { Iterator<Template$BlockInfo> iterator2 = (Iterator<Template$BlockInfo>)iterator; while (iterator2.hasNext()) { final Template$BlockInfo template$BlockInfo = iterator.next(); final NBTTagCompound nbtTagCompound2 = nbtTagCompound; final BlockPos pos = template$BlockInfo.pos; final Template$BlockInfo template$BlockInfo2 = template$BlockInfo; ((Id)nbtTagCompound2).M(pos, template$BlockInfo2.blockState); if (template$BlockInfo2.tileentityData != null) { try { final Template$BlockInfo template$BlockInfo3 = template$BlockInfo; template$BlockInfo3.tileentityData.setInteger("x", template$BlockInfo.pos.getX()); final NBTTagCompound tileentityData = template$BlockInfo3.tileentityData; final String s = "y"; final Template$BlockInfo template$BlockInfo4 = template$BlockInfo; tileentityData.setInteger(s, template$BlockInfo4.pos.getY()); template$BlockInfo4.tileentityData.setInteger("z", template$BlockInfo.pos.getZ()); final TileEntity i; if ((i = KA.M(template$BlockInfo3.tileentityData)) == null) { iterator2 = (Iterator<Template$BlockInfo>)iterator; continue; } ((Id)nbtTagCompound).M(template$BlockInfo.pos, i); } catch (Exception ex) { ld.H.error("TileEntity failed to load properly!", (Throwable)ex); } continue Label_0062; } iterator2 = (Iterator<Template$BlockInfo>)iterator; } break; } return (J)nbtTagCompound; } }
UTF-8
Java
5,087
java
Vb.java
Java
[]
null
[]
package com.client.glowclient; import net.minecraft.nbt.*; import net.minecraft.entity.*; import net.minecraft.util.math.*; import net.minecraft.world.gen.structure.template.*; import net.minecraft.tileentity.*; import java.util.*; import net.minecraft.item.*; public class vb extends Sd { @Override public String D() { return "schematica.format.structure"; } @Override public String M() { return ".nbt"; } @Override public boolean M(final NBTTagCompound nbtTagCompound, final J j) { final Template template2; final Template template = template2 = new Template(); template2.size = new BlockPos(j.D(), j.M(), j.A()); template2.setAuthor(j.M()); final BlockPos origin = BlockPos.ORIGIN; final BlockPos size = template.size; final int n = -1; final Iterator iterator2; Iterator<BlockPos> iterator = (Iterator<BlockPos>)(iterator2 = BlockPos.getAllInBox(origin, size.add(n, n, n)).iterator()); while (iterator.hasNext()) { final BlockPos blockPos = iterator2.next(); final TileEntity m; NBTTagCompound i; Template template3; if ((m = j.M(blockPos)) != null) { i = KA.M(m); template3 = template; final String s = "M"; final NBTTagCompound nbtTagCompound2 = i; final String s2 = "Z"; i.removeTag("x"); nbtTagCompound2.removeTag(kb.M(s2)); nbtTagCompound2.removeTag(Ea.M(s)); } else { i = null; template3 = template; } final List blocks = template3.blocks; final BlockPos blockPos2 = blockPos; blocks.add(new Template$BlockInfo(blockPos2, j.M(blockPos2), i)); iterator = (Iterator<BlockPos>)iterator2; } for (final Entity entity : j.D()) { try { final Vec3d vec3d = new Vec3d(entity.posX, entity.posY, entity.posZ); final NBTTagCompound nbtTagCompound3 = new NBTTagCompound(); entity.writeToNBTOptional(nbtTagCompound3); template.entities.add(new Template$EntityInfo(vec3d, new BlockPos(vec3d), nbtTagCompound3)); } catch (Throwable t) { ld.H.error("Entity {} failed to save, skipping!", (Object)entity, (Object)t); } } template.writeToNBT(nbtTagCompound); return true; } public vb() { super(); } @Override public J M(NBTTagCompound nbtTagCompound) { final ItemStack m = Pd.M(nbtTagCompound); final Template template2; final Template template = template2 = new Template(); template.read(nbtTagCompound); nbtTagCompound = (NBTTagCompound)new Id(m, template2.size.getX(), template2.size.getY(), template2.size.getZ(), template2.getAuthor()); final Iterator iterator = template.blocks.iterator(); Label_0062: while (true) { Iterator<Template$BlockInfo> iterator2 = (Iterator<Template$BlockInfo>)iterator; while (iterator2.hasNext()) { final Template$BlockInfo template$BlockInfo = iterator.next(); final NBTTagCompound nbtTagCompound2 = nbtTagCompound; final BlockPos pos = template$BlockInfo.pos; final Template$BlockInfo template$BlockInfo2 = template$BlockInfo; ((Id)nbtTagCompound2).M(pos, template$BlockInfo2.blockState); if (template$BlockInfo2.tileentityData != null) { try { final Template$BlockInfo template$BlockInfo3 = template$BlockInfo; template$BlockInfo3.tileentityData.setInteger("x", template$BlockInfo.pos.getX()); final NBTTagCompound tileentityData = template$BlockInfo3.tileentityData; final String s = "y"; final Template$BlockInfo template$BlockInfo4 = template$BlockInfo; tileentityData.setInteger(s, template$BlockInfo4.pos.getY()); template$BlockInfo4.tileentityData.setInteger("z", template$BlockInfo.pos.getZ()); final TileEntity i; if ((i = KA.M(template$BlockInfo3.tileentityData)) == null) { iterator2 = (Iterator<Template$BlockInfo>)iterator; continue; } ((Id)nbtTagCompound).M(template$BlockInfo.pos, i); } catch (Exception ex) { ld.H.error("TileEntity failed to load properly!", (Throwable)ex); } continue Label_0062; } iterator2 = (Iterator<Template$BlockInfo>)iterator; } break; } return (J)nbtTagCompound; } }
5,087
0.559662
0.548064
121
41.041321
29.80138
143
false
false
0
0
0
0
0
0
0.809917
false
false
13
9ab3d18069f4aac3be7b4d4e744e62422c11badb
20,684,562,545,504
7ca5b9e702fe547fcf450653fe8944b3094b5a97
/socle-gwt-client-components/src/main/java/fr/generali/accueilclient/gwt/client/ui/components/menu/Resources.java
c2c148c3317831ec3d5759074dc9a6d21cb1b316
[]
no_license
holmeskelly/proto-ws-cxf
https://github.com/holmeskelly/proto-ws-cxf
8bfb2d7e1eb1a8f3930f8b15451d12e52523f68e
b02f358e7022074d3d0672407527eb844ef329d0
refs/heads/master
2016-08-04T10:13:37.748000
2012-09-06T00:13:45
2012-09-06T00:13:45
5,144,012
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.generali.accueilclient.gwt.client.ui.components.menu; import com.google.gwt.resources.client.CssResource; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource.ImageOptions; import com.google.gwt.resources.client.ImageResource.RepeatStyle; import fr.generali.accueilclient.gwt.client.ui.resources.GlobalResources; public interface Resources extends GlobalResources { @Source("components/menu/image/menuBackground.png") @ImageOptions(repeatStyle = RepeatStyle.Horizontal) ImageResource menuBackground(); @Source("components/menu/image/dropDownMenuFrameBackground.png") @ImageOptions(repeatStyle = RepeatStyle.Horizontal) ImageResource dropDownMenuFrameBackground(); @Source("components/menu/image/dropDownMenuHeadArrow.png") @ImageOptions(repeatStyle = RepeatStyle.None) ImageResource dropDownMenuHeadArrow(); @Source("components/menu/image/redArrow.png") @ImageOptions(repeatStyle = RepeatStyle.None) ImageResource redArrow(); @Source({"components/menu/menu.css", "components/menu/menu-tablet.css" }) Style style(); interface Style extends CssResource { String dropDownMenu(); String contextualMenu(); String headerArrow(); String cornerHeaderArrow(); String arrow(); String frame(); String first(); String menuItem(); String menuItemContent(); String tabMenu(); String itemGroup(); String title(); String menuTitle(); String localLink(); String itemTitle(); String closeMenu(); } }
UTF-8
Java
1,663
java
Resources.java
Java
[]
null
[]
package fr.generali.accueilclient.gwt.client.ui.components.menu; import com.google.gwt.resources.client.CssResource; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource.ImageOptions; import com.google.gwt.resources.client.ImageResource.RepeatStyle; import fr.generali.accueilclient.gwt.client.ui.resources.GlobalResources; public interface Resources extends GlobalResources { @Source("components/menu/image/menuBackground.png") @ImageOptions(repeatStyle = RepeatStyle.Horizontal) ImageResource menuBackground(); @Source("components/menu/image/dropDownMenuFrameBackground.png") @ImageOptions(repeatStyle = RepeatStyle.Horizontal) ImageResource dropDownMenuFrameBackground(); @Source("components/menu/image/dropDownMenuHeadArrow.png") @ImageOptions(repeatStyle = RepeatStyle.None) ImageResource dropDownMenuHeadArrow(); @Source("components/menu/image/redArrow.png") @ImageOptions(repeatStyle = RepeatStyle.None) ImageResource redArrow(); @Source({"components/menu/menu.css", "components/menu/menu-tablet.css" }) Style style(); interface Style extends CssResource { String dropDownMenu(); String contextualMenu(); String headerArrow(); String cornerHeaderArrow(); String arrow(); String frame(); String first(); String menuItem(); String menuItemContent(); String tabMenu(); String itemGroup(); String title(); String menuTitle(); String localLink(); String itemTitle(); String closeMenu(); } }
1,663
0.70896
0.70896
64
24.984375
24.093239
77
false
false
0
0
0
0
0
0
0.4375
false
false
13
6875c8c53089125c0b263ff98a95b5ffdeb735a6
13,408,887,923,568
c650e57b74c9aa7727da5ea03dba5f31eb1c7fda
/app/src/main/java/me/ilich/mymeteringdevices/data/DataSource.java
488f28da897bb4867c4097040f27f95f68f427a8
[]
no_license
dsokolov/MyMeteringDevices
https://github.com/dsokolov/MyMeteringDevices
767746a464f8a553459b3cf53a507f5888d83f0d
7405f017cd4343846b6d16c6dc54aaff8c68b26e
refs/heads/master
2020-12-25T05:44:08.962000
2016-06-08T13:25:01
2016-06-08T13:25:01
60,236,782
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.ilich.mymeteringdevices.data; import android.database.Cursor; public interface DataSource { Cursor getMeteringDevices(); void addMeteringDevice(MeteringDevice meteringDevice); void deleteMeteringDevice(int id); void deleteAllMeteringDevices(); }
UTF-8
Java
280
java
DataSource.java
Java
[]
null
[]
package me.ilich.mymeteringdevices.data; import android.database.Cursor; public interface DataSource { Cursor getMeteringDevices(); void addMeteringDevice(MeteringDevice meteringDevice); void deleteMeteringDevice(int id); void deleteAllMeteringDevices(); }
280
0.775
0.775
15
17.666666
19.747292
58
false
false
0
0
0
0
0
0
0.4
false
false
13
75c7ddd0b6938b46a74e1be57ad677fbdaa4a4b1
7,919,919,730,472
028a503abadafe8305c63eba2a8531f61e93cdd6
/src/main/java/org/pdxfinder/services/result/GenomicTsvWriter.java
7726aaab75dce3a5f4a3be1d1f1889576dd7d9fc
[ "Apache-2.0" ]
permissive
PDXFinder/pdx-transformer
https://github.com/PDXFinder/pdx-transformer
8965fabff5aaa1f8005c4e4eccb343c50f4cc065
b2b7db8d5c9c0d0b3545c487becf4f40d8b19dab
refs/heads/master
2023-02-27T19:47:40.403000
2022-11-29T10:17:42
2022-11-29T10:17:42
279,078,970
0
1
null
false
2021-02-09T17:13:27
2020-07-12T14:15:31
2020-07-24T13:49:27
2021-02-09T17:13:26
318
0
0
0
Java
false
false
package org.pdxfinder.services.result; import org.pdxfinder.services.common.FileUtil; import java.io.IOException; import java.util.List; public class GenomicTsvWriter { private GenomicTsvWriter(){ // Never Called } public static void writeTsv(List<?> mutationTsvs, String outputDirectory) throws IOException { String data = FileUtil.serializePojoToTsv(mutationTsvs); FileUtil.write(data, outputDirectory); } }
UTF-8
Java
457
java
GenomicTsvWriter.java
Java
[]
null
[]
package org.pdxfinder.services.result; import org.pdxfinder.services.common.FileUtil; import java.io.IOException; import java.util.List; public class GenomicTsvWriter { private GenomicTsvWriter(){ // Never Called } public static void writeTsv(List<?> mutationTsvs, String outputDirectory) throws IOException { String data = FileUtil.serializePojoToTsv(mutationTsvs); FileUtil.write(data, outputDirectory); } }
457
0.728665
0.728665
20
21.85
26.021673
98
false
false
0
0
0
0
0
0
0.4
false
false
13
db086ad16a1da8e4c162b9254939f4f63a1d5a47
7,919,919,732,337
82fe5c838618e425edb188ab59baa0acd10a4bc6
/src/main/java/com/h2cg/accommodation/service/impl/AdvertiseService.java
520e82f3428023a29a62fcca561e5ca9718e17ce
[]
no_license
wickwickthedog/comp3900
https://github.com/wickwickthedog/comp3900
5a3d6c6badd68a20c2f3c6addb31fb5cadda0ea3
4834442608cd71def7b110d5db85928e108b37db
refs/heads/master
2020-09-07T01:13:59.776000
2019-11-09T08:43:12
2019-11-09T08:43:12
220,612,192
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.h2cg.accommodation.service.impl; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.h2cg.accommodation.dao.AdvertiseDAO; import com.h2cg.accommodation.dao.UsersDAO; import com.h2cg.accommodation.dto.AdvertiseDTO; import com.h2cg.accommodation.dto.BookDTO; //import com.ass2.dto.UserActivityDTO; import com.h2cg.accommodation.dto.UsersDTO; import com.h2cg.accommodation.service.IAdvertiseService; import com.h2cg.accommodation.service.IUserService; import com.h2cg.accommodation.utils.DateUtils; import com.h2cg.accommodation.utils.PhotoUtil; import com.h2cg.accommodation.utils.SendEmail; @Transactional @Service(value = "advService") public class AdvertiseService implements IAdvertiseService{ @Autowired private AdvertiseDAO advertiseDao; @Override public List<AdvertiseDTO> selectAdv(BookDTO bookDto,HttpServletRequest request) { // TODO Auto-generated method stub if (bookDto.getStayBeginStr() != null && bookDto.getStayBeginStr() != "") { try { bookDto.setStayBegin(DateUtils.DateString2Date(bookDto.getStayBeginStr())); bookDto.setStayEnd(DateUtils.DateString2Date(bookDto.getStayEndStr())); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } List<AdvertiseDTO> advList =advertiseDao.selectAdv(bookDto); String pathval = request.getSession().getServletContext().getRealPath("/") + "WEB-INF/"; for(AdvertiseDTO adv:advList) { String photoDir = "photo/"+ adv.getId() + "/" ; ArrayList<String> picList = PhotoUtil.getPhotoPath(pathval + photoDir,photoDir); if(picList.size()>0) { adv.setPicPath(picList.remove(0)); } } return advList; } @Override public AdvertiseDTO selectAdvById(AdvertiseDTO advDto) { // TODO Auto-generated method stub return advertiseDao.selectAdvById(advDto); } @Override public int addAdv(AdvertiseDTO advDto) { // TODO Auto-generated method stub advDto.setTime(new Date()); return advertiseDao.insertSelective(advDto); } @Override public AdvertiseDTO checkAddrExist(String addr) { // TODO Auto-generated method stub return advertiseDao.selectByAddr(addr); } @Override public int removeAdv(Integer id) { // TODO Auto-generated method stub return advertiseDao.deleteById(id); } // @Override // public AdvertiseDTO selectAdvByUId(UsersDTO userDto) { // // TODO Auto-generated method stub // return null; // } @Override public List<AdvertiseDTO> selectAdvByUserId(Integer id) { // TODO Auto-generated method stub return advertiseDao.selectAdvByUserId(id); } @Override public int updateRmNum(Integer advId,Integer bedroom, Integer capacity) { // TODO Auto-generated method stub return advertiseDao.updateRmNum(advId,bedroom, capacity); } @Override public List<AdvertiseDTO> selectAdvByAddress(BookDTO bookDto,HttpServletRequest request) { // TODO Auto-generated method stub List<AdvertiseDTO> advList =advertiseDao.selectAdvByAddress(bookDto); String pathval = request.getSession().getServletContext().getRealPath("/") + "WEB-INF/"; for(AdvertiseDTO adv:advList) { String photoDir = "photo/"+ adv.getId() + "/" ; ArrayList<String> picList = PhotoUtil.getPhotoPath(pathval + photoDir,photoDir); if(picList.size()>0) { adv.setPicPath(picList.remove(0)); } } return advList; } // @Override // public AdvertiseDTO selectAdvByUId(UsersDTO userDto) { // // TODO Auto-generated method stub // return advertiseDao.selectAdvByUId(userDto); // } }
UTF-8
Java
3,899
java
AdvertiseService.java
Java
[]
null
[]
package com.h2cg.accommodation.service.impl; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.h2cg.accommodation.dao.AdvertiseDAO; import com.h2cg.accommodation.dao.UsersDAO; import com.h2cg.accommodation.dto.AdvertiseDTO; import com.h2cg.accommodation.dto.BookDTO; //import com.ass2.dto.UserActivityDTO; import com.h2cg.accommodation.dto.UsersDTO; import com.h2cg.accommodation.service.IAdvertiseService; import com.h2cg.accommodation.service.IUserService; import com.h2cg.accommodation.utils.DateUtils; import com.h2cg.accommodation.utils.PhotoUtil; import com.h2cg.accommodation.utils.SendEmail; @Transactional @Service(value = "advService") public class AdvertiseService implements IAdvertiseService{ @Autowired private AdvertiseDAO advertiseDao; @Override public List<AdvertiseDTO> selectAdv(BookDTO bookDto,HttpServletRequest request) { // TODO Auto-generated method stub if (bookDto.getStayBeginStr() != null && bookDto.getStayBeginStr() != "") { try { bookDto.setStayBegin(DateUtils.DateString2Date(bookDto.getStayBeginStr())); bookDto.setStayEnd(DateUtils.DateString2Date(bookDto.getStayEndStr())); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } List<AdvertiseDTO> advList =advertiseDao.selectAdv(bookDto); String pathval = request.getSession().getServletContext().getRealPath("/") + "WEB-INF/"; for(AdvertiseDTO adv:advList) { String photoDir = "photo/"+ adv.getId() + "/" ; ArrayList<String> picList = PhotoUtil.getPhotoPath(pathval + photoDir,photoDir); if(picList.size()>0) { adv.setPicPath(picList.remove(0)); } } return advList; } @Override public AdvertiseDTO selectAdvById(AdvertiseDTO advDto) { // TODO Auto-generated method stub return advertiseDao.selectAdvById(advDto); } @Override public int addAdv(AdvertiseDTO advDto) { // TODO Auto-generated method stub advDto.setTime(new Date()); return advertiseDao.insertSelective(advDto); } @Override public AdvertiseDTO checkAddrExist(String addr) { // TODO Auto-generated method stub return advertiseDao.selectByAddr(addr); } @Override public int removeAdv(Integer id) { // TODO Auto-generated method stub return advertiseDao.deleteById(id); } // @Override // public AdvertiseDTO selectAdvByUId(UsersDTO userDto) { // // TODO Auto-generated method stub // return null; // } @Override public List<AdvertiseDTO> selectAdvByUserId(Integer id) { // TODO Auto-generated method stub return advertiseDao.selectAdvByUserId(id); } @Override public int updateRmNum(Integer advId,Integer bedroom, Integer capacity) { // TODO Auto-generated method stub return advertiseDao.updateRmNum(advId,bedroom, capacity); } @Override public List<AdvertiseDTO> selectAdvByAddress(BookDTO bookDto,HttpServletRequest request) { // TODO Auto-generated method stub List<AdvertiseDTO> advList =advertiseDao.selectAdvByAddress(bookDto); String pathval = request.getSession().getServletContext().getRealPath("/") + "WEB-INF/"; for(AdvertiseDTO adv:advList) { String photoDir = "photo/"+ adv.getId() + "/" ; ArrayList<String> picList = PhotoUtil.getPhotoPath(pathval + photoDir,photoDir); if(picList.size()>0) { adv.setPicPath(picList.remove(0)); } } return advList; } // @Override // public AdvertiseDTO selectAdvByUId(UsersDTO userDto) { // // TODO Auto-generated method stub // return advertiseDao.selectAdvByUId(userDto); // } }
3,899
0.733265
0.728648
129
28.224806
25.565311
91
false
false
0
0
0
0
0
0
1.627907
false
false
13
55191e93c31f4986d2c0d321c383b2b51f1cb0ac
14,663,018,383,373
5bce8fb4785a678939140c1cb04043dc284ed5e5
/src/se/jkrau/mclib/package-info.java
9335ca1066d509823fd3fc57a5fed5ef9c8fab01
[ "MIT", "BSD-3-Clause" ]
permissive
SuperSpyTX/MCLib
https://github.com/SuperSpyTX/MCLib
09ea73f7f6ac819f1413872e5818f8e3d274c90b
2890e587645b67412f76130a0d394d184fc4c0f5
refs/heads/master
2020-05-18T18:45:26.815000
2017-07-15T22:12:04
2017-07-15T22:12:04
27,856,378
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * A powerful code injection framework that allows for easy instrumenting and transforming of any class. <br/> * You can use this library to inject & modify code dynamically on the fly via it's own injected ClassLoader. <br/> * This could be used to make Minecraft mods, without the need to wait for the next MCP update. <br/> * Obviously this does not need to be used just for Minecraft. <br/><br/> * * <strong>Reason why I packed ASM in MCLib</strong><br/><br/> * The convenience of the ASM library being packed into the same library has some pretty significant advantages. * Obviously, I have made some modifications to improve ASM's functionality a little bit. For example, see {@link se.jkrau.mclib.utils.ClassUtils#getOpcode(int)} * * @author Joe * @version 1.4 */ package se.jkrau.mclib;
UTF-8
Java
812
java
package-info.java
Java
[ { "context": "lib.utils.ClassUtils#getOpcode(int)}\n *\n * @author Joe\n * @version 1.4\n */\npackage se.jkrau.mclib;", "end": 768, "score": 0.9997330904006958, "start": 765, "tag": "NAME", "value": "Joe" } ]
null
[]
/** * A powerful code injection framework that allows for easy instrumenting and transforming of any class. <br/> * You can use this library to inject & modify code dynamically on the fly via it's own injected ClassLoader. <br/> * This could be used to make Minecraft mods, without the need to wait for the next MCP update. <br/> * Obviously this does not need to be used just for Minecraft. <br/><br/> * * <strong>Reason why I packed ASM in MCLib</strong><br/><br/> * The convenience of the ASM library being packed into the same library has some pretty significant advantages. * Obviously, I have made some modifications to improve ASM's functionality a little bit. For example, see {@link se.jkrau.mclib.utils.ClassUtils#getOpcode(int)} * * @author Joe * @version 1.4 */ package se.jkrau.mclib;
812
0.738916
0.736453
14
57.07143
52.935898
162
false
false
0
0
0
0
0
0
0.285714
false
false
13
4678edc717c6385f98a9584f2c5749c98ca0cd39
21,260,088,130,948
6643b8ec7c251b0b6e71f8936d1a99dcdce11227
/base/baselibrary/src/main/java/com/sxu/baselibrary/datasource/http/impl/listener/MultiRequestListener.java
6450963c8e6db947c28136cefd5e6fcf457ac51f
[]
no_license
Liberuman/Antelope
https://github.com/Liberuman/Antelope
31db7be652f87d9f0a39bbaf6383daa1f19cf86a
d95197fccc8205a648138fc1a701e61d3595ee00
refs/heads/master
2023-04-27T05:47:55.284000
2023-04-19T13:58:12
2023-04-19T13:58:12
313,590,353
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sxu.baselibrary.datasource.http.impl.listener; import java.util.List; /******************************************************************************* * 多个接口并行请求过程的监听 * * @author: Freeman * * @date: 2020/5/20 * * Copyright: all rights reserved by Freeman. *******************************************************************************/ public interface MultiRequestListener extends RequestListener { /** * 网络请求成功时被调用 * @param responseList 应答数据 */ void onSuccess(List<Object> responseList); /** * 网络请求失败时被调用 * @param code 应答Code * @param msg 应答消息提示 */ void onFailure(int code, String msg); }
UTF-8
Java
724
java
MultiRequestListener.java
Java
[ { "context": "******************\n * 多个接口并行请求过程的监听\n *\n * @author: Freeman\n *\n * @date: 2020/5/20\n *\n * Copyright: all right", "end": 204, "score": 0.995987594127655, "start": 197, "tag": "NAME", "value": "Freeman" } ]
null
[]
package com.sxu.baselibrary.datasource.http.impl.listener; import java.util.List; /******************************************************************************* * 多个接口并行请求过程的监听 * * @author: Freeman * * @date: 2020/5/20 * * Copyright: all rights reserved by Freeman. *******************************************************************************/ public interface MultiRequestListener extends RequestListener { /** * 网络请求成功时被调用 * @param responseList 应答数据 */ void onSuccess(List<Object> responseList); /** * 网络请求失败时被调用 * @param code 应答Code * @param msg 应答消息提示 */ void onFailure(int code, String msg); }
724
0.522082
0.511041
28
21.642857
24.006271
81
false
false
0
0
0
0
0
0
0.571429
false
false
13
e500c079810cf2b49f52b63923f81f433e3939b8
9,912,784,542,186
efbfbad75813b92ba0cce0df492fe6c7cf41a8c6
/basic-tests/src/test/java/example/controller/MVCSanitizePathVariableTest.java
69ec832acd7a34e76ac4191d2b853a4b0b743dcf
[]
no_license
sergueik/springboot_study
https://github.com/sergueik/springboot_study
d4636cd255cdaec07a22276393541a7dd9bb97c1
59c87d64d0d8d5e2eae6fe496b2a84425208fcfd
refs/heads/master
2023-09-01T14:04:34.285000
2023-08-31T22:29:09
2023-08-31T22:29:09
101,407,389
5
6
null
false
2023-03-04T00:57:19
2017-08-25T13:38:05
2022-05-11T06:49:44
2023-03-04T00:57:19
68,180
2
2
82
Java
false
false
package example.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.PropertySource; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.collection.IsArrayWithSize.*; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Assumptions; import static org.junit.jupiter.api.Assertions.assertThrows; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; // https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/web/servlet/result/JsonPathResultMatchers.html import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; // requires a later version ? // import static org.springframework.test.web.servlet.result.JsonPathResultMatchers.isArray; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import example.controller.ExampleController; import example.service.ExampleService; import example.Application; @WebMvcTest public class MVCSanitizePathVariableTest { static String route = "/basic/sanitize/"; // http://www.w3schools.com/tags/ref_urlencode.ASP static final List<String> badFilenames = Arrays.asList( new String[] { "%03Ctest", "test%24", "test$$", "test!", "test&" }); static final List<String> goodFilenames = Arrays.asList( new String[] { "alphanumric123", "white space is OK", "_-123", "test@" }); static final List<String> invalidFilenames = Arrays .asList(new String[] { "test?" }); @Autowired private MockMvc mvc; @MockBean private ExampleService mockService; private ResultActions resultActions; // examine HTTP status and body - missing request params @Test public void test1() throws Exception { for (String filename : badFilenames) { resultActions = mvc.perform(get(route + "/" + filename + "/data")); resultActions.andExpect(status().isMethodNotAllowed()) .andExpect(content().string("invalid filename")); } } @Test public void test2() throws Exception { for (String filename : goodFilenames) { resultActions = mvc.perform(get(route + "/" + filename + "/data")); resultActions.andExpect(status().isMethodNotAllowed()) .andExpect(content().string("invalid filename")); } } @Test public void test3() throws Exception { for (String filename : invalidFilenames) { resultActions = mvc.perform(get(route + "/" + filename + "/data")); resultActions.andExpect(status().isNotFound()) .andExpect(content().string("")); } } }
UTF-8
Java
3,685
java
MVCSanitizePathVariableTest.java
Java
[]
null
[]
package example.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.PropertySource; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.collection.IsArrayWithSize.*; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Assumptions; import static org.junit.jupiter.api.Assertions.assertThrows; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; // https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/web/servlet/result/JsonPathResultMatchers.html import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; // requires a later version ? // import static org.springframework.test.web.servlet.result.JsonPathResultMatchers.isArray; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import example.controller.ExampleController; import example.service.ExampleService; import example.Application; @WebMvcTest public class MVCSanitizePathVariableTest { static String route = "/basic/sanitize/"; // http://www.w3schools.com/tags/ref_urlencode.ASP static final List<String> badFilenames = Arrays.asList( new String[] { "%03Ctest", "test%24", "test$$", "test!", "test&" }); static final List<String> goodFilenames = Arrays.asList( new String[] { "alphanumric123", "white space is OK", "_-123", "test@" }); static final List<String> invalidFilenames = Arrays .asList(new String[] { "test?" }); @Autowired private MockMvc mvc; @MockBean private ExampleService mockService; private ResultActions resultActions; // examine HTTP status and body - missing request params @Test public void test1() throws Exception { for (String filename : badFilenames) { resultActions = mvc.perform(get(route + "/" + filename + "/data")); resultActions.andExpect(status().isMethodNotAllowed()) .andExpect(content().string("invalid filename")); } } @Test public void test2() throws Exception { for (String filename : goodFilenames) { resultActions = mvc.perform(get(route + "/" + filename + "/data")); resultActions.andExpect(status().isMethodNotAllowed()) .andExpect(content().string("invalid filename")); } } @Test public void test3() throws Exception { for (String filename : invalidFilenames) { resultActions = mvc.perform(get(route + "/" + filename + "/data")); resultActions.andExpect(status().isNotFound()) .andExpect(content().string("")); } } }
3,685
0.762008
0.758209
93
37.623657
28.473686
139
false
false
0
0
0
0
70
0.018996
1.397849
false
false
13
7a88326c5c617e332e0711980e9e4870728b36d4
2,302,102,491,889
b146594bccfded847236840ebeef357e6456a581
/src/main/java/com/springmvc/final_project/ServiceImpl/CompaniesServiceImpl.java
1a17d38aa4d9efab685cd3e2e95d926fdd056b56
[]
no_license
BuiVanKhoa/backend
https://github.com/BuiVanKhoa/backend
b79ee7fbe9b6f978593a396c079768e252b78399
b6f262a269909700092f45d18568e3b91b052041
refs/heads/master
2022-11-30T09:57:13.519000
2020-08-14T03:59:14
2020-08-14T03:59:14
287,438,450
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.springmvc.final_project.ServiceImpl; import java.util.List; import com.springmvc.final_project.Entity.CompaniesEntity; import com.springmvc.final_project.Repository.CompaniesRepository; import com.springmvc.final_project.Service.CompaniesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class CompaniesServiceImpl implements CompaniesService { private CompaniesRepository companiesRepository; @Autowired public CompaniesServiceImpl (CompaniesRepository companiesRepository) { this.companiesRepository = companiesRepository; } @Override public CompaniesEntity createCompanies(CompaniesEntity companiesEntity) { return companiesRepository.save(companiesEntity); } @Override public List<CompaniesEntity> getAllCompaniesEntities() { return (List<CompaniesEntity>) companiesRepository.findAll(); } @Override public CompaniesEntity updateCompanies(CompaniesEntity companiesEntity) { return companiesRepository.save(companiesEntity); } @Override public void remove(CompaniesEntity companiesEntity) { companiesRepository.delete(companiesEntity); } }
UTF-8
Java
1,260
java
CompaniesServiceImpl.java
Java
[]
null
[]
package com.springmvc.final_project.ServiceImpl; import java.util.List; import com.springmvc.final_project.Entity.CompaniesEntity; import com.springmvc.final_project.Repository.CompaniesRepository; import com.springmvc.final_project.Service.CompaniesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class CompaniesServiceImpl implements CompaniesService { private CompaniesRepository companiesRepository; @Autowired public CompaniesServiceImpl (CompaniesRepository companiesRepository) { this.companiesRepository = companiesRepository; } @Override public CompaniesEntity createCompanies(CompaniesEntity companiesEntity) { return companiesRepository.save(companiesEntity); } @Override public List<CompaniesEntity> getAllCompaniesEntities() { return (List<CompaniesEntity>) companiesRepository.findAll(); } @Override public CompaniesEntity updateCompanies(CompaniesEntity companiesEntity) { return companiesRepository.save(companiesEntity); } @Override public void remove(CompaniesEntity companiesEntity) { companiesRepository.delete(companiesEntity); } }
1,260
0.777778
0.777778
43
28.325581
28.439018
77
false
false
0
0
0
0
0
0
0.302326
false
false
13
4d3e01764849ea64f8c20ed72c28f6259484c240
7,069,516,189,563
596fb438d7d1e4cccf2bd6af776507792ca90598
/app/src/main/java/cn/zerone/water/activity/LiveMemberInfoActivity.java
4bcb2097f1db6def4ce5758b1e928469720a9f36
[]
no_license
yang1018679/water
https://github.com/yang1018679/water
58507e695afefed4868a12cf8bad5af13cbde8fc
b31f2de4581be6b9f03793ebe03b4a97b427c4c3
refs/heads/master
2020-05-17T18:27:21.187000
2019-06-09T06:36:08
2019-06-09T06:36:08
183,881,602
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.zerone.water.activity; import android.app.Activity; import android.os.Bundle; import cn.zerone.water.R; public class LiveMemberInfoActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_live_member_info); } }
UTF-8
Java
357
java
LiveMemberInfoActivity.java
Java
[]
null
[]
package cn.zerone.water.activity; import android.app.Activity; import android.os.Bundle; import cn.zerone.water.R; public class LiveMemberInfoActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_live_member_info); } }
357
0.7507
0.7507
15
22.799999
21.45134
59
false
false
0
0
0
0
0
0
0.4
false
false
13
1b5eacd7b25b7601d527544e44264473ba4c10ca
18,966,575,598,687
ede69bcaa305484a0abc282b980d392bceaf5717
/src/utopia_listeners/AnimationListener.java
166b5e452c20d68da683511bf7c1684e24eea9ce
[]
no_license
Mikkomario/UtopiaGameEngine
https://github.com/Mikkomario/UtopiaGameEngine
54301f9814d148444f1ab60a9f28463a2ecfa8d6
77e387d13ee16053dd3aff61b81e0a80816a51f8
refs/heads/master
2021-01-19T02:41:42.115000
2014-05-20T13:17:59
2014-05-20T13:17:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package utopia_listeners; import utopia_graphic.SpriteDrawer; import utopia_handleds.LogicalHandled; import utopia_handlers.AnimationListenerHandler; /** * Animationlistener is informed when an animation cycle ends.<br> * Remember to add the object into an AnimationListenerHandler * * @author Mikko Hilpinen. * Created 28.8.2013. * @see AnimationListenerHandler * @see SpriteDrawer */ public interface AnimationListener extends LogicalHandled { /** * This method is called when an animation of the sprite ends or, more * precisely, a cycle in the animation ends. * * @param spritedrawer The spritedrawer that draws the sprite who's * animation just completed a cycle. */ public void onAnimationEnd(SpriteDrawer spritedrawer); }
UTF-8
Java
764
java
AnimationListener.java
Java
[ { "context": "ect into an AnimationListenerHandler\n *\n * @author Mikko Hilpinen.\n * Created 28.8.2013.\n * @see AnimationL", "end": 314, "score": 0.9998601078987122, "start": 300, "tag": "NAME", "value": "Mikko Hilpinen" } ]
null
[]
package utopia_listeners; import utopia_graphic.SpriteDrawer; import utopia_handleds.LogicalHandled; import utopia_handlers.AnimationListenerHandler; /** * Animationlistener is informed when an animation cycle ends.<br> * Remember to add the object into an AnimationListenerHandler * * @author <NAME>. * Created 28.8.2013. * @see AnimationListenerHandler * @see SpriteDrawer */ public interface AnimationListener extends LogicalHandled { /** * This method is called when an animation of the sprite ends or, more * precisely, a cycle in the animation ends. * * @param spritedrawer The spritedrawer that draws the sprite who's * animation just completed a cycle. */ public void onAnimationEnd(SpriteDrawer spritedrawer); }
756
0.760471
0.751309
26
28.384615
24.451014
72
false
false
0
0
0
0
0
0
0.576923
false
false
13
f43e491e38393aea1eda04f84a234dff12444b87
18,270,790,900,651
2555d6e1b92846ee8af07dce6fb7c31bb5eea77b
/app/src/main/java/Model/Response_Labs.java
14809cdce6cb88dcddabbd77ce3ab81f0b31cd6a
[]
no_license
ahmedatefabd/Clinics
https://github.com/ahmedatefabd/Clinics
1340100c5be2390b4a94e32ea6cf590a6083401e
0c38114d888c7797b2a3b53eef3a68794c227803
refs/heads/master
2020-05-05T07:26:36.785000
2019-06-19T07:27:25
2019-06-19T07:27:25
174,692,829
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; public class Response_Labs { @SerializedName("sheet") @Expose private List<Sheet_Labs> sheet_labsList = null; public List<Sheet_Labs> getSheet_labsList() { return sheet_labsList; } public void setSheet_labsList(List<Sheet_Labs> sheet_labsList) { this.sheet_labsList = sheet_labsList; } }
UTF-8
Java
470
java
Response_Labs.java
Java
[]
null
[]
package Model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; public class Response_Labs { @SerializedName("sheet") @Expose private List<Sheet_Labs> sheet_labsList = null; public List<Sheet_Labs> getSheet_labsList() { return sheet_labsList; } public void setSheet_labsList(List<Sheet_Labs> sheet_labsList) { this.sheet_labsList = sheet_labsList; } }
470
0.704255
0.704255
21
21.380953
21.419786
68
false
false
0
0
0
0
0
0
0.333333
false
false
13
ad3cb7f765f31383bb9c0637908b266115457e83
16,484,084,508,890
d2bf73c10c41c516a29ee360dca7e78fbfd3214a
/src/main/java/com/myron/ims/controller/LogController.java
fd2ac31c043b9cbc64bd58aa8dd75c3fc9d06ce9
[]
no_license
micat707/demo-extjs
https://github.com/micat707/demo-extjs
9cb4a73a6a0d7dd11c24b38f663fbb053994ffee
6c3fdc76cf89823171c0a4e45c4e1a828897855a
refs/heads/master
2020-04-13T01:12:48.059000
2018-10-23T09:52:25
2018-10-23T09:52:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.myron.ims.controller; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.beanutils.BeanUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; 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.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.myron.common.util.ExcelUtil; import com.myron.common.util.StringUtils; import com.myron.db.mybatis.bean.ExtjsPage; import com.myron.ims.bean.Log; import com.myron.ims.service.LogService; @Controller @RequestMapping("/product/system/logManager") public class LogController { private static final Logger logger=LoggerFactory.getLogger(LogController.class); @Autowired private LogService logService; @RequestMapping public String logManager(ModelMap map,String filter, ExtjsPage extjsPage){ //TODO filter json转对象 Log log=new Log(); extjsPage.setLength(5); Map<String, Object> resultMap=this.logService.findListByPage(log, extjsPage); extjsPage= (ExtjsPage) resultMap.get("page"); map.put("total", extjsPage.getTotalCount()); map.put("pageInfo", extjsPage); return "/demo/list.jsp"; } @RequestMapping("read.do") @ResponseBody public Map<String, Object>read(String filter, ExtjsPage extjsPage){ Map<String, Object> map=new HashMap<>(); //TODO filter json转对象 Log log=new Log(); Map<String, Object> resultMap=this.logService.findListByPage(log, extjsPage); extjsPage= (ExtjsPage) resultMap.get("page"); map.put("total", extjsPage.getTotalCount()); map.put("records", resultMap.get("data")); return map; } @RequestMapping("create.do") @ResponseBody public Map<String, Object> create(@RequestBody List<Log> list){ Map<String, Object> map=new HashMap<>(); for(Log log: list){ log.preInsert(); this.logService.createLog(log); } map.put("tip", "操作成功"); map.put("valid", true); return map; } @RequestMapping("update.do") @ResponseBody public Map<String, Object> update(@RequestBody List<Log> list){ Map<String, Object> map=new HashMap<>(); int flag=0; for(Log log: list){ flag=this.logService.updateLog(log); } if(flag!=0){ map.put("tip", "操作成功"); map.put("valid", true); } return map; } @RequestMapping("destroy.do") @ResponseBody public Map<String, Object> destroy(@RequestBody List<Log> list){ Map<String, Object> map=new HashMap<>(); int count=0; for(Log log: list){ count=count+this.logService.deleteLog(log.getLogId()); } map.put("count", count);//返回成功删除个数 return map; } /** * 导出Excel文件 * @param req * @param resp * @param model */ @RequestMapping("exportExcel.do") public void exportExcel(HttpServletRequest req, HttpServletResponse resp, ModelMap model){ resp.setContentType("application/x-msdownload"); try { ServletOutputStream output=resp.getOutputStream(); Date date = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String dateStr = String.valueOf(simpleDateFormat.format(date)); String fileName=StringUtils.toUtf8String("Log_"+dateStr); //String fileName="Test"; resp.setHeader("Content-Disposition","attachment;filename=\""+fileName+ ".xlsx\""); Log log=new Log(); List<Map<String,Object>> fieldData=this.logService.findMapList(log); Map<String,String> fieldName=new LinkedHashMap<String,String>(); fieldName.put("logId", "日志主键"); fieldName.put("type", "日志类型"); fieldName.put("title", "日志标题"); fieldName.put("remoteAddr", "请求地址"); fieldName.put("requestUri", "URI"); fieldName.put("method", "请求方式"); fieldName.put("params", "提交参数"); fieldName.put("exception", "异常"); fieldName.put("operateDate", "开始时间"); fieldName.put("timeout", "结束时间"); fieldName.put("userId", "用户ID"); ExcelUtil.export(fieldName, fieldData, output); } catch (IOException e) { e.printStackTrace(); } } /** * excel导入 * TODO 导入成功回调提示 * @param req * @param file * @param model * @throws IOException */ @RequestMapping("importExcel.do") @ResponseBody public Map<String, Object> importExcel(HttpServletRequest req, @RequestParam(value="excelFile", required=false) MultipartFile file){ logger.debug("执行导入操作开始"); Map<String, Object> map=new HashMap<>(); CommonsMultipartFile commonsMultipartFile=(CommonsMultipartFile) file; try { List<Map<String,Object>> list=ExcelUtil.readExcelData(commonsMultipartFile); for(Map<String,Object> obj:list){ Log log=new Log(); BeanUtils.populate(log, obj); log.preInsert(); this.logService.createLog(log); } } catch (IOException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } map.put("tip", "导入成功啦啦啦"); map.put("success", true); return map; } /** * 下载模板 * @param model * @param req * @param resp */ @SuppressWarnings("unchecked") @RequestMapping("downloadTemplate.do") public void downloadTemplate(String model,HttpServletRequest req, HttpServletResponse resp){ Map<String, String> fieldName; try { if(model!=null && !"".equals(model) ){ ObjectMapper mapper = new ObjectMapper(); fieldName = mapper.readValue(model, LinkedHashMap.class); }else{ fieldName=new LinkedHashMap<String,String>(); fieldName.put("type", "日志类型"); fieldName.put("title", "日志标题"); fieldName.put("remoteAddr", "请求地址"); fieldName.put("requestUri", "URI"); fieldName.put("method", "请求方式"); fieldName.put("params", "提交参数"); fieldName.put("exception", "异常"); fieldName.put("operateDate", "开始时间"); fieldName.put("timeout", "结束时间"); fieldName.put("userId", "用户ID"); } ServletOutputStream outputStream; outputStream = resp.getOutputStream(); String fileName=StringUtils.toUtf8String("logTemplate"); resp.setContentType("application/x-msdownload"); resp.setHeader("Content-Disposition","attachment;filename=\""+fileName+ ".xlsx\""); ExcelUtil.exportTemplate(fieldName, outputStream); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
7,418
java
LogController.java
Java
[]
null
[]
package com.myron.ims.controller; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.beanutils.BeanUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; 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.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.myron.common.util.ExcelUtil; import com.myron.common.util.StringUtils; import com.myron.db.mybatis.bean.ExtjsPage; import com.myron.ims.bean.Log; import com.myron.ims.service.LogService; @Controller @RequestMapping("/product/system/logManager") public class LogController { private static final Logger logger=LoggerFactory.getLogger(LogController.class); @Autowired private LogService logService; @RequestMapping public String logManager(ModelMap map,String filter, ExtjsPage extjsPage){ //TODO filter json转对象 Log log=new Log(); extjsPage.setLength(5); Map<String, Object> resultMap=this.logService.findListByPage(log, extjsPage); extjsPage= (ExtjsPage) resultMap.get("page"); map.put("total", extjsPage.getTotalCount()); map.put("pageInfo", extjsPage); return "/demo/list.jsp"; } @RequestMapping("read.do") @ResponseBody public Map<String, Object>read(String filter, ExtjsPage extjsPage){ Map<String, Object> map=new HashMap<>(); //TODO filter json转对象 Log log=new Log(); Map<String, Object> resultMap=this.logService.findListByPage(log, extjsPage); extjsPage= (ExtjsPage) resultMap.get("page"); map.put("total", extjsPage.getTotalCount()); map.put("records", resultMap.get("data")); return map; } @RequestMapping("create.do") @ResponseBody public Map<String, Object> create(@RequestBody List<Log> list){ Map<String, Object> map=new HashMap<>(); for(Log log: list){ log.preInsert(); this.logService.createLog(log); } map.put("tip", "操作成功"); map.put("valid", true); return map; } @RequestMapping("update.do") @ResponseBody public Map<String, Object> update(@RequestBody List<Log> list){ Map<String, Object> map=new HashMap<>(); int flag=0; for(Log log: list){ flag=this.logService.updateLog(log); } if(flag!=0){ map.put("tip", "操作成功"); map.put("valid", true); } return map; } @RequestMapping("destroy.do") @ResponseBody public Map<String, Object> destroy(@RequestBody List<Log> list){ Map<String, Object> map=new HashMap<>(); int count=0; for(Log log: list){ count=count+this.logService.deleteLog(log.getLogId()); } map.put("count", count);//返回成功删除个数 return map; } /** * 导出Excel文件 * @param req * @param resp * @param model */ @RequestMapping("exportExcel.do") public void exportExcel(HttpServletRequest req, HttpServletResponse resp, ModelMap model){ resp.setContentType("application/x-msdownload"); try { ServletOutputStream output=resp.getOutputStream(); Date date = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String dateStr = String.valueOf(simpleDateFormat.format(date)); String fileName=StringUtils.toUtf8String("Log_"+dateStr); //String fileName="Test"; resp.setHeader("Content-Disposition","attachment;filename=\""+fileName+ ".xlsx\""); Log log=new Log(); List<Map<String,Object>> fieldData=this.logService.findMapList(log); Map<String,String> fieldName=new LinkedHashMap<String,String>(); fieldName.put("logId", "日志主键"); fieldName.put("type", "日志类型"); fieldName.put("title", "日志标题"); fieldName.put("remoteAddr", "请求地址"); fieldName.put("requestUri", "URI"); fieldName.put("method", "请求方式"); fieldName.put("params", "提交参数"); fieldName.put("exception", "异常"); fieldName.put("operateDate", "开始时间"); fieldName.put("timeout", "结束时间"); fieldName.put("userId", "用户ID"); ExcelUtil.export(fieldName, fieldData, output); } catch (IOException e) { e.printStackTrace(); } } /** * excel导入 * TODO 导入成功回调提示 * @param req * @param file * @param model * @throws IOException */ @RequestMapping("importExcel.do") @ResponseBody public Map<String, Object> importExcel(HttpServletRequest req, @RequestParam(value="excelFile", required=false) MultipartFile file){ logger.debug("执行导入操作开始"); Map<String, Object> map=new HashMap<>(); CommonsMultipartFile commonsMultipartFile=(CommonsMultipartFile) file; try { List<Map<String,Object>> list=ExcelUtil.readExcelData(commonsMultipartFile); for(Map<String,Object> obj:list){ Log log=new Log(); BeanUtils.populate(log, obj); log.preInsert(); this.logService.createLog(log); } } catch (IOException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } map.put("tip", "导入成功啦啦啦"); map.put("success", true); return map; } /** * 下载模板 * @param model * @param req * @param resp */ @SuppressWarnings("unchecked") @RequestMapping("downloadTemplate.do") public void downloadTemplate(String model,HttpServletRequest req, HttpServletResponse resp){ Map<String, String> fieldName; try { if(model!=null && !"".equals(model) ){ ObjectMapper mapper = new ObjectMapper(); fieldName = mapper.readValue(model, LinkedHashMap.class); }else{ fieldName=new LinkedHashMap<String,String>(); fieldName.put("type", "日志类型"); fieldName.put("title", "日志标题"); fieldName.put("remoteAddr", "请求地址"); fieldName.put("requestUri", "URI"); fieldName.put("method", "请求方式"); fieldName.put("params", "提交参数"); fieldName.put("exception", "异常"); fieldName.put("operateDate", "开始时间"); fieldName.put("timeout", "结束时间"); fieldName.put("userId", "用户ID"); } ServletOutputStream outputStream; outputStream = resp.getOutputStream(); String fileName=StringUtils.toUtf8String("logTemplate"); resp.setContentType("application/x-msdownload"); resp.setHeader("Content-Disposition","attachment;filename=\""+fileName+ ".xlsx\""); ExcelUtil.exportTemplate(fieldName, outputStream); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
7,418
0.713748
0.712632
241
28.759336
22.2962
93
false
false
0
0
0
0
0
0
2.726141
false
false
13
1b3ba33addff160f1a2f7556c3b2250e4d9a5ebc
16,484,084,506,239
18668942dddac74ffb046c4326973b32faa3401c
/10_ProjetEcommerce/src/fr/adaming/converters/CategorieConverter.java
6f4dd32abaf6992cd0c395df4a4fb6af8958e620
[]
no_license
ProjetJEEAslAb/Ecommerce
https://github.com/ProjetJEEAslAb/Ecommerce
fd4de8d9772a6f647cf57499a606d63999b39363
f9e9d789d0fd3b1829cee9d73cc036ca5d9e4336
refs/heads/master
2021-07-23T13:51:59.587000
2017-10-30T09:30:08
2017-10-30T09:30:08
108,239,745
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.adaming.converters; import javax.ejb.EJB; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.ConverterException; import javax.faces.convert.FacesConverter; import fr.adaming.model.Agent; import fr.adaming.service.ICategorieService; @FacesConverter("catConverter") public class CategorieConverter implements Converter{ @EJB ICategorieService catService; @Override public Object getAsObject(FacesContext fc, UIComponent uic, String value) { if(value != null && value.trim().length() > 0) { try { Agent ag=(Agent) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("agentSession"); return catService.getAllCategorie(ag).get(Integer.parseInt(value)); } catch(NumberFormatException e) { throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Conversion Error", "Not a valid theme.")); } } else { return null; } } @Override public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) { // TODO Auto-generated method stub return null; } }
UTF-8
Java
1,372
java
CategorieConverter.java
Java
[]
null
[]
package fr.adaming.converters; import javax.ejb.EJB; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.ConverterException; import javax.faces.convert.FacesConverter; import fr.adaming.model.Agent; import fr.adaming.service.ICategorieService; @FacesConverter("catConverter") public class CategorieConverter implements Converter{ @EJB ICategorieService catService; @Override public Object getAsObject(FacesContext fc, UIComponent uic, String value) { if(value != null && value.trim().length() > 0) { try { Agent ag=(Agent) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("agentSession"); return catService.getAllCategorie(ag).get(Integer.parseInt(value)); } catch(NumberFormatException e) { throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Conversion Error", "Not a valid theme.")); } } else { return null; } } @Override public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) { // TODO Auto-generated method stub return null; } }
1,372
0.670554
0.667638
44
29.181818
31.069769
135
false
false
0
0
0
0
0
0
1.136364
false
false
13
d4d4ad80b5f67528d9e1030f9255d7d74e943dae
20,255,065,795,431
a748759303d36336b37dbecfb22c52561a72a56d
/java/toolgood.algorithm/src/main/java/toolgood/algorithm/mathNet/Distributions/FisherSnedecor.java
d7da34ef1d937684e1b70146462c8d19ec29bec4
[ "Apache-2.0" ]
permissive
toolgood/ToolGood.Algorithm
https://github.com/toolgood/ToolGood.Algorithm
fe64cd2d9c8aa5c6c1e7d83c824e1519f628a392
63d8ea226ac7ead2fe8701387141873ffb0fef91
refs/heads/master
2023-08-29T11:44:19.191000
2023-08-12T00:38:09
2023-08-12T00:38:09
69,866,985
95
34
Apache-2.0
false
2023-09-14T08:48:05
2016-10-03T12:06:12
2023-08-08T06:11:01
2023-09-14T08:48:04
11,382
94
32
0
Java
false
false
package toolgood.algorithm.mathNet.Distributions; import java.util.function.Function; import toolgood.algorithm.mathNet.SpecialFunctions; import toolgood.algorithm.mathNet.RootFinding.Brent; public class FisherSnedecor { public static double CDF(double d1, double d2, double x) { //if (d1 <= 0.0 || d2 <= 0.0) { // throw new ArgumentException(Resources.InvalidDistributionParameters); //} return SpecialFunctions.BetaRegularized(d1 / 2.0, d2 / 2.0, d1 * x / (d1 * x + d2)); } public static double InvCDF(double d1, double d2, double p) throws Exception { //if (d1 <= 0.0 || d2 <= 0.0) { // throw new ArgumentException(Resources.InvalidDistributionParameters); //} Function<Double,Double> f= x->{ return SpecialFunctions.BetaRegularized(d1 / 2.0, d2 / 2.0, d1 * x / (d1 * x + d2)) - p; }; return Brent.FindRoot(f, 0, 1000, 1e-12); } }
UTF-8
Java
963
java
FisherSnedecor.java
Java
[]
null
[]
package toolgood.algorithm.mathNet.Distributions; import java.util.function.Function; import toolgood.algorithm.mathNet.SpecialFunctions; import toolgood.algorithm.mathNet.RootFinding.Brent; public class FisherSnedecor { public static double CDF(double d1, double d2, double x) { //if (d1 <= 0.0 || d2 <= 0.0) { // throw new ArgumentException(Resources.InvalidDistributionParameters); //} return SpecialFunctions.BetaRegularized(d1 / 2.0, d2 / 2.0, d1 * x / (d1 * x + d2)); } public static double InvCDF(double d1, double d2, double p) throws Exception { //if (d1 <= 0.0 || d2 <= 0.0) { // throw new ArgumentException(Resources.InvalidDistributionParameters); //} Function<Double,Double> f= x->{ return SpecialFunctions.BetaRegularized(d1 / 2.0, d2 / 2.0, d1 * x / (d1 * x + d2)) - p; }; return Brent.FindRoot(f, 0, 1000, 1e-12); } }
963
0.624091
0.580478
29
32.241379
31.934908
101
false
false
0
0
0
0
0
0
0.896552
false
false
13
eb54842d35568c3880e5602614479f78cf203e79
26,310,969,683,268
6dbae30c806f661bcdcbc5f5f6a366ad702b1eea
/Corpus/eclipse.jdt.debug/421.java
64ca2c826a6554705591b9dd8f475d1ee1457cad
[ "MIT" ]
permissive
SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018
https://github.com/SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018
d3fd21745dfddb2979e8ac262588cfdfe471899f
0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0
refs/heads/master
2020-03-31T15:52:01.005000
2018-10-01T23:38:50
2018-10-01T23:38:50
152,354,327
1
0
MIT
true
2018-10-10T02:57:02
2018-10-10T02:57:02
2018-10-01T23:38:52
2018-10-01T23:38:50
135,431
0
0
0
null
false
null
/******************************************************************************* * Copyright (c) 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.launching.macosx; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { //$NON-NLS-1$ private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.launching.macosx.messages"; public static String MacOSXVMInstallType_0; public static String MacOSXVMInstallType_1; public static String MacOSXVMInstallType_2; public static String MacOSXVMInstallType_jre; public static String MacOSXVMInstallType_jre_version; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); } private Messages() { } }
UTF-8
Java
1,180
java
421.java
Java
[]
null
[]
/******************************************************************************* * Copyright (c) 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.launching.macosx; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { //$NON-NLS-1$ private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.launching.macosx.messages"; public static String MacOSXVMInstallType_0; public static String MacOSXVMInstallType_1; public static String MacOSXVMInstallType_2; public static String MacOSXVMInstallType_jre; public static String MacOSXVMInstallType_jre_version; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); } private Messages() { } }
1,180
0.631356
0.621186
37
30.891891
28.756935
99
false
false
0
0
0
0
0
0
0.297297
false
false
13
511419e4be5ab5a2e4dec11b00b2b2fbc285f051
13,400,297,988,632
1034b4a219f579a2632a04ea23d15567fb460a82
/modul4/asisten/paperProblem/src/main/PaperProblem/Gudang.java
46f20aa06a7f1bcb84f4f2a53e4de6202becffbb
[]
no_license
yogiprasetio/Praktikum_PBO
https://github.com/yogiprasetio/Praktikum_PBO
ec80c2c1d34802703850ac4678b46b2435f6509a
720f41ce11e3ba8166e88ac9022529b1f3ae3502
refs/heads/master
2020-08-05T00:01:37.923000
2019-12-17T17:07:10
2019-12-17T17:07:10
212,323,566
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.PaperProblem; abstract class Gudang { String waktu; int debet=0; int saldo=0; public int getSaldo() { return saldo; } public int getDebet() { return debet; } public abstract void Stockbrg(int debet); public abstract void Ambilbrg(int debet,int saldo); }
UTF-8
Java
341
java
Gudang.java
Java
[]
null
[]
package main.PaperProblem; abstract class Gudang { String waktu; int debet=0; int saldo=0; public int getSaldo() { return saldo; } public int getDebet() { return debet; } public abstract void Stockbrg(int debet); public abstract void Ambilbrg(int debet,int saldo); }
341
0.595308
0.589443
20
16.049999
15.124401
55
false
false
0
0
0
0
0
0
0.45
false
false
13
5850611b139f3687c3c43820584fd4dff1f28391
3,229,815,412,861
2b6c6481f4f6dadd60f6cf4451420f13227d9751
/src/main/java/csci305/javalab/Player.java
4d4babef3d7ce549265a96545ee8ce5d3d4b3388
[ "MIT" ]
permissive
KyleWebster1/csci305-java-lab
https://github.com/KyleWebster1/csci305-java-lab
5edc661e18c6b508adc7c367801be186c609d431
8b25df0b3193fb5dcd81cdee2e58a5ceafd6dbd5
refs/heads/master
2021-04-12T06:38:35.021000
2018-04-09T16:38:18
2018-04-09T16:38:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package csci305.javalab; /** * Created by kylewebster1 on 3/26/18. */ public abstract class Player { //stores the last element played by the opponent, used for MyBot and LastPlayBot public Element last = null; //stores the name private String name; public Player(String name) { this.name = name; } //gets the name of the player class public String getName() { return name; } //abstractly creates Element Class public abstract Element play(); }
UTF-8
Java
510
java
Player.java
Java
[ { "context": "package csci305.javalab;\n\n/**\n * Created by kylewebster1 on 3/26/18.\n */\npublic abstract class Player {\n ", "end": 56, "score": 0.9995590448379517, "start": 44, "tag": "USERNAME", "value": "kylewebster1" } ]
null
[]
package csci305.javalab; /** * Created by kylewebster1 on 3/26/18. */ public abstract class Player { //stores the last element played by the opponent, used for MyBot and LastPlayBot public Element last = null; //stores the name private String name; public Player(String name) { this.name = name; } //gets the name of the player class public String getName() { return name; } //abstractly creates Element Class public abstract Element play(); }
510
0.654902
0.637255
23
21.173914
19.55072
84
false
false
0
0
0
0
0
0
0.304348
false
false
13
ac7b4fff8b046f4e44bf892f53e85f17bb0f0b24
6,906,307,419,741
b27e59eaa61fe0861baecee47f4b3ac59267c93f
/annotation-service/src/main/java/org/forome/annotation/annotator/executor/ThreadExecutor.java
457d90f867639a98d3138c14dc878b6d50a939f6
[ "Apache-2.0" ]
permissive
ForomePlatform/Anfisa-Annotations
https://github.com/ForomePlatform/Anfisa-Annotations
1eea8cb42d05cfee6d93d6d4ad1949cb394c95ca
35b428f3348284237296c80b23c982e5dc29de62
refs/heads/master
2022-12-25T11:25:04.576000
2022-12-17T21:59:08
2022-12-17T21:59:08
170,938,347
0
5
Apache-2.0
false
2022-06-13T06:45:43
2019-02-15T22:47:00
2021-12-18T00:48:38
2022-06-13T06:45:42
10,327
0
3
0
Java
false
false
/* Copyright (c) 2019. Vladimir Ulitin, Partners Healthcare and members of Forome Association Developed by Vladimir Ulitin and Michael Bouzinier Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.forome.annotation.annotator.executor; import net.minidev.json.JSONObject; import org.forome.annotation.iterator.vcf.VCFFileIterator; import org.forome.annotation.iterator.vepjson.VepJsonFileIterator; import org.forome.annotation.processing.Processing; import org.forome.annotation.processing.struct.ProcessingResult; import org.forome.annotation.service.ensemblvep.EnsemblVepService; import org.forome.annotation.struct.mavariant.MAVariant; import org.forome.annotation.struct.mavariant.MAVariantCNV; import org.forome.annotation.struct.mavariant.MAVariantVCF; import org.forome.annotation.struct.mavariant.MAVariantVep; import org.forome.annotation.struct.mcase.MCase; import org.forome.annotation.struct.variant.Variant; import org.forome.annotation.struct.variant.vep.VariantVep; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.file.Path; import java.util.Collections; import java.util.Deque; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentLinkedDeque; public class ThreadExecutor implements AutoCloseable { private final static Logger log = LoggerFactory.getLogger(ThreadExecutor.class); private final int index; private final EnsemblVepService ensemblVepService; private final Processing processing; private final MCase samples; private final int start; private final int step; private final VCFFileIterator vcfFileIterator; private final VepJsonFileIterator vepJsonIterator; private Result nextResult; private final Deque<Result> waitExecuteVariants;//Варианты ожидающие выполнения private int nextPosition; private volatile boolean isCompleted = false; public ThreadExecutor( int index, EnsemblVepService ensemblVepService, Processing processing, MCase samples, Path pathVcf, Path pathVepJson, Path cnvFile, int start, int step, Thread.UncaughtExceptionHandler uncaughtExceptionHandler ) { this.index = index; this.ensemblVepService = ensemblVepService; this.processing = processing; this.samples = samples; this.start = start; this.step = step; this.vcfFileIterator = new VCFFileIterator(pathVcf, cnvFile); if (pathVepJson != null) { vepJsonIterator = new VepJsonFileIterator(pathVepJson); } else { vepJsonIterator = null; } this.nextResult = new Result(nextPosition, new CompletableFuture<>()); this.waitExecuteVariants = new ConcurrentLinkedDeque<>(); this.waitExecuteVariants.add(nextResult); nextPosition = start + step; //Исполнитель Thread executor = new Thread(() -> { log.debug("Thread: {} start", index); Source source = null; try { //Прокручиваем до начала итерации if (start > 0) { nextSource(start); } source = nextSource(1); } catch (NoSuchElementException e) { isCompleted = true; log.debug("Thread: {} completed", index); } while (true) { //TODO Переписать на засыпание потока while (waitExecuteVariants.isEmpty()) { if (isCompleted) return; try { Thread.sleep(10L); } catch (InterruptedException e) { } } Result result = waitExecuteVariants.poll(); if (isCompleted) { result.future.complete(null); continue; } MAVariant maVariant = source.variant; if (maVariant instanceof MAVariantVCF && vepJsonIterator != null) { List<ProcessingResult> processingResults = processing.exec(samples, maVariant); result.future.complete(processingResults); } else { // String alternative; // if (variant instanceof MAVariantVCF) { // VariantContext variantContext = ((MAVariantVCF) variant).variantContext; // // Allele allele = variantContext.getAlternateAlleles().stream() // .filter(iAllele -> !iAllele.getDisplayString().equals("*")) // .max(Comparator.comparing(variantContext::getCalledChrCount)) // .orElse(null); // alternative = allele.getDisplayString(); // } else if (variant instanceof MAVariantCNV) { // alternative = "-"; // } else { // throw new RuntimeException("Not support type variant: " + variant); // } Variant variant; if (maVariant instanceof MAVariantCNV) { variant = ((MAVariantCNV) maVariant).variantCNV; } else { throw new RuntimeException("Not support type maVariant: " + maVariant); } ensemblVepService.getVepJson(variant) .thenApply(iVepJson -> { ((VariantVep) variant).setVepJson(iVepJson); ProcessingResult processingResult = processing.exec(samples, variant); result.future.complete(Collections.singletonList(processingResult)); return null; }) .exceptionally(throwable -> { result.future.completeExceptionally(throwable); return null; }); } //Дожидаемся выполнения try { result.future.join(); } catch (Throwable ignore) { } try { source = nextSource(step); } catch (NoSuchElementException e) { isCompleted = true; log.debug("Thread: {} completed", index); } } }); executor.setUncaughtExceptionHandler(uncaughtExceptionHandler); executor.start(); } private Source nextSource(int step) { if (step < 1) throw new IllegalArgumentException(); MAVariantVep variantVep = null; JSONObject vepJson = null; for (int i = 0; i < step; i++) { try { variantVep = vcfFileIterator.next(); } catch (NoSuchElementException ne) { //Валидация того, что в vep.json - тоже не осталось записей if (vepJsonIterator != null) { try { vepJsonIterator.next(); throw new RuntimeException("Not equals count rows, vcf file and vep.json file"); } catch (NoSuchElementException ignore) { } } throw ne; } if (variantVep instanceof MAVariantVCF && vepJsonIterator != null) { try { vepJson = vepJsonIterator.next(); } catch (NoSuchElementException ne) { //Валидация того, что в vep.json - остались записи throw new RuntimeException("Not equals count rows, vcf file and vep.json file"); } } else { vepJson = null; } } return new Source(variantVep, vepJson); } public Result next() { Result value; synchronized (waitExecuteVariants) { value = nextResult; nextPosition += step; if (isCompleted) { nextResult = new Result(nextPosition, CompletableFuture.completedFuture(null)); } else { nextResult = new Result(nextPosition, new CompletableFuture<>()); this.waitExecuteVariants.add(nextResult); } } return value; } @Override public void close() throws IOException { vcfFileIterator.close(); if (vepJsonIterator != null) { vepJsonIterator.close(); } } }
UTF-8
Java
7,628
java
ThreadExecutor.java
Java
[ { "context": "/*\n Copyright (c) 2019. Vladimir Ulitin, Partners Healthcare and members of Forome Associ", "end": 39, "score": 0.9998928308486938, "start": 24, "tag": "NAME", "value": "Vladimir Ulitin" }, { "context": "e and members of Forome Association\n\n Developed by Vladimir Ulitin and Michael Bouzinier\n\n Licensed under the Apache", "end": 125, "score": 0.9998917579650879, "start": 110, "tag": "NAME", "value": "Vladimir Ulitin" }, { "context": "ome Association\n\n Developed by Vladimir Ulitin and Michael Bouzinier\n\n Licensed under the Apache License, Version 2.0 ", "end": 147, "score": 0.9998903274536133, "start": 130, "tag": "NAME", "value": "Michael Bouzinier" } ]
null
[]
/* Copyright (c) 2019. <NAME>, Partners Healthcare and members of Forome Association Developed by <NAME> and <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.forome.annotation.annotator.executor; import net.minidev.json.JSONObject; import org.forome.annotation.iterator.vcf.VCFFileIterator; import org.forome.annotation.iterator.vepjson.VepJsonFileIterator; import org.forome.annotation.processing.Processing; import org.forome.annotation.processing.struct.ProcessingResult; import org.forome.annotation.service.ensemblvep.EnsemblVepService; import org.forome.annotation.struct.mavariant.MAVariant; import org.forome.annotation.struct.mavariant.MAVariantCNV; import org.forome.annotation.struct.mavariant.MAVariantVCF; import org.forome.annotation.struct.mavariant.MAVariantVep; import org.forome.annotation.struct.mcase.MCase; import org.forome.annotation.struct.variant.Variant; import org.forome.annotation.struct.variant.vep.VariantVep; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.file.Path; import java.util.Collections; import java.util.Deque; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentLinkedDeque; public class ThreadExecutor implements AutoCloseable { private final static Logger log = LoggerFactory.getLogger(ThreadExecutor.class); private final int index; private final EnsemblVepService ensemblVepService; private final Processing processing; private final MCase samples; private final int start; private final int step; private final VCFFileIterator vcfFileIterator; private final VepJsonFileIterator vepJsonIterator; private Result nextResult; private final Deque<Result> waitExecuteVariants;//Варианты ожидающие выполнения private int nextPosition; private volatile boolean isCompleted = false; public ThreadExecutor( int index, EnsemblVepService ensemblVepService, Processing processing, MCase samples, Path pathVcf, Path pathVepJson, Path cnvFile, int start, int step, Thread.UncaughtExceptionHandler uncaughtExceptionHandler ) { this.index = index; this.ensemblVepService = ensemblVepService; this.processing = processing; this.samples = samples; this.start = start; this.step = step; this.vcfFileIterator = new VCFFileIterator(pathVcf, cnvFile); if (pathVepJson != null) { vepJsonIterator = new VepJsonFileIterator(pathVepJson); } else { vepJsonIterator = null; } this.nextResult = new Result(nextPosition, new CompletableFuture<>()); this.waitExecuteVariants = new ConcurrentLinkedDeque<>(); this.waitExecuteVariants.add(nextResult); nextPosition = start + step; //Исполнитель Thread executor = new Thread(() -> { log.debug("Thread: {} start", index); Source source = null; try { //Прокручиваем до начала итерации if (start > 0) { nextSource(start); } source = nextSource(1); } catch (NoSuchElementException e) { isCompleted = true; log.debug("Thread: {} completed", index); } while (true) { //TODO Переписать на засыпание потока while (waitExecuteVariants.isEmpty()) { if (isCompleted) return; try { Thread.sleep(10L); } catch (InterruptedException e) { } } Result result = waitExecuteVariants.poll(); if (isCompleted) { result.future.complete(null); continue; } MAVariant maVariant = source.variant; if (maVariant instanceof MAVariantVCF && vepJsonIterator != null) { List<ProcessingResult> processingResults = processing.exec(samples, maVariant); result.future.complete(processingResults); } else { // String alternative; // if (variant instanceof MAVariantVCF) { // VariantContext variantContext = ((MAVariantVCF) variant).variantContext; // // Allele allele = variantContext.getAlternateAlleles().stream() // .filter(iAllele -> !iAllele.getDisplayString().equals("*")) // .max(Comparator.comparing(variantContext::getCalledChrCount)) // .orElse(null); // alternative = allele.getDisplayString(); // } else if (variant instanceof MAVariantCNV) { // alternative = "-"; // } else { // throw new RuntimeException("Not support type variant: " + variant); // } Variant variant; if (maVariant instanceof MAVariantCNV) { variant = ((MAVariantCNV) maVariant).variantCNV; } else { throw new RuntimeException("Not support type maVariant: " + maVariant); } ensemblVepService.getVepJson(variant) .thenApply(iVepJson -> { ((VariantVep) variant).setVepJson(iVepJson); ProcessingResult processingResult = processing.exec(samples, variant); result.future.complete(Collections.singletonList(processingResult)); return null; }) .exceptionally(throwable -> { result.future.completeExceptionally(throwable); return null; }); } //Дожидаемся выполнения try { result.future.join(); } catch (Throwable ignore) { } try { source = nextSource(step); } catch (NoSuchElementException e) { isCompleted = true; log.debug("Thread: {} completed", index); } } }); executor.setUncaughtExceptionHandler(uncaughtExceptionHandler); executor.start(); } private Source nextSource(int step) { if (step < 1) throw new IllegalArgumentException(); MAVariantVep variantVep = null; JSONObject vepJson = null; for (int i = 0; i < step; i++) { try { variantVep = vcfFileIterator.next(); } catch (NoSuchElementException ne) { //Валидация того, что в vep.json - тоже не осталось записей if (vepJsonIterator != null) { try { vepJsonIterator.next(); throw new RuntimeException("Not equals count rows, vcf file and vep.json file"); } catch (NoSuchElementException ignore) { } } throw ne; } if (variantVep instanceof MAVariantVCF && vepJsonIterator != null) { try { vepJson = vepJsonIterator.next(); } catch (NoSuchElementException ne) { //Валидация того, что в vep.json - остались записи throw new RuntimeException("Not equals count rows, vcf file and vep.json file"); } } else { vepJson = null; } } return new Source(variantVep, vepJson); } public Result next() { Result value; synchronized (waitExecuteVariants) { value = nextResult; nextPosition += step; if (isCompleted) { nextResult = new Result(nextPosition, CompletableFuture.completedFuture(null)); } else { nextResult = new Result(nextPosition, new CompletableFuture<>()); this.waitExecuteVariants.add(nextResult); } } return value; } @Override public void close() throws IOException { vcfFileIterator.close(); if (vepJsonIterator != null) { vepJsonIterator.close(); } } }
7,599
0.715015
0.712866
253
28.43083
24.180647
91
false
false
0
0
0
0
0
0
2.996047
false
false
13
42e13574826bccbeb60b5a07459e5be2cef5e134
7,069,516,175,245
e5da9a18a0c436027670ffa7d8d9099763706b00
/src/test/java/inheritance/Daughter.java
2d55676b59353c9b8918ece0e5cf5407ca21acdb
[]
no_license
usergalina1/MyJavaWebdriver
https://github.com/usergalina1/MyJavaWebdriver
e51f19e3aad0e7ca73827705f92d3e30fab726d6
80f2bd2d89840e65afbe68aee4b7c1c9d19936a5
refs/heads/master
2023-05-12T17:28:30.213000
2019-06-02T20:56:37
2019-06-02T20:56:37
187,736,240
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package inheritance; public class Daughter extends Family { public void studies(String arg) { System.out.println("My sister studies at" + arg); } }
UTF-8
Java
166
java
Daughter.java
Java
[]
null
[]
package inheritance; public class Daughter extends Family { public void studies(String arg) { System.out.println("My sister studies at" + arg); } }
166
0.674699
0.674699
7
22.571428
20.430069
57
false
false
0
0
0
0
0
0
0.285714
false
false
13
a11e692757f864ad5819c8f12f6ccbf22ca5d68b
6,966,436,966,527
f37048ec9b557e658eb2bade9f9a12e6a8e30481
/src/main/java/model/Order.java
63ed76caa713d9392f45f05e28337c7e136291d0
[]
no_license
cerker/camel-examples
https://github.com/cerker/camel-examples
8d71c4793ec0d9957a174170441baee2714b9e55
403a2a6b78c8f160509277946409f5cf9a8a4084
refs/heads/master
2020-05-30T14:50:31.982000
2015-02-23T13:04:06
2015-02-23T13:04:06
31,204,248
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement @XmlAccessorType( XmlAccessType.PROPERTY ) public class Order { private String orderNumber; public String getOrderNumber() { return orderNumber; } @XmlElement public void setOrderNumber( String orderNumber ) { this.orderNumber = orderNumber; } @Override public String toString() { return "Order{" + "orderNumber='" + orderNumber + '\'' + '}'; } }
UTF-8
Java
668
java
Order.java
Java
[]
null
[]
package model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement @XmlAccessorType( XmlAccessType.PROPERTY ) public class Order { private String orderNumber; public String getOrderNumber() { return orderNumber; } @XmlElement public void setOrderNumber( String orderNumber ) { this.orderNumber = orderNumber; } @Override public String toString() { return "Order{" + "orderNumber='" + orderNumber + '\'' + '}'; } }
668
0.669162
0.669162
29
22.034483
18.651953
54
false
false
0
0
0
0
0
0
0.310345
false
false
13
9363c42876273bb89ad188eefb8ae66950be6bb5
16,887,811,472,244
ba75003b52010c2aebac794f9eddc515a8fb1cbc
/app/src/main/java/com/jelliroo/mallmapbeta/activities/SplashActivity.java
cfe5dc4165d9b28abcaf86c13289f4b06fd10fe0
[]
no_license
roger-cores/mall-map-client
https://github.com/roger-cores/mall-map-client
740ea3bbd15782eac2d288ec0b99e740af4505c6
bef12e9aa2fbe644001117018930845614b192e8
refs/heads/master
2020-12-31T07:42:16.380000
2019-04-24T22:20:35
2019-04-24T22:20:35
86,548,755
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jelliroo.mallmapbeta.activities; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import com.jelliroo.mallmapbeta.R; public class SplashActivity extends AppCompatActivity { ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); imageView = (ImageView) findViewById(R.id.imageView3); } @Override protected void onStart() { super.onStart(); imageView.setVisibility(View.GONE); Animation bottomUp = AnimationUtils.loadAnimation(this, R.anim.bottom_up); imageView.startAnimation(bottomUp); imageView.setVisibility(View.VISIBLE); bottomUp.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { final Animation bottomDown = AnimationUtils.loadAnimation(SplashActivity.this, R.anim.fade_out); imageView.startAnimation(bottomDown); bottomDown.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { imageView.setVisibility(View.GONE); Intent intent = new Intent(SplashActivity.this, LaunchActivity.class); startActivity(intent); } @Override public void onAnimationRepeat(Animation animation) { } }); } }, 1000); } @Override public void onAnimationRepeat(Animation animation) { } }); } }
UTF-8
Java
2,620
java
SplashActivity.java
Java
[]
null
[]
package com.jelliroo.mallmapbeta.activities; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import com.jelliroo.mallmapbeta.R; public class SplashActivity extends AppCompatActivity { ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); imageView = (ImageView) findViewById(R.id.imageView3); } @Override protected void onStart() { super.onStart(); imageView.setVisibility(View.GONE); Animation bottomUp = AnimationUtils.loadAnimation(this, R.anim.bottom_up); imageView.startAnimation(bottomUp); imageView.setVisibility(View.VISIBLE); bottomUp.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { final Animation bottomDown = AnimationUtils.loadAnimation(SplashActivity.this, R.anim.fade_out); imageView.startAnimation(bottomDown); bottomDown.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { imageView.setVisibility(View.GONE); Intent intent = new Intent(SplashActivity.this, LaunchActivity.class); startActivity(intent); } @Override public void onAnimationRepeat(Animation animation) { } }); } }, 1000); } @Override public void onAnimationRepeat(Animation animation) { } }); } }
2,620
0.556107
0.553817
81
31.345678
26.661648
102
false
false
0
0
0
0
0
0
0.395062
false
false
13
ed622df462669cb0612570a7e0a737384ee5bbbb
8,469,675,538,794
211f8916a90c13d628eaad94b4766399eb6734a2
/kodilla-rps/src/main/java/com/kodilla/rps/ShapeRecognizer.java
d09f5c5a24a35849bb3a7544fe6245eec0bdf0b7
[]
no_license
mryndak/przemyslaw-zdanowicz-kodilla-java
https://github.com/mryndak/przemyslaw-zdanowicz-kodilla-java
b2cdf4793046a5d49a4fc71623f5531631ede931
73f0d7d8212d2e4e249ce212ae4fca418ef2edbb
refs/heads/master
2023-08-14T02:11:58.098000
2021-09-24T16:28:23
2021-09-24T16:28:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kodilla.rps; public class ShapeRecognizer { String userKey; Shape shape; int computersMove; public String getUserKey() { return userKey; } public void setUserKey(String userKey) { this.userKey = userKey; } public Shape recognize(String userKey) { if (userKey.equals("1")) { return new Rock(); } else if (userKey.equals("2")) { return new Paper(); } else if (userKey.equals("3")) { return new Scissors(); } else { return null; } } }
UTF-8
Java
590
java
ShapeRecognizer.java
Java
[]
null
[]
package com.kodilla.rps; public class ShapeRecognizer { String userKey; Shape shape; int computersMove; public String getUserKey() { return userKey; } public void setUserKey(String userKey) { this.userKey = userKey; } public Shape recognize(String userKey) { if (userKey.equals("1")) { return new Rock(); } else if (userKey.equals("2")) { return new Paper(); } else if (userKey.equals("3")) { return new Scissors(); } else { return null; } } }
590
0.538983
0.533898
30
18.700001
15.271214
44
false
false
0
0
0
0
0
0
0.333333
false
false
13
de78bea367fe119a4f811ee1463d7165e0de0951
8,899,172,238,675
6381f01046045145386e50f77b61c4c41aa27091
/atest/app/src/main/java/com/atest/atest/ActivityFocus.java
7dec4c5024e5a00eff25a0f5c3a3edaaf7062161
[]
no_license
sl1296/android
https://github.com/sl1296/android
3a7baa82b00b6dabb9b6bb4f0db7925c511efd5d
f56e93b493813ebb118fbea68ef35f8fc38bc034
refs/heads/master
2020-11-29T13:06:07.064000
2019-10-07T03:17:26
2019-10-07T03:17:26
230,119,589
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.atest.atest; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; public class ActivityFocus extends AppCompatActivity { private boolean r = false, f = false, c = false, l = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_focus); DataFocus x = new DataFocus(getIntent().getBundleExtra("1")); TextView tmp = findViewById(R.id.tv_title); tmp.setText(x.str()); final ImageView reward=(ImageView) findViewById(R.id.reward); final ImageView forward=(ImageView) findViewById(R.id.forward); final ImageView comment=(ImageView) findViewById(R.id.comment); final ImageView like=(ImageView) findViewById(R.id.like); final TextView rewardt=(TextView) findViewById(R.id.rewardt); final TextView forwardt=(TextView) findViewById(R.id.forwardt); final TextView commentt=(TextView) findViewById(R.id.commentt); final TextView liket=(TextView) findViewById(R.id.liket); findViewById(R.id.rewardl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (r) { reward.setImageResource(R.drawable.reward); rewardt.setTextColor(0x8a000000); } else { reward.setImageResource(R.drawable.rewarded); rewardt.setTextColor(0xffffba26); } r = !r; } }); findViewById(R.id.forwardl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (f) { forward.setImageResource(R.drawable.forward); forwardt.setTextColor(0x8a000000); } else { forward.setImageResource(R.drawable.forwarded); forwardt.setTextColor(0xffffba26); } f = !f; } }); findViewById(R.id.commentl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (c) { comment.setImageResource(R.drawable.comment); commentt.setTextColor(0x8a000000); } else { comment.setImageResource(R.drawable.commented); commentt.setTextColor(0xffffba26); } c = !c; } }); findViewById(R.id.likel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (l) { like.setImageResource(R.drawable.like); liket.setTextColor(0x8a000000); } else { like.setImageResource(R.drawable.liked); liket.setTextColor(0xffffba26); } l= !l; } }); } }
UTF-8
Java
3,232
java
ActivityFocus.java
Java
[]
null
[]
package com.atest.atest; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.TextView; public class ActivityFocus extends AppCompatActivity { private boolean r = false, f = false, c = false, l = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_focus); DataFocus x = new DataFocus(getIntent().getBundleExtra("1")); TextView tmp = findViewById(R.id.tv_title); tmp.setText(x.str()); final ImageView reward=(ImageView) findViewById(R.id.reward); final ImageView forward=(ImageView) findViewById(R.id.forward); final ImageView comment=(ImageView) findViewById(R.id.comment); final ImageView like=(ImageView) findViewById(R.id.like); final TextView rewardt=(TextView) findViewById(R.id.rewardt); final TextView forwardt=(TextView) findViewById(R.id.forwardt); final TextView commentt=(TextView) findViewById(R.id.commentt); final TextView liket=(TextView) findViewById(R.id.liket); findViewById(R.id.rewardl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (r) { reward.setImageResource(R.drawable.reward); rewardt.setTextColor(0x8a000000); } else { reward.setImageResource(R.drawable.rewarded); rewardt.setTextColor(0xffffba26); } r = !r; } }); findViewById(R.id.forwardl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (f) { forward.setImageResource(R.drawable.forward); forwardt.setTextColor(0x8a000000); } else { forward.setImageResource(R.drawable.forwarded); forwardt.setTextColor(0xffffba26); } f = !f; } }); findViewById(R.id.commentl).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (c) { comment.setImageResource(R.drawable.comment); commentt.setTextColor(0x8a000000); } else { comment.setImageResource(R.drawable.commented); commentt.setTextColor(0xffffba26); } c = !c; } }); findViewById(R.id.likel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (l) { like.setImageResource(R.drawable.like); liket.setTextColor(0x8a000000); } else { like.setImageResource(R.drawable.liked); liket.setTextColor(0xffffba26); } l= !l; } }); } }
3,232
0.561572
0.547339
81
38.901234
23.410774
83
false
false
0
0
0
0
0
0
0.592593
false
false
13
53b1ef46433d8a719b3472d834d5b394a8ad8a29
9,371,618,686,329
a941f91eb1d463070fbfa6935ef05bd9781d5c07
/src/test/java/Task8.java
3593f862c734557f6115903714b92c8fd5c70ee7
[ "Apache-2.0" ]
permissive
da-shutka/dp-selenium-course
https://github.com/da-shutka/dp-selenium-course
5b27d3b8f1613b406e8744e7444df76ce58be660
458eb32755c4e29b4846b3edc14fc52519532cfb
refs/heads/master
2020-03-09T20:37:48.876000
2018-05-15T22:07:44
2018-05-15T22:07:44
128,989,895
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; import static org.junit.Assert.*; public class Task8 { public WebDriver driver; //public WebDriverWait wait; @Before public void start(){ driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS); } static Boolean isStickerPresent (WebElement product){ try{ product.findElement(By.cssSelector(".sticker")); return true; } catch(NoSuchElementException e){return false;} } static int areMultipleSrickers (WebElement product){ return product.findElements(By.cssSelector(".sticker")).size(); } @Test public void checkStickersLitecart(){ driver.get("http://localhost/litecart"); List<WebElement> products = driver.findElements(By.cssSelector("ul.products li")); Integer productsNumber = products.size(); for (Integer i=0; i<productsNumber; i++){ String productName = products.get(i).findElement(By.cssSelector(".name")).getAttribute("innerText"); assertTrue(isStickerPresent(products.get(i))); assertEquals("Stickers count error for product " + productName,1, areMultipleSrickers(products.get(i))); } } @After public void stop(){ driver.quit(); driver = null; } }
UTF-8
Java
1,706
java
Task8.java
Java
[]
null
[]
import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.List; import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; import static org.junit.Assert.*; public class Task8 { public WebDriver driver; //public WebDriverWait wait; @Before public void start(){ driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS); } static Boolean isStickerPresent (WebElement product){ try{ product.findElement(By.cssSelector(".sticker")); return true; } catch(NoSuchElementException e){return false;} } static int areMultipleSrickers (WebElement product){ return product.findElements(By.cssSelector(".sticker")).size(); } @Test public void checkStickersLitecart(){ driver.get("http://localhost/litecart"); List<WebElement> products = driver.findElements(By.cssSelector("ul.products li")); Integer productsNumber = products.size(); for (Integer i=0; i<productsNumber; i++){ String productName = products.get(i).findElement(By.cssSelector(".name")).getAttribute("innerText"); assertTrue(isStickerPresent(products.get(i))); assertEquals("Stickers count error for product " + productName,1, areMultipleSrickers(products.get(i))); } } @After public void stop(){ driver.quit(); driver = null; } }
1,706
0.677608
0.675264
54
30.592592
27.25634
116
false
false
0
0
0
0
0
0
0.611111
false
false
13
62dfd4b48f20a22a22ef451b264254804a8b6bd2
4,226,247,878,314
23d1499790d5eeec89c40f737bc7815ec545c823
/lims-testing-service/src/main/java/com/todaysoft/lims/testing/dpcrsanger/service/IDataPcrSangerService.java
ab392a8ce81893404430cee34188eb4938bc476f
[]
no_license
thrishul1989/lims
https://github.com/thrishul1989/lims
f06e2e74a486fc5a5188acaf79f065f46bca5337
6819589aa75d04202c6a7bacdef9ef157fddd897
refs/heads/master
2020-04-15T12:25:33.269000
2018-10-31T07:47:54
2018-10-31T07:47:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.todaysoft.lims.testing.dpcrsanger.service; import java.util.List; import com.todaysoft.lims.testing.base.model.VariableModel; import com.todaysoft.lims.testing.dpcrsanger.dao.DataPcrSangerAssignableTaskSearcher; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerAssignArgs; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerAssignModel; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerAssignRequest; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerSheetModel; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerSubmitRequest; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerTask; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrTaskVariables; public interface IDataPcrSangerService { List<DataPcrSangerTask> getAssignableList(DataPcrSangerAssignableTaskSearcher searcher, int searchType); DataPcrSangerAssignModel getAssignableModel(DataPcrSangerAssignArgs args); void assign(DataPcrSangerAssignRequest request, String token); DataPcrSangerSheetModel getTestingSheet(String id); void submit(DataPcrSangerSubmitRequest request, String token, VariableModel model); DataPcrTaskVariables getTaskRunningVariables(String taskId); DataPcrSangerSheetModel getAnalysModel(String id); }
UTF-8
Java
1,349
java
IDataPcrSangerService.java
Java
[]
null
[]
package com.todaysoft.lims.testing.dpcrsanger.service; import java.util.List; import com.todaysoft.lims.testing.base.model.VariableModel; import com.todaysoft.lims.testing.dpcrsanger.dao.DataPcrSangerAssignableTaskSearcher; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerAssignArgs; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerAssignModel; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerAssignRequest; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerSheetModel; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerSubmitRequest; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrSangerTask; import com.todaysoft.lims.testing.dpcrsanger.model.DataPcrTaskVariables; public interface IDataPcrSangerService { List<DataPcrSangerTask> getAssignableList(DataPcrSangerAssignableTaskSearcher searcher, int searchType); DataPcrSangerAssignModel getAssignableModel(DataPcrSangerAssignArgs args); void assign(DataPcrSangerAssignRequest request, String token); DataPcrSangerSheetModel getTestingSheet(String id); void submit(DataPcrSangerSubmitRequest request, String token, VariableModel model); DataPcrTaskVariables getTaskRunningVariables(String taskId); DataPcrSangerSheetModel getAnalysModel(String id); }
1,349
0.838399
0.838399
30
43.966667
34.883121
108
false
false
0
0
0
0
0
0
0.733333
false
false
13
406be30face58b711c380c3c31fd5a5e4eeaa2f4
21,320,217,722,664
d2798388180b926e131b9b5e5c542de5b5dbd607
/src/by/it/sinkevich/jd01_12/TaskB/Main.java
b0581b344ebd649ac5c65fde13dc82f13053fb49
[]
no_license
VasilevichSergey/JD2016
https://github.com/VasilevichSergey/JD2016
14a22a5c31ded3783014b9d89cdddf0eb6ad4398
dfb8e38a6c4022677708dc03d0047d76bc801bfd
refs/heads/master
2020-12-24T20:25:06.458000
2016-10-04T10:35:49
2016-10-04T10:35:49
58,029,314
0
0
null
true
2016-05-04T06:46:27
2016-05-04T06:46:27
2016-05-03T21:33:48
2016-05-03T23:17:47
66
0
0
0
null
null
null
package by.it.sinkevich.jd01_12.TaskB; /** * VariantB1 class for testing tasks N1, N2. * * @author Sinkevich Denis */ class Main { public static void main(String[] args) { System.out.println("Задание №1: "); TaskB1 taskB1 = new TaskB1(); taskB1.fillMapWithWords(); taskB1.printMap(); System.out.println("\nЗадание №2: "); TaskB2 taskB2 = new TaskB2(100000); System.out.print("Время выполнения задачи при помощи ArrayList в наносекундах: "); long arrayTime = taskB2.processArray(); System.out.println(arrayTime); System.out.print("Время выполнения задачи при помощи LinkedList в наносекундах: "); long linkedTime = taskB2.processLinked(); System.out.println(linkedTime); System.out.println("ArrayList медленнее, чем LinkedList в " + (double) arrayTime / linkedTime + " раз(а)!"); } }
UTF-8
Java
1,024
java
Main.java
Java
[ { "context": "ntB1 class for testing tasks N1, N2.\n *\n * @author Sinkevich Denis\n */\nclass Main {\n\n public static void main(Str", "end": 118, "score": 0.999835193157196, "start": 103, "tag": "NAME", "value": "Sinkevich Denis" } ]
null
[]
package by.it.sinkevich.jd01_12.TaskB; /** * VariantB1 class for testing tasks N1, N2. * * @author <NAME> */ class Main { public static void main(String[] args) { System.out.println("Задание №1: "); TaskB1 taskB1 = new TaskB1(); taskB1.fillMapWithWords(); taskB1.printMap(); System.out.println("\nЗадание №2: "); TaskB2 taskB2 = new TaskB2(100000); System.out.print("Время выполнения задачи при помощи ArrayList в наносекундах: "); long arrayTime = taskB2.processArray(); System.out.println(arrayTime); System.out.print("Время выполнения задачи при помощи LinkedList в наносекундах: "); long linkedTime = taskB2.processLinked(); System.out.println(linkedTime); System.out.println("ArrayList медленнее, чем LinkedList в " + (double) arrayTime / linkedTime + " раз(а)!"); } }
1,015
0.643411
0.615725
27
32.444443
29.875462
116
false
false
0
0
0
0
0
0
0.592593
false
false
13
1c5a374365d180c569d1e7047d32f421e5d909f4
21,320,217,722,010
4e73232440150b5afe25cdc8a33a28e5ced6546e
/tesla-ops/src/main/java/io/github/tesla/ops/filter/controller/FilterRouteController.java
3d7707ff6a4e3e48cab75232e1d9e1841ea6e0db
[]
no_license
wolfpi/tesla
https://github.com/wolfpi/tesla
df0a7f8e6ddfb5c96d7ea7ba101b687a769211ea
884f9cb2e78947a88cdcae4c5c4150cc4ed67cbb
refs/heads/master
2020-03-08T19:50:57.412000
2018-03-30T09:44:25
2018-03-30T09:44:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2014-2017 the original author or authors. * * 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 io.github.tesla.ops.filter.controller; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.google.common.collect.Lists; import io.github.tesla.ops.common.TeslaException; import io.github.tesla.ops.common.BaseController; import io.github.tesla.ops.common.CommonResponse; import io.github.tesla.ops.common.Log; import io.github.tesla.ops.filter.dto.FilterRouteDto; import io.github.tesla.ops.filter.service.ProtobufService; import io.github.tesla.ops.filter.service.FilterRouteService; import io.github.tesla.ops.filter.vo.RouteVo; import io.github.tesla.ops.system.domain.PageDO; import io.github.tesla.ops.utils.FileType; import io.github.tesla.ops.utils.Query; /** * @author liushiming * @version ZuulController.java, v 0.0.1 2018年1月9日 上午11:19:14 liushiming */ @Controller @RequestMapping("/filter/route") public class FilterRouteController extends BaseController { private final String prefix = "filter/route"; @Autowired private ProtobufService protobufService; @Autowired private FilterRouteService routeService; @RequiresPermissions("filter:route:route") @GetMapping() public String route() { return prefix + "/route"; } @RequiresPermissions("filter:route:add") @GetMapping("/add") public String add() { return prefix + "/add"; } @RequiresPermissions("filter:route:edit") @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, Model model) { FilterRouteDto zuulDto = routeService.get(id); RouteVo zuulVo = RouteVo.buildRouteVo(zuulDto); model.addAttribute("route", zuulVo); return prefix + "/edit"; } @Log("保存路由") @RequiresPermissions("filter:route:add") @PostMapping("/save") @ResponseBody() public CommonResponse save(RouteVo zuulVo, @RequestParam(name = "zipFile", required = false) MultipartFile zipFile) { try { // grpc路由 if (zipFile != null) { InputStream directoryZipStream = zipFile.getInputStream(); CommonResponse response = judgeFileType(directoryZipStream, "zip"); if (response != null) { return response; } else { String serviceFileName = zuulVo.getServiceFileName(); byte[] protoContext = protobufService.compileDirectoryProto(zipFile, serviceFileName); FilterRouteDto zuulDto = zuulVo.buildRouteDto(); zuulDto.setProtoContext(protoContext); routeService.save(zuulDto); } } else { FilterRouteDto zuulDto = zuulVo.buildRouteDto(); routeService.save(zuulDto); } } catch (IOException e) { throw new TeslaException("保存路由失败", e); } return CommonResponse.ok(); } @Log("查询路由") @RequiresPermissions("filter:route:route") @GetMapping("/list") @ResponseBody public PageDO<RouteVo> list(@RequestParam Map<String, Object> params) { Query query = new Query(params); PageDO<FilterRouteDto> pageDto = routeService.queryList(query); PageDO<RouteVo> pageVo = new PageDO<>(); pageVo.setTotal(pageDto.getTotal()); List<FilterRouteDto> zuulDtos = pageDto.getRows(); List<RouteVo> vos = Lists.newArrayListWithCapacity(zuulDtos.size()); for (FilterRouteDto zuulDto : zuulDtos) { vos.add(RouteVo.buildRouteVo(zuulDto)); } pageVo.setRows(vos); return pageVo; } @Log("更新路由") @RequiresPermissions("filter:route:edit") @PostMapping("/update") @ResponseBody() public CommonResponse update(RouteVo zuulVo, @RequestParam(name = "zipFile", required = false) MultipartFile zipFile) { try { // grpc路由 if (zipFile != null) { InputStream directoryZipStream = zipFile.getInputStream(); CommonResponse response = judgeFileType(directoryZipStream, "zip"); if (response != null) { return response; } else { String serviceFileName = zuulVo.getServiceFileName(); byte[] protoContext = protobufService.compileDirectoryProto(zipFile, serviceFileName); FilterRouteDto zuulDto = zuulVo.buildRouteDto(); zuulDto.setProtoContext(protoContext); routeService.update(zuulDto); } } else { FilterRouteDto zuulDto = zuulVo.buildRouteDto(); routeService.update(zuulDto); } } catch (IOException e) { throw new TeslaException("保存路由失败", e); } return CommonResponse.ok(); } @Log("删除路由") @RequiresPermissions("filter:route:remove") @PostMapping("/remove") @ResponseBody() public CommonResponse save(Long id) { if (routeService.remove(id) > 0) { return CommonResponse.ok(); } else { return CommonResponse.error(1, "删除失败"); } } @RequiresPermissions("filter:route:batchRemove") @Log("批量删除路由") @PostMapping("/batchRemove") @ResponseBody public CommonResponse batchRemove(@RequestParam("ids[]") Long[] ids) { int response = routeService.batchRemove(ids); if (response > 0) { return CommonResponse.ok(); } return CommonResponse.error(); } private CommonResponse judgeFileType(InputStream inpustream, String type) throws IOException { String fileType = FileType.calculateFileHexString(inpustream); if (!type.equals(fileType)) { return CommonResponse.error(1, "只能上传" + type + "类型文件"); } else { return null; } } }
UTF-8
Java
6,704
java
FilterRouteController.java
Java
[ { "context": "t io.github.tesla.ops.utils.Query;\n\n/**\n * @author liushiming\n * @version ZuulController.java, v 0.0.1 2018年1月9", "end": 2002, "score": 0.9992571473121643, "start": 1992, "tag": "USERNAME", "value": "liushiming" } ]
null
[]
/* * Copyright 2014-2017 the original author or authors. * * 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 io.github.tesla.ops.filter.controller; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.google.common.collect.Lists; import io.github.tesla.ops.common.TeslaException; import io.github.tesla.ops.common.BaseController; import io.github.tesla.ops.common.CommonResponse; import io.github.tesla.ops.common.Log; import io.github.tesla.ops.filter.dto.FilterRouteDto; import io.github.tesla.ops.filter.service.ProtobufService; import io.github.tesla.ops.filter.service.FilterRouteService; import io.github.tesla.ops.filter.vo.RouteVo; import io.github.tesla.ops.system.domain.PageDO; import io.github.tesla.ops.utils.FileType; import io.github.tesla.ops.utils.Query; /** * @author liushiming * @version ZuulController.java, v 0.0.1 2018年1月9日 上午11:19:14 liushiming */ @Controller @RequestMapping("/filter/route") public class FilterRouteController extends BaseController { private final String prefix = "filter/route"; @Autowired private ProtobufService protobufService; @Autowired private FilterRouteService routeService; @RequiresPermissions("filter:route:route") @GetMapping() public String route() { return prefix + "/route"; } @RequiresPermissions("filter:route:add") @GetMapping("/add") public String add() { return prefix + "/add"; } @RequiresPermissions("filter:route:edit") @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, Model model) { FilterRouteDto zuulDto = routeService.get(id); RouteVo zuulVo = RouteVo.buildRouteVo(zuulDto); model.addAttribute("route", zuulVo); return prefix + "/edit"; } @Log("保存路由") @RequiresPermissions("filter:route:add") @PostMapping("/save") @ResponseBody() public CommonResponse save(RouteVo zuulVo, @RequestParam(name = "zipFile", required = false) MultipartFile zipFile) { try { // grpc路由 if (zipFile != null) { InputStream directoryZipStream = zipFile.getInputStream(); CommonResponse response = judgeFileType(directoryZipStream, "zip"); if (response != null) { return response; } else { String serviceFileName = zuulVo.getServiceFileName(); byte[] protoContext = protobufService.compileDirectoryProto(zipFile, serviceFileName); FilterRouteDto zuulDto = zuulVo.buildRouteDto(); zuulDto.setProtoContext(protoContext); routeService.save(zuulDto); } } else { FilterRouteDto zuulDto = zuulVo.buildRouteDto(); routeService.save(zuulDto); } } catch (IOException e) { throw new TeslaException("保存路由失败", e); } return CommonResponse.ok(); } @Log("查询路由") @RequiresPermissions("filter:route:route") @GetMapping("/list") @ResponseBody public PageDO<RouteVo> list(@RequestParam Map<String, Object> params) { Query query = new Query(params); PageDO<FilterRouteDto> pageDto = routeService.queryList(query); PageDO<RouteVo> pageVo = new PageDO<>(); pageVo.setTotal(pageDto.getTotal()); List<FilterRouteDto> zuulDtos = pageDto.getRows(); List<RouteVo> vos = Lists.newArrayListWithCapacity(zuulDtos.size()); for (FilterRouteDto zuulDto : zuulDtos) { vos.add(RouteVo.buildRouteVo(zuulDto)); } pageVo.setRows(vos); return pageVo; } @Log("更新路由") @RequiresPermissions("filter:route:edit") @PostMapping("/update") @ResponseBody() public CommonResponse update(RouteVo zuulVo, @RequestParam(name = "zipFile", required = false) MultipartFile zipFile) { try { // grpc路由 if (zipFile != null) { InputStream directoryZipStream = zipFile.getInputStream(); CommonResponse response = judgeFileType(directoryZipStream, "zip"); if (response != null) { return response; } else { String serviceFileName = zuulVo.getServiceFileName(); byte[] protoContext = protobufService.compileDirectoryProto(zipFile, serviceFileName); FilterRouteDto zuulDto = zuulVo.buildRouteDto(); zuulDto.setProtoContext(protoContext); routeService.update(zuulDto); } } else { FilterRouteDto zuulDto = zuulVo.buildRouteDto(); routeService.update(zuulDto); } } catch (IOException e) { throw new TeslaException("保存路由失败", e); } return CommonResponse.ok(); } @Log("删除路由") @RequiresPermissions("filter:route:remove") @PostMapping("/remove") @ResponseBody() public CommonResponse save(Long id) { if (routeService.remove(id) > 0) { return CommonResponse.ok(); } else { return CommonResponse.error(1, "删除失败"); } } @RequiresPermissions("filter:route:batchRemove") @Log("批量删除路由") @PostMapping("/batchRemove") @ResponseBody public CommonResponse batchRemove(@RequestParam("ids[]") Long[] ids) { int response = routeService.batchRemove(ids); if (response > 0) { return CommonResponse.ok(); } return CommonResponse.error(); } private CommonResponse judgeFileType(InputStream inpustream, String type) throws IOException { String fileType = FileType.calculateFileHexString(inpustream); if (!type.equals(fileType)) { return CommonResponse.error(1, "只能上传" + type + "类型文件"); } else { return null; } } }
6,704
0.710798
0.706096
195
32.815384
25.329151
100
false
false
0
0
0
0
0
0
0.512821
false
false
13
9b46db20f38a64f95869fc701a0c7e62c04b8146
1,382,979,510,950
0d7f0937790b9b0f7e645ba1ab03f60d4e013e8d
/Buoi4_4/bai17/TestMyCircle.java
8e678b2eb6bdab33251cc8adfff984d7dfcd322f
[]
no_license
duchau97kma/JavaWebExercise_02
https://github.com/duchau97kma/JavaWebExercise_02
57d8bf44969a186f2d3b17022bdb39a8f57231a6
7c33b19bc01499a9d015dc45b3209911aa091794
refs/heads/master
2020-04-16T06:52:05.033000
2019-06-28T01:58:47
2019-06-28T01:58:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Buoi4.bai17; /** * * @author Winter */ public class TestMyCircle { public static void main(String[] args) { MyPoint point = new MyPoint(3, 4); MyCircle mc = new MyCircle(point, 6); System.out.println(mc.toString()); System.out.println("Area of my circle is: "+mc.getArea()); } }
UTF-8
Java
525
java
TestMyCircle.java
Java
[ { "context": "ditor.\n */\npackage Buoi4.bai17;\n\n/**\n *\n * @author Winter\n */\npublic class TestMyCircle {\n public static", "end": 231, "score": 0.9996076226234436, "start": 225, "tag": "NAME", "value": "Winter" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Buoi4.bai17; /** * * @author Winter */ public class TestMyCircle { public static void main(String[] args) { MyPoint point = new MyPoint(3, 4); MyCircle mc = new MyCircle(point, 6); System.out.println(mc.toString()); System.out.println("Area of my circle is: "+mc.getArea()); } }
525
0.641905
0.630476
20
25.25
24.132706
79
false
false
0
0
0
0
0
0
0.5
false
false
13
f2135a932ebf0448a68aa8c3c34a874472369614
29,661,044,202,124
61899a8cd79fc01b61391721f6479f10eeaa5506
/swing/src/swing/JbuttonTest.java
adf90ca8466ffcf6373969e2d7ac6317fc0882a2
[]
no_license
HappyDale/SelfLearning
https://github.com/HappyDale/SelfLearning
b4f7bc69db27ab12cfb1d3db7392dd850d709935
521326ed435cc7d9b9c9ed43721fda2ededfc2a6
refs/heads/master
2020-03-01T09:25:07.316000
2017-03-03T05:38:07
2017-03-03T05:38:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package swing; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JbuttonTest { JFrame f=null; JbuttonTest(){ f=new JFrame("单选框示例");//创建一个JFrame的对象 Container contentPane=f.getContentPane();//创建一个内容面板容器 contentPane.setLayout(new FlowLayout());//设置该窗口的布局 JPanel p1=new JPanel();//创建一个面板对象 p1.setLayout(new GridLayout(1,3));//设置布局管理器的格式 p1.setBorder(BorderFactory.createTitledBorder("选择你喜欢的人:")); //定义三个JbuttonTest对象 JRadioButton r1=new JRadioButton("戴毅"); JRadioButton r2=new JRadioButton("赵雷"); JRadioButton r3=new JRadioButton("习近平"); p1.add(r1); p1.add(r2); p1.add(r3); r1.setSelected(true);//设置戴毅为单选框的状态为被选中 contentPane.add(p1);//设置对象p1加到窗口内容面板容器中 f.pack(); f.setVisible(true); f.addWindowListener(new WindowAdapter(){//添加一个窗口监听器 public void windowClosing(WindowEvent e){ System.exit(0); } }); } public static void main(String[] args) { new JbuttonTest(); } }
GB18030
Java
1,162
java
JbuttonTest.java
Java
[]
null
[]
package swing; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JbuttonTest { JFrame f=null; JbuttonTest(){ f=new JFrame("单选框示例");//创建一个JFrame的对象 Container contentPane=f.getContentPane();//创建一个内容面板容器 contentPane.setLayout(new FlowLayout());//设置该窗口的布局 JPanel p1=new JPanel();//创建一个面板对象 p1.setLayout(new GridLayout(1,3));//设置布局管理器的格式 p1.setBorder(BorderFactory.createTitledBorder("选择你喜欢的人:")); //定义三个JbuttonTest对象 JRadioButton r1=new JRadioButton("戴毅"); JRadioButton r2=new JRadioButton("赵雷"); JRadioButton r3=new JRadioButton("习近平"); p1.add(r1); p1.add(r2); p1.add(r3); r1.setSelected(true);//设置戴毅为单选框的状态为被选中 contentPane.add(p1);//设置对象p1加到窗口内容面板容器中 f.pack(); f.setVisible(true); f.addWindowListener(new WindowAdapter(){//添加一个窗口监听器 public void windowClosing(WindowEvent e){ System.exit(0); } }); } public static void main(String[] args) { new JbuttonTest(); } }
1,162
0.714135
0.695148
37
24.621622
17.92379
61
false
false
0
0
0
0
0
0
2.162162
false
false
13
1a4ebb414987071f506523853ae5eeffe8b41649
30,442,728,249,294
090f54fec4b5fa42899944ab7e3847bbd17daa1b
/eclipse-workspace/Eva1/Fuente/Ejercicio49.java
c98264b21edad59bc59721478c64e20d6728ab90
[]
no_license
parktem/clase
https://github.com/parktem/clase
515fd6ea3a4fcbe19bff55f46dbb83446126675c
1a05a75bd36d2df6fc929e99dba28e474aa2e282
refs/heads/master
2021-04-28T19:03:09.704000
2018-09-19T21:51:24
2018-09-19T21:51:24
121,886,139
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Ejercicio49 { public static void main (String arg []) { int vector []={18,33,14,16,23,15}; int aux=0; int cont=0; while(cont<vector.length-1){ for(int i=cont+1;i>0;i--){ if(vector[i]<vector[i-1]){ aux=vector[i-1]; vector[i-1]=vector[i]; vector[i]=aux; } } cont++; } for (int i=0;i<vector.length;i++) System.out.println (vector[i]); } }
UTF-8
Java
458
java
Ejercicio49.java
Java
[]
null
[]
public class Ejercicio49 { public static void main (String arg []) { int vector []={18,33,14,16,23,15}; int aux=0; int cont=0; while(cont<vector.length-1){ for(int i=cont+1;i>0;i--){ if(vector[i]<vector[i-1]){ aux=vector[i-1]; vector[i-1]=vector[i]; vector[i]=aux; } } cont++; } for (int i=0;i<vector.length;i++) System.out.println (vector[i]); } }
458
0.49345
0.443231
23
18.869566
13.898089
45
false
false
0
0
0
0
0
0
2.304348
false
false
13
df2d5ffee1bba8c168150e35c245e31b888c1139
34,136,400,101,681
42164caaf9e459e23dc061b7dfc1e2df7539e2f1
/app/src/main/java/com/appcode/db/BlogManager.java
495b66eaa7995ecdff0d0c2910572f6ae348a3ba
[]
no_license
zhengjun516/AppCode
https://github.com/zhengjun516/AppCode
da0d129326b74c2d25587c76dd8d9a5bdec27563
cde6aaacbede89be8b229a10852c1dec7b6879c8
refs/heads/master
2021-07-20T03:50:02.839000
2020-05-18T06:41:52
2020-05-18T06:41:52
162,499,061
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.appcode.db; import com.appcode.blog.model.Blog; import com.appcode.blog.model.BlogCategory; import com.appcode.model.Category; import java.util.ArrayList; import java.util.List; public class BlogManager { public static List<Blog> getBlogs(){ List<Blog> blogs = new ArrayList<>(); blogs.add(new Blog(8,"数据库","database")); blogs.add(new Blog(9,"数据库","database")); blogs.add(new Blog(10,"linux","linux")); blogs.add(new Blog(11,"git","git")); return blogs; } public static List<BlogCategory> getBlogCategories(){ List<BlogCategory> blogCategories = new ArrayList<>(); List<Blog> blogs = new ArrayList<>(); BlogCategory blogCategory = new BlogCategory(1,"java"); blogs.add(new Blog(1,"java基础","java")); blogs.add(new Blog(2,"java中级","java")); blogs.add(new Blog(3,"java高级","java")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); blogCategory = new BlogCategory(2,"android"); blogs = new ArrayList<>(); blogs.add(new Blog(3,"Android基础","android")); blogs.add(new Blog(3,"Android中高级","android")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); blogCategory = new BlogCategory(3,"kotlin"); blogs = new ArrayList<>(); blogs.add(new Blog(4,"kotlin基础","kotlin")); blogs.add(new Blog(5,"kotlin中级","kotlin")); blogs.add(new Blog(6,"kotlin高级","kotlin")); blogs.add(new Blog(7,"flutter","kotlin")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); blogCategory = new BlogCategory(4,"database"); blogs = new ArrayList<>(); blogs.add(new Blog(8,"数据库","database")); blogs.add(new Blog(9,"数据库","database")); blogs.add(new Blog(10,"linux","linux")); blogs.add(new Blog(11,"git","git")); blogCategory = new BlogCategory(4,"第三方框架"); blogs = new ArrayList<>(); blogs.add(new Blog(3,"第三方框架","android")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); return blogCategories; } }
UTF-8
Java
2,003
java
BlogManager.java
Java
[]
null
[]
package com.appcode.db; import com.appcode.blog.model.Blog; import com.appcode.blog.model.BlogCategory; import com.appcode.model.Category; import java.util.ArrayList; import java.util.List; public class BlogManager { public static List<Blog> getBlogs(){ List<Blog> blogs = new ArrayList<>(); blogs.add(new Blog(8,"数据库","database")); blogs.add(new Blog(9,"数据库","database")); blogs.add(new Blog(10,"linux","linux")); blogs.add(new Blog(11,"git","git")); return blogs; } public static List<BlogCategory> getBlogCategories(){ List<BlogCategory> blogCategories = new ArrayList<>(); List<Blog> blogs = new ArrayList<>(); BlogCategory blogCategory = new BlogCategory(1,"java"); blogs.add(new Blog(1,"java基础","java")); blogs.add(new Blog(2,"java中级","java")); blogs.add(new Blog(3,"java高级","java")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); blogCategory = new BlogCategory(2,"android"); blogs = new ArrayList<>(); blogs.add(new Blog(3,"Android基础","android")); blogs.add(new Blog(3,"Android中高级","android")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); blogCategory = new BlogCategory(3,"kotlin"); blogs = new ArrayList<>(); blogs.add(new Blog(4,"kotlin基础","kotlin")); blogs.add(new Blog(5,"kotlin中级","kotlin")); blogs.add(new Blog(6,"kotlin高级","kotlin")); blogs.add(new Blog(7,"flutter","kotlin")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); blogCategory = new BlogCategory(4,"database"); blogs = new ArrayList<>(); blogs.add(new Blog(8,"数据库","database")); blogs.add(new Blog(9,"数据库","database")); blogs.add(new Blog(10,"linux","linux")); blogs.add(new Blog(11,"git","git")); blogCategory = new BlogCategory(4,"第三方框架"); blogs = new ArrayList<>(); blogs.add(new Blog(3,"第三方框架","android")); blogCategory.blogs = blogs; blogCategories.add(blogCategory); return blogCategories; } }
2,003
0.688312
0.674286
66
28.166666
18.200552
57
false
false
0
0
0
0
0
0
2.590909
false
false
13
2e780f9fad2bd3b6773ab3a83278572d5ef30abe
29,841,432,837,521
c147710fcde5a03250a61bb43317cb42a4ce01c2
/netconf-server-modelnode-fwk/src/test/java/org/broadband_forum/obbaa/netconf/mn/fwk/tests/persistence/entities/toaster/ToasterConstants.java
f58ca38c9223bf5130f7d29c4686de7202d2aebf
[ "Apache-2.0" ]
permissive
hchy234/obbaa-netconf-stack
https://github.com/hchy234/obbaa-netconf-stack
234455144c79c3d36de1158fb553a8b17822f773
175c9b85fcda9a64df90cb206dec58cdb4ded508
refs/heads/master
2023-06-28T19:58:39.172000
2021-07-30T05:14:19
2021-07-30T05:14:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.broadband_forum.obbaa.netconf.mn.fwk.tests.persistence.entities.toaster; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; /** * Created by pgorai on 4/4/16. */ public class ToasterConstants { public static final String TOASTER_NS = "http://netconfcentral.org/ns/toaster"; public static final String TOASTER_LOCAL_NAME = "toaster"; public static final String TOASTER_REVISION = "2009-11-20"; public static final SchemaPath TOASTER_SCHEMA_PATH = SchemaPath.create(true, QName.create(TOASTER_NS, TOASTER_REVISION, TOASTER_LOCAL_NAME)); }
UTF-8
Java
632
java
ToasterConstants.java
Java
[ { "context": "ools.yang.model.api.SchemaPath;\n\n/**\n * Created by pgorai on 4/4/16.\n */\npublic class ToasterConstants {\n ", "end": 225, "score": 0.9996878504753113, "start": 219, "tag": "USERNAME", "value": "pgorai" } ]
null
[]
package org.broadband_forum.obbaa.netconf.mn.fwk.tests.persistence.entities.toaster; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.SchemaPath; /** * Created by pgorai on 4/4/16. */ public class ToasterConstants { public static final String TOASTER_NS = "http://netconfcentral.org/ns/toaster"; public static final String TOASTER_LOCAL_NAME = "toaster"; public static final String TOASTER_REVISION = "2009-11-20"; public static final SchemaPath TOASTER_SCHEMA_PATH = SchemaPath.create(true, QName.create(TOASTER_NS, TOASTER_REVISION, TOASTER_LOCAL_NAME)); }
632
0.768987
0.75
14
44.142857
41.185741
145
false
false
0
0
0
0
0
0
0.714286
false
false
13
18d0f07e5d0b2343bff7adaaa60919a774a4d836
1,005,022,398,893
02a037648fb37c5090c53b202c1076bbc6866c3f
/security/security-rbac/src/main/java/com/zos/security/rbac/web/handler/RbacExceptionHandler.java
b8d73a3485db450605356fc19181493276f5a27f
[]
no_license
zostudio/01Studio
https://github.com/zostudio/01Studio
373066fd0de5960ce3482d6634b60d9ea80af859
d41e649a82af6b9c9991bacae2452075d1f6308b
refs/heads/master
2020-03-09T10:19:44.399000
2018-10-25T03:34:28
2018-10-25T03:34:28
122,426,876
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zos.security.rbac.web.handler; import com.zos.security.rbac.dto.common.ResponseDTO; import com.zos.security.rbac.exception.RbacException; import com.zos.security.rbac.support.constance.ResponseCode; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; /** * @author 01Studio * */ @Slf4j @ControllerAdvice public class RbacExceptionHandler { @ExceptionHandler(RbacException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public @ResponseBody ResponseDTO<RbacException> handleRbacException(RbacException ex) { ResponseDTO<RbacException> result = new ResponseDTO<RbacException>(); result.setCode(ResponseCode.INVALID); result.setData(ex); result.setMessage(ex.getMessage()); return result; } }
UTF-8
Java
826
java
RbacExceptionHandler.java
Java
[ { "context": "gframework.web.bind.annotation.*;\n\n/**\n * @author 01Studio\n *\n */\n@Slf4j\n@ControllerAdvice\npublic class Rbac", "end": 364, "score": 0.9987948536872864, "start": 356, "tag": "USERNAME", "value": "01Studio" } ]
null
[]
package com.zos.security.rbac.web.handler; import com.zos.security.rbac.dto.common.ResponseDTO; import com.zos.security.rbac.exception.RbacException; import com.zos.security.rbac.support.constance.ResponseCode; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; /** * @author 01Studio * */ @Slf4j @ControllerAdvice public class RbacExceptionHandler { @ExceptionHandler(RbacException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public @ResponseBody ResponseDTO<RbacException> handleRbacException(RbacException ex) { ResponseDTO<RbacException> result = new ResponseDTO<RbacException>(); result.setCode(ResponseCode.INVALID); result.setData(ex); result.setMessage(ex.getMessage()); return result; } }
826
0.772397
0.766344
28
28.5
24.861761
88
false
false
0
0
0
0
0
0
0.607143
false
false
13
a549150c2910d2097bd09c3627dd8ab41587387c
35,880,156,802,005
2cd64dc79a59be9073fc007dd2ec7e359cd27caf
/app/src/main/java/com/aueb/podshare/database/UserDAO.java
eca328aa519534992e32a6bc6cbf0f57361a9e23
[ "MIT" ]
permissive
EfthymiaKostaki/PodShare-Android
https://github.com/EfthymiaKostaki/PodShare-Android
a9ebe79891d77d91ef7aa834fda17b6befa2af14
69f9633cdcaef169d0dceb574ee715e2343f6ab3
refs/heads/master
2022-12-15T15:44:05.470000
2020-08-27T10:43:57
2020-08-27T10:43:57
268,098,428
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aueb.podshare.database; public class UserDAO { public String username; public String email; private String uid; private String description; public UserDAO() { // Default constructor required for calls to DataSnapshot.getValue(User.class) } public UserDAO(String email, String username) { this.email = email; this.username = username; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
UTF-8
Java
997
java
UserDAO.java
Java
[ { "context": " this.email = email;\n this.username = username;\n }\n\n public String getDescription() {\n ", "end": 400, "score": 0.9913501143455505, "start": 392, "tag": "USERNAME", "value": "username" }, { "context": "\n\n public String getUsername() {\n return username;\n }\n\n public void setUsername(String userna", "end": 763, "score": 0.8850601315498352, "start": 755, "tag": "USERNAME", "value": "username" }, { "context": "sername(String username) {\n this.username = username;\n }\n\n public String getEmail() {\n re", "end": 851, "score": 0.9885839819908142, "start": 843, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.aueb.podshare.database; public class UserDAO { public String username; public String email; private String uid; private String description; public UserDAO() { // Default constructor required for calls to DataSnapshot.getValue(User.class) } public UserDAO(String email, String username) { this.email = email; this.username = username; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
997
0.614845
0.614845
51
18.549019
18.400036
86
false
false
0
0
0
0
0
0
0.313726
false
false
13
fe104bb028e1d9bb667fc4f5b87b1eb8b3ad9951
16,045,997,855,154
46bfbd29702d67064ddd45163e4d20b6cf42f4b2
/code/src/main/java/com/codeyyt/leetcode/q096/Q096.java
513525396598a3279291b3993916dcb59fbd652e
[]
no_license
yytTrunk/algorithm-learning
https://github.com/yytTrunk/algorithm-learning
7063c8381c5d5135b9da1f8c2eb016336aaa62ae
ea016a44635a28b8bbae5c8720a6781fa52421e8
refs/heads/main
2023-02-19T14:11:53.826000
2021-01-18T14:44:04
2021-01-18T14:44:04
330,694,212
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.codeyyt.leetcode.q096; /* 给定一个整数 n,求以 1 ... n 为节点组成的二叉搜索树有多少种? 示例: 输入: 3 输出: 5 解释: 给定 n = 3, 一共有 5 种不同结构的二叉搜索树: 1 3 3 2 1 \ / / / \ \ 3 2 1 1 3 2 / / \ \ 2 1 2 3 */ public class Q096 { public static void main(String[] args) { Q096 q139 = new Q096(); System.out.println(new Q096().numTrees(3)); } public int numTrees(int n) { // 分解成规模较小的两个子问题,且子问题的解可以复用 // 发现重叠子问题 if (n == 0) { return 1; } int[] dp = new int[n+1]; dp[0] = 1; dp[1] = 1; // 以i为根的二叉搜索树个数 for (int i = 2; i <= n; i++) { for (int j = 1; j <= i; j++) { dp[i] += dp[j-1] * dp[i-j]; } } return dp[n]; } }
UTF-8
Java
1,090
java
Q096.java
Java
[]
null
[]
package com.codeyyt.leetcode.q096; /* 给定一个整数 n,求以 1 ... n 为节点组成的二叉搜索树有多少种? 示例: 输入: 3 输出: 5 解释: 给定 n = 3, 一共有 5 种不同结构的二叉搜索树: 1 3 3 2 1 \ / / / \ \ 3 2 1 1 3 2 / / \ \ 2 1 2 3 */ public class Q096 { public static void main(String[] args) { Q096 q139 = new Q096(); System.out.println(new Q096().numTrees(3)); } public int numTrees(int n) { // 分解成规模较小的两个子问题,且子问题的解可以复用 // 发现重叠子问题 if (n == 0) { return 1; } int[] dp = new int[n+1]; dp[0] = 1; dp[1] = 1; // 以i为根的二叉搜索树个数 for (int i = 2; i <= n; i++) { for (int j = 1; j <= i; j++) { dp[i] += dp[j-1] * dp[i-j]; } } return dp[n]; } }
1,090
0.362431
0.308287
50
16.940001
16.030483
51
false
false
0
0
0
0
0
0
0.28
false
false
13
e4e664f9b12cf9077397be1e9c2c0e45649ff3f1
21,466,246,603,423
1c9c0cc3038f4ef5cf8365c3a8607bc8ec5f7800
/src/com/java/practice/LocalDateExample.java
5ac7e1e0236411bdb033bd83e24edf27bd14eb8e
[]
no_license
shehzadmalik0329/DesignPatternExample
https://github.com/shehzadmalik0329/DesignPatternExample
6114c096874f20c3e8a4c6a6c337c3cd7d4711e3
5430398a727356b1fd157eb82c0d36b002143f1a
refs/heads/master
2023-05-05T14:40:43.489000
2021-05-29T05:03:56
2021-05-29T05:03:56
353,229,308
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.java.practice; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class LocalDateExample { public static void main(String[] args) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDate transaction_date = LocalDate.parse("2020-03-25", dtf); System.out.println(transaction_date); } }
UTF-8
Java
366
java
LocalDateExample.java
Java
[]
null
[]
package com.java.practice; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class LocalDateExample { public static void main(String[] args) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDate transaction_date = LocalDate.parse("2020-03-25", dtf); System.out.println(transaction_date); } }
366
0.759563
0.737705
15
23.4
24.439857
74
false
false
0
0
0
0
0
0
1.133333
false
false
13
641dd816168ffbf57c404bbec26c354f815a7dfc
35,021,163,350,939
abaf4bb0568a0bcc914fdc34ce3415f400148f2d
/src/test/java/test_0/Test_1.java
331d1ce214f9a29d5d26947c27376d39ca3d3a48
[]
no_license
Marinsereda/MavenBasics.Edition2.0
https://github.com/Marinsereda/MavenBasics.Edition2.0
5a45d90f731c679470f1427770bd847e1bf9ddc4
20741bffb96bae8f807440e36b1fb21a292dc121
refs/heads/master
2022-08-01T08:33:55.968000
2020-05-27T14:01:56
2020-05-27T14:01:56
263,682,597
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test_0; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.concurrent.TimeUnit; public class Test_1 { private static WebDriver browser; public static void generateNumbers(Integer total, Integer min, Integer max, Integer threshold) throws InterruptedException { System.setProperty ("webdriver.chrome.driver", "C:\\projects\\seleniumBasicMaven\\chromedriver.exe") ; browser = new ChromeDriver(); browser.get("https://www.random.org/integers/"); browser.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS); clearAndFill(By.cssSelector("input[name='num']"), total.toString()); clearAndFill(By.cssSelector("input[name='min']"), min.toString()); clearAndFill(By.cssSelector("input[name='max']"), max.toString()).submit(); // submit() == click() of WebElement from <form> String[] data = browser.findElement(By.cssSelector("pre.data")).getText().trim().split("\\s+"); // получаем массив строк, каждый эл-т кот. - это отдельное число(текст из браузера) // System.out.println(browser.findElement(By.cssSelector("pre.data")).getText()); HashMap<String, Integer> numberMap = new HashMap<>(); for (String n: data){ numberMap.put(n, numberMap.containsKey(n) ? numberMap.get(n) +1 : 1); } Collection<Integer> occurances = numberMap.values(); // получаем массив всех количеств //Assert.assertTrue if (Collections.max(occurances) - Collections.min(occurances)<=(total/100 * threshold)) { System.out.println("Test is succesful");} else {System.out.println("Test is failed");} Thread.sleep(3000); browser.quit(); } public static WebElement clearAndFill(By selector, String data){ WebElement element = browser.findElement(selector); element.clear(); element.sendKeys(data); return element; } public static void main(String[] args) throws InterruptedException { generateNumbers(10, 3, 100, 4); } }
UTF-8
Java
2,388
java
Test_1.java
Java
[]
null
[]
package test_0; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.concurrent.TimeUnit; public class Test_1 { private static WebDriver browser; public static void generateNumbers(Integer total, Integer min, Integer max, Integer threshold) throws InterruptedException { System.setProperty ("webdriver.chrome.driver", "C:\\projects\\seleniumBasicMaven\\chromedriver.exe") ; browser = new ChromeDriver(); browser.get("https://www.random.org/integers/"); browser.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS); clearAndFill(By.cssSelector("input[name='num']"), total.toString()); clearAndFill(By.cssSelector("input[name='min']"), min.toString()); clearAndFill(By.cssSelector("input[name='max']"), max.toString()).submit(); // submit() == click() of WebElement from <form> String[] data = browser.findElement(By.cssSelector("pre.data")).getText().trim().split("\\s+"); // получаем массив строк, каждый эл-т кот. - это отдельное число(текст из браузера) // System.out.println(browser.findElement(By.cssSelector("pre.data")).getText()); HashMap<String, Integer> numberMap = new HashMap<>(); for (String n: data){ numberMap.put(n, numberMap.containsKey(n) ? numberMap.get(n) +1 : 1); } Collection<Integer> occurances = numberMap.values(); // получаем массив всех количеств //Assert.assertTrue if (Collections.max(occurances) - Collections.min(occurances)<=(total/100 * threshold)) { System.out.println("Test is succesful");} else {System.out.println("Test is failed");} Thread.sleep(3000); browser.quit(); } public static WebElement clearAndFill(By selector, String data){ WebElement element = browser.findElement(selector); element.clear(); element.sendKeys(data); return element; } public static void main(String[] args) throws InterruptedException { generateNumbers(10, 3, 100, 4); } }
2,388
0.660139
0.651871
66
33.81818
32.837021
128
false
false
0
0
0
0
0
0
0.69697
false
false
13
f6207421343420055d7518d4d0434e96b26badbc
35,880,156,808,149
6651613ffe2e0d3030abb1592e898901cd7cd8b0
/joinfaces-autoconfigure/src/main/java/org/joinfaces/autoconfigure/myfaces/MyFacesAutoConfiguration.java
fa1a1f6a21494d4c23222006cd3a556f4112a566
[ "Apache-2.0" ]
permissive
joinfaces/joinfaces
https://github.com/joinfaces/joinfaces
9257a811032979d1d1572ee446fec181e54371bb
cf9d08cac315419dfb002cce4b13d475dc9658bc
refs/heads/5.2.x
2023-09-01T06:31:35.334000
2023-08-29T00:18:56
2023-08-29T00:18:56
57,401,572
378
113
Apache-2.0
false
2023-09-14T12:06:37
2016-04-29T17:27:00
2023-08-29T16:43:04
2023-09-14T12:06:37
6,467
359
87
31
Java
false
false
/* * Copyright 2016-2022 the original author or authors. * * 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 * * https://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.joinfaces.autoconfigure.myfaces; import jakarta.servlet.ServletContainerInitializer; import org.apache.myfaces.webapp.StartupServletContextListener; import org.joinfaces.autoconfigure.FacesImplementationAutoConfiguration; import org.joinfaces.autoconfigure.faces.JakartaFaces3AutoConfiguration; import org.joinfaces.servlet.WebFragmentRegistrationBean; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; /** * Spring Boot Auto Configuration of MyFaces. * * @author Marcelo Fernandes */ @AutoConfiguration(before = WebMvcAutoConfiguration.class, after = JakartaFaces3AutoConfiguration.class) @EnableConfigurationProperties({MyFacesProperties.class, MyFaces2_3Properties.class}) @ConditionalOnClass(StartupServletContextListener.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnMissingBean(FacesImplementationAutoConfiguration.class) public class MyFacesAutoConfiguration implements FacesImplementationAutoConfiguration { @Bean @ConditionalOnClass(name = "org.apache.myfaces.ee.MyFacesContainerInitializer") public MyFacesInitializerRegistrationBean<?> myFaces3ServletContainerInitializer() throws ClassNotFoundException { Class<? extends ServletContainerInitializer> clazz = Class.forName("org.apache.myfaces.ee.MyFacesContainerInitializer").asSubclass(ServletContainerInitializer.class); return new MyFacesInitializerRegistrationBean<>(clazz); } /** * This {@link WebFragmentRegistrationBean} is equivalent to the * {@code META-INF/web-fragment.xml} of the {@code myfaces-impl.jar}. * * @return myFacesWebFragmentRegistrationBean */ @Bean @ConditionalOnClass(name = "org.apache.myfaces.webapp.StartupServletContextListener") public WebFragmentRegistrationBean myFacesWebFragmentRegistrationBean() { WebFragmentRegistrationBean webFragmentRegistrationBean = new WebFragmentRegistrationBean(); webFragmentRegistrationBean.getListeners().add(StartupServletContextListener.class); return webFragmentRegistrationBean; } @AutoConfiguration @EnableConfigurationProperties(MyFaces4Properties.class) @ConditionalOnClass(name = "org.apache.myfaces.webapp.MyFacesContainerInitializer") public static class MyFaces4AutoConfiguration { @Bean public MyFacesInitializerRegistrationBean<?> myFaces4ServletContainerInitializer() throws ClassNotFoundException { Class<? extends ServletContainerInitializer> clazz = Class.forName("org.apache.myfaces.webapp.MyFacesContainerInitializer").asSubclass(ServletContainerInitializer.class); return new MyFacesInitializerRegistrationBean<>(clazz); } } }
UTF-8
Java
3,694
java
MyFacesAutoConfiguration.java
Java
[ { "context": " Boot Auto Configuration of MyFaces.\n *\n * @author Marcelo Fernandes\n */\n@AutoConfiguration(before = WebMvcAutoConfigu", "end": 1598, "score": 0.9998779296875, "start": 1581, "tag": "NAME", "value": "Marcelo Fernandes" } ]
null
[]
/* * Copyright 2016-2022 the original author or authors. * * 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 * * https://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.joinfaces.autoconfigure.myfaces; import jakarta.servlet.ServletContainerInitializer; import org.apache.myfaces.webapp.StartupServletContextListener; import org.joinfaces.autoconfigure.FacesImplementationAutoConfiguration; import org.joinfaces.autoconfigure.faces.JakartaFaces3AutoConfiguration; import org.joinfaces.servlet.WebFragmentRegistrationBean; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; /** * Spring Boot Auto Configuration of MyFaces. * * @author <NAME> */ @AutoConfiguration(before = WebMvcAutoConfiguration.class, after = JakartaFaces3AutoConfiguration.class) @EnableConfigurationProperties({MyFacesProperties.class, MyFaces2_3Properties.class}) @ConditionalOnClass(StartupServletContextListener.class) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnMissingBean(FacesImplementationAutoConfiguration.class) public class MyFacesAutoConfiguration implements FacesImplementationAutoConfiguration { @Bean @ConditionalOnClass(name = "org.apache.myfaces.ee.MyFacesContainerInitializer") public MyFacesInitializerRegistrationBean<?> myFaces3ServletContainerInitializer() throws ClassNotFoundException { Class<? extends ServletContainerInitializer> clazz = Class.forName("org.apache.myfaces.ee.MyFacesContainerInitializer").asSubclass(ServletContainerInitializer.class); return new MyFacesInitializerRegistrationBean<>(clazz); } /** * This {@link WebFragmentRegistrationBean} is equivalent to the * {@code META-INF/web-fragment.xml} of the {@code myfaces-impl.jar}. * * @return myFacesWebFragmentRegistrationBean */ @Bean @ConditionalOnClass(name = "org.apache.myfaces.webapp.StartupServletContextListener") public WebFragmentRegistrationBean myFacesWebFragmentRegistrationBean() { WebFragmentRegistrationBean webFragmentRegistrationBean = new WebFragmentRegistrationBean(); webFragmentRegistrationBean.getListeners().add(StartupServletContextListener.class); return webFragmentRegistrationBean; } @AutoConfiguration @EnableConfigurationProperties(MyFaces4Properties.class) @ConditionalOnClass(name = "org.apache.myfaces.webapp.MyFacesContainerInitializer") public static class MyFaces4AutoConfiguration { @Bean public MyFacesInitializerRegistrationBean<?> myFaces4ServletContainerInitializer() throws ClassNotFoundException { Class<? extends ServletContainerInitializer> clazz = Class.forName("org.apache.myfaces.webapp.MyFacesContainerInitializer").asSubclass(ServletContainerInitializer.class); return new MyFacesInitializerRegistrationBean<>(clazz); } } }
3,683
0.832431
0.827017
78
46.358974
40.189289
173
false
false
0
0
0
0
0
0
0.871795
false
false
13
37e0781397b43ddbdd8be2fe2d5f3268078e4bbc
6,768,868,491,453
c39c233d7684e493a785a19c00378e9c16b57077
/spring-cloud-pyg-client/spring-cloud-pyg-web-client/src/main/java/com/ittzg/cloud/PygClientApplication.java
a17d3e7a66d01abfd58412a2a53228a91946fc72
[]
no_license
tazhigang/spring-cloud-pyg-parent
https://github.com/tazhigang/spring-cloud-pyg-parent
a3382d0fc4605031d7d912641666438e19ef7bad
9747d61b022cb1c51a448ad5c80a5eb04fc0c705
refs/heads/master
2020-04-17T23:20:22.624000
2019-03-24T16:36:54
2019-03-24T16:36:54
167,031,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ittzg.cloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; /** * @Author: ittzg * @CreateDate: 2019/1/26 17:28 * @Description: 页面客户端 */ @SpringBootApplication public class PygClientApplication { public static void main(String[] args) { SpringApplication.run(PygClientApplication.class,args); } }
UTF-8
Java
482
java
PygClientApplication.java
Java
[ { "context": "etflix.eureka.EnableEurekaClient;\n\n/**\n * @Author: ittzg\n * @CreateDate: 2019/1/26 17:28\n * @Description: ", "end": 236, "score": 0.9996897578239441, "start": 231, "tag": "USERNAME", "value": "ittzg" } ]
null
[]
package com.ittzg.cloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; /** * @Author: ittzg * @CreateDate: 2019/1/26 17:28 * @Description: 页面客户端 */ @SpringBootApplication public class PygClientApplication { public static void main(String[] args) { SpringApplication.run(PygClientApplication.class,args); } }
482
0.775424
0.752119
17
26.764706
23.518526
68
false
false
0
0
0
0
0
0
0.352941
false
false
13
5023fc013cac5a7fd293caf9ba9e5e32e77b75a8
23,467,701,368,169
f005fdd129d497ba9764b0ade47b2730f087e07c
/BaseApp/src/main/java/com/afra55/baseclient/util/BinnerHelper.java
75a5aa3cfb94323026cb21b3bc5abc4df5e9942e
[]
no_license
wuguanjun/AndroidBasicFramework
https://github.com/wuguanjun/AndroidBasicFramework
cfd10cc01e14e4ad65b896080172556e0086c6b5
4048520147f48bdb74637bcb6b9c3820b091ee69
refs/heads/master
2021-01-17T07:42:08.938000
2016-07-08T03:46:49
2016-07-08T03:46:49
64,185,712
2
0
null
true
2016-07-26T03:08:54
2016-07-26T03:08:53
2016-07-26T03:08:54
2016-07-25T08:38:23
839
0
0
0
Java
null
null
package com.afra55.baseclient.util; import android.annotation.SuppressLint; import android.content.Context; import android.os.Handler; import android.os.Message; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.widget.RadioButton; import android.widget.RadioGroup; import com.afra55.baseclient.R; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; /** * Created by yangshuai in the 17:13 of 2016.01.06 . */ public class BinnerHelper { private ViewPager binnerVp; private Context context; private BinnerHelper() { } public static BinnerHelper getInstance() { return new BinnerHelper(); } public BinnerHelper start(Context context, ViewPager viewPager, final ArrayList<View> binnerViewArray, RadioGroup binnerIndicatorRg) { this.context = context; binnerVp = viewPager; binnerVp.setCurrentItem(1); binnerVp.setOffscreenPageLimit(binnerViewArray.size()); addChangeListener(binnerViewArray, binnerIndicatorRg); initIndicator(binnerViewArray, binnerIndicatorRg); beginPagerTimer(); return this; } private void initIndicator(ArrayList<View> binnerViewArray, RadioGroup binnerIndicatorRg) { binnerIndicatorRg.removeAllViews(); for (int i = 0; i < binnerViewArray.size(); i++) { LayoutInflater layoutInflater = LayoutInflater.from(context); RadioButton rbIndicator = (RadioButton) layoutInflater.inflate( R.layout.ad_vp_indicator_rb, binnerIndicatorRg, false); if (binnerViewArray.size() > 3) if (i == 0) { rbIndicator.setVisibility(View.GONE); } else if (i == binnerViewArray.size() - 1) { rbIndicator.setVisibility(View.GONE); } binnerIndicatorRg.addView(rbIndicator); } ((RadioButton) binnerIndicatorRg.getChildAt(0)).setChecked(true); } private int lastCheckedPosition = 0; private void addChangeListener(final ArrayList<View> binnerViewArray, final RadioGroup binnerIndicatorRg) { binnerVp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int willCheckedPosition; if (positionOffset >= 0.5) { int nextPosition = position + 1; if (nextPosition == binnerViewArray.size() - 1) { willCheckedPosition = 1; } else { willCheckedPosition = nextPosition; } } else if (position == 0) { willCheckedPosition = binnerViewArray.size() - 2; } else { willCheckedPosition = position; } if (willCheckedPosition != lastCheckedPosition) { ((RadioButton) binnerIndicatorRg.getChildAt(lastCheckedPosition)).setChecked(false); } ((RadioButton) binnerIndicatorRg.getChildAt(willCheckedPosition)).setChecked(true); lastCheckedPosition = willCheckedPosition; if (binnerViewArray.size() <= 1) { return; } if (position == 0 && positionOffset <= 0.01) { binnerVp.setCurrentItem(binnerViewArray.size() - 2, false); } else if (position == binnerViewArray.size() - 1) { binnerVp.setCurrentItem(1, false); } } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { switch (state) { case ViewPager.SCROLL_STATE_DRAGGING:// 如果用户点击viewpager,则取消自动翻页 pageTouch = true; canelPagerTimer(); break; case ViewPager.SCROLL_STATE_IDLE:// 如果用户点击viewpager并松开,则开启自动翻页 if (pageTouch) { pageTouch = false; beginPagerTimer(); } break; } } }); } /* 自动翻页功能 start */ private Timer timer; private int index = 0; private MyTimerTask mTimerTask; /** * 自动翻页时间间隔 **/ private final int TIMER_OFFSET = 3 * 1000; /** * viewpager滚动速率 **/ private final int SPEED_OFFSET = 800; /** * 判断手指是否碰触viewpager **/ private boolean pageTouch; /** * 创建或重置计时器 */ public void beginPagerTimer() { canelPagerTimer(); // 设置viewpaper自动播放 timer = new Timer(); if (mTimerTask != null) { mTimerTask.cancel(); // 将原任务从队列中移除 } mTimerTask = new MyTimerTask(); // 新建一个任务 timer.schedule(mTimerTask, TIMER_OFFSET, TIMER_OFFSET + SPEED_OFFSET); } /*** * 停止翻页计时器 */ public void canelPagerTimer() { if (timer != null) { timer.cancel(); timer = null; } } /** * 定时器,实现自动播放 */ class MyTimerTask extends TimerTask { @Override public void run() { Message message = new Message(); message.what = 2; index = binnerVp.getCurrentItem(); index++; handler.sendMessage(message); } } @SuppressLint("HandlerLeak") private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 2: binnerVp.setCurrentItem(index); break; default: break; } } }; /* 自动翻页功能 end */ /** * 初始化viewpager资源 * * @param binnerViewArray view list * @param startAndEndView 存储开始和结束的 view */ public static void initViewList(ArrayList<View> binnerViewArray, ArrayList<View> startAndEndView) { if (binnerViewArray.size() <= 1) { return; } ArrayList<View> binnerViewArrayClone = (ArrayList<View>) binnerViewArray.clone(); binnerViewArray.clear(); for (int i = 0; i < binnerViewArrayClone.size() + 2; i++) { if (i <= 0) { binnerViewArray.add(startAndEndView.get(startAndEndView.size() - 1)); } else if (i >= binnerViewArrayClone.size() + 1) { binnerViewArray.add(startAndEndView.get(0)); } else { binnerViewArray.add(binnerViewArrayClone.get(i - 1)); } } } }
UTF-8
Java
7,205
java
BinnerHelper.java
Java
[ { "context": "er;\nimport java.util.TimerTask;\n\n/**\n * Created by yangshuai in the 17:13 of 2016.01.06 .\n */\npublic class Bin", "end": 478, "score": 0.9996946454048157, "start": 469, "tag": "USERNAME", "value": "yangshuai" } ]
null
[]
package com.afra55.baseclient.util; import android.annotation.SuppressLint; import android.content.Context; import android.os.Handler; import android.os.Message; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.widget.RadioButton; import android.widget.RadioGroup; import com.afra55.baseclient.R; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; /** * Created by yangshuai in the 17:13 of 2016.01.06 . */ public class BinnerHelper { private ViewPager binnerVp; private Context context; private BinnerHelper() { } public static BinnerHelper getInstance() { return new BinnerHelper(); } public BinnerHelper start(Context context, ViewPager viewPager, final ArrayList<View> binnerViewArray, RadioGroup binnerIndicatorRg) { this.context = context; binnerVp = viewPager; binnerVp.setCurrentItem(1); binnerVp.setOffscreenPageLimit(binnerViewArray.size()); addChangeListener(binnerViewArray, binnerIndicatorRg); initIndicator(binnerViewArray, binnerIndicatorRg); beginPagerTimer(); return this; } private void initIndicator(ArrayList<View> binnerViewArray, RadioGroup binnerIndicatorRg) { binnerIndicatorRg.removeAllViews(); for (int i = 0; i < binnerViewArray.size(); i++) { LayoutInflater layoutInflater = LayoutInflater.from(context); RadioButton rbIndicator = (RadioButton) layoutInflater.inflate( R.layout.ad_vp_indicator_rb, binnerIndicatorRg, false); if (binnerViewArray.size() > 3) if (i == 0) { rbIndicator.setVisibility(View.GONE); } else if (i == binnerViewArray.size() - 1) { rbIndicator.setVisibility(View.GONE); } binnerIndicatorRg.addView(rbIndicator); } ((RadioButton) binnerIndicatorRg.getChildAt(0)).setChecked(true); } private int lastCheckedPosition = 0; private void addChangeListener(final ArrayList<View> binnerViewArray, final RadioGroup binnerIndicatorRg) { binnerVp.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int willCheckedPosition; if (positionOffset >= 0.5) { int nextPosition = position + 1; if (nextPosition == binnerViewArray.size() - 1) { willCheckedPosition = 1; } else { willCheckedPosition = nextPosition; } } else if (position == 0) { willCheckedPosition = binnerViewArray.size() - 2; } else { willCheckedPosition = position; } if (willCheckedPosition != lastCheckedPosition) { ((RadioButton) binnerIndicatorRg.getChildAt(lastCheckedPosition)).setChecked(false); } ((RadioButton) binnerIndicatorRg.getChildAt(willCheckedPosition)).setChecked(true); lastCheckedPosition = willCheckedPosition; if (binnerViewArray.size() <= 1) { return; } if (position == 0 && positionOffset <= 0.01) { binnerVp.setCurrentItem(binnerViewArray.size() - 2, false); } else if (position == binnerViewArray.size() - 1) { binnerVp.setCurrentItem(1, false); } } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { switch (state) { case ViewPager.SCROLL_STATE_DRAGGING:// 如果用户点击viewpager,则取消自动翻页 pageTouch = true; canelPagerTimer(); break; case ViewPager.SCROLL_STATE_IDLE:// 如果用户点击viewpager并松开,则开启自动翻页 if (pageTouch) { pageTouch = false; beginPagerTimer(); } break; } } }); } /* 自动翻页功能 start */ private Timer timer; private int index = 0; private MyTimerTask mTimerTask; /** * 自动翻页时间间隔 **/ private final int TIMER_OFFSET = 3 * 1000; /** * viewpager滚动速率 **/ private final int SPEED_OFFSET = 800; /** * 判断手指是否碰触viewpager **/ private boolean pageTouch; /** * 创建或重置计时器 */ public void beginPagerTimer() { canelPagerTimer(); // 设置viewpaper自动播放 timer = new Timer(); if (mTimerTask != null) { mTimerTask.cancel(); // 将原任务从队列中移除 } mTimerTask = new MyTimerTask(); // 新建一个任务 timer.schedule(mTimerTask, TIMER_OFFSET, TIMER_OFFSET + SPEED_OFFSET); } /*** * 停止翻页计时器 */ public void canelPagerTimer() { if (timer != null) { timer.cancel(); timer = null; } } /** * 定时器,实现自动播放 */ class MyTimerTask extends TimerTask { @Override public void run() { Message message = new Message(); message.what = 2; index = binnerVp.getCurrentItem(); index++; handler.sendMessage(message); } } @SuppressLint("HandlerLeak") private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case 2: binnerVp.setCurrentItem(index); break; default: break; } } }; /* 自动翻页功能 end */ /** * 初始化viewpager资源 * * @param binnerViewArray view list * @param startAndEndView 存储开始和结束的 view */ public static void initViewList(ArrayList<View> binnerViewArray, ArrayList<View> startAndEndView) { if (binnerViewArray.size() <= 1) { return; } ArrayList<View> binnerViewArrayClone = (ArrayList<View>) binnerViewArray.clone(); binnerViewArray.clear(); for (int i = 0; i < binnerViewArrayClone.size() + 2; i++) { if (i <= 0) { binnerViewArray.add(startAndEndView.get(startAndEndView.size() - 1)); } else if (i >= binnerViewArrayClone.size() + 1) { binnerViewArray.add(startAndEndView.get(0)); } else { binnerViewArray.add(binnerViewArrayClone.get(i - 1)); } } } }
7,205
0.554246
0.545912
214
31.518692
25.938049
138
false
false
0
0
0
0
0
0
0.471963
false
false
13
9a84f0260697d58f8e8b9d18870bb6b56c7ba3b3
14,568,529,072,042
a672792f32dbfd8ff405193e8d850244e795e17e
/modules/utils/src/test/java/org/springside/modules/utils/base/ValueValidatorTest.java
78a4d30cde66959bd8c4ad4ac8e3fe58bf56029e
[ "Apache-2.0" ]
permissive
starcloudmountain/springside4
https://github.com/starcloudmountain/springside4
4822255fc33efd75fa332db285e8547267aaab12
ef0c820b143fe43f050129d3780cf197deaa3aae
refs/heads/master
2021-01-17T17:37:38.205000
2019-04-28T15:35:48
2019-04-28T15:35:48
95,531,304
1
0
Apache-2.0
true
2019-04-28T15:35:49
2017-06-27T07:40:24
2017-06-27T07:41:04
2019-04-28T15:35:49
4,780
1
0
0
Java
false
false
package org.springside.modules.utils.base; import static org.assertj.core.api.Assertions.*; import org.junit.Test; import org.springside.modules.utils.base.ValueValidator.Validator; public class ValueValidatorTest { @Test public void testValidator() { assertThat(ValueValidator.checkAndGet(-1, 1, Validator.INTEGER_GT_ZERO_VALIDATOR)).isEqualTo(1); assertThat(ValueValidator.checkAndGet("testUnEmpty", "isEmpty", Validator.STRING_EMPTY_VALUE_VALIDATOR)).isEqualTo("testUnEmpty"); assertThat(ValueValidator.checkAndGet("flase", "true", Validator.STRICT_BOOL_VALUE_VALIDATOR)).isEqualTo("true"); } }
UTF-8
Java
610
java
ValueValidatorTest.java
Java
[]
null
[]
package org.springside.modules.utils.base; import static org.assertj.core.api.Assertions.*; import org.junit.Test; import org.springside.modules.utils.base.ValueValidator.Validator; public class ValueValidatorTest { @Test public void testValidator() { assertThat(ValueValidator.checkAndGet(-1, 1, Validator.INTEGER_GT_ZERO_VALIDATOR)).isEqualTo(1); assertThat(ValueValidator.checkAndGet("testUnEmpty", "isEmpty", Validator.STRING_EMPTY_VALUE_VALIDATOR)).isEqualTo("testUnEmpty"); assertThat(ValueValidator.checkAndGet("flase", "true", Validator.STRICT_BOOL_VALUE_VALIDATOR)).isEqualTo("true"); } }
610
0.790164
0.785246
15
39.666668
42.886932
132
false
false
0
0
0
0
0
0
1.466667
false
false
13
c8e78c6b54a2191af48e4e919c79b78dda82b6f7
5,866,925,391,553
57eec205242766e643138ac9c6978b2c9035b165
/src/main/java/com/ocr/mustapha/mode/Duel.java
8a05e80d579e0479c62dbf8cecf4fbcb786e3876
[]
no_license
Mustaphabdt/MastermindV1
https://github.com/Mustaphabdt/MastermindV1
8bc733d1be6ca9ebd04d37829e97201cd1d5ff4e
5a6a9aa7f65ea3b08f44c87eb56a2fc51e425f51
refs/heads/master
2022-10-08T00:35:25.219000
2019-08-01T08:31:37
2019-08-01T08:31:37
196,250,028
0
0
null
false
2021-12-14T21:29:39
2019-07-10T17:41:52
2019-08-01T08:31:56
2021-12-14T21:29:37
102
0
0
2
Java
false
false
package com.ocr.mustapha.mode; import com.ocr.mustapha.configuration.Configuration; import java.util.Scanner; import static com.ocr.mustapha.Main.LOGGER; /** * classe qui permet le mode de jeu Duel * chacun leur tour l'ordinateur et le joueur chosissent un code secret que lautre doit trouver * ensuite chacun leur tout le joueur et l'odinateur font une proposition jusqu'a trouver la solution de l'autre. */ public class Duel extends Methode { /** * Methode permettant le lancement du mode Duel */ public static void runDuel() { Configuration c = new Configuration(); LOGGER.info("\n*****Bienvenue dans le mode Duel !*****"); int chance = c.getChance(); boolean gagner = false; // ORDINATEUR VS UTILISATEUSystem.out.println(" la longeur de la combinaison doit etre de " + c.getlgCombinaison() + " Chiffres ! Veuillez recommencer");R VARIABLES ET INIT String solution = null, proposition = null; Scanner sc = new Scanner(System.in); System.out.println("Veuillez entrer une combinaison de "+c.getlgCombinaison()+" chiffres que l'ordinateur doit trouver!"); boolean contientChiffre = true; do { solution = sc.nextLine(); if (solution.length() != c.getlgCombinaison()) { System.out.println(" Votre solution doit comporter "+c.getlgCombinaison()+" Chiffres"); solution= sc.nextLine(); }else { } }while (!verificationCombinaison(contientChiffre,solution)); if (c.getDevelopper()) { System.out.println("la combinaison secrete que l'odinateur doit trouver est: " + solution);//optionel permet de verifié les proposition de l'ordinateur } else { } System.out.println("Ordinateur Vous avez " + chance + " chances pour trouver la combinaison de " + solution.length() + " chiffres c'est à vous !"); proposition = getAlphaNumericString(solution.length()); // proposition est défini par l'ordinateur // UTILISATEUR VS ORDINATEUR VARIABLES String solution2 = null, proposition2 = null; System.out.println("Ordinateur entrez une combinaison de chiffres que l'utilisateur doit trouver !"); solution2 = getAlphaNumericString(solution.length()); if (c.getDevelopper()) { System.out.println("la combinaison secrete de l'ordinateur est : " + solution2);//optionel permet de verifié les proposition de l'ordinateur } else { } System.out.println("Vous avez " + chance + " chances pour trouver la combinaison de " + solution2.length() + " chiffres que l'ordinateur a généré c'est à vous !"); while (chance >= 0 && gagner == false) { if (proposition.length() != solution.length()) { System.out.println(" Votre proposition ne comporte pas le même nombre que dans la solution veuillez recommancer"); // Si Longueur de la solution n'est pas respecter } String prochaineProposition = "";// optionel permet de verifié les proposition de l'ordinateur System.out.println(proposition); for (int i = 0; i < solution.length(); i++) { // recupère la valeur charAt(i) // string en in correspondant a la valeur du tableau ASCII getNumericValue permet de le convertir dans le tableau ASCII if (Character.getNumericValue(solution.charAt(i)) == Character.getNumericValue(proposition.charAt(i))) { System.out.print("="); prochaineProposition = prochaineProposition + Character.getNumericValue(proposition.charAt(i)); } if (Character.getNumericValue(solution.charAt(i)) > Character.getNumericValue(proposition.charAt(i))) { System.out.print("+"); char a = proposition.charAt(i); int j = Character.getNumericValue(a); prochaineProposition = prochaineProposition + generateRandomIntIntRange(j + 1, 9); // generation d'un nombre aléatoire pour la prochaine position qui est superieur non egale a la valeur presedente } if (Character.getNumericValue(solution.charAt(i)) < Character.getNumericValue(proposition.charAt(i))) { System.out.print("-"); char a = proposition.charAt(i); int j = Character.getNumericValue(a); prochaineProposition = prochaineProposition + generateRandomIntIntRange(0, j - 1); // generation d'un nombre aléatoire pour la prochaine position qui est inferieur non egale a la valeur presedente } } System.out.println( " *****résultat de l'ordinateur*****"); Scanner sc2 = new Scanner(System.in); do { proposition2 = sc2.nextLine();// proposition est défini par l'utilisateur . if (proposition2.length() != c.getlgCombinaison()) { System.out.println(" Votre solution doit comporter "+c.getlgCombinaison()+" Chiffres"); proposition2= sc.nextLine(); }else { } }while (!verificationCombinaison(contientChiffre,proposition2)); System.out.println("Faites une proposition il vous reste " + chance + " chances"); for (int j = 0; j < solution2.length(); j++) { if (Character.getNumericValue(solution2.charAt(j)) == Character.getNumericValue(proposition2.charAt(j))) {// recupère la valeur charAt(i) string en int correspondant a la valeur du tableau ASCII getNumericValue permet de le convertir dans le tableau ASCII System.out.print("="); } if (Character.getNumericValue(solution2.charAt(j)) > Character.getNumericValue(proposition2.charAt(j))) { System.out.print("+"); } if (Character.getNumericValue(solution2.charAt(j)) < Character.getNumericValue(proposition2.charAt(j))) { System.out.print("-"); } } System.out.println(" *****Votre résultat***** "); if (proposition.equals(solution)) { gagner = true; System.out.println(" Gagnant : l'ordinateur ( la solution trouvée en " + (10 - chance) + " essais ) "); } else { proposition = prochaineProposition; } // si ma proposition est bonne ne variable gagner change de valeur et arrete la boucle + affichage de fin if (chance == 0) { System.out.println("Vous n'avez plus de chance"); } if (proposition2.equals(solution2)) { gagner = true; System.out.println(" Gagnant :Bravo! Vous avez trouvé la solution en " + (10 - chance) + " essais "); } chance--; // a chaque tour de boucle la valeur chance est décrementé } } }
UTF-8
Java
7,112
java
Duel.java
Java
[]
null
[]
package com.ocr.mustapha.mode; import com.ocr.mustapha.configuration.Configuration; import java.util.Scanner; import static com.ocr.mustapha.Main.LOGGER; /** * classe qui permet le mode de jeu Duel * chacun leur tour l'ordinateur et le joueur chosissent un code secret que lautre doit trouver * ensuite chacun leur tout le joueur et l'odinateur font une proposition jusqu'a trouver la solution de l'autre. */ public class Duel extends Methode { /** * Methode permettant le lancement du mode Duel */ public static void runDuel() { Configuration c = new Configuration(); LOGGER.info("\n*****Bienvenue dans le mode Duel !*****"); int chance = c.getChance(); boolean gagner = false; // ORDINATEUR VS UTILISATEUSystem.out.println(" la longeur de la combinaison doit etre de " + c.getlgCombinaison() + " Chiffres ! Veuillez recommencer");R VARIABLES ET INIT String solution = null, proposition = null; Scanner sc = new Scanner(System.in); System.out.println("Veuillez entrer une combinaison de "+c.getlgCombinaison()+" chiffres que l'ordinateur doit trouver!"); boolean contientChiffre = true; do { solution = sc.nextLine(); if (solution.length() != c.getlgCombinaison()) { System.out.println(" Votre solution doit comporter "+c.getlgCombinaison()+" Chiffres"); solution= sc.nextLine(); }else { } }while (!verificationCombinaison(contientChiffre,solution)); if (c.getDevelopper()) { System.out.println("la combinaison secrete que l'odinateur doit trouver est: " + solution);//optionel permet de verifié les proposition de l'ordinateur } else { } System.out.println("Ordinateur Vous avez " + chance + " chances pour trouver la combinaison de " + solution.length() + " chiffres c'est à vous !"); proposition = getAlphaNumericString(solution.length()); // proposition est défini par l'ordinateur // UTILISATEUR VS ORDINATEUR VARIABLES String solution2 = null, proposition2 = null; System.out.println("Ordinateur entrez une combinaison de chiffres que l'utilisateur doit trouver !"); solution2 = getAlphaNumericString(solution.length()); if (c.getDevelopper()) { System.out.println("la combinaison secrete de l'ordinateur est : " + solution2);//optionel permet de verifié les proposition de l'ordinateur } else { } System.out.println("Vous avez " + chance + " chances pour trouver la combinaison de " + solution2.length() + " chiffres que l'ordinateur a généré c'est à vous !"); while (chance >= 0 && gagner == false) { if (proposition.length() != solution.length()) { System.out.println(" Votre proposition ne comporte pas le même nombre que dans la solution veuillez recommancer"); // Si Longueur de la solution n'est pas respecter } String prochaineProposition = "";// optionel permet de verifié les proposition de l'ordinateur System.out.println(proposition); for (int i = 0; i < solution.length(); i++) { // recupère la valeur charAt(i) // string en in correspondant a la valeur du tableau ASCII getNumericValue permet de le convertir dans le tableau ASCII if (Character.getNumericValue(solution.charAt(i)) == Character.getNumericValue(proposition.charAt(i))) { System.out.print("="); prochaineProposition = prochaineProposition + Character.getNumericValue(proposition.charAt(i)); } if (Character.getNumericValue(solution.charAt(i)) > Character.getNumericValue(proposition.charAt(i))) { System.out.print("+"); char a = proposition.charAt(i); int j = Character.getNumericValue(a); prochaineProposition = prochaineProposition + generateRandomIntIntRange(j + 1, 9); // generation d'un nombre aléatoire pour la prochaine position qui est superieur non egale a la valeur presedente } if (Character.getNumericValue(solution.charAt(i)) < Character.getNumericValue(proposition.charAt(i))) { System.out.print("-"); char a = proposition.charAt(i); int j = Character.getNumericValue(a); prochaineProposition = prochaineProposition + generateRandomIntIntRange(0, j - 1); // generation d'un nombre aléatoire pour la prochaine position qui est inferieur non egale a la valeur presedente } } System.out.println( " *****résultat de l'ordinateur*****"); Scanner sc2 = new Scanner(System.in); do { proposition2 = sc2.nextLine();// proposition est défini par l'utilisateur . if (proposition2.length() != c.getlgCombinaison()) { System.out.println(" Votre solution doit comporter "+c.getlgCombinaison()+" Chiffres"); proposition2= sc.nextLine(); }else { } }while (!verificationCombinaison(contientChiffre,proposition2)); System.out.println("Faites une proposition il vous reste " + chance + " chances"); for (int j = 0; j < solution2.length(); j++) { if (Character.getNumericValue(solution2.charAt(j)) == Character.getNumericValue(proposition2.charAt(j))) {// recupère la valeur charAt(i) string en int correspondant a la valeur du tableau ASCII getNumericValue permet de le convertir dans le tableau ASCII System.out.print("="); } if (Character.getNumericValue(solution2.charAt(j)) > Character.getNumericValue(proposition2.charAt(j))) { System.out.print("+"); } if (Character.getNumericValue(solution2.charAt(j)) < Character.getNumericValue(proposition2.charAt(j))) { System.out.print("-"); } } System.out.println(" *****Votre résultat***** "); if (proposition.equals(solution)) { gagner = true; System.out.println(" Gagnant : l'ordinateur ( la solution trouvée en " + (10 - chance) + " essais ) "); } else { proposition = prochaineProposition; } // si ma proposition est bonne ne variable gagner change de valeur et arrete la boucle + affichage de fin if (chance == 0) { System.out.println("Vous n'avez plus de chance"); } if (proposition2.equals(solution2)) { gagner = true; System.out.println(" Gagnant :Bravo! Vous avez trouvé la solution en " + (10 - chance) + " essais "); } chance--; // a chaque tour de boucle la valeur chance est décrementé } } }
7,112
0.605274
0.600762
151
45.966888
50.426579
272
false
false
0
0
0
0
0
0
0.437086
false
false
13
35535eb0c1561842ba72db71b91c20e80e90ceaa
24,532,853,205,643
a8b49d492d81397d6dd8f0bd0c7fada634002f45
/LakeLib/src/com/lakemonsters2635/sensor/modules/SensorRawButton.java
b93c08ce7fb1f9caf9577765fd2aa9bd839021c9
[]
no_license
2635Lakemonsters/BunnyBotWorkSpace
https://github.com/2635Lakemonsters/BunnyBotWorkSpace
2d6d50053b316ee44e9c0e6608511b7c39053993
0bd9e3a5b70ba207fbaff4a1b2b034f7761d8c40
refs/heads/master
2020-12-24T10:40:31.221000
2017-01-21T22:21:52
2017-01-21T22:21:52
73,139,128
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lakemonsters2635.sensor.modules; import com.lakemonsters2635.sensor.interfaces.BaseSensor; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.PIDSourceType; public class SensorRawButton extends BaseSensor<Boolean> { int button; Joystick joystick; public SensorRawButton(int button, Joystick joystick) { super(); this.button = button; this.joystick = joystick; } @Override public Boolean sense(Object unused) { return joystick.getRawButton(button); } @Override public void setPIDSourceType(PIDSourceType pidSource) { // TODO Auto-generated method stub } @Override public PIDSourceType getPIDSourceType() { // TODO Auto-generated method stub return null; } @Override public double pidGet() { // TODO Auto-generated method stub return 0; } }
UTF-8
Java
813
java
SensorRawButton.java
Java
[]
null
[]
package com.lakemonsters2635.sensor.modules; import com.lakemonsters2635.sensor.interfaces.BaseSensor; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.PIDSourceType; public class SensorRawButton extends BaseSensor<Boolean> { int button; Joystick joystick; public SensorRawButton(int button, Joystick joystick) { super(); this.button = button; this.joystick = joystick; } @Override public Boolean sense(Object unused) { return joystick.getRawButton(button); } @Override public void setPIDSourceType(PIDSourceType pidSource) { // TODO Auto-generated method stub } @Override public PIDSourceType getPIDSourceType() { // TODO Auto-generated method stub return null; } @Override public double pidGet() { // TODO Auto-generated method stub return 0; } }
813
0.755228
0.744157
41
18.829268
18.721193
57
false
false
0
0
0
0
0
0
1.317073
false
false
13
41e70f52af0db3b84cf1086fbfc2d1ccf94c892f
4,672,924,485,278
fdcb19186331e1ec58438233f1a56ac7213b79ce
/src/clock/ClockBorderPane.java
351ee0811217f79bcf534355e28e806c8bdfc083
[]
no_license
DawidBialek/Clock
https://github.com/DawidBialek/Clock
cad79626285d821fac16d00058b2691646b426e1
120f2027a4751af995a38fb869ac5ce7fff259d8
refs/heads/master
2021-04-18T21:52:39.365000
2018-04-15T21:20:44
2018-04-15T21:20:44
126,800,226
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package clock; import javafx.scene.layout.BorderPane; public class ClockBorderPane extends BorderPane{ private NodeLoader activeNodeLoader; ClockBorderPane(NodeLoader nodeLoader){ this.activeNodeLoader = nodeLoader; this.activeNodeLoader.getTimeline().playFromStart(); } void switchCenter(NodeLoader nodeLoader) { this.activeNodeLoader.getTimeline().pause(); setCenter(nodeLoader.getNode()); this.activeNodeLoader = nodeLoader; this.activeNodeLoader.getTimeline().play(); } public NodeLoader getActiveNodeLoader() { return activeNodeLoader; } }
UTF-8
Java
575
java
ClockBorderPane.java
Java
[]
null
[]
package clock; import javafx.scene.layout.BorderPane; public class ClockBorderPane extends BorderPane{ private NodeLoader activeNodeLoader; ClockBorderPane(NodeLoader nodeLoader){ this.activeNodeLoader = nodeLoader; this.activeNodeLoader.getTimeline().playFromStart(); } void switchCenter(NodeLoader nodeLoader) { this.activeNodeLoader.getTimeline().pause(); setCenter(nodeLoader.getNode()); this.activeNodeLoader = nodeLoader; this.activeNodeLoader.getTimeline().play(); } public NodeLoader getActiveNodeLoader() { return activeNodeLoader; } }
575
0.782609
0.782609
24
22.958334
19.915403
54
false
false
0
0
0
0
0
0
1.416667
false
false
13
7c197ff703f6edbcb411e9568205b43241a0e3c6
22,582,938,064,557
adc89ea3ea358ae7889848823ec9a9a8f30f2016
/app/src/main/java/com/robandboo/fq/callback/LoadFileInAnswerToQuestionImageViewsCallback.java
9694d668f9f27d3717134ccb0715fc0f3af64826
[]
no_license
bestofoleg/fastQuestionAndroidFront
https://github.com/bestofoleg/fastQuestionAndroidFront
cef8aa07fc1fa15124a447d165619ae45d7b0de1
c3044525023cf954f89631e49a222aa454d6f450
refs/heads/master
2022-12-07T05:50:06.476000
2020-09-03T12:21:58
2020-09-03T12:21:58
257,186,130
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.robandboo.fq.callback; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Base64; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import com.robandboo.fq.chain.ChainManager; import com.robandboo.fq.dto.Question; import com.robandboo.fq.dto.QuestionFile; import com.robandboo.fq.service.AnswerService; import com.robandboo.fq.service.QuestionService; import com.robandboo.fq.util.enumeration.QuestionType; import com.robandboo.fq.util.wrapper.Wrapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import lombok.Builder; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @Builder public class LoadFileInAnswerToQuestionImageViewsCallback implements Callback<List<QuestionFile>> { private Map<String, Long> imageCodeToFileId; private ImageView imageView1; private ImageView imageView2; private Wrapper<Bitmap> currentBitmap1; private Wrapper<Bitmap> currentBitmap2; private Question currentQuestion; private Boolean skipValidation; private String voteErrorMessage; private LinearLayout answerToQuestionLayout; private ChainManager chainManager; private AnswerService answerService; private QuestionService questionService; private TextView vote1; private TextView vote2; private boolean isVoted = false; public void makeVote(String imageName) { Long fileId = imageCodeToFileId.get(imageName); if (QuestionType.VOTE.isA(currentQuestion.getQuestionType()) && !isVoted) { isVoted = true; skipValidation = Boolean.TRUE; List<Long> fileIds = new ArrayList<>(currentQuestion.getFileIds().keySet()); RollChangeManagerWhenVotingCallback rollChangeManagerWhenVotingCallback = RollChangeManagerWhenVotingCallback.builder() .voteErrorMessage(voteErrorMessage) .answerToQuestionLayout(answerToQuestionLayout) .chainManager(chainManager) .chosenPictureId(fileId) .questionService(questionService) .currentQuestion(currentQuestion) .imageCodeToFileId(imageCodeToFileId) .vote1(vote1) .vote2(vote2).build(); answerService.saveVote(fileId).enqueue(rollChangeManagerWhenVotingCallback); } else { skipValidation = Boolean.FALSE; } } @Override public void onResponse(Call<List<QuestionFile>> call, Response<List<QuestionFile>> response) { imageCodeToFileId = new HashMap<>(); List<QuestionFile> questionFiles = response.body(); if (questionFiles != null && !questionFiles.isEmpty()) { imageView1.setVisibility(View.VISIBLE); byte[] bytes1 = Base64.decode( questionFiles.get(0).getData().getBytes(), Base64.DEFAULT ); Bitmap bitmap1 = BitmapFactory.decodeByteArray( bytes1, 0, bytes1.length ); currentBitmap1.setData(bitmap1); Glide .with(imageView1) .load(bitmap1) .into(imageView1); imageCodeToFileId.put("image1", questionFiles.get(0).getId()); if (questionFiles.size() > 1) { imageView2.setVisibility(View.VISIBLE); byte[] bytes2 = Base64.decode( questionFiles.get(1).getData().getBytes(), Base64.DEFAULT ); Bitmap bitmap2 = BitmapFactory.decodeByteArray( bytes2, 0, bytes2.length ); currentBitmap2.setData(bitmap2); Glide .with(imageView2) .load(bitmap2) .into(imageView2); imageCodeToFileId.put("image2", questionFiles.get(1).getId()); } else { imageView2.setVisibility(View.GONE); if (currentBitmap2.getData() != null) { currentBitmap2.getData().recycle(); } } } else { imageView1.setVisibility(View.GONE); imageView2.setVisibility(View.GONE); if (currentBitmap1.getData() != null) { currentBitmap1.getData().recycle(); } if (currentBitmap2.getData() != null) { currentBitmap2.getData().recycle(); } } } @Override public void onFailure(Call<List<QuestionFile>> call, Throwable t) { t.printStackTrace(); } }
UTF-8
Java
4,894
java
LoadFileInAnswerToQuestionImageViewsCallback.java
Java
[]
null
[]
package com.robandboo.fq.callback; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Base64; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import com.robandboo.fq.chain.ChainManager; import com.robandboo.fq.dto.Question; import com.robandboo.fq.dto.QuestionFile; import com.robandboo.fq.service.AnswerService; import com.robandboo.fq.service.QuestionService; import com.robandboo.fq.util.enumeration.QuestionType; import com.robandboo.fq.util.wrapper.Wrapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import lombok.Builder; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @Builder public class LoadFileInAnswerToQuestionImageViewsCallback implements Callback<List<QuestionFile>> { private Map<String, Long> imageCodeToFileId; private ImageView imageView1; private ImageView imageView2; private Wrapper<Bitmap> currentBitmap1; private Wrapper<Bitmap> currentBitmap2; private Question currentQuestion; private Boolean skipValidation; private String voteErrorMessage; private LinearLayout answerToQuestionLayout; private ChainManager chainManager; private AnswerService answerService; private QuestionService questionService; private TextView vote1; private TextView vote2; private boolean isVoted = false; public void makeVote(String imageName) { Long fileId = imageCodeToFileId.get(imageName); if (QuestionType.VOTE.isA(currentQuestion.getQuestionType()) && !isVoted) { isVoted = true; skipValidation = Boolean.TRUE; List<Long> fileIds = new ArrayList<>(currentQuestion.getFileIds().keySet()); RollChangeManagerWhenVotingCallback rollChangeManagerWhenVotingCallback = RollChangeManagerWhenVotingCallback.builder() .voteErrorMessage(voteErrorMessage) .answerToQuestionLayout(answerToQuestionLayout) .chainManager(chainManager) .chosenPictureId(fileId) .questionService(questionService) .currentQuestion(currentQuestion) .imageCodeToFileId(imageCodeToFileId) .vote1(vote1) .vote2(vote2).build(); answerService.saveVote(fileId).enqueue(rollChangeManagerWhenVotingCallback); } else { skipValidation = Boolean.FALSE; } } @Override public void onResponse(Call<List<QuestionFile>> call, Response<List<QuestionFile>> response) { imageCodeToFileId = new HashMap<>(); List<QuestionFile> questionFiles = response.body(); if (questionFiles != null && !questionFiles.isEmpty()) { imageView1.setVisibility(View.VISIBLE); byte[] bytes1 = Base64.decode( questionFiles.get(0).getData().getBytes(), Base64.DEFAULT ); Bitmap bitmap1 = BitmapFactory.decodeByteArray( bytes1, 0, bytes1.length ); currentBitmap1.setData(bitmap1); Glide .with(imageView1) .load(bitmap1) .into(imageView1); imageCodeToFileId.put("image1", questionFiles.get(0).getId()); if (questionFiles.size() > 1) { imageView2.setVisibility(View.VISIBLE); byte[] bytes2 = Base64.decode( questionFiles.get(1).getData().getBytes(), Base64.DEFAULT ); Bitmap bitmap2 = BitmapFactory.decodeByteArray( bytes2, 0, bytes2.length ); currentBitmap2.setData(bitmap2); Glide .with(imageView2) .load(bitmap2) .into(imageView2); imageCodeToFileId.put("image2", questionFiles.get(1).getId()); } else { imageView2.setVisibility(View.GONE); if (currentBitmap2.getData() != null) { currentBitmap2.getData().recycle(); } } } else { imageView1.setVisibility(View.GONE); imageView2.setVisibility(View.GONE); if (currentBitmap1.getData() != null) { currentBitmap1.getData().recycle(); } if (currentBitmap2.getData() != null) { currentBitmap2.getData().recycle(); } } } @Override public void onFailure(Call<List<QuestionFile>> call, Throwable t) { t.printStackTrace(); } }
4,894
0.616878
0.604414
130
36.646152
22.705086
131
false
false
0
0
0
0
0
0
0.6
false
false
13
c3b090b849f765a59a1f0e937e130c480b1d4d50
21,148,419,006,006
0263a5c1bc395ca5d65b02a349c98bd8f8bcac98
/src/Array/Maximum_j_minus_i_st_arr_j_gt_arr_i.java
1bb6fa57d846286f1e7f6421eb5ddecd87208ecc
[]
no_license
dheeraj9198/Algorithms-and-Data-Structures-in-Java
https://github.com/dheeraj9198/Algorithms-and-Data-Structures-in-Java
01caaff40c080e0693b4e9b15f55eac8ceed1c0b
18d075adfc072f031c38ea283a2604c59098fb6f
refs/heads/master
2020-12-25T16:49:04.451000
2020-02-07T20:04:17
2020-02-07T20:04:17
26,867,050
28
27
null
null
null
null
null
null
null
null
null
null
null
null
null
package Array; /** * Created by dheeraj on 7/7/2016. * Given an array arr[], find the maximum j – i such that arr[j] > arr[i] */ public class Maximum_j_minus_i_st_arr_j_gt_arr_i { public static void main(String[] strings){ int[] ints = new int[]{9, 2, 3, 4, 5, 6, 7, 8, 18, 0}; int[] min = new int[ints.length]; int[] max = new int[ints.length]; int length = ints.length; min[0] = ints[0]; for(int k =1;k<ints.length;k++){ min[k] = Math.min(min[k-1],ints[k]); } max[length-1] = ints[length-1]; for(int k = length-2;k>=0;k--){ max[k] = Math.max(max[k+1],ints[k]); } int i=0,j=0; int diff = 0; while(i<length && j <length){ if(min[i] < max[j]){ diff = Math.max(diff,j-i); j++; }else{ i++; } } System.out.println(diff); } }
UTF-8
Java
977
java
Maximum_j_minus_i_st_arr_j_gt_arr_i.java
Java
[ { "context": "package Array;\n\n/**\n * Created by dheeraj on 7/7/2016.\n * Given an array arr[], find the ma", "end": 41, "score": 0.9968094825744629, "start": 34, "tag": "USERNAME", "value": "dheeraj" } ]
null
[]
package Array; /** * Created by dheeraj on 7/7/2016. * Given an array arr[], find the maximum j – i such that arr[j] > arr[i] */ public class Maximum_j_minus_i_st_arr_j_gt_arr_i { public static void main(String[] strings){ int[] ints = new int[]{9, 2, 3, 4, 5, 6, 7, 8, 18, 0}; int[] min = new int[ints.length]; int[] max = new int[ints.length]; int length = ints.length; min[0] = ints[0]; for(int k =1;k<ints.length;k++){ min[k] = Math.min(min[k-1],ints[k]); } max[length-1] = ints[length-1]; for(int k = length-2;k>=0;k--){ max[k] = Math.max(max[k+1],ints[k]); } int i=0,j=0; int diff = 0; while(i<length && j <length){ if(min[i] < max[j]){ diff = Math.max(diff,j-i); j++; }else{ i++; } } System.out.println(diff); } }
977
0.447179
0.417436
46
20.195652
20.037594
73
false
false
0
0
0
0
0
0
0.717391
false
false
13
4e05b8e5b401e3e53ea89684077d69125c124ab4
24,541,443,196,858
07e9c2c4e2aeee20839326439b516a7e8137eaf8
/rest-services/src/main/java/com/sofmen/rest/webmvc/GoogleController.java
61a5503123de867dd64bfc3a18e31bab3f9eded8
[]
no_license
dbobra/place-search-engine
https://github.com/dbobra/place-search-engine
f0d2078a9778a6c912275c66cc61fb6b0497e99c
0e8c83d656c2ac3f1daf564f5a131d4eb83e48b3
refs/heads/master
2016-08-05T05:29:39.291000
2015-01-30T07:18:49
2015-01-30T07:18:49
26,793,286
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sofmen.rest.webmvc; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestParam; import com.sofmen.rest.dto.GoogleDTO; import com.sofmen.rest.manager.SearchManager; @Controller @RequestMapping("/search") public class GoogleController { /**Your Controllers or REST URIs here + Models*/ private static Logger logger = LoggerFactory.getLogger(GoogleController.class); @Autowired SearchManager searchManager; @RequestMapping(value="/nearbysearch" ,method=RequestMethod.POST) public String nearSearch(@RequestParam String keyword,ModelMap model){ GoogleDTO googleDTO = new GoogleDTO(); logger.trace("GoogleDTO", googleDTO); googleDTO.setKeyword(keyword); model.addAttribute("googleDTO",googleDTO); logger.trace("Google DTO mapped and redirect to nearbysearch.jsp"); return "nearbysearch"; } @RequestMapping(value="/textsearch") public String textSearch(@RequestParam String keyword,@RequestParam String sensor,ModelMap model){ String searchResult = searchManager.textSearch(keyword, sensor); logger.trace(searchResult); model.addAttribute("",null); return "display"; } @RequestMapping(value="/radarsearch") public String radarSearch(@RequestParam String keyword,ModelMap model){ GoogleDTO googleDTO = new GoogleDTO(); googleDTO.setKeyword(keyword); model.addAttribute("googleDTO",googleDTO); return "radarsearch"; } @RequestMapping(value="/nearbyresultdisplay" ,method=RequestMethod.GET) public String nearByResultDisplay(@RequestParam String keyword,@RequestParam String sensor, @RequestParam double latitude, @RequestParam double longitude,@RequestParam float radius,ModelMap model){ logger.info("Compile the near by resultDisplay method"); List<GoogleDTO> listPlacesSearch = searchManager.displayResult(keyword, sensor, latitude, longitude, radius); model.put("listPlacesSearch",listPlacesSearch); return "display"; } @RequestMapping(value="/radarresultdisplay",method=RequestMethod.GET) public String radarResultDisplay(@RequestParam String keyword,@RequestParam String sensor, @RequestParam double latitude, @RequestParam double longitude,@RequestParam float radius,ModelMap model){ logger.info("Compile the radar search resultDisplay method"); String result =searchManager.radarSearch(keyword, sensor, latitude, longitude, radius); GoogleDTO googleDTO = new GoogleDTO(); googleDTO.setResult(result); model.addAttribute("googleDTO",googleDTO ); return "display"; } @RequestMapping(value="/detailsearch") public String detailSearch(@RequestParam String referenceId,@RequestParam String sensor ,ModelMap model){ GoogleDTO googleDTO = new GoogleDTO(); googleDTO=searchManager.searchDetail(referenceId, sensor); model.addAttribute("googleDTO", googleDTO); return "detailsearch"; } /** * To Save the Details via Google Places * Required Parameters : ReferenceId, Name, Latitude, Longitude etc. * * * @param referenceId * @param sensor * @return */ @RequestMapping(value="/save",method=RequestMethod.POST) public String saveDetail(@RequestParam String referenceId,@RequestParam String sensor){ logger.debug(referenceId); logger.debug(sensor); GoogleDTO googleDTO = searchManager.searchDetail(referenceId, sensor); searchManager.saveDetail(googleDTO); return "save"; } }
UTF-8
Java
3,704
java
GoogleController.java
Java
[]
null
[]
package com.sofmen.rest.webmvc; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.RequestParam; import com.sofmen.rest.dto.GoogleDTO; import com.sofmen.rest.manager.SearchManager; @Controller @RequestMapping("/search") public class GoogleController { /**Your Controllers or REST URIs here + Models*/ private static Logger logger = LoggerFactory.getLogger(GoogleController.class); @Autowired SearchManager searchManager; @RequestMapping(value="/nearbysearch" ,method=RequestMethod.POST) public String nearSearch(@RequestParam String keyword,ModelMap model){ GoogleDTO googleDTO = new GoogleDTO(); logger.trace("GoogleDTO", googleDTO); googleDTO.setKeyword(keyword); model.addAttribute("googleDTO",googleDTO); logger.trace("Google DTO mapped and redirect to nearbysearch.jsp"); return "nearbysearch"; } @RequestMapping(value="/textsearch") public String textSearch(@RequestParam String keyword,@RequestParam String sensor,ModelMap model){ String searchResult = searchManager.textSearch(keyword, sensor); logger.trace(searchResult); model.addAttribute("",null); return "display"; } @RequestMapping(value="/radarsearch") public String radarSearch(@RequestParam String keyword,ModelMap model){ GoogleDTO googleDTO = new GoogleDTO(); googleDTO.setKeyword(keyword); model.addAttribute("googleDTO",googleDTO); return "radarsearch"; } @RequestMapping(value="/nearbyresultdisplay" ,method=RequestMethod.GET) public String nearByResultDisplay(@RequestParam String keyword,@RequestParam String sensor, @RequestParam double latitude, @RequestParam double longitude,@RequestParam float radius,ModelMap model){ logger.info("Compile the near by resultDisplay method"); List<GoogleDTO> listPlacesSearch = searchManager.displayResult(keyword, sensor, latitude, longitude, radius); model.put("listPlacesSearch",listPlacesSearch); return "display"; } @RequestMapping(value="/radarresultdisplay",method=RequestMethod.GET) public String radarResultDisplay(@RequestParam String keyword,@RequestParam String sensor, @RequestParam double latitude, @RequestParam double longitude,@RequestParam float radius,ModelMap model){ logger.info("Compile the radar search resultDisplay method"); String result =searchManager.radarSearch(keyword, sensor, latitude, longitude, radius); GoogleDTO googleDTO = new GoogleDTO(); googleDTO.setResult(result); model.addAttribute("googleDTO",googleDTO ); return "display"; } @RequestMapping(value="/detailsearch") public String detailSearch(@RequestParam String referenceId,@RequestParam String sensor ,ModelMap model){ GoogleDTO googleDTO = new GoogleDTO(); googleDTO=searchManager.searchDetail(referenceId, sensor); model.addAttribute("googleDTO", googleDTO); return "detailsearch"; } /** * To Save the Details via Google Places * Required Parameters : ReferenceId, Name, Latitude, Longitude etc. * * * @param referenceId * @param sensor * @return */ @RequestMapping(value="/save",method=RequestMethod.POST) public String saveDetail(@RequestParam String referenceId,@RequestParam String sensor){ logger.debug(referenceId); logger.debug(sensor); GoogleDTO googleDTO = searchManager.searchDetail(referenceId, sensor); searchManager.saveDetail(googleDTO); return "save"; } }
3,704
0.784557
0.784017
101
35.673267
35.876606
198
false
false
0
0
0
0
0
0
2.009901
false
false
13
db45781fee97a1fc5ce943e5ecb72440a8e53a52
26,714,696,585,304
e23023eb65adca8f288f3097a9b58af9611a9167
/src/test2/java/run/main/java/dipti/Trainingselenium/Search.java
c87180ae154aed95ff590174831f121e1db5ecb2
[]
no_license
Jakiaferdous23/Automation
https://github.com/Jakiaferdous23/Automation
df01edbc5923c2a99387ee2b7effe1e1cdadcf42
3f96baf0ac1d47f26eae78ae21aad455912f3048
refs/heads/master
2023-01-21T00:37:43.908000
2020-12-04T03:11:12
2020-12-04T03:11:12
318,032,593
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dipti.Trainingselenium; public class Search { public static final String sendkeys = null; public static void SendKeys(String string) { } }
UTF-8
Java
157
java
Search.java
Java
[]
null
[]
package dipti.Trainingselenium; public class Search { public static final String sendkeys = null; public static void SendKeys(String string) { } }
157
0.738854
0.738854
11
13.272727
17.669136
45
false
false
0
0
0
0
0
0
0.636364
false
false
13
2dfb9cd7ea8fbebea7acc0906b8bda44eb0ac341
26,714,696,582,107
232e770bf11ed17fd0352129b76f010728aff3fc
/frame/game/ActivityConfig.java
c413c74fbbc0e3c04613c627a2c2d135524eb985
[]
no_license
haha88888888/ChessGameServeFrame
https://github.com/haha88888888/ChessGameServeFrame
3dec591835a1848349568a5c15cefce603dd2189
6414c47316179cacb49caf43965ccf95163fd58f
refs/heads/master
2023-03-16T21:26:29.214000
2020-02-01T07:10:33
2020-02-01T07:10:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package frame.game; import frame.game.proto.Game.updataTurnConfig; import lombok.Getter; import lombok.Setter; /** * @author KAZER * @version 创建时间:2019年6月9日 下午4:04:48 * 类说明 */ @Setter @Getter public class ActivityConfig { //转换积分的下注百分比 private int betRate; // 状态1启用,0禁用 private int status; // 活动开始时间 private long activityBegin; // 活动结束时间 private long activityEnd; public ActivityConfig() { } public ActivityConfig(updataTurnConfig turnConfig) { this.betRate = (int) turnConfig.getPercentage(); this.status = turnConfig.getStatus(); this.activityBegin = turnConfig.getStartime(); this.activityEnd = turnConfig.getEndtime(); } }
UTF-8
Java
745
java
ActivityConfig.java
Java
[ { "context": "ombok.Getter;\nimport lombok.Setter;\n\n/**\n* @author KAZER\n* @version 创建时间:2019年6月9日 下午4:04:48\n* 类说明\n*/\n@Set", "end": 132, "score": 0.9960996508598328, "start": 127, "tag": "USERNAME", "value": "KAZER" } ]
null
[]
package frame.game; import frame.game.proto.Game.updataTurnConfig; import lombok.Getter; import lombok.Setter; /** * @author KAZER * @version 创建时间:2019年6月9日 下午4:04:48 * 类说明 */ @Setter @Getter public class ActivityConfig { //转换积分的下注百分比 private int betRate; // 状态1启用,0禁用 private int status; // 活动开始时间 private long activityBegin; // 活动结束时间 private long activityEnd; public ActivityConfig() { } public ActivityConfig(updataTurnConfig turnConfig) { this.betRate = (int) turnConfig.getPercentage(); this.status = turnConfig.getStatus(); this.activityBegin = turnConfig.getStartime(); this.activityEnd = turnConfig.getEndtime(); } }
745
0.732224
0.712557
35
17.885714
16.359831
53
false
false
0
0
0
0
0
0
1.057143
false
false
13
c72027d673a5b390f52917cf2ae174d0ac685fdb
11,132,555,278,158
c5139c354f4542ed3801a932577c522f93b1a894
/app/src/main/java/com/ipcam/asyncio/IIOStreamProvider.java
5baee80fe8db5c704fc267c656e542a778600771
[]
no_license
cuda-convnet/IPCam_AndroidStudioProject
https://github.com/cuda-convnet/IPCam_AndroidStudioProject
790483d925086598206c9a498dbd84d20c8b3a23
837faa004f66df640e8555449cc1fba837dcd611
refs/heads/master
2020-03-19T20:23:12.040000
2017-12-06T09:18:31
2017-12-06T09:18:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ipcam.asyncio; import java.io.InputStream; import java.io.OutputStream; public interface IIOStreamProvider { public OutputStream getOutputStream(); public InputStream getInputStream(); public void closeAll(); }
UTF-8
Java
237
java
IIOStreamProvider.java
Java
[]
null
[]
package com.ipcam.asyncio; import java.io.InputStream; import java.io.OutputStream; public interface IIOStreamProvider { public OutputStream getOutputStream(); public InputStream getInputStream(); public void closeAll(); }
237
0.772152
0.772152
11
20.545454
15.945154
42
false
false
0
0
0
0
0
0
0.545455
false
false
13
0047f21eefcf0a12c51096b462b1a595f44e5a81
13,348,758,356,897
07ab6d62685a17b8a125ca0bb891c2af7920504d
/Time4Popcorn/src/com/heliocratic/imovies/googlecast/CastPopcornListener.java
85c175d60349040711a254d47f5404b174095df2
[]
no_license
tarasmelko/RedesignData
https://github.com/tarasmelko/RedesignData
00bfd6cb77ed1e371aadeac937ab4583f7b530f8
2c49dd3e0736317bc24c3b4df012807d86a6ea02
refs/heads/master
2016-09-05T23:33:03.483000
2015-03-28T16:57:15
2015-03-28T16:57:15
25,962,159
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.heliocratic.imovies.googlecast; public interface CastPopcornListener { public void onCastConnection(); public void onCastRouteSelected(); public void onCastRouteUnselected(long position); public void onCastStatePlaying(); public void onCastStatePaused(); public void onCastStateIdle(); public void onCastStateBuffering(); public void onCastMediaLoadSuccess(); public void onCastMediaLoadCancelInterrupt(); public void teardown(); }
UTF-8
Java
463
java
CastPopcornListener.java
Java
[]
null
[]
package com.heliocratic.imovies.googlecast; public interface CastPopcornListener { public void onCastConnection(); public void onCastRouteSelected(); public void onCastRouteUnselected(long position); public void onCastStatePlaying(); public void onCastStatePaused(); public void onCastStateIdle(); public void onCastStateBuffering(); public void onCastMediaLoadSuccess(); public void onCastMediaLoadCancelInterrupt(); public void teardown(); }
463
0.799136
0.799136
23
19.173914
18.910894
50
false
false
0
0
0
0
0
0
0.913043
false
false
13
17c6f56200b7aaae65130aa8455dc80a509e1745
13,348,758,357,360
4feac5a1e41a787350686da0cfc063d39ddbaae5
/JavaEE/Spring/SpringDemo/src/test/java/com/lvhao/c02bean/s01beaninstantiation/Bean1Test.java
6538e498db5ea4e6c110895e6135c98e8b136fbb
[]
no_license
lvhlvh/IdeaProjects
https://github.com/lvhlvh/IdeaProjects
e4f19b88ac0b423c5a73fe4c50143404d6eeaf50
9c69fb924765970121e268435317f65324c854c6
refs/heads/master
2020-05-03T08:08:11.725000
2020-02-20T14:07:40
2020-02-20T14:07:40
178,517,756
0
0
null
false
2020-01-21T23:00:46
2019-03-30T05:52:48
2020-01-19T09:55:33
2020-01-21T23:00:44
141,397
0
0
5
JavaScript
false
false
package com.lvhao.c02bean.s01beaninstantiation; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; class Bean1Test { @Test void test() { // 创建工厂 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); // 从工厂获取bean对象(这里调用了无参构造器) Bean1 bean1 = (Bean1) applicationContext.getBean("bean1"); } }
UTF-8
Java
556
java
Bean1Test.java
Java
[]
null
[]
package com.lvhao.c02bean.s01beaninstantiation; import org.junit.jupiter.api.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; class Bean1Test { @Test void test() { // 创建工厂 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); // 从工厂获取bean对象(这里调用了无参构造器) Bean1 bean1 = (Bean1) applicationContext.getBean("bean1"); } }
556
0.731373
0.713726
15
32.133335
31.168076
109
false
false
0
0
0
0
0
0
0.4
false
false
13
a93e4e07deff3525631ca357f2494d1e4645e7cf
31,327,491,477,956
6a488e6c07cba803c47aa1d8b5c7ad5a01e2dc14
/JDBC/StatementCDemo01.java
86f3928f9fa5a69ecfee2c75058821d611f1afe9
[]
no_license
z944733142/JavePractice
https://github.com/z944733142/JavePractice
dde591aa1d8520a0c6b2b6ca0370d224a84ba656
f7521472580653bd551783a4fa5d87e57952475b
refs/heads/master
2020-03-21T12:41:48.347000
2019-03-30T09:15:26
2019-03-30T09:15:26
138,567,159
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.xupt.JDBC; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; // 执行和注入 public class StatementCDemo01 { public static void main(String[] args) throws ClassNotFoundException, SQLException { // 加载驱动类 Class.forName("com.mysql.cj.jdbc.Driver"); // 建立连接 Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8" ,"root","159630235z"); Statement stmt = connection.createStatement(); // String sql = "insert into t_user (username,pwd,regtime) values ('zz',6666,now())"; // stmt.execute(sql); // 注入危险 删库 String sql = "delete from t_user where id=5 or 1=1"; // String sql = "delete from t_user where id=5"; // stmt.execute(sql); if (connection != null) { connection.close(); } } }
UTF-8
Java
1,012
java
StatementCDemo01.java
Java
[]
null
[]
package app.xupt.JDBC; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; // 执行和注入 public class StatementCDemo01 { public static void main(String[] args) throws ClassNotFoundException, SQLException { // 加载驱动类 Class.forName("com.mysql.cj.jdbc.Driver"); // 建立连接 Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8" ,"root","159630235z"); Statement stmt = connection.createStatement(); // String sql = "insert into t_user (username,pwd,regtime) values ('zz',6666,now())"; // stmt.execute(sql); // 注入危险 删库 String sql = "delete from t_user where id=5 or 1=1"; // String sql = "delete from t_user where id=5"; // stmt.execute(sql); if (connection != null) { connection.close(); } } }
1,012
0.63786
0.613169
28
33.714287
33.070118
150
false
false
0
0
0
0
0
0
0.75
false
false
13
f1428b591d06762d7572256b5a06cf240d0c2df8
24,781,961,360,754
a34f221459a40ded597f3b8a276a4bedd5995d95
/course0.2/src/util/Calculator.java
7089510559a2efc42e45d2225d00821152882e22
[ "Apache-2.0" ]
permissive
Buenomaurilio/Javateste
https://github.com/Buenomaurilio/Javateste
0c2b54ef431911bcf44d69db75f689c4286444f5
0c028999c4cad8ef2a8e9a7c8399dc3ea9ebdf7b
refs/heads/master
2020-09-29T04:38:14.946000
2019-12-10T20:03:03
2019-12-10T20:03:03
226,952,665
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; public class Calculator { public static final double PI = 3.14159; }
UTF-8
Java
87
java
Calculator.java
Java
[]
null
[]
package util; public class Calculator { public static final double PI = 3.14159; }
87
0.724138
0.655172
7
11.428572
14.936601
41
false
false
0
0
0
0
0
0
0.428571
false
false
13
db5b3c097bb226e64d04eaa67df65d8baaf7cf4e
24,781,961,360,360
94de6d3b3163a33a72b0ac1f75cc180f1a202edd
/src/test/java/com/github/witalijbukatkin/getcolorofphoto/TestUtil.java
6130879b55cb758abf878e95d2a03db964ec9c1e
[]
no_license
WitalijBukatkin/GetColorOfPhoto
https://github.com/WitalijBukatkin/GetColorOfPhoto
1c7fe7be225d5773bfde347e4538bf25cf325ed7
3b5f9fbbf5fbf1d38ae744804d724884b0c88072
refs/heads/master
2020-07-24T22:29:45.215000
2019-12-03T07:39:54
2019-12-03T07:39:54
208,069,614
0
0
null
false
2019-11-18T09:33:14
2019-09-12T14:23:13
2019-11-18T09:32:47
2019-11-18T09:32:45
1,338
0
0
0
Java
false
false
/* * Copyright (c) 2019. Witalij Bukatkin * Github profile: https://github.com/witalijbukatkin */ package com.github.witalijbukatkin.getcolorofphoto; import com.github.witalijbukatkin.getcolorofphoto.initializer.colorlist.MockColorListInitializerImpl; import com.github.witalijbukatkin.getcolorofphoto.initializer.setting.MockSettingsInitializerImpl; import com.github.witalijbukatkin.getcolorofphoto.to.Color; import com.github.witalijbukatkin.getcolorofphoto.to.ColorList; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class TestUtil { public static final ColorList COLOR_LIST = new MockColorListInitializerImpl().init(); public static final Properties SETTINGS = new MockSettingsInitializerImpl().init(); public static final Map<File, Color> IMAGES = new HashMap<>(); static { for (String name : Arrays.asList("Blue", "Green", "Red")) { IMAGES.put(new File(TestUtil.class.getResource("/images/" + name + ".jpg").getFile()), COLOR_LIST.valueOf(name.toUpperCase())); } } }
UTF-8
Java
1,135
java
TestUtil.java
Java
[ { "context": "/*\n * Copyright (c) 2019. Witalij Bukatkin\n * Github profile: https://github.com/witalijbuka", "end": 42, "score": 0.9998819231987, "start": 26, "tag": "NAME", "value": "Witalij Bukatkin" }, { "context": "ij Bukatkin\n * Github profile: https://github.com/witalijbukatkin\n */\n\npackage com.github.witalijbukatkin.getcoloro", "end": 96, "score": 0.9953749179840088, "start": 81, "tag": "USERNAME", "value": "witalijbukatkin" }, { "context": "thub.com/witalijbukatkin\n */\n\npackage com.github.witalijbukatkin.getcolorofphoto;\n\nimport com.github.witalijbukatk", "end": 136, "score": 0.5696412324905396, "start": 122, "tag": "USERNAME", "value": "italijbukatkin" }, { "context": "katkin.getcolorofphoto;\n\nimport com.github.witalijbukatkin.getcolorofphoto.initializer.colorlist.MockC", "end": 182, "score": 0.5070255994796753, "start": 180, "tag": "USERNAME", "value": "bu" }, { "context": "olorListInitializerImpl;\nimport com.github.witalijbukatkin.getcolorofphoto.initializer.setting.MockSet", "end": 284, "score": 0.514812707901001, "start": 282, "tag": "USERNAME", "value": "bu" }, { "context": "g.MockSettingsInitializerImpl;\nimport com.github.witalijbukatkin.getcolorofphoto.to.Color;\nimport com.github.wital", "end": 389, "score": 0.5396109819412231, "start": 375, "tag": "USERNAME", "value": "italijbukatkin" }, { "context": "tkin.getcolorofphoto.to.Color;\nimport com.github.witalijbukatkin.getcolorofphoto.to.ColorList;\n\nimport java.io.", "end": 446, "score": 0.549714207649231, "start": 435, "tag": "USERNAME", "value": "italijbukat" } ]
null
[]
/* * Copyright (c) 2019. <NAME> * Github profile: https://github.com/witalijbukatkin */ package com.github.witalijbukatkin.getcolorofphoto; import com.github.witalijbukatkin.getcolorofphoto.initializer.colorlist.MockColorListInitializerImpl; import com.github.witalijbukatkin.getcolorofphoto.initializer.setting.MockSettingsInitializerImpl; import com.github.witalijbukatkin.getcolorofphoto.to.Color; import com.github.witalijbukatkin.getcolorofphoto.to.ColorList; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class TestUtil { public static final ColorList COLOR_LIST = new MockColorListInitializerImpl().init(); public static final Properties SETTINGS = new MockSettingsInitializerImpl().init(); public static final Map<File, Color> IMAGES = new HashMap<>(); static { for (String name : Arrays.asList("Blue", "Green", "Red")) { IMAGES.put(new File(TestUtil.class.getResource("/images/" + name + ".jpg").getFile()), COLOR_LIST.valueOf(name.toUpperCase())); } } }
1,125
0.742731
0.739207
31
35.612904
34.090656
101
false
false
0
0
0
0
0
0
0.580645
false
false
13
55a3c2b39f91eb089b499ae60f6ca35d9f007fb7
4,466,766,056,415
037d619800a6f18971619534544b96bd3bbe25dd
/TEMA_3_POO/Tema3/src/BasketballTeam.java
0621d25a029955f0114a536aaa51ee705e8d7a9e
[]
no_license
albertchirila/OOP
https://github.com/albertchirila/OOP
bbe8b3cfef51017e4ebbd33a861d2d65bd540b71
5f533d901942f9bfa496d194ef563dd9d7dbbe91
refs/heads/main
2023-02-13T03:21:37.901000
2021-01-14T14:10:36
2021-01-14T14:10:36
329,632,918
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** @author Chirila Albert */ public class BasketballTeam extends Team { /** * Constructor ce initializeaza campurile clasei parinte * @param type tipul de echipa * @param teamName numele echipei * @param gender genul persoanelor dintr-o echipa * @param numberOfPlayers numarul de jucatori */ public BasketballTeam(String type, String teamName, String gender, int numberOfPlayers) { super(type, teamName, gender, numberOfPlayers); } }
UTF-8
Java
456
java
BasketballTeam.java
Java
[ { "context": "\n/** @author Chirila Albert */\npublic class BasketballTeam extends Team {\n\t\n\t", "end": 28, "score": 0.9998373985290527, "start": 14, "tag": "NAME", "value": "Chirila Albert" } ]
null
[]
/** @author <NAME> */ public class BasketballTeam extends Team { /** * Constructor ce initializeaza campurile clasei parinte * @param type tipul de echipa * @param teamName numele echipei * @param gender genul persoanelor dintr-o echipa * @param numberOfPlayers numarul de jucatori */ public BasketballTeam(String type, String teamName, String gender, int numberOfPlayers) { super(type, teamName, gender, numberOfPlayers); } }
448
0.743421
0.743421
14
31.5
25.764732
90
false
false
0
0
0
0
0
0
1.357143
false
false
13
b944197bb8e3a86b8a2c89e9cf33bb93cc8fcb18
30,004,641,566,922
ceed8ee18ab314b40b3e5b170dceb9adedc39b1e
/android/packages/apps/TvSettings/Settings/src/com/android/tv/settings/device/display/ScreenMarginActivity.java
8dc49e149f53e688dd70936353cca88e5f9ecbac
[ "Apache-2.0" ]
permissive
BPI-SINOVOIP/BPI-H3-New-Android7
https://github.com/BPI-SINOVOIP/BPI-H3-New-Android7
c9906db06010ed6b86df53afb6e25f506ad3917c
111cb59a0770d080de7b30eb8b6398a545497080
refs/heads/master
2023-02-28T20:15:21.191000
2018-10-08T06:51:44
2018-10-08T06:51:44
132,708,249
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.tv.settings.device.display; import android.content.Context; import android.annotation.Nullable; import android.app.Activity; import android.app.ActivityManager; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v17.leanback.app.GuidedStepFragment; import android.support.v17.leanback.widget.GuidanceStylist; import android.support.v17.leanback.widget.GuidedAction; import android.util.Log; import android.widget.TextView; import android.os.ServiceManager; import android.view.Display; import android.os.IDisplayOutputManager; import android.os.DisplayOutputManager; import com.android.tv.settings.R; import java.util.List; public class ScreenMarginActivity extends Activity { private static final String TAG = "ScreenMarginActivity"; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { GuidedStepFragment.addAsRoot(this, ScreenMarginFragment.newInstance(), android.R.id.content); } } public static class ScreenMarginFragment extends GuidedStepFragment { private static final int MAX_SCREEN_MARGIN = 100; private static final int MIN_SCREEN_MARGIN = 80; private DisplayOutputManager mDisplayOutputManager = null; private int currentMargin = MAX_SCREEN_MARGIN; public static ScreenMarginFragment newInstance() { Bundle args = new Bundle(); ScreenMarginFragment fragment = new ScreenMarginFragment(); fragment.setArguments(args); return fragment; } @NonNull @Override public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) { IDisplayOutputManager service = IDisplayOutputManager.Stub.asInterface(ServiceManager.getService(Context.DISPLAYOUTPUT_SERVICE)); mDisplayOutputManager = new DisplayOutputManager(getActivity(), service); currentMargin = mDisplayOutputManager.getDisplayMargin(Display.DEFAULT_DISPLAY)[0]; String title = String.format("%s: %d%%", getString(R.string.screen_margin), currentMargin); return new GuidanceStylist.Guidance( title, getString(R.string.screen_margin_description), null, getContext().getDrawable(R.drawable.ic_settings_backup_restore_132dp)); } @Override public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) { actions.add(new GuidedAction.Builder(getContext()) .clickAction(GuidedAction.ACTION_ID_CANCEL) .title(getString(R.string.margin_scaleup)) .build()); actions.add(new GuidedAction.Builder(getContext()) .clickAction(GuidedAction.ACTION_ID_OK) .title(getString(R.string.margin_scaledown)) .build()); } @Override public void onGuidedActionClicked(GuidedAction action) { int newMargin = currentMargin; if (action.getId() == GuidedAction.ACTION_ID_OK) { // scale down if (currentMargin > MIN_SCREEN_MARGIN) newMargin = currentMargin - 1; } else if (action.getId() == GuidedAction.ACTION_ID_CANCEL) { // scale up if (currentMargin < MAX_SCREEN_MARGIN) newMargin = currentMargin + 1; } else { Log.wtf(TAG, "Unknown action clicked"); } if (newMargin != currentMargin) { currentMargin = newMargin; TextView title = getGuidanceStylist().getTitleView(); title.setText(String.format("%s: %d%%", getString(R.string.screen_margin), currentMargin)); mDisplayOutputManager.setDisplayMargin(Display.DEFAULT_DISPLAY, currentMargin, currentMargin); } } } }
UTF-8
Java
4,780
java
ScreenMarginActivity.java
Java
[]
null
[]
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.tv.settings.device.display; import android.content.Context; import android.annotation.Nullable; import android.app.Activity; import android.app.ActivityManager; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v17.leanback.app.GuidedStepFragment; import android.support.v17.leanback.widget.GuidanceStylist; import android.support.v17.leanback.widget.GuidedAction; import android.util.Log; import android.widget.TextView; import android.os.ServiceManager; import android.view.Display; import android.os.IDisplayOutputManager; import android.os.DisplayOutputManager; import com.android.tv.settings.R; import java.util.List; public class ScreenMarginActivity extends Activity { private static final String TAG = "ScreenMarginActivity"; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { GuidedStepFragment.addAsRoot(this, ScreenMarginFragment.newInstance(), android.R.id.content); } } public static class ScreenMarginFragment extends GuidedStepFragment { private static final int MAX_SCREEN_MARGIN = 100; private static final int MIN_SCREEN_MARGIN = 80; private DisplayOutputManager mDisplayOutputManager = null; private int currentMargin = MAX_SCREEN_MARGIN; public static ScreenMarginFragment newInstance() { Bundle args = new Bundle(); ScreenMarginFragment fragment = new ScreenMarginFragment(); fragment.setArguments(args); return fragment; } @NonNull @Override public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) { IDisplayOutputManager service = IDisplayOutputManager.Stub.asInterface(ServiceManager.getService(Context.DISPLAYOUTPUT_SERVICE)); mDisplayOutputManager = new DisplayOutputManager(getActivity(), service); currentMargin = mDisplayOutputManager.getDisplayMargin(Display.DEFAULT_DISPLAY)[0]; String title = String.format("%s: %d%%", getString(R.string.screen_margin), currentMargin); return new GuidanceStylist.Guidance( title, getString(R.string.screen_margin_description), null, getContext().getDrawable(R.drawable.ic_settings_backup_restore_132dp)); } @Override public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) { actions.add(new GuidedAction.Builder(getContext()) .clickAction(GuidedAction.ACTION_ID_CANCEL) .title(getString(R.string.margin_scaleup)) .build()); actions.add(new GuidedAction.Builder(getContext()) .clickAction(GuidedAction.ACTION_ID_OK) .title(getString(R.string.margin_scaledown)) .build()); } @Override public void onGuidedActionClicked(GuidedAction action) { int newMargin = currentMargin; if (action.getId() == GuidedAction.ACTION_ID_OK) { // scale down if (currentMargin > MIN_SCREEN_MARGIN) newMargin = currentMargin - 1; } else if (action.getId() == GuidedAction.ACTION_ID_CANCEL) { // scale up if (currentMargin < MAX_SCREEN_MARGIN) newMargin = currentMargin + 1; } else { Log.wtf(TAG, "Unknown action clicked"); } if (newMargin != currentMargin) { currentMargin = newMargin; TextView title = getGuidanceStylist().getTitleView(); title.setText(String.format("%s: %d%%", getString(R.string.screen_margin), currentMargin)); mDisplayOutputManager.setDisplayMargin(Display.DEFAULT_DISPLAY, currentMargin, currentMargin); } } } }
4,780
0.657741
0.65251
122
38.180328
29.745373
141
false
false
0
0
0
0
0
0
0.52459
false
false
13
6d2cfb5ae986087947726e4bf23851d11d19a258
29,119,878,325,681
a0481579ab97043b4685fa617b8b6c15441c2753
/Simple Web Crawler/java/src/main/java/SequentialCrawler.java
1aa6272fd775de5911ddcea14fa5727526bd90fa
[]
no_license
gsp789/Projects
https://github.com/gsp789/Projects
d4484944fb83924b673f3540744c94c4ce3c3ff3
7b023e6aee977df28bafa4bcda90d5b9a148b4be
refs/heads/master
2021-01-10T10:54:47.355000
2016-03-16T20:05:52
2016-03-16T20:05:52
52,482,922
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.*; public class SequentialCrawler{ public static int sequentialCrawler(String url, Set<String> visitedSet){ List<String>toVisit = new Parser().parser(url); toVisit.forEach(link -> { if(!(visitedSet.contains(link))){ visitedSet.add(link); sequentialCrawler(link, visitedSet); } }); return visitedSet.size(); } }
UTF-8
Java
399
java
SequentialCrawler.java
Java
[]
null
[]
import java.io.*; import java.util.*; public class SequentialCrawler{ public static int sequentialCrawler(String url, Set<String> visitedSet){ List<String>toVisit = new Parser().parser(url); toVisit.forEach(link -> { if(!(visitedSet.contains(link))){ visitedSet.add(link); sequentialCrawler(link, visitedSet); } }); return visitedSet.size(); } }
399
0.649123
0.649123
15
25.666666
21.070253
79
false
false
0
0
0
0
0
0
0.6
false
false
13
b52d65744e98c472c728239b932ad71c4904b7d9
5,282,809,821,339
c3b4cbce61aed64b1a038de6f0184cffaba07901
/topAmazonQuestions/Turnstile.java
faba2bd434cef2a563c4c7d0eb07765d85be1222
[]
no_license
neerazz/FAANG
https://github.com/neerazz/FAANG
30a1041b501d5ab9d81a38da0f7b45f4cdef414f
d113f24a12c773083a412065e715e0b66e7e6324
refs/heads/master
2023-09-05T07:25:13.835000
2023-04-09T17:30:05
2023-04-09T17:30:05
193,811,440
1,657
460
null
false
2023-09-10T12:45:39
2019-06-26T01:59:00
2023-09-09T23:47:40
2023-09-10T12:45:38
257,584
1,564
453
4
Java
false
false
import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; /** * Created on: Jan 12, 2021 * Questions: https://leetcode.com/discuss/interview-question/699973/ */ public class Turnstile { public static void main(String[] args) { System.out.println("Solution 1"); System.out.println(Arrays.toString(getTimes(new int[]{0, 0, 1, 5}, new int[]{0, 1, 1, 0}))); System.out.println(Arrays.toString(getTimes(new int[]{1, 2, 4}, new int[]{0, 1, 1}))); System.out.println(Arrays.toString(getTimes(new int[]{1, 1}, new int[]{1, 1}))); System.out.println(Arrays.toString(getTimes(new int[]{1, 1, 3, 3, 4, 5, 6, 7, 7}, new int[]{1, 1, 0, 0, 0, 1, 1, 1, 1}))); System.out.println("Solution 2"); System.out.println(Arrays.toString(getTimes(4, new int[]{0, 0, 1, 5}, new int[]{0, 1, 1, 0}))); System.out.println(Arrays.toString(getTimes(4, new int[]{1, 2, 4}, new int[]{0, 1, 1}))); System.out.println(Arrays.toString(getTimes(2, new int[]{1, 1}, new int[]{1, 1}))); System.out.println(Arrays.toString(getTimes(9, new int[]{1, 1, 3, 3, 4, 5, 6, 7, 7}, new int[]{1, 1, 0, 0, 0, 1, 1, 1, 1}))); } public static int[] getTimes(int numCustomers, int[] arrTime, int[] direction) { Queue<int[]> in = new LinkedList<>(), out = new LinkedList<>(); // 0: time, 1: idx for (int i = 0; i < arrTime.length; i++) { int time = arrTime[i], dir = direction[i]; if (dir == 1) { out.add(new int[]{time, i}); } else { in.add(new int[]{time, i}); } } int[] times = new int[arrTime.length]; int pre = 1, time = 0; while (!in.isEmpty() || !out.isEmpty()) { boolean hasIn = !in.isEmpty() && in.peek()[0] <= time; boolean hasOut = !out.isEmpty() && out.peek()[0] <= time; if (hasIn && hasOut) { if (pre == 1) { // Let the person out times[out.poll()[1]] = time; } else { times[in.poll()[1]] = time; } } else if (hasIn) { times[in.poll()[1]] = time; pre = 0; } else if (hasOut) { times[out.poll()[1]] = time; pre = 1; } else { pre = 1; } time++; } return times; } private static int[] getTimes(int[] time, int[] dirs) { int len = time.length; int[] persons = new int[len]; Queue<int[]> in = new LinkedList<>(), out = new LinkedList<>(); // collect all the based on the directions. for (int i = 0; i < len; i++) { if (dirs[i] == 0) { in.add(new int[]{time[i], i}); } else { out.add(new int[]{time[i], i}); } } int t = 0, preDir = 1; // Set the initial direction to out, as that is the directions when pre was not used. while (!in.isEmpty() || !out.isEmpty()) { // Loop till both the queue is empty. boolean hasIn = !in.isEmpty() && in.peek()[0] <= t, hasOut = !out.isEmpty() && out.peek()[0] <= t; int inTime = Math.max(t, in.isEmpty() ? Integer.MAX_VALUE : in.peek()[0]); int outTime = Math.max(t, out.isEmpty() ? Integer.MAX_VALUE : out.peek()[0]); if (hasIn && hasOut) { // If there are two people at the same moment, then take the one with if (preDir == 1) { persons[out.poll()[1]] = t; t = outTime + 1; } else { persons[in.poll()[1]] = t; t = inTime + 1; } } else if (hasIn) { persons[in.poll()[1]] = t; preDir = 0; t = inTime + 1; } else if (hasOut) { persons[out.poll()[1]] = t; preDir = 1; t = outTime + 1; } else { preDir = 1; t++; } } return persons; } }
UTF-8
Java
4,217
java
Turnstile.java
Java
[]
null
[]
import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; /** * Created on: Jan 12, 2021 * Questions: https://leetcode.com/discuss/interview-question/699973/ */ public class Turnstile { public static void main(String[] args) { System.out.println("Solution 1"); System.out.println(Arrays.toString(getTimes(new int[]{0, 0, 1, 5}, new int[]{0, 1, 1, 0}))); System.out.println(Arrays.toString(getTimes(new int[]{1, 2, 4}, new int[]{0, 1, 1}))); System.out.println(Arrays.toString(getTimes(new int[]{1, 1}, new int[]{1, 1}))); System.out.println(Arrays.toString(getTimes(new int[]{1, 1, 3, 3, 4, 5, 6, 7, 7}, new int[]{1, 1, 0, 0, 0, 1, 1, 1, 1}))); System.out.println("Solution 2"); System.out.println(Arrays.toString(getTimes(4, new int[]{0, 0, 1, 5}, new int[]{0, 1, 1, 0}))); System.out.println(Arrays.toString(getTimes(4, new int[]{1, 2, 4}, new int[]{0, 1, 1}))); System.out.println(Arrays.toString(getTimes(2, new int[]{1, 1}, new int[]{1, 1}))); System.out.println(Arrays.toString(getTimes(9, new int[]{1, 1, 3, 3, 4, 5, 6, 7, 7}, new int[]{1, 1, 0, 0, 0, 1, 1, 1, 1}))); } public static int[] getTimes(int numCustomers, int[] arrTime, int[] direction) { Queue<int[]> in = new LinkedList<>(), out = new LinkedList<>(); // 0: time, 1: idx for (int i = 0; i < arrTime.length; i++) { int time = arrTime[i], dir = direction[i]; if (dir == 1) { out.add(new int[]{time, i}); } else { in.add(new int[]{time, i}); } } int[] times = new int[arrTime.length]; int pre = 1, time = 0; while (!in.isEmpty() || !out.isEmpty()) { boolean hasIn = !in.isEmpty() && in.peek()[0] <= time; boolean hasOut = !out.isEmpty() && out.peek()[0] <= time; if (hasIn && hasOut) { if (pre == 1) { // Let the person out times[out.poll()[1]] = time; } else { times[in.poll()[1]] = time; } } else if (hasIn) { times[in.poll()[1]] = time; pre = 0; } else if (hasOut) { times[out.poll()[1]] = time; pre = 1; } else { pre = 1; } time++; } return times; } private static int[] getTimes(int[] time, int[] dirs) { int len = time.length; int[] persons = new int[len]; Queue<int[]> in = new LinkedList<>(), out = new LinkedList<>(); // collect all the based on the directions. for (int i = 0; i < len; i++) { if (dirs[i] == 0) { in.add(new int[]{time[i], i}); } else { out.add(new int[]{time[i], i}); } } int t = 0, preDir = 1; // Set the initial direction to out, as that is the directions when pre was not used. while (!in.isEmpty() || !out.isEmpty()) { // Loop till both the queue is empty. boolean hasIn = !in.isEmpty() && in.peek()[0] <= t, hasOut = !out.isEmpty() && out.peek()[0] <= t; int inTime = Math.max(t, in.isEmpty() ? Integer.MAX_VALUE : in.peek()[0]); int outTime = Math.max(t, out.isEmpty() ? Integer.MAX_VALUE : out.peek()[0]); if (hasIn && hasOut) { // If there are two people at the same moment, then take the one with if (preDir == 1) { persons[out.poll()[1]] = t; t = outTime + 1; } else { persons[in.poll()[1]] = t; t = inTime + 1; } } else if (hasIn) { persons[in.poll()[1]] = t; preDir = 0; t = inTime + 1; } else if (hasOut) { persons[out.poll()[1]] = t; preDir = 1; t = outTime + 1; } else { preDir = 1; t++; } } return persons; } }
4,217
0.456249
0.426369
106
38.78302
29.07505
133
false
false
0
0
0
0
0
0
1.386792
false
false
13
45c64c23465e994f98e0d0131c57e449aaa22d4c
9,972,914,109,334
a4cf0d66a006c167d32e119c0077c38492c29742
/src/generic_libraries/Screenshot_fb_fk.java
20add828e5316b9e5229c80ea896efc807b6758b
[]
no_license
praveenpvg/Actitime_cmd
https://github.com/praveenpvg/Actitime_cmd
a2b0b18bce4678a3b0eb060a1d0f3708fc0e0d4f
9f6d81937b1001b27b4c3c7ecaee143ef377f3e0
refs/heads/master
2020-09-04T11:18:41.001000
2019-11-05T10:26:44
2019-11-05T10:26:44
219,718,539
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package generic_libraries; import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Screenshot_fb_fk { public static void main(String[] args) throws IOException, InterruptedException { System.setProperty("webdriver.gecko.driver", "./softselenium/geckodriver.exe"); WebDriver driver=new FirefoxDriver(); driver.get("http://www.facebook.com"); Screenshot.Get_screenshot(driver); Thread.sleep(2000); driver.get("http://www.flipkart.com"); Screenshot.Get_screenshot(driver); } }
UTF-8
Java
612
java
Screenshot_fb_fk.java
Java
[]
null
[]
package generic_libraries; import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Screenshot_fb_fk { public static void main(String[] args) throws IOException, InterruptedException { System.setProperty("webdriver.gecko.driver", "./softselenium/geckodriver.exe"); WebDriver driver=new FirefoxDriver(); driver.get("http://www.facebook.com"); Screenshot.Get_screenshot(driver); Thread.sleep(2000); driver.get("http://www.flipkart.com"); Screenshot.Get_screenshot(driver); } }
612
0.70915
0.702614
26
21.538462
24.133015
82
false
false
0
0
0
0
0
0
1.576923
false
false
13
6367ced12a80b633078990bff9e5133dce589470
4,054,449,176,946
6ca404c9f8791f5cb6f91f40eaf55877ac5f987a
/SimpleNumbers.java
fce974486429d1fa567cbc9c1265daab3cfb9de8
[]
no_license
kalyan57/test
https://github.com/kalyan57/test
18b9dbafea28ddab446be67c806765e475eb6fe6
5491a2f8d84f1f9e4fc4332b8abb62598ab774d9
refs/heads/master
2020-04-21T01:26:12.135000
2019-02-05T11:42:00
2019-02-05T11:42:00
169,223,638
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; class SimpleNumbers implements test.Task { private final String task; private final Scanner in; public SimpleNumbers(Scanner in) { this.task = "Задание 1\nНеобходимо написать программу, которая вычисляет простые числа в пределах от 1\n" + "до N. N вводится вручную во время выполнения программы.\n"; this.in =in; } @Override public String getTask() { return this.task; } @Override public void performTask() { System.out.println(getTask()); int N = test.readNumber(in, "Введите целое положительное число больше 1:", 2); List<Integer> primesList = new ArrayList<Integer>(); boolean[] isPrime = new boolean[N]; Arrays.fill(isPrime,true); isPrime[1] = false; // for (int i=2; i*i < N; i++) for (int i=2; i < N; i++) // that's not the best solution of possible, i know it if (isPrime[i]) { primesList.add(i); for (int j = i * i; j < N; j += i) isPrime[j] = false; } System.out.println("Перечень простых чисел от 1 до " + N + ":"); System.out.println(primesList.toString()); //System.out.println("Don't forget to finish and withdraw all the simple numbers to N, not only to sqrt(N)"); } }
UTF-8
Java
1,612
java
SimpleNumbers.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; class SimpleNumbers implements test.Task { private final String task; private final Scanner in; public SimpleNumbers(Scanner in) { this.task = "Задание 1\nНеобходимо написать программу, которая вычисляет простые числа в пределах от 1\n" + "до N. N вводится вручную во время выполнения программы.\n"; this.in =in; } @Override public String getTask() { return this.task; } @Override public void performTask() { System.out.println(getTask()); int N = test.readNumber(in, "Введите целое положительное число больше 1:", 2); List<Integer> primesList = new ArrayList<Integer>(); boolean[] isPrime = new boolean[N]; Arrays.fill(isPrime,true); isPrime[1] = false; // for (int i=2; i*i < N; i++) for (int i=2; i < N; i++) // that's not the best solution of possible, i know it if (isPrime[i]) { primesList.add(i); for (int j = i * i; j < N; j += i) isPrime[j] = false; } System.out.println("Перечень простых чисел от 1 до " + N + ":"); System.out.println(primesList.toString()); //System.out.println("Don't forget to finish and withdraw all the simple numbers to N, not only to sqrt(N)"); } }
1,612
0.590529
0.584958
43
32.372093
29.487896
117
false
false
0
0
0
0
0
0
0.744186
false
false
13