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
ce48188e2c438a849dff667976d2f89e286a7398
10,307,921,560,789
690a2ea8c3fe4d7570b257947f46c1858652710f
/src/main/java/nl/thijsmolendijk/ibex/ast/expr/IntegerLiteralExpr.java
5e179306384524c7e8411a1be201f1dc1118776a
[]
no_license
ibex-lang/ibex-java
https://github.com/ibex-lang/ibex-java
03d83cc518cae8afa4d8443525d7d284f5568510
06b58592ba668d5d9ccd752d412563d3a3bcbe44
refs/heads/master
2021-01-10T10:15:58.718000
2015-12-28T20:56:40
2015-12-28T20:56:40
48,278,520
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.thijsmolendijk.ibex.ast.expr; import nl.thijsmolendijk.ibex.ast.Expression; import nl.thijsmolendijk.ibex.parse.SourceLocation; /** * Represents an integer literal. * * Created by molenzwiebel on 19-12-15. */ public class IntegerLiteralExpr extends Expression { private SourceLocation loc; private String val; public IntegerLiteralExpr(SourceLocation loc, String val) { this.loc = loc; this.val = val; } public String getVal() { return val; } @Override public SourceLocation getLocation() { return loc; } }
UTF-8
Java
595
java
IntegerLiteralExpr.java
Java
[ { "context": " * Represents an integer literal.\n *\n * Created by molenzwiebel on 19-12-15.\n */\npublic class IntegerLiteralExpr ", "end": 208, "score": 0.9983307719230652, "start": 196, "tag": "USERNAME", "value": "molenzwiebel" } ]
null
[]
package nl.thijsmolendijk.ibex.ast.expr; import nl.thijsmolendijk.ibex.ast.Expression; import nl.thijsmolendijk.ibex.parse.SourceLocation; /** * Represents an integer literal. * * Created by molenzwiebel on 19-12-15. */ public class IntegerLiteralExpr extends Expression { private SourceLocation loc; private String val; public IntegerLiteralExpr(SourceLocation loc, String val) { this.loc = loc; this.val = val; } public String getVal() { return val; } @Override public SourceLocation getLocation() { return loc; } }
595
0.678992
0.668908
28
20.25
18.925842
63
false
false
0
0
0
0
0
0
0.357143
false
false
15
f4251836ef8d94774c551fa4aa09bac6780c016f
28,535,762,781,832
29bda29f302dac69fcbadcb37e516d16cd069e63
/src/com/designpatterns/abstractfactory/GoldenApple.java
66c17282d316530ecd9dc4206f7f446fbabb2406
[]
no_license
mukteshkrmishra/Design-Pattern-Examples
https://github.com/mukteshkrmishra/Design-Pattern-Examples
36d56d6374e8cba493a9f1d2d490119449f56966
39731cce6e24577ea42fdb259cbdd968de763d02
refs/heads/master
2020-08-04T05:02:12.499000
2015-04-10T08:06:27
2015-04-10T08:06:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.designpatterns.abstractfactory; public class GoldenApple implements Apple { @Override public String getType() { // TODO Auto-generated method stub return "Golden Apple"; } }
UTF-8
Java
196
java
GoldenApple.java
Java
[]
null
[]
package com.designpatterns.abstractfactory; public class GoldenApple implements Apple { @Override public String getType() { // TODO Auto-generated method stub return "Golden Apple"; } }
196
0.75
0.75
11
16.818182
17.161364
43
false
false
0
0
0
0
0
0
0.818182
false
false
15
5f978223f55c7b923197e5ed5bb32a3f64a50c40
22,342,419,942,843
19657c384d7930a5cfefee62095aa59348cd9850
/src/main/java/com/nikita/atm/ATMController.java
bb0f41e6c406fc1318939bfeefb9398569c50703
[]
no_license
nkhose/ATM-Withdrawal
https://github.com/nkhose/ATM-Withdrawal
7cb641cd7678de80c92d421d7219eec4478f9f06
07a35eb52a44d97cc3c392e11460c9b1bd9cf846
refs/heads/master
2020-05-03T16:12:19.077000
2019-03-31T17:08:58
2019-03-31T17:08:58
178,717,788
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nikita.atm; import java.util.HashMap; import org.json.JSONException; import org.json.JSONObject; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class ATMController { @RequestMapping(value = "/atm") public HashMap<String, Object> getCalculation(@RequestParam("amt") String amt) { HashMap<String, Object> map = new HashMap<>(); try { Integer amount = Integer.parseInt(amt); ATM a = new ATM(); map.put("result", "OK"); map.put("notes", a.getResult(amount)); } catch (Exception e) { e.printStackTrace(); map.put("result", "Exception"); map.put("message", e.getMessage()); } return map; } }
UTF-8
Java
928
java
ATMController.java
Java
[]
null
[]
package com.nikita.atm; import java.util.HashMap; import org.json.JSONException; import org.json.JSONObject; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class ATMController { @RequestMapping(value = "/atm") public HashMap<String, Object> getCalculation(@RequestParam("amt") String amt) { HashMap<String, Object> map = new HashMap<>(); try { Integer amount = Integer.parseInt(amt); ATM a = new ATM(); map.put("result", "OK"); map.put("notes", a.getResult(amount)); } catch (Exception e) { e.printStackTrace(); map.put("result", "Exception"); map.put("message", e.getMessage()); } return map; } }
928
0.707974
0.707974
35
24.571428
21.71015
81
false
false
0
0
0
0
0
0
1.657143
false
false
15
1f067e8404496f3f5153cab48d8f9f4ef60d10c9
1,571,958,039,916
9ce5d9c5a860dc1b7293d8cd16e17c96dd715039
/src/com/ensa/controllers/ClientController.java
94036b5b9b0fa4735cea1e8449cb9029bdaf9587
[]
no_license
mchoubby/ecommerce
https://github.com/mchoubby/ecommerce
70cb518da164afe20fe4ce26da800a45ff61068a
4c94fed5821a2239de11a0beb18034623f8e9cd8
refs/heads/master
2021-09-05T01:31:20.711000
2017-06-29T09:08:29
2017-06-29T09:08:29
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ensa.controllers; import java.io.IOException; import java.util.Date; import javax.ejb.EJB; import javax.ejb.EJBException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.ensa.forms.ClientForm; import com.ensa.models.Client; import com.ensa.service.ClientService; import com.ensa.util.Name; @WebServlet(value={"/client","/client/add","/client/update"}) public class ClientController extends HttpServlet { private static final long serialVersionUID = 1L; @EJB ClientService cs; public ClientController() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getServletPath().equals("/client/add")){ addClientGet(request,response); }else if(request.getServletPath().equals("/client/update")){ UpdateClientGet(request,response); }else if(request.getServletPath().equals("/client")){ clientProfil(request,response); } else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getServletPath().equals("/client/add")){ addClientPost(request,response); }else if(request.getServletPath().equals("/client/update")){ updateClientPost(request,response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } private void clientProfil(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ HttpSession session = request.getSession(); if(session.getAttribute(Name.ACCOUNT) != null && ((String)session.getAttribute(Name.ACCOUNT_TYPE)).equals("client") ){ Client client = (Client)session.getAttribute(Name.ACCOUNT); request.setAttribute(Name.CLIENT, client); this.getServletContext().getRequestDispatcher(Name.PROFIL_CLIENT_PAGE).forward(request,response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } private void addClientPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ //validate the form values ClientForm form = new ClientForm(); Client client = form.addClient(request); if(form.getResult().equals("true")){ //set client info client.getInfo().setLastModifiedDate(new Date()); client.getInfo().setLastLoginDate(new Date()); client.getInfo().setRegistratioDate(new Date()); client.getInfo().setNumbers_logons(1); client.setStatus(true); try{ if(cs.getClient(client.getEmail()) == null){ client = cs.add(client); System.out.println("||the client added"); request.getSession().setAttribute(Name.ACCOUNT, client); request.getSession().setAttribute(Name.ACCOUNT_TYPE, "client"); response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); }else{ request.setAttribute(Name.FORM, form); request.setAttribute(Name.CLIENT, client); request.setAttribute(Name.USED_EMAIL,"l'email que vous avez entrez est deja utilise , veuillez choisir une autre adresse email"); this.getServletContext().getRequestDispatcher(Name.ADD_CLIENT_FORM).forward(request,response); } }catch(EJBException e){ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } }else{ //display the form with the errors attached to it when some exception occurs request.setAttribute(Name.FORM, form); request.setAttribute(Name.CLIENT, client); this.getServletContext().getRequestDispatcher(Name.ADD_CLIENT_FORM).forward(request,response); } } private void updateClientPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ //verifing the form using the addClientForm because add and update had the same fields ClientForm form = new ClientForm(); Client client = form.addClient(request); if(form.getResult().equals("true")){ Client rclient = (Client)request.getSession().getAttribute(Name.ACCOUNT); rclient.setEmail(client.getEmail()); rclient.setPassword(client.getPassword()); rclient.setPhone(client.getPhone()); rclient.getPerson().setBirth(client.getPerson().getBirth()); rclient.getPerson().setFirstname(client.getPerson().getFirstname()); rclient.getPerson().setLastname(client.getPerson().getLastname()); rclient.getPerson().setGender(client.getPerson().getGender()); rclient.getInfo().setLastModifiedDate(new Date()); rclient = cs.update(rclient); request.getSession().setAttribute(Name.ACCOUNT,rclient); response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); }else{ request.setAttribute(Name.FORM, form); request.setAttribute(Name.CLIENT, client); this.getServletContext().getRequestDispatcher(Name.UPDATE_CLIENT_FORM).forward(request,response); } } private void addClientGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ if(request.getSession().getAttribute(Name.ACCOUNT) == null){ this.getServletContext().getRequestDispatcher(Name.ADD_CLIENT_FORM).forward(request, response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } private void UpdateClientGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ HttpSession session = request.getSession(); //check if the client is logged if(session.getAttribute(Name.ACCOUNT_TYPE) != null && ((String)session.getAttribute(Name.ACCOUNT_TYPE)).equals("client") ){ Client client =(Client)session.getAttribute(Name.ACCOUNT); //fill old information in a new client object Client clientUpdate = new Client(); clientUpdate.setEmail(client.getEmail()); clientUpdate.setPerson(client.getPerson());; clientUpdate.setPassword(client.getPassword()); clientUpdate.setPhone(client.getPhone()); //set the information in the request request.setAttribute(Name.CLIENT, clientUpdate); //display the form with old values this.getServletContext().getRequestDispatcher(Name.UPDATE_CLIENT_FORM).forward(request,response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } }
UTF-8
Java
6,675
java
ClientController.java
Java
[ { "context": "tEmail(client.getEmail());\n\t\t\trclient.setPassword(client.getPassword());\n\t\t\trclient.setPhone(client.getPhone());\n\t\t\trc", "end": 4487, "score": 0.7802176475524902, "start": 4469, "tag": "PASSWORD", "value": "client.getPassword" }, { "context": "client.getPers...
null
[]
package com.ensa.controllers; import java.io.IOException; import java.util.Date; import javax.ejb.EJB; import javax.ejb.EJBException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.ensa.forms.ClientForm; import com.ensa.models.Client; import com.ensa.service.ClientService; import com.ensa.util.Name; @WebServlet(value={"/client","/client/add","/client/update"}) public class ClientController extends HttpServlet { private static final long serialVersionUID = 1L; @EJB ClientService cs; public ClientController() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getServletPath().equals("/client/add")){ addClientGet(request,response); }else if(request.getServletPath().equals("/client/update")){ UpdateClientGet(request,response); }else if(request.getServletPath().equals("/client")){ clientProfil(request,response); } else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getServletPath().equals("/client/add")){ addClientPost(request,response); }else if(request.getServletPath().equals("/client/update")){ updateClientPost(request,response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } private void clientProfil(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ HttpSession session = request.getSession(); if(session.getAttribute(Name.ACCOUNT) != null && ((String)session.getAttribute(Name.ACCOUNT_TYPE)).equals("client") ){ Client client = (Client)session.getAttribute(Name.ACCOUNT); request.setAttribute(Name.CLIENT, client); this.getServletContext().getRequestDispatcher(Name.PROFIL_CLIENT_PAGE).forward(request,response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } private void addClientPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ //validate the form values ClientForm form = new ClientForm(); Client client = form.addClient(request); if(form.getResult().equals("true")){ //set client info client.getInfo().setLastModifiedDate(new Date()); client.getInfo().setLastLoginDate(new Date()); client.getInfo().setRegistratioDate(new Date()); client.getInfo().setNumbers_logons(1); client.setStatus(true); try{ if(cs.getClient(client.getEmail()) == null){ client = cs.add(client); System.out.println("||the client added"); request.getSession().setAttribute(Name.ACCOUNT, client); request.getSession().setAttribute(Name.ACCOUNT_TYPE, "client"); response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); }else{ request.setAttribute(Name.FORM, form); request.setAttribute(Name.CLIENT, client); request.setAttribute(Name.USED_EMAIL,"l'email que vous avez entrez est deja utilise , veuillez choisir une autre adresse email"); this.getServletContext().getRequestDispatcher(Name.ADD_CLIENT_FORM).forward(request,response); } }catch(EJBException e){ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } }else{ //display the form with the errors attached to it when some exception occurs request.setAttribute(Name.FORM, form); request.setAttribute(Name.CLIENT, client); this.getServletContext().getRequestDispatcher(Name.ADD_CLIENT_FORM).forward(request,response); } } private void updateClientPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ //verifing the form using the addClientForm because add and update had the same fields ClientForm form = new ClientForm(); Client client = form.addClient(request); if(form.getResult().equals("true")){ Client rclient = (Client)request.getSession().getAttribute(Name.ACCOUNT); rclient.setEmail(client.getEmail()); rclient.setPassword(<PASSWORD>()); rclient.setPhone(client.getPhone()); rclient.getPerson().setBirth(client.getPerson().getBirth()); rclient.getPerson().setFirstname(client.getPerson().getFirstname()); rclient.getPerson().setLastname(client.getPerson().getLastname()); rclient.getPerson().setGender(client.getPerson().getGender()); rclient.getInfo().setLastModifiedDate(new Date()); rclient = cs.update(rclient); request.getSession().setAttribute(Name.ACCOUNT,rclient); response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); }else{ request.setAttribute(Name.FORM, form); request.setAttribute(Name.CLIENT, client); this.getServletContext().getRequestDispatcher(Name.UPDATE_CLIENT_FORM).forward(request,response); } } private void addClientGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ if(request.getSession().getAttribute(Name.ACCOUNT) == null){ this.getServletContext().getRequestDispatcher(Name.ADD_CLIENT_FORM).forward(request, response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } private void UpdateClientGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ HttpSession session = request.getSession(); //check if the client is logged if(session.getAttribute(Name.ACCOUNT_TYPE) != null && ((String)session.getAttribute(Name.ACCOUNT_TYPE)).equals("client") ){ Client client =(Client)session.getAttribute(Name.ACCOUNT); //fill old information in a new client object Client clientUpdate = new Client(); clientUpdate.setEmail(client.getEmail()); clientUpdate.setPerson(client.getPerson());; clientUpdate.setPassword(<PASSWORD>()); clientUpdate.setPhone(client.getPhone()); //set the information in the request request.setAttribute(Name.CLIENT, clientUpdate); //display the form with old values this.getServletContext().getRequestDispatcher(Name.UPDATE_CLIENT_FORM).forward(request,response); }else{ response.sendRedirect(this.getServletContext().getContextPath()+Name.HOME); } } }
6,659
0.741423
0.741124
188
34.505318
34.369781
134
false
false
0
0
0
0
0
0
2.803191
false
false
15
a2e04e0d710c250c3252749c87f656e9efa416f3
7,773,890,825,301
e7f2f616c5e8340aa2f234833bf43d6bf2cbdcb0
/Matrix_Multiply_Leidos/src/test/TestMatrixMultiply.java
12f371e656c65269dda4e823a9181f3d2921ee0d
[]
no_license
aratikaushik/hunter-test
https://github.com/aratikaushik/hunter-test
65332a4871f2ea712e052a5fe46c69083d0640c2
fc9de81ab7ec6d1d1b050391a525ec2fd6aacaa7
refs/heads/master
2021-01-10T13:55:49.346000
2015-10-20T18:38:08
2015-10-20T18:38:08
44,137,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test; import src.MatrixMultiply; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import java.util.Vector; public class TestMatrixMultiply { static Vector<Vector<Double>> mat1; static Vector<Vector<Double>> mat2; static Vector<Vector<Double>> mat3; static Vector<Vector<Double>> mult23; static Vector<Vector<Double>> res; @Before public void initialize() { mat1 = new Vector<Vector<Double>>(2); Vector<Double> temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 0); mat1.add(temp); temp = new Vector<Double>(2); temp.add((double) 0); temp.add((double) 1); mat1.add(temp); mat2 = new Vector<Vector<Double>>(2); temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 2); mat2.add(temp); temp = new Vector<Double>(2); temp.add((double) 3); temp.add((double) 4); mat2.add(temp); mat3 = new Vector<Vector<Double>>(2); temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 1); mat3.add(temp); temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 1); mat3.add(temp); mult23 = new Vector<Vector<Double>>(2); temp = new Vector<Double>(2); temp.add((double) 3); temp.add((double) 3); mult23.add(temp); temp = new Vector<Double>(2); temp.add((double) 7); temp.add((double) 7); mult23.add(temp); } @Before public void setup() { res = new Vector<Vector<Double>>(); } @Test public void mat_test_12() { MatrixMultiply.multiply(mat1, mat2, res); assertEquals(mat2, res); } @Test public void mat_test_21() { MatrixMultiply.multiply(mat2, mat1, res); assertEquals(mat2, res); } @Test public void mat_test_23() { MatrixMultiply.multiply(mat2, mat3, res); assertEquals(mult23, res); } @Test public void mat_test_13() { MatrixMultiply.multiply(mat1, mat3, res); assertEquals(mat3, res); } @Test public void mat_test_31() { MatrixMultiply.multiply(mat3, mat1, res); assertEquals(mat3, res); } }
UTF-8
Java
2,025
java
TestMatrixMultiply.java
Java
[]
null
[]
package test; import src.MatrixMultiply; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import java.util.Vector; public class TestMatrixMultiply { static Vector<Vector<Double>> mat1; static Vector<Vector<Double>> mat2; static Vector<Vector<Double>> mat3; static Vector<Vector<Double>> mult23; static Vector<Vector<Double>> res; @Before public void initialize() { mat1 = new Vector<Vector<Double>>(2); Vector<Double> temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 0); mat1.add(temp); temp = new Vector<Double>(2); temp.add((double) 0); temp.add((double) 1); mat1.add(temp); mat2 = new Vector<Vector<Double>>(2); temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 2); mat2.add(temp); temp = new Vector<Double>(2); temp.add((double) 3); temp.add((double) 4); mat2.add(temp); mat3 = new Vector<Vector<Double>>(2); temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 1); mat3.add(temp); temp = new Vector<Double>(2); temp.add((double) 1); temp.add((double) 1); mat3.add(temp); mult23 = new Vector<Vector<Double>>(2); temp = new Vector<Double>(2); temp.add((double) 3); temp.add((double) 3); mult23.add(temp); temp = new Vector<Double>(2); temp.add((double) 7); temp.add((double) 7); mult23.add(temp); } @Before public void setup() { res = new Vector<Vector<Double>>(); } @Test public void mat_test_12() { MatrixMultiply.multiply(mat1, mat2, res); assertEquals(mat2, res); } @Test public void mat_test_21() { MatrixMultiply.multiply(mat2, mat1, res); assertEquals(mat2, res); } @Test public void mat_test_23() { MatrixMultiply.multiply(mat2, mat3, res); assertEquals(mult23, res); } @Test public void mat_test_13() { MatrixMultiply.multiply(mat1, mat3, res); assertEquals(mat3, res); } @Test public void mat_test_31() { MatrixMultiply.multiply(mat3, mat1, res); assertEquals(mat3, res); } }
2,025
0.662716
0.626173
96
20.104166
14.009282
46
false
false
0
0
0
0
0
0
2.010417
false
false
15
9b1d5afbfdb9b66a370da107dcf1a225a5c6a009
22,213,570,923,107
f3e0b8792b161e3ff7bf64d536712c8b820e9c62
/pmo/src/main/java/com/clw/pmo/mvc/plugin/TabDictDao.java
ede4c29d9caf50e18256007a55bcd646a03f4d8c
[]
no_license
isurfing/com.clw.repository
https://github.com/isurfing/com.clw.repository
9b173bf7db166357bd128a9f34563b67f7ee3674
fdf6a6cf6905e5aaef6e5cf2f9520b7874009d04
refs/heads/master
2018-11-02T13:09:39.662000
2018-08-31T04:05:48
2018-08-31T04:05:48
146,063,932
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.clw.pmo.mvc.plugin; import java.util.List; import com.clw.pmo.SysConstant; import net.sf.json.JSONArray; public class TabDictDao extends BaseDao<TabDict> { public List<TabDict> getList() { String sql = " select table_name,table_comment comments from information_schema.tables where table_schema = '"+SysConstant.DBName+"' and table_type='base table' order by table_name "; return super.getList(sql, null, new TabDict(), DBType.MySQL); } public static void main(String[] args) { List<TabDict> list = new TabDictDao().getList(); System.out.println(JSONArray.fromObject(list)); } }
UTF-8
Java
627
java
TabDictDao.java
Java
[]
null
[]
package com.clw.pmo.mvc.plugin; import java.util.List; import com.clw.pmo.SysConstant; import net.sf.json.JSONArray; public class TabDictDao extends BaseDao<TabDict> { public List<TabDict> getList() { String sql = " select table_name,table_comment comments from information_schema.tables where table_schema = '"+SysConstant.DBName+"' and table_type='base table' order by table_name "; return super.getList(sql, null, new TabDict(), DBType.MySQL); } public static void main(String[] args) { List<TabDict> list = new TabDictDao().getList(); System.out.println(JSONArray.fromObject(list)); } }
627
0.717703
0.717703
19
31
41.903397
185
false
false
0
0
0
0
0
0
1.263158
false
false
15
e2efe36bfebb9c4ff49378f0efe5f2c1462a6c96
10,934,986,778,940
85df6cf0c1f681fb8401882d33690040bca8196e
/src/main/java/com.youngc.pipeline/bean/auth/StudentBean.java
f3faf971cd3de5a867196933faf1910e7f576f96
[]
no_license
bangsjm/service-kechengsheji
https://github.com/bangsjm/service-kechengsheji
5dcdf3086c88bf48835e07dcec6046816d553c6c
b99d576b050d298aaa0a593b1e146a055c018494
refs/heads/master
2020-04-09T11:39:51.697000
2018-12-07T10:33:49
2018-12-07T10:33:49
160,319,067
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.youngc.pipeline.bean.auth; import lombok.Data; @Data public class StudentBean { private String studentNumber; private String password; private String email; private String studentName; private String sex; private int entranceYear; private int identity; }
UTF-8
Java
304
java
StudentBean.java
Java
[]
null
[]
package com.youngc.pipeline.bean.auth; import lombok.Data; @Data public class StudentBean { private String studentNumber; private String password; private String email; private String studentName; private String sex; private int entranceYear; private int identity; }
304
0.720395
0.720395
21
13.476191
14.053025
38
false
false
0
0
0
0
0
0
0.428571
false
false
15
132a0c4db970c12d9bd2a2f903e751e2a6c58546
12,240,656,862,906
f54e185f653d025c971cda63c3db24e7ff9100a1
/src/main/java/pt/gapiap/proccess/validation/bean/checker/ValidationContextImpl.java
d31daae5533f3bd260a7a06d75bbf94864a667e0
[]
no_license
fabm/cloud-beans
https://github.com/fabm/cloud-beans
b559582040a74cd6fa2673e8dd36759fd50ee7ab
f5b386a1099ba61358acb1d4091c0cbff418d80c
refs/heads/master
2021-01-23T02:29:40.798000
2014-10-26T15:45:19
2014-10-26T15:45:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pt.gapiap.proccess.validation.bean.checker; import pt.gapiap.proccess.validation.LocaleFieldName; import pt.gapiap.runtime.reflection.ReflectField; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collection; public class ValidationContextImpl<T extends Annotation> implements ValidationContext<T> { ReflectField reflectField; private T annotation; private Collection<Object> failArgs; private LocaleFieldName localeFieldName; private String language; public ValidationContextImpl( ReflectField reflectField, T annotation, LocaleFieldName localeFieldName, String language ) { this.reflectField = reflectField; this.annotation = annotation; this.localeFieldName = localeFieldName; this.language = language; this.failArgs = new ArrayList<>(); } @Override public Collection<Object> failArgs() { return failArgs; } @Override public boolean isNull() { return getValue() == null; } @Override public T getAnnotation() { return annotation; } @Override public Class<?> getType() { return reflectField.getField().getType(); } @Override public String getName() { return reflectField.getField().getName(); } @Override public boolean isString() { return getType() == String.class; } @Override public boolean isCollection() { return getType().isAssignableFrom(Collection.class); } @Override public boolean isArray() { return getType().isArray(); } @Override public boolean isAPermittedNull(boolean permitted) { return permitted && isNull(); } @Override public boolean isEmptyString() { return getType() == String.class && getValue().toString().isEmpty(); } @Override public Object getValue() { return reflectField.forceGet(); } @Override public void setValue(Object value) { reflectField.forceSet(value); } @Override public String getLocalFieldName() { return localeFieldName.getLocaleFildName(getName(), reflectField.getBaseClass(), language); } @Override public Object getContainer() { return reflectField.getObject(); } }
UTF-8
Java
2,176
java
ValidationContextImpl.java
Java
[]
null
[]
package pt.gapiap.proccess.validation.bean.checker; import pt.gapiap.proccess.validation.LocaleFieldName; import pt.gapiap.runtime.reflection.ReflectField; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collection; public class ValidationContextImpl<T extends Annotation> implements ValidationContext<T> { ReflectField reflectField; private T annotation; private Collection<Object> failArgs; private LocaleFieldName localeFieldName; private String language; public ValidationContextImpl( ReflectField reflectField, T annotation, LocaleFieldName localeFieldName, String language ) { this.reflectField = reflectField; this.annotation = annotation; this.localeFieldName = localeFieldName; this.language = language; this.failArgs = new ArrayList<>(); } @Override public Collection<Object> failArgs() { return failArgs; } @Override public boolean isNull() { return getValue() == null; } @Override public T getAnnotation() { return annotation; } @Override public Class<?> getType() { return reflectField.getField().getType(); } @Override public String getName() { return reflectField.getField().getName(); } @Override public boolean isString() { return getType() == String.class; } @Override public boolean isCollection() { return getType().isAssignableFrom(Collection.class); } @Override public boolean isArray() { return getType().isArray(); } @Override public boolean isAPermittedNull(boolean permitted) { return permitted && isNull(); } @Override public boolean isEmptyString() { return getType() == String.class && getValue().toString().isEmpty(); } @Override public Object getValue() { return reflectField.forceGet(); } @Override public void setValue(Object value) { reflectField.forceSet(value); } @Override public String getLocalFieldName() { return localeFieldName.getLocaleFildName(getName(), reflectField.getBaseClass(), language); } @Override public Object getContainer() { return reflectField.getObject(); } }
2,176
0.70864
0.70864
102
20.333334
20.035915
95
false
false
0
0
0
0
0
0
0.343137
false
false
15
b5827d1ab562314152be0b67f09edb012d8e11b5
13,924,283,978,455
fb34da6c067457c08eac5ab928db17bf7b351391
/Madkit-Observer/src/main/java/madkit/models/CGRModel.java
fbad08bf9f612589dbfe91725bebcd26bd49e24e
[]
no_license
TsubameDono/Madkit-Extend
https://github.com/TsubameDono/Madkit-Extend
f5cf343b19eedb1221026c3e722f46fa9a671df9
2b5279947445ee46cc4c368477e221c51d277455
refs/heads/master
2019-07-10T06:39:34.657000
2015-10-17T11:31:22
2015-10-17T11:31:22
38,901,927
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package madkit.models; import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.Set; /** * Created by BEUGNON on 10/07/2015. */ public interface CGRModel { /** * * @return une liste */ @NotNull Set<String> getCommunities(); @NotNull Set<String> getGroups(@NotNull String community); @NotNull Set<String> getRoles(@NotNull String community, @NotNull String group); boolean haveCommunity(@NotNull String community); boolean haveGroup(@NotNull String community, @NotNull String group); boolean haveRole(@NotNull String community, @NotNull String group, @NotNull String role); void clear(); void retainsCommunities(@NotNull Set<String> keepCommunity); void retainsGroups(@NotNull String community, @NotNull Set<String> keepGroups); void retainsRoles(@NotNull String community, @NotNull String group, @NotNull Set<String> keepRoles); void addCommunity(@NotNull String community); void addGroup(@NotNull String community, @NotNull String group); void addRole(@NotNull String community, @NotNull String group, @NotNull String role); void addRoles(@NotNull String community, @NotNull String group, @NotNull Set<String> roles); void addGroups(@NotNull String community, @NotNull Set<String> groups); void addGroupsAndRoles(@NotNull String community, @NotNull Map<String, Set<String>> groupsAndRoles); }
UTF-8
Java
1,432
java
CGRModel.java
Java
[ { "context": "util.Map;\nimport java.util.Set;\n\n/**\n * Created by BEUGNON on 10/07/2015.\n */\npublic interface CGRModel {\n\n ", "end": 137, "score": 0.9985807538032532, "start": 130, "tag": "USERNAME", "value": "BEUGNON" } ]
null
[]
package madkit.models; import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.Set; /** * Created by BEUGNON on 10/07/2015. */ public interface CGRModel { /** * * @return une liste */ @NotNull Set<String> getCommunities(); @NotNull Set<String> getGroups(@NotNull String community); @NotNull Set<String> getRoles(@NotNull String community, @NotNull String group); boolean haveCommunity(@NotNull String community); boolean haveGroup(@NotNull String community, @NotNull String group); boolean haveRole(@NotNull String community, @NotNull String group, @NotNull String role); void clear(); void retainsCommunities(@NotNull Set<String> keepCommunity); void retainsGroups(@NotNull String community, @NotNull Set<String> keepGroups); void retainsRoles(@NotNull String community, @NotNull String group, @NotNull Set<String> keepRoles); void addCommunity(@NotNull String community); void addGroup(@NotNull String community, @NotNull String group); void addRole(@NotNull String community, @NotNull String group, @NotNull String role); void addRoles(@NotNull String community, @NotNull String group, @NotNull Set<String> roles); void addGroups(@NotNull String community, @NotNull Set<String> groups); void addGroupsAndRoles(@NotNull String community, @NotNull Map<String, Set<String>> groupsAndRoles); }
1,432
0.725559
0.719972
49
28.224489
33.823231
104
false
false
0
0
0
0
0
0
0.714286
false
false
15
1d863169101e31e3d7ad2bd356cb9478bca9cc74
8,796,093,034,072
721b6e996f035b664d816a4e5ba2c7bbeeb54f4e
/commonservice/src/main/java/com/naruto/mobile/framework/service/common/multimedia/video/data/APVideoRecordRsp.java
185175b1c564cf7e899e4c2df49f9af397d361a5
[]
no_license
ObitoNaruto/NarutoAndroid
https://github.com/ObitoNaruto/NarutoAndroid
6aa581d8baf73735a69d74e13b8d727981208386
ca12e476e9f5ccb5e4d4e0a437f3208a24b6f168
refs/heads/master
2021-01-19T10:25:35.473000
2018-02-12T08:01:01
2018-02-12T08:01:01
82,179,206
8
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.naruto.mobile.framework.service.common.multimedia.video.data; import android.R.integer; public class APVideoRecordRsp { public static final int CODE_SUCCESS = 0; /** * 麦克风未知错误 */ public static final int CODE_ERR_MIC_UNKNOWN_ERROR = 0; /** * 麦克风权限受限 */ public static final int CODE_ERR_MIC_PERMISSION_DENIED = 1; /** * 麦克风无效操作 */ public static final int CODE_ERR_MIC_INVALID_OPERATION = 2; /** * 麦克风读取无效值 */ public static final int CODE_ERR_MIC_BAD_VALUE = 3; /** * 获取BufferIndex异常 */ public static final int CODE_ERR_MIC_INVALID_BUFFER_INDEX = 4; /** * 停用Mic失败 */ public static final int CODE_ERR_MIC_STOP_FAILED = 5; /*********************** 视频相关 ***************************/ /** * 摄像头打开异常 */ public static final int CODE_ERR_CAMERA_OPEN = 100; public String mId = ""; public int mRspCode = -1; public int mWidth; public int mHeight; @Override public String toString() { return "APVideoRecordRsp{" + "mId='" + mId + '\'' + ", mRspCode=" + mRspCode + '}'; } }
UTF-8
Java
1,143
java
APVideoRecordRsp.java
Java
[]
null
[]
package com.naruto.mobile.framework.service.common.multimedia.video.data; import android.R.integer; public class APVideoRecordRsp { public static final int CODE_SUCCESS = 0; /** * 麦克风未知错误 */ public static final int CODE_ERR_MIC_UNKNOWN_ERROR = 0; /** * 麦克风权限受限 */ public static final int CODE_ERR_MIC_PERMISSION_DENIED = 1; /** * 麦克风无效操作 */ public static final int CODE_ERR_MIC_INVALID_OPERATION = 2; /** * 麦克风读取无效值 */ public static final int CODE_ERR_MIC_BAD_VALUE = 3; /** * 获取BufferIndex异常 */ public static final int CODE_ERR_MIC_INVALID_BUFFER_INDEX = 4; /** * 停用Mic失败 */ public static final int CODE_ERR_MIC_STOP_FAILED = 5; /*********************** 视频相关 ***************************/ /** * 摄像头打开异常 */ public static final int CODE_ERR_CAMERA_OPEN = 100; public String mId = ""; public int mRspCode = -1; public int mWidth; public int mHeight; @Override public String toString() { return "APVideoRecordRsp{" + "mId='" + mId + '\'' + ", mRspCode=" + mRspCode + '}'; } }
1,143
0.617956
0.60745
53
18.754717
20.880527
73
false
false
0
0
0
0
0
0
1.264151
false
false
15
bf028ffb3fa912cd80c1b38707b632a8a7980d7a
8,796,093,037,084
f9bcbdacffd870a7475c5a1c013c5389fbe250ca
/Ch11ActBarSpinner/src/andbas/Ch11ActBarSpinner/Ch11ActBarSpinner.java
e6d318ab756f3e3a3734f48cede1e49b20bbafbb
[]
no_license
idarfan/android41
https://github.com/idarfan/android41
5c6c2cacad7c81d23312c865aa8924fc8ec53fe3
8d1c48dd0b603c2c0e0b887142f3d109773697f2
refs/heads/master
2020-04-28T00:27:41.168000
2012-08-07T13:12:04
2012-08-07T13:12:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package andbas.Ch11ActBarSpinner; import android.app.ActionBar; import android.app.ActionBar.OnNavigationListener; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.Toast; public class Ch11ActBarSpinner extends Activity { private FragmentManager FragManager; private FragmentTransaction FragTran; private String[] stEduAry; private String stEdu; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buildViews(); //user define } private void buildViews(){ ArrayAdapter <CharSequence> adEduList = ArrayAdapter.createFromResource( this, R.array.spnEduList, android.R.layout.simple_spinner_dropdown_item); stEduAry = getResources().getStringArray(R.array.spnEduList); ActionBar actBar = getActionBar(); actBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actBar.setListNavigationCallbacks(adEduList, ListNaviCallback); } private OnNavigationListener ListNaviCallback = new OnNavigationListener() { public boolean onNavigationItemSelected(int position, long itemId) { SpinnerFragment newFragment = new SpinnerFragment(); FragManager = getFragmentManager(); FragTran = FragManager.beginTransaction(); FragTran.replace(R.id.fragcontent, newFragment, stEduAry[position]); FragTran.commit(); return true; } }; public class SpinnerFragment extends Fragment { @Override public void onAttach(Activity activity) { super.onAttach(activity); stEdu = getTag(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { TextView tvEdu = new TextView(getActivity()); tvEdu.setTextColor(Color.GREEN); tvEdu.setTextSize(20); tvEdu.setText(stEdu); Toast.makeText(Ch11ActBarSpinner.this, "教育程度為 : " + stEdu, Toast.LENGTH_SHORT).show(); return tvEdu; } } }
UTF-8
Java
2,557
java
Ch11ActBarSpinner.java
Java
[]
null
[]
package andbas.Ch11ActBarSpinner; import android.app.ActionBar; import android.app.ActionBar.OnNavigationListener; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.Toast; public class Ch11ActBarSpinner extends Activity { private FragmentManager FragManager; private FragmentTransaction FragTran; private String[] stEduAry; private String stEdu; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buildViews(); //user define } private void buildViews(){ ArrayAdapter <CharSequence> adEduList = ArrayAdapter.createFromResource( this, R.array.spnEduList, android.R.layout.simple_spinner_dropdown_item); stEduAry = getResources().getStringArray(R.array.spnEduList); ActionBar actBar = getActionBar(); actBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actBar.setListNavigationCallbacks(adEduList, ListNaviCallback); } private OnNavigationListener ListNaviCallback = new OnNavigationListener() { public boolean onNavigationItemSelected(int position, long itemId) { SpinnerFragment newFragment = new SpinnerFragment(); FragManager = getFragmentManager(); FragTran = FragManager.beginTransaction(); FragTran.replace(R.id.fragcontent, newFragment, stEduAry[position]); FragTran.commit(); return true; } }; public class SpinnerFragment extends Fragment { @Override public void onAttach(Activity activity) { super.onAttach(activity); stEdu = getTag(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { TextView tvEdu = new TextView(getActivity()); tvEdu.setTextColor(Color.GREEN); tvEdu.setTextSize(20); tvEdu.setText(stEdu); Toast.makeText(Ch11ActBarSpinner.this, "教育程度為 : " + stEdu, Toast.LENGTH_SHORT).show(); return tvEdu; } } }
2,557
0.688016
0.684872
74
33.405407
17.994682
69
false
false
0
0
0
0
0
0
1.202703
false
false
15
916a2e1fa178058e16c9f4f3852a05837f0c5e43
14,087,492,779,765
aa899e5940d26af5929a2741dcbc01114d221bc1
/core/src/main/java/com/excelsoft/dao/MststylecomponentDao.java
d17326e6b5c2487c1ef3b81d80a27a4d69888cc9
[]
no_license
sabashan/taping
https://github.com/sabashan/taping
f23fc0353b05c85d3393a07dd1475db99dd2af10
d1ccc0034d2076389ee7ead2a839a810c3b9d375
refs/heads/master
2020-06-15T12:54:02.144000
2016-12-01T12:57:48
2016-12-01T12:57:48
75,292,033
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.excelsoft.dao; import java.util.List; import com.excelsoft.dao.GenericDao; import com.excelsoft.model.Mststylecomponent; import com.excelsoft.model.MststylecomponentId; import com.excelsoft.model.Mststyleheader; /** * An interface that provides a data management interface to the * Mststylecomponent table. */ public interface MststylecomponentDao extends GenericDao<Mststylecomponent, MststylecomponentId> { /** * * @param mststyleheader * @return List<Mststylecomponent> */ public List<Mststylecomponent> getAll(Mststyleheader mststyleheader); public List<String> getAllStrings(Mststyleheader mststyleheader); public List<String> getAllStrings(String style,String location,String department,String company,String buyer) ; public List<String> getcode(); public List<Mststylecomponent> getAll(String style, String location, String department, String company, String buyer, String query); }
UTF-8
Java
935
java
MststylecomponentDao.java
Java
[]
null
[]
package com.excelsoft.dao; import java.util.List; import com.excelsoft.dao.GenericDao; import com.excelsoft.model.Mststylecomponent; import com.excelsoft.model.MststylecomponentId; import com.excelsoft.model.Mststyleheader; /** * An interface that provides a data management interface to the * Mststylecomponent table. */ public interface MststylecomponentDao extends GenericDao<Mststylecomponent, MststylecomponentId> { /** * * @param mststyleheader * @return List<Mststylecomponent> */ public List<Mststylecomponent> getAll(Mststyleheader mststyleheader); public List<String> getAllStrings(Mststyleheader mststyleheader); public List<String> getAllStrings(String style,String location,String department,String company,String buyer) ; public List<String> getcode(); public List<Mststylecomponent> getAll(String style, String location, String department, String company, String buyer, String query); }
935
0.793583
0.793583
29
31.275862
29.14399
116
false
false
0
0
0
0
0
0
1.275862
false
false
15
09de477c68f2fddc5686365108a3625bf9063d3c
5,179,730,602,970
d88a66969fa0c83830932e360cc40586585a90a8
/Basics/src/practices/DivisibleBy3and5.java
bf8c02b30df47623c780634620e75ce749dbdc23
[]
no_license
SarathPotluri456/Core-Java-Programs
https://github.com/SarathPotluri456/Core-Java-Programs
566565e1237fa8ad1fac87b5466a031666e6d1b5
34970a767c748ea20435f439efc77ea14af844f8
refs/heads/master
2021-09-07T08:28:41.506000
2018-02-20T09:02:51
2018-02-20T09:02:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package practices; public class DivisibleBy3and5 { public static void main(String []args) { System.out.println("The numbers Which are divisible by 3:"); for(int i=0;i<=100;i++) { if(i%3==0) { System.out.print(i+","); } } System.out.println(); System.out.println("The numbers Which are divisible by 5:"); for(int i=0;i<=100;i++) { if(i%5==0) { System.out.print(i+","); } } System.out.println(); System.out.println("The numbers Which are divisible by 3 and 5:"); for(int i=0;i<=100;i++) { if((i%3==0)&&(i%5==0)) { System.out.print(i+","); } } } }
UTF-8
Java
747
java
DivisibleBy3and5.java
Java
[]
null
[]
package practices; public class DivisibleBy3and5 { public static void main(String []args) { System.out.println("The numbers Which are divisible by 3:"); for(int i=0;i<=100;i++) { if(i%3==0) { System.out.print(i+","); } } System.out.println(); System.out.println("The numbers Which are divisible by 5:"); for(int i=0;i<=100;i++) { if(i%5==0) { System.out.print(i+","); } } System.out.println(); System.out.println("The numbers Which are divisible by 3 and 5:"); for(int i=0;i<=100;i++) { if((i%3==0)&&(i%5==0)) { System.out.print(i+","); } } } }
747
0.467202
0.432396
40
16.674999
17.608788
70
false
false
0
0
0
0
0
0
2.725
false
false
15
fb7f1f3387e16808db8306ccb81fb100d94fd594
15,384,572,892,407
5fefd391eb870a68a0178b0fe6a56ab8483a47b5
/android/src/main/java/wakelock/wakelock/WakelockPlugin.java
48f58d682b3e6c8836a4395713e88df07a2d5a5e
[ "BSD-3-Clause" ]
permissive
amazingrace/wakelock
https://github.com/amazingrace/wakelock
8e828af2d77640ab255da020e3c07275088bb7b1
8bc419923e45d2527105d61f914d631114e46bcb
refs/heads/master
2020-12-13T00:51:50.322000
2020-01-16T08:23:24
2020-01-16T08:23:24
234,270,181
0
0
BSD-3-Clause
true
2020-01-16T08:21:36
2020-01-16T08:21:36
2020-01-03T06:24:12
2019-12-11T15:42:36
186
0
0
0
null
false
false
package wakelock.wakelock; import android.view.WindowManager; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugin.common.PluginRegistry.Registrar; public class WakelockPlugin implements MethodCallHandler { private Registrar registrar; private WakelockPlugin(Registrar registrar) { this.registrar = registrar; } public static void registerWith(Registrar registrar) { final MethodChannel channel = new MethodChannel(registrar.messenger(), "wakelock"); channel.setMethodCallHandler(new WakelockPlugin(registrar)); } private boolean isEnabled() { return (registrar.activity().getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) != 0; } @Override public void onMethodCall(MethodCall call, Result result) { if (call.method.equals("toggle")) { final boolean enable = call.argument("enable"), enabled = isEnabled(); if (enable) { if (!enabled) registrar.activity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else if (enabled) { registrar.activity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } result.success(null); } else if (call.method.equals("isEnabled")) { result.success(isEnabled()); } else { result.notImplemented(); } } }
UTF-8
Java
1,535
java
WakelockPlugin.java
Java
[]
null
[]
package wakelock.wakelock; import android.view.WindowManager; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugin.common.PluginRegistry.Registrar; public class WakelockPlugin implements MethodCallHandler { private Registrar registrar; private WakelockPlugin(Registrar registrar) { this.registrar = registrar; } public static void registerWith(Registrar registrar) { final MethodChannel channel = new MethodChannel(registrar.messenger(), "wakelock"); channel.setMethodCallHandler(new WakelockPlugin(registrar)); } private boolean isEnabled() { return (registrar.activity().getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) != 0; } @Override public void onMethodCall(MethodCall call, Result result) { if (call.method.equals("toggle")) { final boolean enable = call.argument("enable"), enabled = isEnabled(); if (enable) { if (!enabled) registrar.activity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else if (enabled) { registrar.activity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } result.success(null); } else if (call.method.equals("isEnabled")) { result.success(isEnabled()); } else { result.notImplemented(); } } }
1,535
0.723127
0.722476
45
33.111111
28.538647
100
false
false
0
0
0
0
0
0
0.466667
false
false
15
664a5dc9faa8f13c4689b6325feb9bc12231d96f
29,283,087,052,904
2496262efc374af6e22d604dd61b50bfadf64b26
/app/src/main/java/com/uphealth/cn/ui/login/PhoneBandActivity.java
ee7710dc88d54c9cf01b7db2240e929ee86c8bcf
[]
no_license
gitdahai/apu
https://github.com/gitdahai/apu
1044e45ee540ca347ebd2cc3439bc3f61abd7553
29fc78df3c6d971fba09e12dbd3ba98daa8fef2d
refs/heads/master
2021-01-15T15:32:36.862000
2016-08-19T00:54:57
2016-08-19T00:54:57
65,005,827
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.uphealth.cn.ui.login; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.uphealth.cn.R; import com.uphealth.cn.data.Contants; import com.uphealth.cn.data.GlobalData; import com.uphealth.cn.data.StringClass; import com.uphealth.cn.loadimage.LoadImage; import com.uphealth.cn.network.ErrorMsg; import com.uphealth.cn.utils.Utils; import com.uphealth.cn.widget.CircularImage; import org.json.JSONException; import org.json.JSONObject; /** * @description 登录 * @data 2016年5月13日 * @author jun.wang */ public class PhoneBandActivity extends BaseActivity implements OnClickListener { private TextView text_error_phone , text_error_code , text_phone_code; private EditText edit_phone , edit_password; private static final int COUNT_SECONT_ID = 1000; // 计时递增的Id private static final int END_COUNT_SECONT_ID = 1001;// 停止计时的ID private static final int VERFICATE_PHONE_CODE = 1002; private int mCountSecondNum = 60; // 倒数计时起始数字 private Button next ; private CircularImage headImage ; LoadImage loadImage ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_phone_band); init() ; } private void init(){ loadImage = LoadImage.getInstance() ; ((TextView)findViewById(R.id.title)).setText("绑定手机"); findViewById(R.id.back).setOnClickListener(this); findViewById(R.id.next).setOnClickListener(this); next = (Button)this.findViewById(R.id.next) ; ((Button)findViewById(R.id.next)).setText("下一步"); findViewById(R.id.text_phone_code).setOnClickListener(this); edit_phone = (EditText)this.findViewById(R.id.edit_phone) ; edit_password = (EditText)this.findViewById(R.id.edit_password) ; text_phone_code = (TextView)this.findViewById(R.id.text_phone_code) ; text_error_phone = (TextView)this.findViewById(R.id.text_error_phone) ; text_error_code = (TextView)this.findViewById(R.id.text_error_code) ; headImage = (CircularImage)this.findViewById(R.id.headImage) ; showImage() ; initEditListener() ; } private void initEditListener(){ edit_phone.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) { if(s.toString().length() == 11){ text_phone_code.setBackgroundResource(R.drawable.verification_cornor); text_phone_code.setEnabled(true); if(edit_password.getText().toString().length() == 6){ next.setBackgroundResource(R.drawable.login_cornor); next.setEnabled(true); } }else { text_phone_code.setBackgroundResource(R.drawable.verification_cornor_default); text_phone_code.setEnabled(false); next.setBackgroundResource(R.drawable.login_cornor_default); next.setEnabled(false); } } }); edit_password.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) { // 手机号满足的情况下 if(edit_phone.getText().toString().length() == 11){ if(s.toString().length() == 6){ next.setBackgroundResource(R.drawable.login_cornor); next.setEnabled(true); }else { next.setBackgroundResource(R.drawable.login_cornor_default); next.setEnabled(false); } } } }); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.back: finish(); break; case R.id.next: next() ; break ; case R.id.text_phone_code: getPhoneCode() ; break ; default: break; } } // 获取短信验证码 private void getPhoneCode(){ if(!Utils.isMobileNO(edit_phone.getText().toString())){ text_error_phone.setVisibility(View.VISIBLE); return ; } text_error_phone.setVisibility(View.GONE); text_phone_code.setClickable(false); text_phone_code.setTextColor(getResources().getColor(R.color.white)); mCountHandler.post(mCountRunnable); text_phone_code.setBackgroundResource((R.drawable.verification_cornor_default)); } private Handler mCountHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case COUNT_SECONT_ID: // 计时中,刷新计时数据 text_phone_code.setText(msg.arg1 + ""); mCountHandler.postDelayed(mCountRunnable, 1000); break; // 结束计时 case END_COUNT_SECONT_ID: text_phone_code.setClickable(true); text_phone_code.setTextColor(getResources().getColor(R.color.white)); // 恢复倒数计时数据 mCountSecondNum = 60; mCountHandler.removeCallbacks(mCountRunnable); text_phone_code .setText(StringClass.FSIRT_PAY_DETAIL_REQUEST_MSG_REGET_CODE); break; default: break; } }; }; private Runnable mCountRunnable = new Runnable() { public void run() { Message msg = new Message(); msg.what = COUNT_SECONT_ID; msg.arg1 = mCountSecondNum--; if (mCountSecondNum >= 0) { mCountHandler.sendMessage(msg); // 倒数计时,刷新界面显示(一秒鐘刷新一次) } else { // 当倒数至零的时候,停止计时 mCountHandler.removeCallbacks(mCountRunnable); mCountHandler.sendEmptyMessage(END_COUNT_SECONT_ID); } } }; private void next(){ if(!Utils.isMobileNO(edit_phone.getText().toString())){ text_error_phone.setVisibility(View.VISIBLE); return ; } text_error_code.setVisibility(View.GONE); requestNext() ; } private void requestNext(){ // 验证手机验证码无误后 showDialog(); StringBuilder builder = new StringBuilder() ; builder.append(Contants.updatePersonInfo) ; builder.append("?accountId=").append(GlobalData.thirdAccountId) .append("&nickName=").append(GlobalData.thirdBean.getName()) .append("&sex=").append(GlobalData.thirdBean.getGender()) .append("&pitUrl=").append(GlobalData.thirdBean.getPicUrl()); System.out.println("builder=="+builder.toString()); StringRequest stringRequest = new StringRequest(Request.Method.GET, builder.toString(), new Response.Listener<String>() { @Override public void onResponse(String arg0) { closeDialog() ; try { System.out.println("arg0=" +arg0); JSONObject json = new JSONObject(arg0) ; int result = json.getInt("result") ; String data = json.getString("data") ; if(result == 1){ GlobalData.isThird = true ; Intent intent = new Intent(PhoneBandActivity.this , PersonActivity.class) ; startActivity(intent); GlobalData.savePhone(PhoneBandActivity.this, edit_phone.getText().toString()); GlobalData.saveUserId(PhoneBandActivity.this, data); GlobalData.saveFirst(PhoneBandActivity.this, "0"); }else { showToast("手机号绑定成功!请设置个人信息!"); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { closeDialog() ; showToast(ErrorMsg.net_error) ; } }); //为此get请求设置一个Tag属性 stringRequest.setTag("GET_TAG"); //将此get请求加入 requestQueue.add(stringRequest); } private void showImage(){ headImage.setTag(GlobalData.thirdBean.getPicUrl()); loadImage.addTask(GlobalData.thirdBean.getPicUrl(), headImage); loadImage.doTask(); } }
UTF-8
Java
8,579
java
PhoneBandActivity.java
Java
[ { "context": "* @description 登录 \n * @data 2016年5月13日\n\n * @author jun.wang\n */\npublic class PhoneBandActivity extends BaseAc", "end": 967, "score": 0.9995096921920776, "start": 959, "tag": "NAME", "value": "jun.wang" } ]
null
[]
package com.uphealth.cn.ui.login; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.uphealth.cn.R; import com.uphealth.cn.data.Contants; import com.uphealth.cn.data.GlobalData; import com.uphealth.cn.data.StringClass; import com.uphealth.cn.loadimage.LoadImage; import com.uphealth.cn.network.ErrorMsg; import com.uphealth.cn.utils.Utils; import com.uphealth.cn.widget.CircularImage; import org.json.JSONException; import org.json.JSONObject; /** * @description 登录 * @data 2016年5月13日 * @author jun.wang */ public class PhoneBandActivity extends BaseActivity implements OnClickListener { private TextView text_error_phone , text_error_code , text_phone_code; private EditText edit_phone , edit_password; private static final int COUNT_SECONT_ID = 1000; // 计时递增的Id private static final int END_COUNT_SECONT_ID = 1001;// 停止计时的ID private static final int VERFICATE_PHONE_CODE = 1002; private int mCountSecondNum = 60; // 倒数计时起始数字 private Button next ; private CircularImage headImage ; LoadImage loadImage ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_phone_band); init() ; } private void init(){ loadImage = LoadImage.getInstance() ; ((TextView)findViewById(R.id.title)).setText("绑定手机"); findViewById(R.id.back).setOnClickListener(this); findViewById(R.id.next).setOnClickListener(this); next = (Button)this.findViewById(R.id.next) ; ((Button)findViewById(R.id.next)).setText("下一步"); findViewById(R.id.text_phone_code).setOnClickListener(this); edit_phone = (EditText)this.findViewById(R.id.edit_phone) ; edit_password = (EditText)this.findViewById(R.id.edit_password) ; text_phone_code = (TextView)this.findViewById(R.id.text_phone_code) ; text_error_phone = (TextView)this.findViewById(R.id.text_error_phone) ; text_error_code = (TextView)this.findViewById(R.id.text_error_code) ; headImage = (CircularImage)this.findViewById(R.id.headImage) ; showImage() ; initEditListener() ; } private void initEditListener(){ edit_phone.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) { if(s.toString().length() == 11){ text_phone_code.setBackgroundResource(R.drawable.verification_cornor); text_phone_code.setEnabled(true); if(edit_password.getText().toString().length() == 6){ next.setBackgroundResource(R.drawable.login_cornor); next.setEnabled(true); } }else { text_phone_code.setBackgroundResource(R.drawable.verification_cornor_default); text_phone_code.setEnabled(false); next.setBackgroundResource(R.drawable.login_cornor_default); next.setEnabled(false); } } }); edit_password.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) { // 手机号满足的情况下 if(edit_phone.getText().toString().length() == 11){ if(s.toString().length() == 6){ next.setBackgroundResource(R.drawable.login_cornor); next.setEnabled(true); }else { next.setBackgroundResource(R.drawable.login_cornor_default); next.setEnabled(false); } } } }); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.back: finish(); break; case R.id.next: next() ; break ; case R.id.text_phone_code: getPhoneCode() ; break ; default: break; } } // 获取短信验证码 private void getPhoneCode(){ if(!Utils.isMobileNO(edit_phone.getText().toString())){ text_error_phone.setVisibility(View.VISIBLE); return ; } text_error_phone.setVisibility(View.GONE); text_phone_code.setClickable(false); text_phone_code.setTextColor(getResources().getColor(R.color.white)); mCountHandler.post(mCountRunnable); text_phone_code.setBackgroundResource((R.drawable.verification_cornor_default)); } private Handler mCountHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case COUNT_SECONT_ID: // 计时中,刷新计时数据 text_phone_code.setText(msg.arg1 + ""); mCountHandler.postDelayed(mCountRunnable, 1000); break; // 结束计时 case END_COUNT_SECONT_ID: text_phone_code.setClickable(true); text_phone_code.setTextColor(getResources().getColor(R.color.white)); // 恢复倒数计时数据 mCountSecondNum = 60; mCountHandler.removeCallbacks(mCountRunnable); text_phone_code .setText(StringClass.FSIRT_PAY_DETAIL_REQUEST_MSG_REGET_CODE); break; default: break; } }; }; private Runnable mCountRunnable = new Runnable() { public void run() { Message msg = new Message(); msg.what = COUNT_SECONT_ID; msg.arg1 = mCountSecondNum--; if (mCountSecondNum >= 0) { mCountHandler.sendMessage(msg); // 倒数计时,刷新界面显示(一秒鐘刷新一次) } else { // 当倒数至零的时候,停止计时 mCountHandler.removeCallbacks(mCountRunnable); mCountHandler.sendEmptyMessage(END_COUNT_SECONT_ID); } } }; private void next(){ if(!Utils.isMobileNO(edit_phone.getText().toString())){ text_error_phone.setVisibility(View.VISIBLE); return ; } text_error_code.setVisibility(View.GONE); requestNext() ; } private void requestNext(){ // 验证手机验证码无误后 showDialog(); StringBuilder builder = new StringBuilder() ; builder.append(Contants.updatePersonInfo) ; builder.append("?accountId=").append(GlobalData.thirdAccountId) .append("&nickName=").append(GlobalData.thirdBean.getName()) .append("&sex=").append(GlobalData.thirdBean.getGender()) .append("&pitUrl=").append(GlobalData.thirdBean.getPicUrl()); System.out.println("builder=="+builder.toString()); StringRequest stringRequest = new StringRequest(Request.Method.GET, builder.toString(), new Response.Listener<String>() { @Override public void onResponse(String arg0) { closeDialog() ; try { System.out.println("arg0=" +arg0); JSONObject json = new JSONObject(arg0) ; int result = json.getInt("result") ; String data = json.getString("data") ; if(result == 1){ GlobalData.isThird = true ; Intent intent = new Intent(PhoneBandActivity.this , PersonActivity.class) ; startActivity(intent); GlobalData.savePhone(PhoneBandActivity.this, edit_phone.getText().toString()); GlobalData.saveUserId(PhoneBandActivity.this, data); GlobalData.saveFirst(PhoneBandActivity.this, "0"); }else { showToast("手机号绑定成功!请设置个人信息!"); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { closeDialog() ; showToast(ErrorMsg.net_error) ; } }); //为此get请求设置一个Tag属性 stringRequest.setTag("GET_TAG"); //将此get请求加入 requestQueue.add(stringRequest); } private void showImage(){ headImage.setTag(GlobalData.thirdBean.getPicUrl()); loadImage.addTask(GlobalData.thirdBean.getPicUrl(), headImage); loadImage.doTask(); } }
8,579
0.670204
0.665019
291
27.498281
23.285082
94
false
false
0
0
0
0
0
0
2.659794
false
false
15
596cf7e098c8cab87b305108b3479fec721854c4
19,164,144,076,403
7cf0dcc2a3b76570823eb1c72f3976bcdd965fb2
/NooLabSomFluid/src/org/NooLab/somfluid/components/SynonymicalsIdentifier.java
40492f08f30ee7e8b9c23f43eca90960f562dc8a
[]
no_license
Girshwick/noolabsomfluid
https://github.com/Girshwick/noolabsomfluid
ecfb3525b81795048095249d972366e9626682f0
d1418e02f6db3ef6d1134670797357e26f5bc3ce
refs/heads/master
2021-01-25T05:21:37.894000
2012-11-05T18:53:02
2012-11-05T18:53:02
34,005,834
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.NooLab.somfluid.components; public class SynonymicalsIdentifier { ModelOptimizer modelOptimizer ; SomModelDescription modelDescription ; // ======================================================================== public SynonymicalsIdentifier( ModelOptimizer mopti, SomModelDescription modeldescr) { modelOptimizer = mopti; modelDescription = modeldescr ; } // ======================================================================== }
UTF-8
Java
496
java
SynonymicalsIdentifier.java
Java
[]
null
[]
package org.NooLab.somfluid.components; public class SynonymicalsIdentifier { ModelOptimizer modelOptimizer ; SomModelDescription modelDescription ; // ======================================================================== public SynonymicalsIdentifier( ModelOptimizer mopti, SomModelDescription modeldescr) { modelOptimizer = mopti; modelDescription = modeldescr ; } // ======================================================================== }
496
0.506048
0.506048
21
21.619047
28.00251
87
false
false
0
0
0
0
72
0.290323
1.095238
false
false
15
adbf335dd908a0027578c36738a585dd0e12150c
2,259,152,864,692
3df2995328e6c9add779e69789ba56e4f256aeb1
/app/ix/core/plugins/PayloadPlugin.java
6a55d0cadf1125335a82a934da97e24caa7708a2
[ "Apache-2.0" ]
permissive
ncats/gsrs-play
https://github.com/ncats/gsrs-play
06b412a2aa98adefb6e58ceb942f803a33f1f4c6
95b8c1fd7fcdf869606075dbd2ba2a3b0bb10189
refs/heads/GSRS_DEV
2022-10-29T22:19:29.945000
2022-03-03T17:12:26
2022-03-03T17:12:26
223,438,068
8
3
Apache-2.0
false
2022-11-17T13:01:43
2019-11-22T16:00:47
2022-01-10T22:05:40
2022-10-28T03:18:47
593,224
7
2
18
JavaScript
false
false
package ix.core.plugins; import ix.core.controllers.FileDataFactory; import ix.core.controllers.PayloadFactory; import ix.core.models.FileData; import ix.core.models.Payload; import ix.utils.Global; import ix.utils.Util; import java.io.*; import java.nio.file.Files; import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.List; import play.Application; import play.Logger; import play.Play; import play.Plugin; import play.mvc.Http; public class PayloadPlugin extends Plugin { private static final String IX_CORE_FILES_PERSIST_LOCATION = "ix.core.files.persist.location"; private static final String PERSIST_LOCATION_DB = "<DB>"; private static final String PERSIST_LOCATION_FILE = "<NULL>"; private final Application app; private IxContext ctx; public enum PayloadPersistType{ TEMP, PERM } private String storageLocation; public PayloadPlugin (Application app) { this.app = app; storageLocation = app .configuration() .getString(PayloadPlugin.IX_CORE_FILES_PERSIST_LOCATION, PayloadPlugin.PERSIST_LOCATION_FILE); } public void onStart () { Logger.info("Loading plugin "+getClass().getName()+"..."); ctx = app.plugin(IxContext.class); if (ctx == null) throw new IllegalStateException ("IxContext plugin is not loaded!"); } public void onStop () { Logger.info("Plugin "+getClass().getName()+" stopped!"); } public boolean enabled () { return true; } public Payload createPayload (String name, String mime, InputStream is, PayloadPersistType persistType) throws Exception { MessageDigest md = MessageDigest.getInstance("SHA1"); File tmp = File.createTempFile("___", ".tmp", ctx.payload); Payload payload = new Payload(); try(OutputStream fos = new BufferedOutputStream(new FileOutputStream (tmp)); InputStream in = new DigestInputStream (new BufferedInputStream(is), md)) { //default buffersize of BufferedOutputStream is 8K byte[] buf = new byte[8192]; payload.size = 0l; int bytesRead=0; while ( (bytesRead = in.read(buf)) > 0){ fos.write(buf, 0, bytesRead); payload.size += bytesRead; } } payload.sha1 = Util.toHex(md.digest()); List<Payload> found = PayloadFactory.finder.where().eq("sha1", payload.sha1).findList(); boolean save=true; if (!found.isEmpty()){ payload = found.iterator().next(); Logger.debug("payload already loaded as "+payload.id); try{ File f=PayloadFactory.getFile(payload); if(!f.exists()){ Logger.error("Payload deleted"); } save=false; }catch(Exception e){ Logger.debug(payload.name+" file not found"); } } if (save) { payload.name = name; payload.mimeType = mime; payload.save(); if (payload.id != null) { persistFile(tmp,payload,persistType); } Logger.debug(payload.name+" => "+payload.id + " " +payload.sha1); }else{ if(getPayloadFile(payload)==null){ persistFile(tmp,payload,persistType); } } return payload; } public String getUrlForPayload(Payload p){ return Global.getRef(p)+"?format=raw"; } private File persistFile(File tmpFile, Payload payload, PayloadPersistType ptype){ //file system persist File saveFile = new File (ctx.payload, payload.id.toString()); tmpFile.renameTo(saveFile); //database persist if(ptype==PayloadPersistType.PERM){ if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_DB)){ List<FileData> found = FileDataFactory.finder.where().eq("sha1", payload.sha1).findList(); if (found.isEmpty()){ try { FileData fd = new FileData(); fd.data=inputStreamToByteArray(getPayloadAsStream(payload)); fd.mimeType=payload.mimeType; fd.sha1=payload.sha1; fd.size=payload.size; fd.save(); } catch (IOException e) { e.printStackTrace(); } } }else if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_FILE)){ //do nothing }else{ File f = new File(storageLocation); if(!f.exists()){ f.mkdirs(); } File newLoc = new File(f,payload.id.toString()); if(!newLoc.exists()){ try { Files.copy(saveFile.toPath(),newLoc.toPath()); } catch (IOException e) { e.printStackTrace(); } } } } return saveFile; } private FileData getFileDataFromPayload(Payload payload){ List<FileData> found = FileDataFactory.finder.where().eq("sha1", payload.sha1).findList(); if(found.isEmpty()){ return null; } return found.iterator().next(); } private File saveStreamLocal(Payload p, InputStream is) throws IOException, NoSuchAlgorithmException{ File tmp = File.createTempFile("___", ".tmp", ctx.payload); MessageDigest md = MessageDigest.getInstance("SHA1"); FileOutputStream fos = new FileOutputStream (tmp); DigestInputStream dis = new DigestInputStream (is, md); byte[] buf = new byte[2048]; Payload payload = new Payload (); payload.size = 0l; for (int nb; (nb = dis.read(buf, 0, buf.length)) > 0; ) { fos.write(buf, 0, nb); payload.size += nb; } dis.close(); fos.close(); payload.sha1 = Util.toHex(md.digest()); if(!payload.sha1.equals(p.sha1)){ Logger.warn("Recorded SHA1 different than computed SHA1"); } return persistFile(tmp, p,PayloadPersistType.PERM); } public Payload createPayload (String name, String mime, byte[] content) throws Exception { return createPayload (name, mime, new ByteArrayInputStream (content), PayloadPersistType.TEMP); } public Payload createPayload (String name, String mime, String content) throws Exception { return createPayload (name, mime, content.getBytes("utf8")); } private byte[] inputStreamToByteArray(InputStream is) throws IOException{ ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } /** * Create a payload from a form submission. If there is no * multi-part data associated with that field, returns null. * * The persistType gives a hint as to how the data is to * be persisted. PayloadPersistType.TEMP would imply that the * data is not expected to be used in a long term fashion, and * can be deleted from its persistence area after some time. * * PayloadPersistType.PERM implies that the data is meant to be * kept until explicitly removed. * * @param field * @param request * @param persistType * @return * @throws IOException */ public Payload parseMultiPart (String field, Http.Request request, PayloadPersistType persistType) throws IOException { Http.MultipartFormData body = request.body().asMultipartFormData(); Http.MultipartFormData.FilePart part = null; if (body != null) { part = body.getFile(field); if (part == null) { Logger.warn("Unable to parse field " +field+" in multi-part request!"); return null; } } else { Logger.warn("Request is not multi-part!"); return null; } Logger.debug("file="+part.getFilename() +" content="+part.getContentType()); Payload payload = null; try { payload = createPayload (part.getFilename(), part.getContentType(), new FileInputStream (part.getFile()),persistType); } catch (Throwable t) { Logger.trace("Can't save payload", t); } return payload; } public Payload getPayloadForFile (File f, PayloadPersistType persistType) throws IOException { Payload payload = null; try { payload = createPayload (f.getName(), "", new FileInputStream (f), persistType); }catch (Throwable t) { Logger.trace("Can't save payload", t); } return payload; } /** * By defualt, * @param field * @param request * @return * @throws IOException */ public Payload parseMultiPart (String field, Http.Request request) throws IOException { return parseMultiPart(field,request,PayloadPersistType.TEMP); } public File getPayloadFile (Payload pl) { File file = new File (ctx.payload, pl.id.toString()); if (!file.exists()) { if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_DB)){ FileData fd=getFileDataFromPayload(pl); if(fd!=null){ try{ file = saveStreamLocal(pl,new ByteArrayInputStream(fd.data)); return file; }catch(Exception e){ Logger.warn("Error caching file:" + e.getMessage()); } } return null; }else if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_FILE)){ return null; }else{ File f = new File(storageLocation); if(!f.exists()){ return null; } File newLoc = new File(f,pl.id.toString()); if(newLoc.exists()){ try{ file = saveStreamLocal(pl,new FileInputStream(newLoc)); return file; }catch(Exception e){ e.printStackTrace(); } } return null; } } return file; } public InputStream getPayloadAsStream (Payload pl) { File file = getPayloadFile (pl); if (file != null) { try { return new BufferedInputStream(new FileInputStream (file)); } catch (IOException ex) { Logger.trace("Can't open file "+file, ex); } } return null; } public InputStream getPayloadAsStreamUncompressed(Payload pl){ InputStream is = getPayloadAsStream(pl); if(is==null)return null; try { return ix.utils.Util.getUncompressedInputStreamRecursive(is); } catch (IOException e) { Logger.trace("Problem uncompressing stream", e); } return null; } }
UTF-8
Java
11,502
java
PayloadPlugin.java
Java
[]
null
[]
package ix.core.plugins; import ix.core.controllers.FileDataFactory; import ix.core.controllers.PayloadFactory; import ix.core.models.FileData; import ix.core.models.Payload; import ix.utils.Global; import ix.utils.Util; import java.io.*; import java.nio.file.Files; import java.security.DigestInputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.List; import play.Application; import play.Logger; import play.Play; import play.Plugin; import play.mvc.Http; public class PayloadPlugin extends Plugin { private static final String IX_CORE_FILES_PERSIST_LOCATION = "ix.core.files.persist.location"; private static final String PERSIST_LOCATION_DB = "<DB>"; private static final String PERSIST_LOCATION_FILE = "<NULL>"; private final Application app; private IxContext ctx; public enum PayloadPersistType{ TEMP, PERM } private String storageLocation; public PayloadPlugin (Application app) { this.app = app; storageLocation = app .configuration() .getString(PayloadPlugin.IX_CORE_FILES_PERSIST_LOCATION, PayloadPlugin.PERSIST_LOCATION_FILE); } public void onStart () { Logger.info("Loading plugin "+getClass().getName()+"..."); ctx = app.plugin(IxContext.class); if (ctx == null) throw new IllegalStateException ("IxContext plugin is not loaded!"); } public void onStop () { Logger.info("Plugin "+getClass().getName()+" stopped!"); } public boolean enabled () { return true; } public Payload createPayload (String name, String mime, InputStream is, PayloadPersistType persistType) throws Exception { MessageDigest md = MessageDigest.getInstance("SHA1"); File tmp = File.createTempFile("___", ".tmp", ctx.payload); Payload payload = new Payload(); try(OutputStream fos = new BufferedOutputStream(new FileOutputStream (tmp)); InputStream in = new DigestInputStream (new BufferedInputStream(is), md)) { //default buffersize of BufferedOutputStream is 8K byte[] buf = new byte[8192]; payload.size = 0l; int bytesRead=0; while ( (bytesRead = in.read(buf)) > 0){ fos.write(buf, 0, bytesRead); payload.size += bytesRead; } } payload.sha1 = Util.toHex(md.digest()); List<Payload> found = PayloadFactory.finder.where().eq("sha1", payload.sha1).findList(); boolean save=true; if (!found.isEmpty()){ payload = found.iterator().next(); Logger.debug("payload already loaded as "+payload.id); try{ File f=PayloadFactory.getFile(payload); if(!f.exists()){ Logger.error("Payload deleted"); } save=false; }catch(Exception e){ Logger.debug(payload.name+" file not found"); } } if (save) { payload.name = name; payload.mimeType = mime; payload.save(); if (payload.id != null) { persistFile(tmp,payload,persistType); } Logger.debug(payload.name+" => "+payload.id + " " +payload.sha1); }else{ if(getPayloadFile(payload)==null){ persistFile(tmp,payload,persistType); } } return payload; } public String getUrlForPayload(Payload p){ return Global.getRef(p)+"?format=raw"; } private File persistFile(File tmpFile, Payload payload, PayloadPersistType ptype){ //file system persist File saveFile = new File (ctx.payload, payload.id.toString()); tmpFile.renameTo(saveFile); //database persist if(ptype==PayloadPersistType.PERM){ if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_DB)){ List<FileData> found = FileDataFactory.finder.where().eq("sha1", payload.sha1).findList(); if (found.isEmpty()){ try { FileData fd = new FileData(); fd.data=inputStreamToByteArray(getPayloadAsStream(payload)); fd.mimeType=payload.mimeType; fd.sha1=payload.sha1; fd.size=payload.size; fd.save(); } catch (IOException e) { e.printStackTrace(); } } }else if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_FILE)){ //do nothing }else{ File f = new File(storageLocation); if(!f.exists()){ f.mkdirs(); } File newLoc = new File(f,payload.id.toString()); if(!newLoc.exists()){ try { Files.copy(saveFile.toPath(),newLoc.toPath()); } catch (IOException e) { e.printStackTrace(); } } } } return saveFile; } private FileData getFileDataFromPayload(Payload payload){ List<FileData> found = FileDataFactory.finder.where().eq("sha1", payload.sha1).findList(); if(found.isEmpty()){ return null; } return found.iterator().next(); } private File saveStreamLocal(Payload p, InputStream is) throws IOException, NoSuchAlgorithmException{ File tmp = File.createTempFile("___", ".tmp", ctx.payload); MessageDigest md = MessageDigest.getInstance("SHA1"); FileOutputStream fos = new FileOutputStream (tmp); DigestInputStream dis = new DigestInputStream (is, md); byte[] buf = new byte[2048]; Payload payload = new Payload (); payload.size = 0l; for (int nb; (nb = dis.read(buf, 0, buf.length)) > 0; ) { fos.write(buf, 0, nb); payload.size += nb; } dis.close(); fos.close(); payload.sha1 = Util.toHex(md.digest()); if(!payload.sha1.equals(p.sha1)){ Logger.warn("Recorded SHA1 different than computed SHA1"); } return persistFile(tmp, p,PayloadPersistType.PERM); } public Payload createPayload (String name, String mime, byte[] content) throws Exception { return createPayload (name, mime, new ByteArrayInputStream (content), PayloadPersistType.TEMP); } public Payload createPayload (String name, String mime, String content) throws Exception { return createPayload (name, mime, content.getBytes("utf8")); } private byte[] inputStreamToByteArray(InputStream is) throws IOException{ ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } /** * Create a payload from a form submission. If there is no * multi-part data associated with that field, returns null. * * The persistType gives a hint as to how the data is to * be persisted. PayloadPersistType.TEMP would imply that the * data is not expected to be used in a long term fashion, and * can be deleted from its persistence area after some time. * * PayloadPersistType.PERM implies that the data is meant to be * kept until explicitly removed. * * @param field * @param request * @param persistType * @return * @throws IOException */ public Payload parseMultiPart (String field, Http.Request request, PayloadPersistType persistType) throws IOException { Http.MultipartFormData body = request.body().asMultipartFormData(); Http.MultipartFormData.FilePart part = null; if (body != null) { part = body.getFile(field); if (part == null) { Logger.warn("Unable to parse field " +field+" in multi-part request!"); return null; } } else { Logger.warn("Request is not multi-part!"); return null; } Logger.debug("file="+part.getFilename() +" content="+part.getContentType()); Payload payload = null; try { payload = createPayload (part.getFilename(), part.getContentType(), new FileInputStream (part.getFile()),persistType); } catch (Throwable t) { Logger.trace("Can't save payload", t); } return payload; } public Payload getPayloadForFile (File f, PayloadPersistType persistType) throws IOException { Payload payload = null; try { payload = createPayload (f.getName(), "", new FileInputStream (f), persistType); }catch (Throwable t) { Logger.trace("Can't save payload", t); } return payload; } /** * By defualt, * @param field * @param request * @return * @throws IOException */ public Payload parseMultiPart (String field, Http.Request request) throws IOException { return parseMultiPart(field,request,PayloadPersistType.TEMP); } public File getPayloadFile (Payload pl) { File file = new File (ctx.payload, pl.id.toString()); if (!file.exists()) { if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_DB)){ FileData fd=getFileDataFromPayload(pl); if(fd!=null){ try{ file = saveStreamLocal(pl,new ByteArrayInputStream(fd.data)); return file; }catch(Exception e){ Logger.warn("Error caching file:" + e.getMessage()); } } return null; }else if(storageLocation.equals(PayloadPlugin.PERSIST_LOCATION_FILE)){ return null; }else{ File f = new File(storageLocation); if(!f.exists()){ return null; } File newLoc = new File(f,pl.id.toString()); if(newLoc.exists()){ try{ file = saveStreamLocal(pl,new FileInputStream(newLoc)); return file; }catch(Exception e){ e.printStackTrace(); } } return null; } } return file; } public InputStream getPayloadAsStream (Payload pl) { File file = getPayloadFile (pl); if (file != null) { try { return new BufferedInputStream(new FileInputStream (file)); } catch (IOException ex) { Logger.trace("Can't open file "+file, ex); } } return null; } public InputStream getPayloadAsStreamUncompressed(Payload pl){ InputStream is = getPayloadAsStream(pl); if(is==null)return null; try { return ix.utils.Util.getUncompressedInputStreamRecursive(is); } catch (IOException e) { Logger.trace("Problem uncompressing stream", e); } return null; } }
11,502
0.566423
0.562685
359
31.038998
24.057119
107
false
false
0
0
0
0
0
0
1.364902
false
false
15
bdaecf001e7fd873ffa6d6696664e3721e9c65b1
17,849,884,104,684
70d14b8e642f069a25c474e9b08c8b7c23d6e66c
/app/src/main/java/com/example/kvv2/githubrep/model/Repository.java
a729c6a5613e7178c43d09f8065e9c342296038b
[]
no_license
GhostOfSolari/GitHubRep
https://github.com/GhostOfSolari/GitHubRep
79b0271da157d2567089b4d24bf212c08659c360
36244c118520277b78329cede41df2e2a4111485
refs/heads/master
2020-03-24T08:44:21.730000
2018-08-09T11:25:11
2018-08-09T11:25:11
142,605,927
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.kvv2.githubrep.model; import com.example.kvv2.githubrep.RouterInterface; import com.example.kvv2.githubrep.model.tables.GitRepositoryTBL; import java.util.List; public class Repository implements RouterInterface.RepositoryInterface { private RouterInterface.RemoteRepositoryInterface mRemoteStorage; private RouterInterface.LocalRepositoryInterface mLocalStorage; private RouterInterface.OnGetData onGetData; private String mLastText = ""; public Repository(RouterInterface.LocalRepositoryInterface localStorage, RouterInterface.RemoteRepositoryInterface remoteStorage) { mRemoteStorage = remoteStorage; mLocalStorage = localStorage; } @Override public void getData(String s, RouterInterface.OnGetData onGetData) { this.onGetData = onGetData; if (!s.equals(mLastText)) { mLastText = s; mRemoteStorage.getData(s, onRemoteStorageGetData); } else { mLocalStorage.getData(onLocalStorageGetData); } } private RouterInterface.OnGetData onRemoteStorageGetData = new RouterInterface.OnGetData() { @Override public void callBack(List<GitRepositoryTBL> listData, boolean isSuccessful) { if (listData.size() > 0) mLocalStorage.saveData(listData); onGetData.callBack(listData, isSuccessful); } }; private RouterInterface.OnGetData onLocalStorageGetData = new RouterInterface.OnGetData() { @Override public void callBack(List<GitRepositoryTBL> listData, boolean isSuccessful) { onGetData.callBack(listData, isSuccessful); } }; }
UTF-8
Java
1,665
java
Repository.java
Java
[]
null
[]
package com.example.kvv2.githubrep.model; import com.example.kvv2.githubrep.RouterInterface; import com.example.kvv2.githubrep.model.tables.GitRepositoryTBL; import java.util.List; public class Repository implements RouterInterface.RepositoryInterface { private RouterInterface.RemoteRepositoryInterface mRemoteStorage; private RouterInterface.LocalRepositoryInterface mLocalStorage; private RouterInterface.OnGetData onGetData; private String mLastText = ""; public Repository(RouterInterface.LocalRepositoryInterface localStorage, RouterInterface.RemoteRepositoryInterface remoteStorage) { mRemoteStorage = remoteStorage; mLocalStorage = localStorage; } @Override public void getData(String s, RouterInterface.OnGetData onGetData) { this.onGetData = onGetData; if (!s.equals(mLastText)) { mLastText = s; mRemoteStorage.getData(s, onRemoteStorageGetData); } else { mLocalStorage.getData(onLocalStorageGetData); } } private RouterInterface.OnGetData onRemoteStorageGetData = new RouterInterface.OnGetData() { @Override public void callBack(List<GitRepositoryTBL> listData, boolean isSuccessful) { if (listData.size() > 0) mLocalStorage.saveData(listData); onGetData.callBack(listData, isSuccessful); } }; private RouterInterface.OnGetData onLocalStorageGetData = new RouterInterface.OnGetData() { @Override public void callBack(List<GitRepositoryTBL> listData, boolean isSuccessful) { onGetData.callBack(listData, isSuccessful); } }; }
1,665
0.72012
0.717718
47
34.425533
33.381577
135
false
false
0
0
0
0
0
0
0.553191
false
false
15
9995ad6d2243b1ca70e3f180ce7e2e87aaeeb835
17,849,884,104,051
c7945662d1ae51e15aed13bcc883816fa7940185
/frontendMY/iPet/app/src/main/java/sg/edu/ntu/e/fang0074/ipet/PetAdapter.java
18dfa472dc4bffd749ffbaddee71eab7328a0b25
[]
no_license
OrigenesZhang/cz2006project
https://github.com/OrigenesZhang/cz2006project
615ea7737ab1c4cc71446dc8028dbd9d77a50550
0527a099063bf344f6a6637d84f00764ba271995
refs/heads/master
2021-05-09T20:47:42.559000
2018-04-11T03:36:42
2018-04-11T03:36:42
118,705,045
3
1
null
false
2018-03-21T04:37:56
2018-01-24T03:15:05
2018-02-07T12:45:35
2018-03-21T04:37:56
62
1
1
0
Python
false
null
package sg.edu.ntu.e.fang0074.ipet; import android.content.Context; import android.content.Intent; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; /** * Created by Meiyi on 22/3/2018. */ // Item adapter for the pet list public class PetAdapter extends RecyclerView.Adapter<PetAdapter.HolderView> { private List<PetItem> petlist; private Context context; public PetAdapter(List<PetItem> petlist, Context context) { this.petlist = petlist; this.context = context; } @Override public HolderView onCreateViewHolder(ViewGroup parent, int viewType) { View layout = LayoutInflater.from(parent.getContext()).inflate(R.layout.custompetname, parent, false); return new HolderView(layout); } @Override public void onBindViewHolder(HolderView holder, final int position) { holder.v_name.setText(petlist.get(position).getName()); holder.itemView.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ Intent startIntent = new Intent(context, PetProfile.class); LogIn.petDAO.chooseCurrentPet(petlist.get(position).getName()); context.startActivity(startIntent); } }); } @Override public int getItemCount() { return petlist.size(); } class HolderView extends RecyclerView.ViewHolder{ TextView v_name; HolderView(View itemView) { super(itemView); v_name = (TextView)itemView.findViewById(R.id.cus_pet_name); } } }
UTF-8
Java
1,747
java
PetAdapter.java
Java
[ { "context": "xtView;\n\nimport java.util.List;\n\n/**\n * Created by Meiyi on 22/3/2018.\n */\n\n// Item adapter for the pet ", "end": 318, "score": 0.5537997484207153, "start": 315, "tag": "NAME", "value": "Mei" }, { "context": "ew;\n\nimport java.util.List;\n\n/**\n * Created by M...
null
[]
package sg.edu.ntu.e.fang0074.ipet; import android.content.Context; import android.content.Intent; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; /** * Created by Meiyi on 22/3/2018. */ // Item adapter for the pet list public class PetAdapter extends RecyclerView.Adapter<PetAdapter.HolderView> { private List<PetItem> petlist; private Context context; public PetAdapter(List<PetItem> petlist, Context context) { this.petlist = petlist; this.context = context; } @Override public HolderView onCreateViewHolder(ViewGroup parent, int viewType) { View layout = LayoutInflater.from(parent.getContext()).inflate(R.layout.custompetname, parent, false); return new HolderView(layout); } @Override public void onBindViewHolder(HolderView holder, final int position) { holder.v_name.setText(petlist.get(position).getName()); holder.itemView.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view){ Intent startIntent = new Intent(context, PetProfile.class); LogIn.petDAO.chooseCurrentPet(petlist.get(position).getName()); context.startActivity(startIntent); } }); } @Override public int getItemCount() { return petlist.size(); } class HolderView extends RecyclerView.ViewHolder{ TextView v_name; HolderView(View itemView) { super(itemView); v_name = (TextView)itemView.findViewById(R.id.cus_pet_name); } } }
1,747
0.672009
0.66514
59
28.61017
26.171545
110
false
false
0
0
0
0
0
0
0.508475
false
false
15
58f23a104d9a3fe719b7104ed1853e73b55b10f5
1,108,101,623,182
8629760ce42bc954d0d21940188e8957b2eb0ea2
/POO/TP/TP9/ReadOnlyEntry.java
a10def85723c3b1d8f4a56977b99bc768fd80a60
[ "MIT" ]
permissive
firgaty/Uni
https://github.com/firgaty/Uni
68799b598648362879ba88ae50ae7f2ba2bcf547
bc6bef6958c3708d976ea282ee35977d936fa676
refs/heads/master
2021-01-17T09:04:04.324000
2018-10-20T18:41:06
2018-10-20T18:41:06
83,975,799
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class ReadOnlyEntry extends Entry { public ReadOnlyEntry(Folder p, String n, Element e) { super(p, n, e); } @Override public void insert(Element e) { System.out.println("This entry can't be modified."); } @Override public void delete() { System.out.println("This entry can't be deleted."); } }
UTF-8
Java
309
java
ReadOnlyEntry.java
Java
[]
null
[]
class ReadOnlyEntry extends Entry { public ReadOnlyEntry(Folder p, String n, Element e) { super(p, n, e); } @Override public void insert(Element e) { System.out.println("This entry can't be modified."); } @Override public void delete() { System.out.println("This entry can't be deleted."); } }
309
0.686084
0.686084
15
19.666666
20.19791
54
false
false
0
0
0
0
0
0
1.4
false
false
15
b319576616dbe28a14b3a9b32947a3ef9a729e52
2,422,361,591,639
480ddd5d61a25d2989052dc41011c6b80257244a
/Router_Compiler/src/main/java/com/yjt/apt/router/compiler/processor/AutowireProcessor.java
dcb9025a2bd125d929a1934e28b66a5b8972cc39
[]
no_license
Crazy-Ann/AptUtils
https://github.com/Crazy-Ann/AptUtils
37c3a3f4317bdcdbd980d176366c4b8d3c81a6be
e2539bf2bb534f898fd99ce5ac180fbc968f1f89
refs/heads/master
2021-01-09T05:43:23.494000
2017-10-24T16:08:01
2017-10-24T16:08:01
80,819,635
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yjt.apt.router.compiler.processor; import com.google.auto.service.AutoService; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.yjt.apt.router.annotation.Autowire; import com.yjt.apt.router.compiler.constant.Constant; import com.yjt.apt.router.compiler.messager.Messager; import com.yjt.apt.router.compiler.utils.TypeUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.Processor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedOptions; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; import javax.lang.model.util.Types; import static javax.lang.model.element.Modifier.PUBLIC; @AutoService(Processor.class) @SupportedOptions(Constant.KEY_MODULE_NAME) @SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedAnnotationTypes({Constant.ANNOTATION_TYPE_AUTOWIRE}) public class AutowireProcessor extends AbstractProcessor { private Filer filer; // File util, write class file into disk. private Messager messager; private Types types; private Elements elements; private String moduleName; private Map<TypeElement, List<Element>> parentAndChild = new HashMap<>(); // Contain field need autowire and his super class. private static final ClassName ROUTER = ClassName.get("com.yjt.apt.router", "Router"); @Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); filer = processingEnv.getFiler(); // Generate class. types = processingEnv.getTypeUtils(); // Get type utils. elements = processingEnv.getElementUtils(); // Get class meta. messager = new Messager(processingEnv.getMessager()); // Package the log utils. // Attempt to get user configuration [moduleName] Map<String, String> options = processingEnv.getOptions(); if (MapUtils.isNotEmpty(options)) { moduleName = options.get(Constant.KEY_MODULE_NAME); } if (StringUtils.isNotEmpty(moduleName)) { moduleName = moduleName.replaceAll("[^0-9a-zA-Z_]+", ""); messager.info("The user has configuration the module name, it was [" + moduleName + "]"); } else { messager.error("These no module name, at 'build.gradle', like :\n" + "apt {\n" + " arguments {\n" + " moduleName project.getName();\n" + " }\n" + "}\n"); throw new RuntimeException("Router_AutowireProcessor::Compiler >>> No module name, for more information, look at gradle log."); } messager.info(">>> AutowireProcessor init. <<<"); } // @Override // public Set<String> getSupportedAnnotationTypes() { // return Collections.singleton(Autowire.class.getCanonicalName()); // } // // @Override // public SourceVersion getSupportedSourceVersion() { // return SourceVersion.latestSupported(); // } // // @Override // public Set<String> getSupportedOptions() { // return Sets.newHashSet(Constant.KEY_MODULE_NAME); // } @Override public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) { if (CollectionUtils.isNotEmpty(set)) { try { messager.info(">>> Found autowire field, start... <<<"); categories(roundEnvironment.getElementsAnnotatedWith(Autowire.class)); generateHelper(); } catch (IOException | IllegalAccessException e) { messager.error(e); } return true; } return false; } private void generateHelper() throws IOException, IllegalAccessException { TypeElement typeElement = elements.getTypeElement(Constant.ISYRINGE); TypeMirror iProvider = elements.getTypeElement(Constant.IPROVIDER).asType(); TypeMirror activityTm = elements.getTypeElement(Constant.ACTIVITY).asType(); TypeMirror fragmentTm = elements.getTypeElement(Constant.FRAGMENT).asType(); TypeMirror fragmentTmV4 = elements.getTypeElement(Constant.FRAGMENT_V4).asType(); if (MapUtils.isNotEmpty(parentAndChild)) { for (Map.Entry<TypeElement, List<Element>> entry : parentAndChild.entrySet()) { // Build method : 'inject' MethodSpec.Builder injectMethodBuilder = MethodSpec.methodBuilder(Constant.METHOD_INJECT) .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(ParameterSpec.builder(TypeName.OBJECT, "target").build()); TypeElement parent = entry.getKey(); List<Element> childs = entry.getValue(); String qualifiedName = parent.getQualifiedName().toString(); String packageName = qualifiedName.substring(0, qualifiedName.lastIndexOf(".")); String fileName = parent.getSimpleName() + Constant.NAME_OF_AUTOWIRE; messager.info(">>> Start process " + childs.size() + " field in " + parent.getSimpleName() + " ... <<<"); injectMethodBuilder.addStatement("$T substitute = ($T)target", ClassName.get(parent), ClassName.get(parent)); // Generate method body, start inject. for (Element element : childs) { Autowire fieldConfig = element.getAnnotation(Autowire.class); String fieldName = element.getSimpleName().toString(); if (types.isSubtype(element.asType(), iProvider)) { // It's provider if ("".equals(fieldConfig.name())) { // User has not set service path, then use byType. // Getter injectMethodBuilder.addStatement( "substitute." + fieldName + " = $T.getInstance().navigation($T.class)", ROUTER, ClassName.get(element.asType()) ); } else { // use byName // Getter injectMethodBuilder.addStatement( "substitute." + fieldName + " = ($T)$T.getInstance().build($S).navigation();", ClassName.get(element.asType()), ROUTER, fieldConfig.name() ); } // Validater if (fieldConfig.required()) { injectMethodBuilder.beginControlFlow("if (substitute." + fieldName + " == null)"); injectMethodBuilder.addStatement( "throw new RuntimeException(\"The field '" + fieldName + "' is null, in class '\" + $T.class.getName() + \"!\")", ClassName.get(parent)); injectMethodBuilder.endControlFlow(); } } else { // It's normal intent value String statment = "substitute." + fieldName + " = substitute."; boolean isActivity = false; if (types.isSubtype(parent.asType(), activityTm)) { // Activity, then use getIntent() isActivity = true; statment += "getIntent()."; } else if (types.isSubtype(parent.asType(), fragmentTm) || types.isSubtype(parent.asType(), fragmentTmV4)) { // Fragment, then use getArguments() statment += "getArguments()."; } else { throw new IllegalAccessException("The field [" + fieldName + "] need autowire from intent, its parent must be activity or fragment!"); } statment = buildStatement(statment, TypeUtil.typeExchange(element.asType()), isActivity); injectMethodBuilder.addStatement(statment, StringUtils.isEmpty(fieldConfig.name()) ? fieldName : fieldConfig.name()); // Validater if (fieldConfig.required() && !element.asType().getKind().isPrimitive()) { // Primitive wont be check. injectMethodBuilder.beginControlFlow("if (substitute." + fieldName + " == null)"); injectMethodBuilder.addStatement( "throw new RuntimeException(\"The field '" + fieldName + "' is null, in class '\" + $T.class.getName() + \"!\")", ClassName.get(parent)); injectMethodBuilder.endControlFlow(); } } } // Generate autowire helper JavaFile.builder(packageName, TypeSpec.classBuilder(fileName) .addJavadoc(Constant.WARNING_TIPS) .addSuperinterface(ClassName.get(typeElement)) .addModifiers(PUBLIC) .addMethod(injectMethodBuilder.build()) .build() ).build().writeTo(filer); messager.info(">>> " + parent.getSimpleName() + " has been processed, " + fileName + " has been generated. <<<"); } messager.info(">>> Autowire processor stop. <<<"); } } private String buildStatement(String statment, int type, boolean isActivity) { if (type == TypeKind.BOOLEAN.ordinal()) { statment += (isActivity ? ("getBooleanExtra($S, false)") : ("getBoolean($S)")); } else if (type == TypeKind.BYTE.ordinal()) { statment += (isActivity ? ("getByteExtra($S, (byte) 0)") : ("getByte($S)")); } else if (type == TypeKind.SHORT.ordinal()) { statment += (isActivity ? ("getShortExtra($S, (short) 0)") : ("getShort($S)")); } else if (type == TypeKind.INT.ordinal()) { statment += (isActivity ? ("getIntExtra($S, 0)") : ("getInt($S)")); } else if (type == TypeKind.LONG.ordinal()) { statment += (isActivity ? ("getLongExtra($S, 0)") : ("getLong($S)")); } else if (type == TypeKind.FLOAT.ordinal()) { statment += (isActivity ? ("getFloatExtra($S, 0)") : ("getFloat($S)")); } else if (type == TypeKind.DOUBLE.ordinal()) { statment += (isActivity ? ("getDoubleExtra($S, 0)") : ("getDouble($S)")); } else if (type == TypeKind.OTHER.ordinal()) { statment += (isActivity ? ("getStringExtra($S)") : ("getString($S)")); } return statment; } private void categories(Set<? extends Element> elements) throws IllegalAccessException { if (CollectionUtils.isNotEmpty(elements)) { for (Element element : elements) { TypeElement enclosingElement = (TypeElement) element.getEnclosingElement(); if (element.getModifiers().contains(Modifier.PRIVATE)) { throw new IllegalAccessException("The autowire fields CAN NOT BE 'private'!!! please check field [" + element.getSimpleName() + "] in class [" + enclosingElement.getQualifiedName() + "]"); } if (parentAndChild.containsKey(enclosingElement)) { // Has categries parentAndChild.get(enclosingElement).add(element); } else { List<Element> childs = new ArrayList<>(); childs.add(element); parentAndChild.put(enclosingElement, childs); } } messager.info("categories finished."); } } }
UTF-8
Java
13,118
java
AutowireProcessor.java
Java
[]
null
[]
package com.yjt.apt.router.compiler.processor; import com.google.auto.service.AutoService; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.yjt.apt.router.annotation.Autowire; import com.yjt.apt.router.compiler.constant.Constant; import com.yjt.apt.router.compiler.messager.Messager; import com.yjt.apt.router.compiler.utils.TypeUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.Processor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedOptions; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.Elements; import javax.lang.model.util.Types; import static javax.lang.model.element.Modifier.PUBLIC; @AutoService(Processor.class) @SupportedOptions(Constant.KEY_MODULE_NAME) @SupportedSourceVersion(SourceVersion.RELEASE_7) @SupportedAnnotationTypes({Constant.ANNOTATION_TYPE_AUTOWIRE}) public class AutowireProcessor extends AbstractProcessor { private Filer filer; // File util, write class file into disk. private Messager messager; private Types types; private Elements elements; private String moduleName; private Map<TypeElement, List<Element>> parentAndChild = new HashMap<>(); // Contain field need autowire and his super class. private static final ClassName ROUTER = ClassName.get("com.yjt.apt.router", "Router"); @Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); filer = processingEnv.getFiler(); // Generate class. types = processingEnv.getTypeUtils(); // Get type utils. elements = processingEnv.getElementUtils(); // Get class meta. messager = new Messager(processingEnv.getMessager()); // Package the log utils. // Attempt to get user configuration [moduleName] Map<String, String> options = processingEnv.getOptions(); if (MapUtils.isNotEmpty(options)) { moduleName = options.get(Constant.KEY_MODULE_NAME); } if (StringUtils.isNotEmpty(moduleName)) { moduleName = moduleName.replaceAll("[^0-9a-zA-Z_]+", ""); messager.info("The user has configuration the module name, it was [" + moduleName + "]"); } else { messager.error("These no module name, at 'build.gradle', like :\n" + "apt {\n" + " arguments {\n" + " moduleName project.getName();\n" + " }\n" + "}\n"); throw new RuntimeException("Router_AutowireProcessor::Compiler >>> No module name, for more information, look at gradle log."); } messager.info(">>> AutowireProcessor init. <<<"); } // @Override // public Set<String> getSupportedAnnotationTypes() { // return Collections.singleton(Autowire.class.getCanonicalName()); // } // // @Override // public SourceVersion getSupportedSourceVersion() { // return SourceVersion.latestSupported(); // } // // @Override // public Set<String> getSupportedOptions() { // return Sets.newHashSet(Constant.KEY_MODULE_NAME); // } @Override public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) { if (CollectionUtils.isNotEmpty(set)) { try { messager.info(">>> Found autowire field, start... <<<"); categories(roundEnvironment.getElementsAnnotatedWith(Autowire.class)); generateHelper(); } catch (IOException | IllegalAccessException e) { messager.error(e); } return true; } return false; } private void generateHelper() throws IOException, IllegalAccessException { TypeElement typeElement = elements.getTypeElement(Constant.ISYRINGE); TypeMirror iProvider = elements.getTypeElement(Constant.IPROVIDER).asType(); TypeMirror activityTm = elements.getTypeElement(Constant.ACTIVITY).asType(); TypeMirror fragmentTm = elements.getTypeElement(Constant.FRAGMENT).asType(); TypeMirror fragmentTmV4 = elements.getTypeElement(Constant.FRAGMENT_V4).asType(); if (MapUtils.isNotEmpty(parentAndChild)) { for (Map.Entry<TypeElement, List<Element>> entry : parentAndChild.entrySet()) { // Build method : 'inject' MethodSpec.Builder injectMethodBuilder = MethodSpec.methodBuilder(Constant.METHOD_INJECT) .addAnnotation(Override.class) .addModifiers(PUBLIC) .addParameter(ParameterSpec.builder(TypeName.OBJECT, "target").build()); TypeElement parent = entry.getKey(); List<Element> childs = entry.getValue(); String qualifiedName = parent.getQualifiedName().toString(); String packageName = qualifiedName.substring(0, qualifiedName.lastIndexOf(".")); String fileName = parent.getSimpleName() + Constant.NAME_OF_AUTOWIRE; messager.info(">>> Start process " + childs.size() + " field in " + parent.getSimpleName() + " ... <<<"); injectMethodBuilder.addStatement("$T substitute = ($T)target", ClassName.get(parent), ClassName.get(parent)); // Generate method body, start inject. for (Element element : childs) { Autowire fieldConfig = element.getAnnotation(Autowire.class); String fieldName = element.getSimpleName().toString(); if (types.isSubtype(element.asType(), iProvider)) { // It's provider if ("".equals(fieldConfig.name())) { // User has not set service path, then use byType. // Getter injectMethodBuilder.addStatement( "substitute." + fieldName + " = $T.getInstance().navigation($T.class)", ROUTER, ClassName.get(element.asType()) ); } else { // use byName // Getter injectMethodBuilder.addStatement( "substitute." + fieldName + " = ($T)$T.getInstance().build($S).navigation();", ClassName.get(element.asType()), ROUTER, fieldConfig.name() ); } // Validater if (fieldConfig.required()) { injectMethodBuilder.beginControlFlow("if (substitute." + fieldName + " == null)"); injectMethodBuilder.addStatement( "throw new RuntimeException(\"The field '" + fieldName + "' is null, in class '\" + $T.class.getName() + \"!\")", ClassName.get(parent)); injectMethodBuilder.endControlFlow(); } } else { // It's normal intent value String statment = "substitute." + fieldName + " = substitute."; boolean isActivity = false; if (types.isSubtype(parent.asType(), activityTm)) { // Activity, then use getIntent() isActivity = true; statment += "getIntent()."; } else if (types.isSubtype(parent.asType(), fragmentTm) || types.isSubtype(parent.asType(), fragmentTmV4)) { // Fragment, then use getArguments() statment += "getArguments()."; } else { throw new IllegalAccessException("The field [" + fieldName + "] need autowire from intent, its parent must be activity or fragment!"); } statment = buildStatement(statment, TypeUtil.typeExchange(element.asType()), isActivity); injectMethodBuilder.addStatement(statment, StringUtils.isEmpty(fieldConfig.name()) ? fieldName : fieldConfig.name()); // Validater if (fieldConfig.required() && !element.asType().getKind().isPrimitive()) { // Primitive wont be check. injectMethodBuilder.beginControlFlow("if (substitute." + fieldName + " == null)"); injectMethodBuilder.addStatement( "throw new RuntimeException(\"The field '" + fieldName + "' is null, in class '\" + $T.class.getName() + \"!\")", ClassName.get(parent)); injectMethodBuilder.endControlFlow(); } } } // Generate autowire helper JavaFile.builder(packageName, TypeSpec.classBuilder(fileName) .addJavadoc(Constant.WARNING_TIPS) .addSuperinterface(ClassName.get(typeElement)) .addModifiers(PUBLIC) .addMethod(injectMethodBuilder.build()) .build() ).build().writeTo(filer); messager.info(">>> " + parent.getSimpleName() + " has been processed, " + fileName + " has been generated. <<<"); } messager.info(">>> Autowire processor stop. <<<"); } } private String buildStatement(String statment, int type, boolean isActivity) { if (type == TypeKind.BOOLEAN.ordinal()) { statment += (isActivity ? ("getBooleanExtra($S, false)") : ("getBoolean($S)")); } else if (type == TypeKind.BYTE.ordinal()) { statment += (isActivity ? ("getByteExtra($S, (byte) 0)") : ("getByte($S)")); } else if (type == TypeKind.SHORT.ordinal()) { statment += (isActivity ? ("getShortExtra($S, (short) 0)") : ("getShort($S)")); } else if (type == TypeKind.INT.ordinal()) { statment += (isActivity ? ("getIntExtra($S, 0)") : ("getInt($S)")); } else if (type == TypeKind.LONG.ordinal()) { statment += (isActivity ? ("getLongExtra($S, 0)") : ("getLong($S)")); } else if (type == TypeKind.FLOAT.ordinal()) { statment += (isActivity ? ("getFloatExtra($S, 0)") : ("getFloat($S)")); } else if (type == TypeKind.DOUBLE.ordinal()) { statment += (isActivity ? ("getDoubleExtra($S, 0)") : ("getDouble($S)")); } else if (type == TypeKind.OTHER.ordinal()) { statment += (isActivity ? ("getStringExtra($S)") : ("getString($S)")); } return statment; } private void categories(Set<? extends Element> elements) throws IllegalAccessException { if (CollectionUtils.isNotEmpty(elements)) { for (Element element : elements) { TypeElement enclosingElement = (TypeElement) element.getEnclosingElement(); if (element.getModifiers().contains(Modifier.PRIVATE)) { throw new IllegalAccessException("The autowire fields CAN NOT BE 'private'!!! please check field [" + element.getSimpleName() + "] in class [" + enclosingElement.getQualifiedName() + "]"); } if (parentAndChild.containsKey(enclosingElement)) { // Has categries parentAndChild.get(enclosingElement).add(element); } else { List<Element> childs = new ArrayList<>(); childs.add(element); parentAndChild.put(enclosingElement, childs); } } messager.info("categories finished."); } } }
13,118
0.573182
0.571962
248
51.895161
35.92944
173
false
false
0
0
0
0
0
0
0.693548
false
false
15
db817dddadd60be2dd54a231e3855b65ed1e723a
4,054,449,169,821
9b058c67a42c84e3b9d8d92f56d0890fb96cd92e
/src/doing/timescore/ScoreOfGame.java
794b7a7bc8eb9c2fa5807c303a991ddd5ae8a5d5
[]
no_license
prodam-haski/My-Ex
https://github.com/prodam-haski/My-Ex
f0ca9853af31026d577347ef4c44b7e14eb4fa8d
47b089e46200899c5d95ea9f450452d80d38b974
refs/heads/master
2020-05-27T08:24:23.231000
2019-05-29T17:12:32
2019-05-29T17:12:32
188,544,540
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package doing.timescore; public class ScoreOfGame { private int score=0; private int progress=7; public void incrementScore(){score++;} public void incrementProgress(){progress+=7;} public int getScore(){return score;} public int getProgress(){return progress;} public void newScore(){ score=0; progress=7; } }
UTF-8
Java
362
java
ScoreOfGame.java
Java
[]
null
[]
package doing.timescore; public class ScoreOfGame { private int score=0; private int progress=7; public void incrementScore(){score++;} public void incrementProgress(){progress+=7;} public int getScore(){return score;} public int getProgress(){return progress;} public void newScore(){ score=0; progress=7; } }
362
0.657459
0.643646
16
21.625
16.446409
49
false
false
0
0
0
0
0
0
0.5625
false
false
15
9e04996ed9e906cc3e2a85da0a6ee108f591a2d9
16,569,983,860,272
62aaa67a468107022635b566cbcf1109d3e4e648
/srgk/src/private/nc/bs/hkjt/srgk/huiguan/zhangdan/ace/bp/AceHg_zhangdanUpdateBP.java
665ca121113d5dd2fd5376580d759845e976ef75
[]
no_license
boblee821226/hongkun
https://github.com/boblee821226/hongkun
f17a90221683f816f382443f5c223347b41afefc
46c02ab124924f2c976044c5f31e632f706e61cf
refs/heads/master
2021-06-25T03:57:28.516000
2021-02-22T05:42:07
2021-02-22T05:42:07
204,677,636
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package nc.bs.hkjt.srgk.huiguan.zhangdan.ace.bp; import nc.bs.hkjt.srgk.huiguan.zhangdan.plugin.bpplugin.Hg_zhangdanPluginPoint; import nc.impl.pubapp.pattern.data.bill.template.UpdateBPTemplate; import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser; import nc.impl.pubapp.pattern.rule.IRule; import nc.vo.hkjt.srgk.huiguan.zhangdan.ZhangdanBillVO; /** * 修改保存的BP * */ public class AceHg_zhangdanUpdateBP { public ZhangdanBillVO[] update(ZhangdanBillVO[] bills, ZhangdanBillVO[] originBills) { // 调用修改模板 UpdateBPTemplate<ZhangdanBillVO> bp = new UpdateBPTemplate<ZhangdanBillVO>( Hg_zhangdanPluginPoint.UPDATE); // 执行前规则 this.addBeforeRule(bp.getAroundProcesser()); // 执行后规则 this.addAfterRule(bp.getAroundProcesser()); return bp.update(bills, originBills); } private void addAfterRule(CompareAroundProcesser<ZhangdanBillVO> processer) { // TODO 后规则 IRule<ZhangdanBillVO> rule = null; rule = new nc.bs.pubapp.pub.rule.BillCodeCheckRule(); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule).setCbilltype("HK01"); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule) .setCodeItem("vbillcode"); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule) .setGroupItem("pk_group"); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule).setOrgItem("pk_org"); processer.addAfterRule(rule); } private void addBeforeRule(CompareAroundProcesser<ZhangdanBillVO> processer) { // TODO 前规则 IRule<ZhangdanBillVO> rule = null; rule = new nc.bs.pubapp.pub.rule.FillUpdateDataRule(); processer.addBeforeRule(rule); nc.impl.pubapp.pattern.rule.ICompareRule<ZhangdanBillVO> ruleCom = new nc.bs.pubapp.pub.rule.UpdateBillCodeRule(); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setCbilltype("HK01"); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setCodeItem("vbillcode"); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setGroupItem("pk_group"); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setOrgItem("pk_org"); processer.addBeforeRule(ruleCom); } }
GB18030
Java
2,164
java
AceHg_zhangdanUpdateBP.java
Java
[]
null
[]
package nc.bs.hkjt.srgk.huiguan.zhangdan.ace.bp; import nc.bs.hkjt.srgk.huiguan.zhangdan.plugin.bpplugin.Hg_zhangdanPluginPoint; import nc.impl.pubapp.pattern.data.bill.template.UpdateBPTemplate; import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser; import nc.impl.pubapp.pattern.rule.IRule; import nc.vo.hkjt.srgk.huiguan.zhangdan.ZhangdanBillVO; /** * 修改保存的BP * */ public class AceHg_zhangdanUpdateBP { public ZhangdanBillVO[] update(ZhangdanBillVO[] bills, ZhangdanBillVO[] originBills) { // 调用修改模板 UpdateBPTemplate<ZhangdanBillVO> bp = new UpdateBPTemplate<ZhangdanBillVO>( Hg_zhangdanPluginPoint.UPDATE); // 执行前规则 this.addBeforeRule(bp.getAroundProcesser()); // 执行后规则 this.addAfterRule(bp.getAroundProcesser()); return bp.update(bills, originBills); } private void addAfterRule(CompareAroundProcesser<ZhangdanBillVO> processer) { // TODO 后规则 IRule<ZhangdanBillVO> rule = null; rule = new nc.bs.pubapp.pub.rule.BillCodeCheckRule(); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule).setCbilltype("HK01"); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule) .setCodeItem("vbillcode"); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule) .setGroupItem("pk_group"); ((nc.bs.pubapp.pub.rule.BillCodeCheckRule) rule).setOrgItem("pk_org"); processer.addAfterRule(rule); } private void addBeforeRule(CompareAroundProcesser<ZhangdanBillVO> processer) { // TODO 前规则 IRule<ZhangdanBillVO> rule = null; rule = new nc.bs.pubapp.pub.rule.FillUpdateDataRule(); processer.addBeforeRule(rule); nc.impl.pubapp.pattern.rule.ICompareRule<ZhangdanBillVO> ruleCom = new nc.bs.pubapp.pub.rule.UpdateBillCodeRule(); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setCbilltype("HK01"); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setCodeItem("vbillcode"); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setGroupItem("pk_group"); ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule) ruleCom) .setOrgItem("pk_org"); processer.addBeforeRule(ruleCom); } }
2,164
0.733175
0.73128
58
34.379311
27.092325
116
false
false
0
0
0
0
0
0
1.982759
false
false
15
004394ed5d38cc53b8386dbe980bf35707627b4d
6,794,638,286,534
fadbc9a1ac774b3d85e40883541f4791e0098e2b
/app/src/main/java/assignment/microsoft/niraj/assignmentmicrosft/Activities/MainActivity.java
f0aed5aed6c8ea0be45b16f7133ebbf278c60a89
[]
no_license
pdroid007/WikiFetchMicrosoft
https://github.com/pdroid007/WikiFetchMicrosoft
92e394646245cde6b2990289d1ebd373ca106657
5afe7f9252e5e0c84231dbbb3ca9de175c7c5142
refs/heads/master
2016-09-16T20:23:28.646000
2016-06-07T08:16:21
2016-06-07T08:16:21
60,591,661
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package assignment.microsoft.niraj.assignmentmicrosft.Activities; import android.content.res.Configuration; import android.os.AsyncTask; import android.os.Bundle; import android.os.PersistableBundle; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.widget.EditText; import java.util.ArrayList; import java.util.HashMap; import assignment.microsoft.niraj.assignmentmicrosft.Adapter.RecycleViewAdapter; import assignment.microsoft.niraj.assignmentmicrosft.Asynctasks.DataFetchTask; import assignment.microsoft.niraj.assignmentmicrosft.DataModel.SearchListData; import assignment.microsoft.niraj.assignmentmicrosft.Interfaces.UIUpdater; import assignment.microsoft.niraj.assignmentmicrosft.R; import assignment.microsoft.niraj.assignmentmicrosft.Utils.Logger; public class MainActivity extends AppCompatActivity implements UIUpdater{ private static final String SEARCHLIST_DATA="searchlistData", SEARCH_KEYWORD="key"; String searchKeyword; DataFetchTask asyncTaskRef; HashMap<Integer, View> viewsMap=new HashMap<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addViewsToMap(); if(savedInstanceState!=null) { updateUI((ArrayList) savedInstanceState.getSerializable(SEARCHLIST_DATA)); searchKeyword=(String)savedInstanceState.getSerializable(SEARCH_KEYWORD); } setListenerForEditText(); } private void addViewsToMap() { viewsMap.put(R.id.mainactivity_recyclerview,findViewById(R.id.mainactivity_recyclerview)); viewsMap.put(R.id.mainactivity_search_edittext,findViewById(R.id.mainactivity_search_edittext)); viewsMap.put(R.id. activity_main_recycler_progressbar,findViewById(R.id.activity_main_recycler_progressbar)); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setOrientation(LinearLayoutManager.VERTICAL); ((RecyclerView)viewsMap.get(R.id.mainactivity_recyclerview)).setLayoutManager(manager); } private void setListenerForEditText() { ((EditText)viewsMap.get(R.id.mainactivity_search_edittext)).addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if(searchKeyword==null||!searchKeyword.equalsIgnoreCase(s.toString())) {fetchNewData(s); searchKeyword=s.toString(); } } }); } private static int PAGE_LIMIT=50, IMG_SIZE=50; //create this on non-UI thread if input not from views private HashMap addRequestToMap(Editable s) { HashMap<String, String> map=new HashMap<>(); map.put("action","query"); map.put("prop","pageimages"); map.put("format","json"); map.put("piprop","thumbnail"); map.put("pithumbsize",""+IMG_SIZE); map.put("pilimit",""+PAGE_LIMIT); map.put("generator","prefixsearch"); map.put("gpssearch",s.toString()); return map; } private void fetchNewData(Editable s) { viewsMap.get(R.id. activity_main_recycler_progressbar).setVisibility(View.VISIBLE); viewsMap.get(R.id. mainactivity_recyclerview).setVisibility(View.GONE); if(asyncTaskRef!=null&&!asyncTaskRef.isCancelled()) { asyncTaskRef.cancel(true); } if(s!=null&&s.length()>0) { asyncTaskRef = new DataFetchTask(this, addRequestToMap(s)); asyncTaskRef.execute(); } } @Override protected void onStop() { super.onStop(); if(asyncTaskRef!=null&&!asyncTaskRef.isCancelled()) { asyncTaskRef.cancel(true); } } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Logger.d("onconfigchanged()","onconfigchanged()"); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if(searchlistDataFetched!=null) { outState.putSerializable(SEARCHLIST_DATA, searchlistDataFetched); outState.putSerializable(SEARCH_KEYWORD,((EditText)viewsMap.get(R.id.mainactivity_search_edittext)).getText().toString()); } Logger.d("onSavedInstance()","onSavedInstanceState()"); } ArrayList<SearchListData> searchlistDataFetched; @Override public void updateUI(ArrayList<SearchListData> searchlistData) { if(snackBar!=null&&snackBar.isShownOrQueued()) { snackBar.dismiss(); snackBar=null;} viewsMap.get(R.id. activity_main_recycler_progressbar).setVisibility(View.GONE); viewsMap.get(R.id. mainactivity_recyclerview).setVisibility(View.VISIBLE); RecyclerView recyclerView=(RecyclerView) viewsMap.get(R.id.mainactivity_recyclerview); recyclerView.setAdapter(new RecycleViewAdapter(searchlistData,this)); this.searchlistDataFetched=searchlistData; } Snackbar snackBar; @Override public void noNetwork() { //show snackbar snackBar=Snackbar.make(findViewById(R.id.mainactivity_container_coordinator), R.string.mainact_no_network_txt, Snackbar.LENGTH_INDEFINITE); snackBar.show(); } }
UTF-8
Java
5,879
java
MainActivity.java
Java
[]
null
[]
package assignment.microsoft.niraj.assignmentmicrosft.Activities; import android.content.res.Configuration; import android.os.AsyncTask; import android.os.Bundle; import android.os.PersistableBundle; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.widget.EditText; import java.util.ArrayList; import java.util.HashMap; import assignment.microsoft.niraj.assignmentmicrosft.Adapter.RecycleViewAdapter; import assignment.microsoft.niraj.assignmentmicrosft.Asynctasks.DataFetchTask; import assignment.microsoft.niraj.assignmentmicrosft.DataModel.SearchListData; import assignment.microsoft.niraj.assignmentmicrosft.Interfaces.UIUpdater; import assignment.microsoft.niraj.assignmentmicrosft.R; import assignment.microsoft.niraj.assignmentmicrosft.Utils.Logger; public class MainActivity extends AppCompatActivity implements UIUpdater{ private static final String SEARCHLIST_DATA="searchlistData", SEARCH_KEYWORD="key"; String searchKeyword; DataFetchTask asyncTaskRef; HashMap<Integer, View> viewsMap=new HashMap<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addViewsToMap(); if(savedInstanceState!=null) { updateUI((ArrayList) savedInstanceState.getSerializable(SEARCHLIST_DATA)); searchKeyword=(String)savedInstanceState.getSerializable(SEARCH_KEYWORD); } setListenerForEditText(); } private void addViewsToMap() { viewsMap.put(R.id.mainactivity_recyclerview,findViewById(R.id.mainactivity_recyclerview)); viewsMap.put(R.id.mainactivity_search_edittext,findViewById(R.id.mainactivity_search_edittext)); viewsMap.put(R.id. activity_main_recycler_progressbar,findViewById(R.id.activity_main_recycler_progressbar)); LinearLayoutManager manager = new LinearLayoutManager(this); manager.setOrientation(LinearLayoutManager.VERTICAL); ((RecyclerView)viewsMap.get(R.id.mainactivity_recyclerview)).setLayoutManager(manager); } private void setListenerForEditText() { ((EditText)viewsMap.get(R.id.mainactivity_search_edittext)).addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if(searchKeyword==null||!searchKeyword.equalsIgnoreCase(s.toString())) {fetchNewData(s); searchKeyword=s.toString(); } } }); } private static int PAGE_LIMIT=50, IMG_SIZE=50; //create this on non-UI thread if input not from views private HashMap addRequestToMap(Editable s) { HashMap<String, String> map=new HashMap<>(); map.put("action","query"); map.put("prop","pageimages"); map.put("format","json"); map.put("piprop","thumbnail"); map.put("pithumbsize",""+IMG_SIZE); map.put("pilimit",""+PAGE_LIMIT); map.put("generator","prefixsearch"); map.put("gpssearch",s.toString()); return map; } private void fetchNewData(Editable s) { viewsMap.get(R.id. activity_main_recycler_progressbar).setVisibility(View.VISIBLE); viewsMap.get(R.id. mainactivity_recyclerview).setVisibility(View.GONE); if(asyncTaskRef!=null&&!asyncTaskRef.isCancelled()) { asyncTaskRef.cancel(true); } if(s!=null&&s.length()>0) { asyncTaskRef = new DataFetchTask(this, addRequestToMap(s)); asyncTaskRef.execute(); } } @Override protected void onStop() { super.onStop(); if(asyncTaskRef!=null&&!asyncTaskRef.isCancelled()) { asyncTaskRef.cancel(true); } } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Logger.d("onconfigchanged()","onconfigchanged()"); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if(searchlistDataFetched!=null) { outState.putSerializable(SEARCHLIST_DATA, searchlistDataFetched); outState.putSerializable(SEARCH_KEYWORD,((EditText)viewsMap.get(R.id.mainactivity_search_edittext)).getText().toString()); } Logger.d("onSavedInstance()","onSavedInstanceState()"); } ArrayList<SearchListData> searchlistDataFetched; @Override public void updateUI(ArrayList<SearchListData> searchlistData) { if(snackBar!=null&&snackBar.isShownOrQueued()) { snackBar.dismiss(); snackBar=null;} viewsMap.get(R.id. activity_main_recycler_progressbar).setVisibility(View.GONE); viewsMap.get(R.id. mainactivity_recyclerview).setVisibility(View.VISIBLE); RecyclerView recyclerView=(RecyclerView) viewsMap.get(R.id.mainactivity_recyclerview); recyclerView.setAdapter(new RecycleViewAdapter(searchlistData,this)); this.searchlistDataFetched=searchlistData; } Snackbar snackBar; @Override public void noNetwork() { //show snackbar snackBar=Snackbar.make(findViewById(R.id.mainactivity_container_coordinator), R.string.mainact_no_network_txt, Snackbar.LENGTH_INDEFINITE); snackBar.show(); } }
5,879
0.695526
0.694166
159
35.974842
31.412842
147
false
false
0
0
0
0
0
0
0.672956
false
false
15
283de2e80824464c548b956a569d653108d22557
25,477,746,034,117
0c3791a3e96646d82ba21055e59868f329537182
/app/src/main/java/net/fezzed/mvvmdiffutil/view/CompoundRecyclerView.java
e7e74795ac7589c9486eaf138b0b494c3fe9472d
[]
no_license
kejmil01/MVVMDiffUtil
https://github.com/kejmil01/MVVMDiffUtil
dc9ba4c3291b02281b75306bb767b6e2492c6631
72653456fa7be7ca434db8bc18328e4b26c1e86e
refs/heads/master
2020-05-22T20:06:19.256000
2017-04-28T09:59:55
2017-04-28T09:59:55
84,361,857
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.fezzed.mvvmdiffutil.view; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.FrameLayout; import net.fezzed.mvvmdiffutil.ItemAdapter; import net.fezzed.mvvmdiffutil.R; import net.fezzed.mvvmdiffutil.model.ItemModel; import net.fezzed.mvvmdiffutil.model.ResultModel; public class CompoundRecyclerView extends FrameLayout { private ItemAdapter adapter; public CompoundRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(context); } protected void init(Context context) { LayoutInflater .from(getContext()) .inflate(R.layout.list_layout, this, true); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler); recyclerView.setLayoutManager(new LinearLayoutManager(context)); adapter = new ItemAdapter(); recyclerView.setAdapter(adapter); } public void updateList(ResultModel<ItemModel> resultModel) { if(resultModel == null){ return; } adapter.updateItems(resultModel.getModelList()); resultModel.getDiffResult().dispatchUpdatesTo(adapter); } }
UTF-8
Java
1,444
java
CompoundRecyclerView.java
Java
[]
null
[]
package net.fezzed.mvvmdiffutil.view; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.FrameLayout; import net.fezzed.mvvmdiffutil.ItemAdapter; import net.fezzed.mvvmdiffutil.R; import net.fezzed.mvvmdiffutil.model.ItemModel; import net.fezzed.mvvmdiffutil.model.ResultModel; public class CompoundRecyclerView extends FrameLayout { private ItemAdapter adapter; public CompoundRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(context); } protected void init(Context context) { LayoutInflater .from(getContext()) .inflate(R.layout.list_layout, this, true); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler); recyclerView.setLayoutManager(new LinearLayoutManager(context)); adapter = new ItemAdapter(); recyclerView.setAdapter(adapter); } public void updateList(ResultModel<ItemModel> resultModel) { if(resultModel == null){ return; } adapter.updateItems(resultModel.getModelList()); resultModel.getDiffResult().dispatchUpdatesTo(adapter); } }
1,444
0.730609
0.729224
45
31.088888
23.965551
89
false
false
0
0
0
0
0
0
0.622222
false
false
15
db2e890907b8f5f3ad371aa0fdb48e5e005e0ed5
32,040,456,070,101
42941d7f413cb550cac47f4440a86380af648b61
/app/src/main/java/com/iyoyogo/android/ui/common/MediaBean.java
0c9130daf8676d7fabcb46d1c4581a429bd7407d
[]
no_license
Han827222157/Android
https://github.com/Han827222157/Android
fe4593efd826c528cf82916b4e2a6d3e5b5ac864
1ce6fb7806d07093590bb1219c05b3b806d20100
refs/heads/master
2020-04-14T20:23:29.236000
2018-12-31T08:25:02
2018-12-31T08:25:02
164,092,031
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.iyoyogo.android.ui.common; public class MediaBean { }
UTF-8
Java
68
java
MediaBean.java
Java
[]
null
[]
package com.iyoyogo.android.ui.common; public class MediaBean { }
68
0.764706
0.764706
5
12.6
15.666525
38
false
false
0
0
0
0
0
0
0.2
false
false
15
d01572734d63a877975190bc03112d4b78d1329f
27,779,848,501,995
b08647ee102fc81bc059231f516467fb254c87e3
/im-server/src/main/java/com/css/im/websocket/WebSocketConfig.java
04093d823c04f2e4e01eb6d461ed8c1231a18247
[]
no_license
zihanbobo/imserver
https://github.com/zihanbobo/imserver
664176067424079d823b728b9ed262b4f0c456c2
4183ab38ad7d7f9c15479393014aa768baa88fb9
refs/heads/master
2022-12-20T08:00:25.585000
2020-10-13T06:44:57
2020-10-13T06:44:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.css.im.websocket; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.config.annotation.EnableWebSocket; import org.springframework.web.socket.server.standard.ServerEndpointExporter; /** * 开启WebSocket支持 * Create by wx on 2020-08-24 */ @Configuration @EnableWebSocket public class WebSocketConfig { @Bean public ServerEndpointExporter serverEndpointExporter() { return new ServerEndpointExporter(); } }
UTF-8
Java
548
java
WebSocketConfig.java
Java
[ { "context": "dpointExporter;\n\n/**\n * 开启WebSocket支持\n * Create by wx on 2020-08-24\n */\n@Configuration\n@EnableWebSocket", "end": 332, "score": 0.9880481958389282, "start": 330, "tag": "USERNAME", "value": "wx" } ]
null
[]
package com.css.im.websocket; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.config.annotation.EnableWebSocket; import org.springframework.web.socket.server.standard.ServerEndpointExporter; /** * 开启WebSocket支持 * Create by wx on 2020-08-24 */ @Configuration @EnableWebSocket public class WebSocketConfig { @Bean public ServerEndpointExporter serverEndpointExporter() { return new ServerEndpointExporter(); } }
548
0.792593
0.777778
21
24.714285
25.296608
77
false
false
0
0
0
0
0
0
0.285714
false
false
15
4b811b3311e8fb1e543492eddc9a722c70809364
27,075,473,873,792
1f20c0478a82fff3055d12ac90acdd64fc38537f
/LED - SDN/MultipathRouting-master/src/multipathrouting/IMultiPathRoutingService.java
fdf1979493d5fca6f36b34bc5f4494e501c03cf5
[ "Apache-2.0" ]
permissive
jibanli/Link-Error-Detection-and-Failure-Recovery-in-SDN
https://github.com/jibanli/Link-Error-Detection-and-Failure-Recovery-in-SDN
23852a991cd6fa5b6990e25a0edc628b780ae35a
3a27525723b8cc6027dcfdaa85486d5b257f16b0
refs/heads/master
2020-03-24T03:24:43.918000
2017-07-17T18:02:05
2017-07-17T18:02:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.floodlightcontroller.multipathrouting; import java.util.Date; import java.util.Set; import net.floodlightcontroller.routing.Route; import net.floodlightcontroller.core.module.IFloodlightService; public interface IMultiPathRoutingService extends IFloodlightService { public void modifyLinkCost(Long srcDpid,Long dstDpid,short cost); public Route getRoute(long srcDpid,short srcPort,long dstDpid,short dstPort); }
UTF-8
Java
435
java
IMultiPathRoutingService.java
Java
[]
null
[]
package net.floodlightcontroller.multipathrouting; import java.util.Date; import java.util.Set; import net.floodlightcontroller.routing.Route; import net.floodlightcontroller.core.module.IFloodlightService; public interface IMultiPathRoutingService extends IFloodlightService { public void modifyLinkCost(Long srcDpid,Long dstDpid,short cost); public Route getRoute(long srcDpid,short srcPort,long dstDpid,short dstPort); }
435
0.834483
0.834483
11
38.545456
29.435179
81
false
false
0
0
0
0
0
0
1.090909
false
false
15
5a07a2bc97d48dc7d3d30a02e27da3ebb400cde7
27,075,473,874,054
8904b4a0191d856a7be5508ddc83d35360d6fdb3
/src/main/java/lesson02/part01/Task12.java
856377ea9ce7a74b71b8135790666e0dc9a3da62
[]
no_license
belyashik169/java-practice-tasks
https://github.com/belyashik169/java-practice-tasks
7ecda9c65ffebb7d3fbe0a6c8fbfebc73d64ba16
1a399b9f0a41380bd272b95f96ed14b54ea4651f
refs/heads/master
2020-09-20T07:53:50.091000
2019-12-25T05:57:34
2019-12-25T05:57:34
224,416,152
0
0
null
true
2019-11-27T11:34:18
2019-11-27T11:34:17
2019-11-20T11:58:13
2019-11-27T11:17:25
10,222
0
0
0
null
false
false
package lesson02.part01; /** * Вывести на экран все возможные комбинации слов «Мама», «Мыла», «Раму». * Подсказка: их 6 штук. Каждую комбинацию вывести с новой строки. Слова не разделять. Пример: * МылаРамуМама * РамуМамаМыла * ... * <p> * <p> * Требования: * 1. Программа должна выводить текст. * 2. Выведенный текст должен содержать 6 строк. * 3. Текст в каждой строке должен быть уникален. * 4. Должны быть выведены все возможные комбинации. */ public class Task12 { public static void main(String[] args) { String s1 = "Мама"; String s2 = "Мыла"; String s3 = "Раму"; System.out.println(s1 + s2 + s3); System.out.println(s1 + s3 + s2); System.out.println(s2 + s1 + s3); System.out.println(s2 + s3 + s1); System.out.println(s3 + s1 + s2); } }
UTF-8
Java
1,147
java
Task12.java
Java
[ { "context": "* Вывести на экран все возможные комбинации слов «Мама», «Мыла», «Раму».\n * Подсказка: их 6 штук. Каждую", "end": 85, "score": 0.9824549555778503, "start": 81, "tag": "NAME", "value": "Мама" }, { "context": "и на экран все возможные комбинации слов «Мама», «Мыла», «Рам...
null
[]
package lesson02.part01; /** * Вывести на экран все возможные комбинации слов «Мама», «Мыла», «Раму». * Подсказка: их 6 штук. Каждую комбинацию вывести с новой строки. Слова не разделять. Пример: * МылаРамуМама * РамуМамаМыла * ... * <p> * <p> * Требования: * 1. Программа должна выводить текст. * 2. Выведенный текст должен содержать 6 строк. * 3. Текст в каждой строке должен быть уникален. * 4. Должны быть выведены все возможные комбинации. */ public class Task12 { public static void main(String[] args) { String s1 = "Мама"; String s2 = "Мыла"; String s3 = "Раму"; System.out.println(s1 + s2 + s3); System.out.println(s1 + s3 + s2); System.out.println(s2 + s1 + s3); System.out.println(s2 + s3 + s1); System.out.println(s3 + s1 + s2); } }
1,147
0.623798
0.58774
29
27.689655
22.838419
94
false
false
0
0
0
0
0
0
0.517241
false
false
15
94c6487dc64eff2916b9f6dbbbe0e5ae28bc14a5
18,657,337,989,092
ee84008e43302b70400a9e5726add870254f7bea
/src/Maximum2.java
2012283fe1ab786eb39dadc879c40be296e0af1b
[]
no_license
CODERS-BAY/java-6-1-berrechnung-des-maximums-Thomas-Witt
https://github.com/CODERS-BAY/java-6-1-berrechnung-des-maximums-Thomas-Witt
62ce7a95668e296dc6301a5d81ba0c3fea4188af
b41631554c24e1c6c53c937245136da2cf850cb1
refs/heads/master
2021-01-03T06:09:27.257000
2020-09-21T12:55:50
2020-09-21T12:55:50
239,955,135
0
0
null
false
2020-09-24T19:22:58
2020-02-12T07:50:18
2020-09-21T12:55:57
2020-09-21T12:55:56
4
0
0
0
Java
false
false
import java.util.Scanner; public class Maximum2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please type in your numbers: end with q"); int[] numbers = new int[0]; int[] moreNumbers; int highestNumber = 0; // The program will not run, if there is a possibility a variable might not be initialized. // This can only happen here, if the user types no number or just one number. In this case the user is stupid and i will (at this moment) // not create an explaining message and a loop to continue the program. while (!scanner.hasNext("q")) { moreNumbers = new int[numbers.length + 1]; for (int i = 0; i < numbers.length; i++) { moreNumbers[i] = numbers[i]; } moreNumbers[moreNumbers.length - 1] = scanner.nextInt(); if (moreNumbers.length == 1) { highestNumber = moreNumbers[0]; } else if (moreNumbers[moreNumbers.length - 1] > highestNumber) { highestNumber = moreNumbers[moreNumbers.length - 1]; } numbers = moreNumbers; } System.out.println(highestNumber); } }
UTF-8
Java
1,255
java
Maximum2.java
Java
[]
null
[]
import java.util.Scanner; public class Maximum2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please type in your numbers: end with q"); int[] numbers = new int[0]; int[] moreNumbers; int highestNumber = 0; // The program will not run, if there is a possibility a variable might not be initialized. // This can only happen here, if the user types no number or just one number. In this case the user is stupid and i will (at this moment) // not create an explaining message and a loop to continue the program. while (!scanner.hasNext("q")) { moreNumbers = new int[numbers.length + 1]; for (int i = 0; i < numbers.length; i++) { moreNumbers[i] = numbers[i]; } moreNumbers[moreNumbers.length - 1] = scanner.nextInt(); if (moreNumbers.length == 1) { highestNumber = moreNumbers[0]; } else if (moreNumbers[moreNumbers.length - 1] > highestNumber) { highestNumber = moreNumbers[moreNumbers.length - 1]; } numbers = moreNumbers; } System.out.println(highestNumber); } }
1,255
0.594422
0.586454
27
45.51852
33.636806
145
false
false
0
0
0
0
0
0
0.62963
false
false
15
7bf9030f7a9ef9a5d8a8a1165eaa11d9aabb620c
33,517,924,828,765
36d2836ac834d72b3f8c241ae3ef06700e7892d6
/src/main/java/com/happyjey/dao/AdminRoleMapper.java
9b59eff286234675f829a15b8ea080b9824a34ba
[]
no_license
happyjey/ssm
https://github.com/happyjey/ssm
ee89f2c50f2740b69e1e12c6a9d1da9cfe125a72
19dbaba685e1b1f1f185827b2136ebabbd6136af
refs/heads/master
2021-01-01T20:36:08.393000
2017-08-28T14:13:01
2017-08-28T14:13:01
98,890,626
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.happyjey.dao; import com.happyjey.entity.AdminRole; public interface AdminRoleMapper { int insert(AdminRole record); int insertSelective(AdminRole record); }
UTF-8
Java
188
java
AdminRoleMapper.java
Java
[]
null
[]
package com.happyjey.dao; import com.happyjey.entity.AdminRole; public interface AdminRoleMapper { int insert(AdminRole record); int insertSelective(AdminRole record); }
188
0.744681
0.744681
9
19.111111
17.374596
42
false
false
0
0
0
0
0
0
0.444444
false
false
15
ac823994653ae345b99d26bab336f19c4a1651ff
30,219,389,924,533
b03c12209e1386bd80da33fcac7d8c6cc3b09fd1
/src/main/java/undefined/web/rest/WorkTemplateItemPreReqResource.java
0b4a8a40745314ef0ed1ded6408b62e2f594a7ec
[]
no_license
rgause/p3
https://github.com/rgause/p3
f4971f37fa4f56d0c365e3418f5d2c3cf368971a
869fe363b0038c5553ae391b14c79d7805517317
refs/heads/master
2023-08-05T06:06:56.649000
2021-09-14T18:07:14
2021-09-14T18:07:14
406,469,220
0
0
null
false
2021-09-14T18:07:15
2021-09-14T17:51:34
2021-09-14T18:00:39
2021-09-14T18:07:14
0
0
0
0
Java
false
false
package com.mycompany.myapp.web.rest; import com.mycompany.myapp.domain.WorkTemplateItemPreReq; import com.mycompany.myapp.repository.WorkTemplateItemPreReqRepository; import com.mycompany.myapp.web.rest.errors.BadRequestAlertException; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Objects; import java.util.Optional; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import tech.jhipster.web.util.HeaderUtil; import tech.jhipster.web.util.ResponseUtil; /** * REST controller for managing {@link com.mycompany.myapp.domain.WorkTemplateItemPreReq}. */ @RestController @RequestMapping("/api") @Transactional public class WorkTemplateItemPreReqResource { private final Logger log = LoggerFactory.getLogger(WorkTemplateItemPreReqResource.class); private static final String ENTITY_NAME = "workTemplateItemPreReq"; @Value("${jhipster.clientApp.name}") private String applicationName; private final WorkTemplateItemPreReqRepository workTemplateItemPreReqRepository; public WorkTemplateItemPreReqResource(WorkTemplateItemPreReqRepository workTemplateItemPreReqRepository) { this.workTemplateItemPreReqRepository = workTemplateItemPreReqRepository; } /** * {@code POST /work-template-item-pre-reqs} : Create a new workTemplateItemPreReq. * * @param workTemplateItemPreReq the workTemplateItemPreReq to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new workTemplateItemPreReq, or with status {@code 400 (Bad Request)} if the workTemplateItemPreReq has already an ID. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PostMapping("/work-template-item-pre-reqs") public ResponseEntity<WorkTemplateItemPreReq> createWorkTemplateItemPreReq( @Valid @RequestBody WorkTemplateItemPreReq workTemplateItemPreReq ) throws URISyntaxException { log.debug("REST request to save WorkTemplateItemPreReq : {}", workTemplateItemPreReq); if (workTemplateItemPreReq.getId() != null) { throw new BadRequestAlertException("A new workTemplateItemPreReq cannot already have an ID", ENTITY_NAME, "idexists"); } WorkTemplateItemPreReq result = workTemplateItemPreReqRepository.save(workTemplateItemPreReq); return ResponseEntity .created(new URI("/api/work-template-item-pre-reqs/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, false, ENTITY_NAME, result.getId().toString())) .body(result); } /** * {@code PUT /work-template-item-pre-reqs/:id} : Updates an existing workTemplateItemPreReq. * * @param id the id of the workTemplateItemPreReq to save. * @param workTemplateItemPreReq the workTemplateItemPreReq to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated workTemplateItemPreReq, * or with status {@code 400 (Bad Request)} if the workTemplateItemPreReq is not valid, * or with status {@code 500 (Internal Server Error)} if the workTemplateItemPreReq couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PutMapping("/work-template-item-pre-reqs/{id}") public ResponseEntity<WorkTemplateItemPreReq> updateWorkTemplateItemPreReq( @PathVariable(value = "id", required = false) final Long id, @Valid @RequestBody WorkTemplateItemPreReq workTemplateItemPreReq ) throws URISyntaxException { log.debug("REST request to update WorkTemplateItemPreReq : {}, {}", id, workTemplateItemPreReq); if (workTemplateItemPreReq.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } if (!Objects.equals(id, workTemplateItemPreReq.getId())) { throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); } if (!workTemplateItemPreReqRepository.existsById(id)) { throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); } WorkTemplateItemPreReq result = workTemplateItemPreReqRepository.save(workTemplateItemPreReq); return ResponseEntity .ok() .headers(HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, workTemplateItemPreReq.getId().toString())) .body(result); } /** * {@code PATCH /work-template-item-pre-reqs/:id} : Partial updates given fields of an existing workTemplateItemPreReq, field will ignore if it is null * * @param id the id of the workTemplateItemPreReq to save. * @param workTemplateItemPreReq the workTemplateItemPreReq to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated workTemplateItemPreReq, * or with status {@code 400 (Bad Request)} if the workTemplateItemPreReq is not valid, * or with status {@code 404 (Not Found)} if the workTemplateItemPreReq is not found, * or with status {@code 500 (Internal Server Error)} if the workTemplateItemPreReq couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PatchMapping(value = "/work-template-item-pre-reqs/{id}", consumes = "application/merge-patch+json") public ResponseEntity<WorkTemplateItemPreReq> partialUpdateWorkTemplateItemPreReq( @PathVariable(value = "id", required = false) final Long id, @NotNull @RequestBody WorkTemplateItemPreReq workTemplateItemPreReq ) throws URISyntaxException { log.debug("REST request to partial update WorkTemplateItemPreReq partially : {}, {}", id, workTemplateItemPreReq); if (workTemplateItemPreReq.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } if (!Objects.equals(id, workTemplateItemPreReq.getId())) { throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); } if (!workTemplateItemPreReqRepository.existsById(id)) { throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); } Optional<WorkTemplateItemPreReq> result = workTemplateItemPreReqRepository .findById(workTemplateItemPreReq.getId()) .map( existingWorkTemplateItemPreReq -> { if (workTemplateItemPreReq.getPreRequisiteItem() != null) { existingWorkTemplateItemPreReq.setPreRequisiteItem(workTemplateItemPreReq.getPreRequisiteItem()); } return existingWorkTemplateItemPreReq; } ) .map(workTemplateItemPreReqRepository::save); return ResponseUtil.wrapOrNotFound( result, HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, workTemplateItemPreReq.getId().toString()) ); } /** * {@code GET /work-template-item-pre-reqs} : get all the workTemplateItemPreReqs. * * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of workTemplateItemPreReqs in body. */ @GetMapping("/work-template-item-pre-reqs") public List<WorkTemplateItemPreReq> getAllWorkTemplateItemPreReqs() { log.debug("REST request to get all WorkTemplateItemPreReqs"); return workTemplateItemPreReqRepository.findAll(); } /** * {@code GET /work-template-item-pre-reqs/:id} : get the "id" workTemplateItemPreReq. * * @param id the id of the workTemplateItemPreReq to retrieve. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the workTemplateItemPreReq, or with status {@code 404 (Not Found)}. */ @GetMapping("/work-template-item-pre-reqs/{id}") public ResponseEntity<WorkTemplateItemPreReq> getWorkTemplateItemPreReq(@PathVariable Long id) { log.debug("REST request to get WorkTemplateItemPreReq : {}", id); Optional<WorkTemplateItemPreReq> workTemplateItemPreReq = workTemplateItemPreReqRepository.findById(id); return ResponseUtil.wrapOrNotFound(workTemplateItemPreReq); } /** * {@code DELETE /work-template-item-pre-reqs/:id} : delete the "id" workTemplateItemPreReq. * * @param id the id of the workTemplateItemPreReq to delete. * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. */ @DeleteMapping("/work-template-item-pre-reqs/{id}") public ResponseEntity<Void> deleteWorkTemplateItemPreReq(@PathVariable Long id) { log.debug("REST request to delete WorkTemplateItemPreReq : {}", id); workTemplateItemPreReqRepository.deleteById(id); return ResponseEntity .noContent() .headers(HeaderUtil.createEntityDeletionAlert(applicationName, false, ENTITY_NAME, id.toString())) .build(); } }
UTF-8
Java
9,354
java
WorkTemplateItemPreReqResource.java
Java
[]
null
[]
package com.mycompany.myapp.web.rest; import com.mycompany.myapp.domain.WorkTemplateItemPreReq; import com.mycompany.myapp.repository.WorkTemplateItemPreReqRepository; import com.mycompany.myapp.web.rest.errors.BadRequestAlertException; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Objects; import java.util.Optional; import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import tech.jhipster.web.util.HeaderUtil; import tech.jhipster.web.util.ResponseUtil; /** * REST controller for managing {@link com.mycompany.myapp.domain.WorkTemplateItemPreReq}. */ @RestController @RequestMapping("/api") @Transactional public class WorkTemplateItemPreReqResource { private final Logger log = LoggerFactory.getLogger(WorkTemplateItemPreReqResource.class); private static final String ENTITY_NAME = "workTemplateItemPreReq"; @Value("${jhipster.clientApp.name}") private String applicationName; private final WorkTemplateItemPreReqRepository workTemplateItemPreReqRepository; public WorkTemplateItemPreReqResource(WorkTemplateItemPreReqRepository workTemplateItemPreReqRepository) { this.workTemplateItemPreReqRepository = workTemplateItemPreReqRepository; } /** * {@code POST /work-template-item-pre-reqs} : Create a new workTemplateItemPreReq. * * @param workTemplateItemPreReq the workTemplateItemPreReq to create. * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new workTemplateItemPreReq, or with status {@code 400 (Bad Request)} if the workTemplateItemPreReq has already an ID. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PostMapping("/work-template-item-pre-reqs") public ResponseEntity<WorkTemplateItemPreReq> createWorkTemplateItemPreReq( @Valid @RequestBody WorkTemplateItemPreReq workTemplateItemPreReq ) throws URISyntaxException { log.debug("REST request to save WorkTemplateItemPreReq : {}", workTemplateItemPreReq); if (workTemplateItemPreReq.getId() != null) { throw new BadRequestAlertException("A new workTemplateItemPreReq cannot already have an ID", ENTITY_NAME, "idexists"); } WorkTemplateItemPreReq result = workTemplateItemPreReqRepository.save(workTemplateItemPreReq); return ResponseEntity .created(new URI("/api/work-template-item-pre-reqs/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(applicationName, false, ENTITY_NAME, result.getId().toString())) .body(result); } /** * {@code PUT /work-template-item-pre-reqs/:id} : Updates an existing workTemplateItemPreReq. * * @param id the id of the workTemplateItemPreReq to save. * @param workTemplateItemPreReq the workTemplateItemPreReq to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated workTemplateItemPreReq, * or with status {@code 400 (Bad Request)} if the workTemplateItemPreReq is not valid, * or with status {@code 500 (Internal Server Error)} if the workTemplateItemPreReq couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PutMapping("/work-template-item-pre-reqs/{id}") public ResponseEntity<WorkTemplateItemPreReq> updateWorkTemplateItemPreReq( @PathVariable(value = "id", required = false) final Long id, @Valid @RequestBody WorkTemplateItemPreReq workTemplateItemPreReq ) throws URISyntaxException { log.debug("REST request to update WorkTemplateItemPreReq : {}, {}", id, workTemplateItemPreReq); if (workTemplateItemPreReq.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } if (!Objects.equals(id, workTemplateItemPreReq.getId())) { throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); } if (!workTemplateItemPreReqRepository.existsById(id)) { throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); } WorkTemplateItemPreReq result = workTemplateItemPreReqRepository.save(workTemplateItemPreReq); return ResponseEntity .ok() .headers(HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, workTemplateItemPreReq.getId().toString())) .body(result); } /** * {@code PATCH /work-template-item-pre-reqs/:id} : Partial updates given fields of an existing workTemplateItemPreReq, field will ignore if it is null * * @param id the id of the workTemplateItemPreReq to save. * @param workTemplateItemPreReq the workTemplateItemPreReq to update. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated workTemplateItemPreReq, * or with status {@code 400 (Bad Request)} if the workTemplateItemPreReq is not valid, * or with status {@code 404 (Not Found)} if the workTemplateItemPreReq is not found, * or with status {@code 500 (Internal Server Error)} if the workTemplateItemPreReq couldn't be updated. * @throws URISyntaxException if the Location URI syntax is incorrect. */ @PatchMapping(value = "/work-template-item-pre-reqs/{id}", consumes = "application/merge-patch+json") public ResponseEntity<WorkTemplateItemPreReq> partialUpdateWorkTemplateItemPreReq( @PathVariable(value = "id", required = false) final Long id, @NotNull @RequestBody WorkTemplateItemPreReq workTemplateItemPreReq ) throws URISyntaxException { log.debug("REST request to partial update WorkTemplateItemPreReq partially : {}, {}", id, workTemplateItemPreReq); if (workTemplateItemPreReq.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } if (!Objects.equals(id, workTemplateItemPreReq.getId())) { throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); } if (!workTemplateItemPreReqRepository.existsById(id)) { throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); } Optional<WorkTemplateItemPreReq> result = workTemplateItemPreReqRepository .findById(workTemplateItemPreReq.getId()) .map( existingWorkTemplateItemPreReq -> { if (workTemplateItemPreReq.getPreRequisiteItem() != null) { existingWorkTemplateItemPreReq.setPreRequisiteItem(workTemplateItemPreReq.getPreRequisiteItem()); } return existingWorkTemplateItemPreReq; } ) .map(workTemplateItemPreReqRepository::save); return ResponseUtil.wrapOrNotFound( result, HeaderUtil.createEntityUpdateAlert(applicationName, false, ENTITY_NAME, workTemplateItemPreReq.getId().toString()) ); } /** * {@code GET /work-template-item-pre-reqs} : get all the workTemplateItemPreReqs. * * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of workTemplateItemPreReqs in body. */ @GetMapping("/work-template-item-pre-reqs") public List<WorkTemplateItemPreReq> getAllWorkTemplateItemPreReqs() { log.debug("REST request to get all WorkTemplateItemPreReqs"); return workTemplateItemPreReqRepository.findAll(); } /** * {@code GET /work-template-item-pre-reqs/:id} : get the "id" workTemplateItemPreReq. * * @param id the id of the workTemplateItemPreReq to retrieve. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the workTemplateItemPreReq, or with status {@code 404 (Not Found)}. */ @GetMapping("/work-template-item-pre-reqs/{id}") public ResponseEntity<WorkTemplateItemPreReq> getWorkTemplateItemPreReq(@PathVariable Long id) { log.debug("REST request to get WorkTemplateItemPreReq : {}", id); Optional<WorkTemplateItemPreReq> workTemplateItemPreReq = workTemplateItemPreReqRepository.findById(id); return ResponseUtil.wrapOrNotFound(workTemplateItemPreReq); } /** * {@code DELETE /work-template-item-pre-reqs/:id} : delete the "id" workTemplateItemPreReq. * * @param id the id of the workTemplateItemPreReq to delete. * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. */ @DeleteMapping("/work-template-item-pre-reqs/{id}") public ResponseEntity<Void> deleteWorkTemplateItemPreReq(@PathVariable Long id) { log.debug("REST request to delete WorkTemplateItemPreReq : {}", id); workTemplateItemPreReqRepository.deleteById(id); return ResponseEntity .noContent() .headers(HeaderUtil.createEntityDeletionAlert(applicationName, false, ENTITY_NAME, id.toString())) .build(); } }
9,354
0.713064
0.708681
185
49.56216
41.203224
211
false
false
0
0
0
0
0
0
0.545946
false
false
15
f1df9da33b49245893cb2ade21b6147c597c0f09
37,254,546,328,400
ee7d4d619ddb60142aaa8b48f005679f67493076
/src/main/java/com/iambabul/blog/util/ApiEndPoint.java
cdeab62c36642a7f2a76c35c8bdb6e5a55b03d9e
[]
no_license
babul145/blog
https://github.com/babul145/blog
e603855656f2f65f81962a1733f3570067f9737e
596a16fecba40e1f0ef3cbc8408f5facb1843ecb
refs/heads/master
2023-08-19T20:31:47.422000
2021-10-20T05:38:56
2021-10-20T05:38:56
399,174,058
0
0
null
false
2021-10-20T05:36:16
2021-08-23T16:27:04
2021-10-20T05:14:01
2021-10-20T05:35:19
109
0
0
2
Java
false
false
package com.iambabul.blog.util; public class ApiEndPoint { public static final String HOME_ROOT = "/api/v1/home"; public static final String HOME_TITLE_SUBTITLE = "/title-subtitle"; public static final String HOME_ROOT_TITLE_SUBTITLE = HOME_ROOT + HOME_TITLE_SUBTITLE; public static final String HOME_CONTENTS = "/content"; public static final String HOME_5CONTENTS = "/5content"; public static final String HOME_ROOT_CONTENTS = HOME_ROOT + HOME_CONTENTS; public static final String HOME_COMMENT = "/comment"; public static final String HOME_ROOT_COMMENT = HOME_ROOT + HOME_COMMENT; }
UTF-8
Java
621
java
ApiEndPoint.java
Java
[]
null
[]
package com.iambabul.blog.util; public class ApiEndPoint { public static final String HOME_ROOT = "/api/v1/home"; public static final String HOME_TITLE_SUBTITLE = "/title-subtitle"; public static final String HOME_ROOT_TITLE_SUBTITLE = HOME_ROOT + HOME_TITLE_SUBTITLE; public static final String HOME_CONTENTS = "/content"; public static final String HOME_5CONTENTS = "/5content"; public static final String HOME_ROOT_CONTENTS = HOME_ROOT + HOME_CONTENTS; public static final String HOME_COMMENT = "/comment"; public static final String HOME_ROOT_COMMENT = HOME_ROOT + HOME_COMMENT; }
621
0.729469
0.724638
15
40.400002
32.386829
90
false
false
0
0
0
0
0
0
0.6
false
false
15
868e24d1a7b93defda392824800558aae58d1b19
19,576,460,961,465
d630998c87146447eeb004355d335dcf8df078a8
/src/com/android/sms/timedtext/ContactListCursorAdapter.java
60ce650904e1588013db01039a32e9ee7fe06179
[]
no_license
murtoza10/TimedText
https://github.com/murtoza10/TimedText
febba5d2b6cc9e1258827e3a8817ea4fb39f8576
81638011fb6084dcc04a14cd4f2d03a09399fc8b
refs/heads/master
2020-12-13T12:25:25.392000
2020-01-27T23:26:54
2020-01-27T23:26:54
234,415,113
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.android.sms.timedtext; import android.content.Context; import android.database.Cursor; import android.provider.ContactsContract; import android.support.v4.widget.SimpleCursorAdapter; public class ContactListCursorAdapter extends SimpleCursorAdapter{ private Context context; private int layout; private Cursor cursor; public ContactListCursorAdapter (Context context, int layout, Cursor cursor, String[] from, int[] to) { super(context, layout, cursor, from, to); this.context = context; this.layout = layout; this.cursor = cursor; } @Override public Cursor runQueryOnBackgroundThread(CharSequence constraint) { String[] projection = new String[] { ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.HAS_PHONE_NUMBER, ContactsContract.Contacts._ID }; return context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, projection, null, null, null); } }
UTF-8
Java
1,049
java
ContactListCursorAdapter.java
Java
[]
null
[]
package com.android.sms.timedtext; import android.content.Context; import android.database.Cursor; import android.provider.ContactsContract; import android.support.v4.widget.SimpleCursorAdapter; public class ContactListCursorAdapter extends SimpleCursorAdapter{ private Context context; private int layout; private Cursor cursor; public ContactListCursorAdapter (Context context, int layout, Cursor cursor, String[] from, int[] to) { super(context, layout, cursor, from, to); this.context = context; this.layout = layout; this.cursor = cursor; } @Override public Cursor runQueryOnBackgroundThread(CharSequence constraint) { String[] projection = new String[] { ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.HAS_PHONE_NUMBER, ContactsContract.Contacts._ID }; return context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, projection, null, null, null); } }
1,049
0.693994
0.693041
32
31.78125
29.659246
119
false
false
0
0
0
0
0
0
0.875
false
false
15
e3b6fddef251877015454de1aab41f309b95f1bc
26,654,567,102,152
891ea6ea05f8bf63160895b3cbe702649f9463c2
/app/src/main/java/com/mindinfo/xchangemall/xchangemall/beans/Categories.java
12ddd4412554216d998ca053f0379582e37e602b
[]
no_license
surabhimindinfo/xmall
https://github.com/surabhimindinfo/xmall
b03f7a3e58009ad8e08a3c121ffaba996093d655
1b0e1e6a48270fcd586b36a18f5790fbaa571235
refs/heads/master
2018-11-10T09:01:30.640000
2018-10-23T13:30:40
2018-10-23T13:30:40
145,424,355
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mindinfo.xchangemall.xchangemall.beans; import java.util.ArrayList; public class Categories { private String id; private String title; private ArrayList<String> selectedCAt; public Categories() { } public Categories(String id, String title) { this.id = id; this.title = title; } public Categories(ArrayList<String> selectdCAt) { selectedCAt = selectdCAt; } 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; } @Override public String toString() { return title; } public ArrayList<String> getSelectedCAt() { return selectedCAt; } public void setSelectedCAt(ArrayList<String> selectedCAt) { this.selectedCAt = selectedCAt; } }
UTF-8
Java
957
java
Categories.java
Java
[]
null
[]
package com.mindinfo.xchangemall.xchangemall.beans; import java.util.ArrayList; public class Categories { private String id; private String title; private ArrayList<String> selectedCAt; public Categories() { } public Categories(String id, String title) { this.id = id; this.title = title; } public Categories(ArrayList<String> selectdCAt) { selectedCAt = selectdCAt; } 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; } @Override public String toString() { return title; } public ArrayList<String> getSelectedCAt() { return selectedCAt; } public void setSelectedCAt(ArrayList<String> selectedCAt) { this.selectedCAt = selectedCAt; } }
957
0.613375
0.613375
49
18.530613
17.207144
63
false
false
0
0
0
0
0
0
0.326531
false
false
15
653cfb2c88d947d6f1b773c4ce2e075426b9c9d4
34,376,918,259,156
fb46b3b83de9c85620e82325183495c2a1908839
/spring-boot-rest-user-01/src/main/java/com/app/neosoft/user/model/User.java
78b7b0ce36eee05d667b914b7a3170d5eeba5e46
[]
no_license
Nilanchala212/spring-boot-rest-user-01
https://github.com/Nilanchala212/spring-boot-rest-user-01
297b4d983ea56c29fea36a52ded86ff8afc160b2
1b5af0994ab130dd7d79e45e315950678c0e82ca
refs/heads/master
2023-04-16T02:01:26.720000
2021-04-22T13:56:16
2021-04-22T13:56:16
360,501,417
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.app.neosoft.user.model; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; @Entity @Table(name = "USER_REG") @Data @AllArgsConstructor @NoArgsConstructor @ToString public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int userId; private String name; private String surName; private int pinCode; // @Temporal(TemporalType.DATE) // @JsonFormat(pattern ="yyyy-MM-dd") // private Date dob; }
UTF-8
Java
829
java
User.java
Java
[]
null
[]
package com.app.neosoft.user.model; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; @Entity @Table(name = "USER_REG") @Data @AllArgsConstructor @NoArgsConstructor @ToString public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int userId; private String name; private String surName; private int pinCode; // @Temporal(TemporalType.DATE) // @JsonFormat(pattern ="yyyy-MM-dd") // private Date dob; }
829
0.802171
0.802171
38
20.81579
15.0015
52
false
false
0
0
0
0
0
0
0.736842
false
false
15
e63eea0453496e426e5ff27724ec3870abc83cbb
34,239,479,307,261
0697a98c2b4413db2f91a6697a401a29f960ac58
/sprint/api/src/main/java/in/stackroute/planage/sprint/kanban/service/SprintBoardService.java
2417d093020a124e96dc9460a6453b29b7157190
[]
no_license
srjk/planage
https://github.com/srjk/planage
d4102c5294c80be84b6b7980a94fea4a42f93c87
6b45765a2b2094798cc36342a07fee3e718ce210
refs/heads/master
2022-10-21T04:18:18.204000
2019-11-05T04:44:08
2019-11-05T04:44:08
219,647,357
0
0
null
false
2022-10-19T01:30:12
2019-11-05T03:12:45
2019-11-05T04:45:24
2022-10-19T01:30:07
86,460
0
0
48
JavaScript
false
false
package in.stackroute.planage.sprint.kanban.service; import in.stackroute.planage.sprint.configuration.Receiver; import in.stackroute.planage.sprint.kanban.model.Column; import in.stackroute.planage.sprint.kanban.model.FreezeSprint; import in.stackroute.planage.sprint.kanban.model.SprintBoard; import in.stackroute.planage.sprint.kanban.model.Task; import in.stackroute.planage.sprint.kanban.repository.FreezeSprintRepository; import in.stackroute.planage.sprint.kanban.repository.SprintBoardRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; @Service public class SprintBoardService implements ISprintBoard { @Autowired SprintBoardRepository sprintBoardRepository; @Autowired FreezeSprintRepository freezeSprintRepository; private static final Logger log = LoggerFactory.getLogger(SprintBoard.class); private final RabbitTemplate rabbitTemplate; public SprintBoardService( RabbitTemplate rabbitTemplate) { this.rabbitTemplate = rabbitTemplate; } public List<SprintBoard> getAllData() { return sprintBoardRepository.findAll(); } //Current sprint data public SprintBoard getDataOfProduct(String productId) { return sprintBoardRepository.findByProductId(productId).get(); } // data of the product public SprintBoard addSprint(SprintBoard sprintBoard) { return sprintBoardRepository.save(sprintBoard); } public SprintBoard getSprintData(String sprintId, String productId) { return sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); } //data for any previous sprint board public SprintBoard updateSprintBoard(String sprintId, String productId, Column column) { SprintBoard sprintBoardData = sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); sprintBoardData.getColumns().add(column); return sprintBoardRepository.save(sprintBoardData); } @Override public SprintBoard createBacklog(String productId, String sprintId, Task task, String sprintName) { log.info("this is the updtae sprint" + productId); log.info("this is the updtae sprint" + sprintId); // System.out.println("this is the updtae sprint" + userstoryId); log.info("this is the updtae sprint" + task); System.out.println(sprintId+ "::::" + productId); System.out.println("\n\n\n\n\n\n\n"); System.out.println(productId + " " + sprintId); SprintBoard sprintBoard = sprintBoardRepository.findByProductId(productId).get(); System.out.println(sprintBoard); System.out.println("\n\n\n\n\n\n"); if ((sprintBoard.getColumns()).size() == 0) { // SprintBoard sprintBoard1 = new SprintBoard(); sprintBoard.setSprintId(sprintId); sprintBoard.setProductId(productId); sprintBoard.setStatus("live"); sprintBoard.setStartDate(new Date()); sprintBoard.setSprintName(sprintName); int lastActiveSprint = sprintBoard.getLastActiveSprint(); lastActiveSprint++; sprintBoard.setLastActiveSprint(lastActiveSprint); Column column = new Column(); column.setColumnName("Backlog"); List<Task> taskList = new ArrayList<>(); taskList.add(task); column.setTasks(taskList); sprintBoard.setColumns(Arrays.asList(column)); sprintBoard = sprintBoard; } else { List<Column> columnList = sprintBoard.getColumns(); for (Column column : columnList) { if (column.getColumnName().equals("Backlog")) { List<Task> taskList = column.getTasks(); taskList.add(task); column.setTasks(taskList); } sprintBoard.setColumns(columnList); } } sprintBoard.setTotalTaskCount(sprintBoard.getTotalTaskCount()+1); switch (task.getTaskCategory()) { case "Must" : sprintBoard.setTotalMustTask(sprintBoard.getTotalMustTask()+1); break; case "Try" : sprintBoard.setTotalTryTask(sprintBoard.getTotalTryTask()+1); break; case "Stretch" : sprintBoard.setTotalStretchTask(sprintBoard.getTotalStretchTask()+1); } return sprintBoardRepository.save(sprintBoard); } // public SprintBoard updateSprintColumn(String sprintId, String productId, Column column) { // SprintBoard sprintBoardData = sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); // List<Column> list = sprintBoardData.getColumn(); // list.add(column); // sprintBoardData.setColumn(list); // return sprintBoardRepository.save(sprintBoardData); // // } @Override public SprintBoard deleteSprintColumn(String productId, String sprintId, String id) { System.out.println("hi from service"); System.out.println(sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId)); SprintBoard sprintBoard1 = sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); int counter = 0; for (Column column : sprintBoard1.getColumns()) { if (column.getColumnId().equals(id)) { break; } counter++; } List<Column> listOfColumns = sprintBoard1.getColumns(); listOfColumns.remove(counter); sprintBoard1.setColumns(listOfColumns); return sprintBoardRepository.save(sprintBoard1); } //Delete Sprint!!! // @Override // public void deleteSprintBoard(String productId, String sprintId) { // SprintBoard sprintBoard = sprintBoardRepository.findBySprintIdAndProductId(productId, sprintId); // SprintBoard updatedSprint = sprintBoardRepository.save(sprintBoard); // // System.out.println("vkjllkj"+updatedSprint); // rabbitTemplate.convertAndSend("DirectExchange", "sprintStats", updatedSprint); // sprintBoardRepository.deleteByProductIdAndSprintId(productId, sprintId); // } @Override public FreezeSprint addToFreezeSprint(FreezeSprint freezeSprint) { FreezeSprint savedFreezedSprint = freezeSprintRepository.save(freezeSprint); rabbitTemplate.convertAndSend("DirectExchange", "sprintStats", freezeSprint); return savedFreezedSprint; } // @Override // public FreezeSprint addToFreezeSprint(String productId, String sprintId, SprintBoard sprintBoard) { //// FreezeSprint freezeSprint = freezeSprintRepository.findByProductIdAndSprintId(productId,sprintId); // return freezeSprintRepository.save(sprintBoard); // } }
UTF-8
Java
7,117
java
SprintBoardService.java
Java
[]
null
[]
package in.stackroute.planage.sprint.kanban.service; import in.stackroute.planage.sprint.configuration.Receiver; import in.stackroute.planage.sprint.kanban.model.Column; import in.stackroute.planage.sprint.kanban.model.FreezeSprint; import in.stackroute.planage.sprint.kanban.model.SprintBoard; import in.stackroute.planage.sprint.kanban.model.Task; import in.stackroute.planage.sprint.kanban.repository.FreezeSprintRepository; import in.stackroute.planage.sprint.kanban.repository.SprintBoardRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; @Service public class SprintBoardService implements ISprintBoard { @Autowired SprintBoardRepository sprintBoardRepository; @Autowired FreezeSprintRepository freezeSprintRepository; private static final Logger log = LoggerFactory.getLogger(SprintBoard.class); private final RabbitTemplate rabbitTemplate; public SprintBoardService( RabbitTemplate rabbitTemplate) { this.rabbitTemplate = rabbitTemplate; } public List<SprintBoard> getAllData() { return sprintBoardRepository.findAll(); } //Current sprint data public SprintBoard getDataOfProduct(String productId) { return sprintBoardRepository.findByProductId(productId).get(); } // data of the product public SprintBoard addSprint(SprintBoard sprintBoard) { return sprintBoardRepository.save(sprintBoard); } public SprintBoard getSprintData(String sprintId, String productId) { return sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); } //data for any previous sprint board public SprintBoard updateSprintBoard(String sprintId, String productId, Column column) { SprintBoard sprintBoardData = sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); sprintBoardData.getColumns().add(column); return sprintBoardRepository.save(sprintBoardData); } @Override public SprintBoard createBacklog(String productId, String sprintId, Task task, String sprintName) { log.info("this is the updtae sprint" + productId); log.info("this is the updtae sprint" + sprintId); // System.out.println("this is the updtae sprint" + userstoryId); log.info("this is the updtae sprint" + task); System.out.println(sprintId+ "::::" + productId); System.out.println("\n\n\n\n\n\n\n"); System.out.println(productId + " " + sprintId); SprintBoard sprintBoard = sprintBoardRepository.findByProductId(productId).get(); System.out.println(sprintBoard); System.out.println("\n\n\n\n\n\n"); if ((sprintBoard.getColumns()).size() == 0) { // SprintBoard sprintBoard1 = new SprintBoard(); sprintBoard.setSprintId(sprintId); sprintBoard.setProductId(productId); sprintBoard.setStatus("live"); sprintBoard.setStartDate(new Date()); sprintBoard.setSprintName(sprintName); int lastActiveSprint = sprintBoard.getLastActiveSprint(); lastActiveSprint++; sprintBoard.setLastActiveSprint(lastActiveSprint); Column column = new Column(); column.setColumnName("Backlog"); List<Task> taskList = new ArrayList<>(); taskList.add(task); column.setTasks(taskList); sprintBoard.setColumns(Arrays.asList(column)); sprintBoard = sprintBoard; } else { List<Column> columnList = sprintBoard.getColumns(); for (Column column : columnList) { if (column.getColumnName().equals("Backlog")) { List<Task> taskList = column.getTasks(); taskList.add(task); column.setTasks(taskList); } sprintBoard.setColumns(columnList); } } sprintBoard.setTotalTaskCount(sprintBoard.getTotalTaskCount()+1); switch (task.getTaskCategory()) { case "Must" : sprintBoard.setTotalMustTask(sprintBoard.getTotalMustTask()+1); break; case "Try" : sprintBoard.setTotalTryTask(sprintBoard.getTotalTryTask()+1); break; case "Stretch" : sprintBoard.setTotalStretchTask(sprintBoard.getTotalStretchTask()+1); } return sprintBoardRepository.save(sprintBoard); } // public SprintBoard updateSprintColumn(String sprintId, String productId, Column column) { // SprintBoard sprintBoardData = sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); // List<Column> list = sprintBoardData.getColumn(); // list.add(column); // sprintBoardData.setColumn(list); // return sprintBoardRepository.save(sprintBoardData); // // } @Override public SprintBoard deleteSprintColumn(String productId, String sprintId, String id) { System.out.println("hi from service"); System.out.println(sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId)); SprintBoard sprintBoard1 = sprintBoardRepository.findBySprintIdAndProductId(sprintId, productId); int counter = 0; for (Column column : sprintBoard1.getColumns()) { if (column.getColumnId().equals(id)) { break; } counter++; } List<Column> listOfColumns = sprintBoard1.getColumns(); listOfColumns.remove(counter); sprintBoard1.setColumns(listOfColumns); return sprintBoardRepository.save(sprintBoard1); } //Delete Sprint!!! // @Override // public void deleteSprintBoard(String productId, String sprintId) { // SprintBoard sprintBoard = sprintBoardRepository.findBySprintIdAndProductId(productId, sprintId); // SprintBoard updatedSprint = sprintBoardRepository.save(sprintBoard); // // System.out.println("vkjllkj"+updatedSprint); // rabbitTemplate.convertAndSend("DirectExchange", "sprintStats", updatedSprint); // sprintBoardRepository.deleteByProductIdAndSprintId(productId, sprintId); // } @Override public FreezeSprint addToFreezeSprint(FreezeSprint freezeSprint) { FreezeSprint savedFreezedSprint = freezeSprintRepository.save(freezeSprint); rabbitTemplate.convertAndSend("DirectExchange", "sprintStats", freezeSprint); return savedFreezedSprint; } // @Override // public FreezeSprint addToFreezeSprint(String productId, String sprintId, SprintBoard sprintBoard) { //// FreezeSprint freezeSprint = freezeSprintRepository.findByProductIdAndSprintId(productId,sprintId); // return freezeSprintRepository.save(sprintBoard); // } }
7,117
0.685401
0.683434
173
40.144508
30.716999
118
false
false
0
0
0
0
0
0
0.676301
false
false
15
dea174acddb0a08dfa85f6d8a95a95e539fb9c59
23,433,341,637,288
281d18c30e8cd6d3ef4e0eeb4e13f69f4c604414
/app/src/main/java/biz/advancedcalendar/greendao/FileContact.java
25fe1177899cf3ac1ae225186e4f412f783d801c
[]
no_license
zakharovsergey1000/Alarmer
https://github.com/zakharovsergey1000/Alarmer
0cec89d7a71668d3932c5aea23c5c68a5b687aaf
4e2ad4055829ffb62418f139ca1fef257325d9a6
refs/heads/master
2021-05-15T16:51:17.175000
2019-06-02T14:27:15
2019-06-02T14:27:15
107,533,168
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package biz.advancedcalendar.greendao; import biz.advancedcalendar.greendao.DaoSession; import de.greenrobot.dao.DaoException; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit. /** * Entity mapped to table FILE_CONTACT. */ public class FileContact { private Long id; private Long FileId; private Long ContactId; private Boolean IsVirtual; /** Used to resolve relations */ private transient DaoSession daoSession; /** Used for active entity operations. */ private transient FileContactDao myDao; private File file; private Long file__resolvedKey; private Contact contact; private Long contact__resolvedKey; public FileContact() { } public FileContact(Long id) { this.id = id; } public FileContact(Long id, Long FileId, Long ContactId, Boolean IsVirtual) { this.id = id; this.FileId = FileId; this.ContactId = ContactId; this.IsVirtual = IsVirtual; } /** called by internal mechanisms, do not call yourself. */ public void __setDaoSession(DaoSession daoSession) { this.daoSession = daoSession; myDao = daoSession != null ? daoSession.getFileContactDao() : null; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getFileId() { return FileId; } public void setFileId(Long FileId) { this.FileId = FileId; } public Long getContactId() { return ContactId; } public void setContactId(Long ContactId) { this.ContactId = ContactId; } public Boolean getIsVirtual() { return IsVirtual; } public void setIsVirtual(Boolean IsVirtual) { this.IsVirtual = IsVirtual; } /** To-one relationship, resolved on first access. */ public File getFile() { Long __key = this.FileId; if (file__resolvedKey == null || !file__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } FileDao targetDao = daoSession.getFileDao(); File fileNew = targetDao.load(__key); synchronized (this) { file = fileNew; file__resolvedKey = __key; } } return file; } public void setFile(File file) { synchronized (this) { this.file = file; FileId = file == null ? null : file.getId(); file__resolvedKey = FileId; } } /** To-one relationship, resolved on first access. */ public Contact getContact() { Long __key = this.ContactId; if (contact__resolvedKey == null || !contact__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } ContactDao targetDao = daoSession.getContactDao(); Contact contactNew = targetDao.load(__key); synchronized (this) { contact = contactNew; contact__resolvedKey = __key; } } return contact; } public void setContact(Contact contact) { synchronized (this) { this.contact = contact; ContactId = contact == null ? null : contact.getId(); contact__resolvedKey = ContactId; } } /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */ public void delete() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.delete(this); } /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */ public void update() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.update(this); } /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */ public void refresh() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.refresh(this); } }
UTF-8
Java
4,386
java
FileContact.java
Java
[]
null
[]
package biz.advancedcalendar.greendao; import biz.advancedcalendar.greendao.DaoSession; import de.greenrobot.dao.DaoException; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit. /** * Entity mapped to table FILE_CONTACT. */ public class FileContact { private Long id; private Long FileId; private Long ContactId; private Boolean IsVirtual; /** Used to resolve relations */ private transient DaoSession daoSession; /** Used for active entity operations. */ private transient FileContactDao myDao; private File file; private Long file__resolvedKey; private Contact contact; private Long contact__resolvedKey; public FileContact() { } public FileContact(Long id) { this.id = id; } public FileContact(Long id, Long FileId, Long ContactId, Boolean IsVirtual) { this.id = id; this.FileId = FileId; this.ContactId = ContactId; this.IsVirtual = IsVirtual; } /** called by internal mechanisms, do not call yourself. */ public void __setDaoSession(DaoSession daoSession) { this.daoSession = daoSession; myDao = daoSession != null ? daoSession.getFileContactDao() : null; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getFileId() { return FileId; } public void setFileId(Long FileId) { this.FileId = FileId; } public Long getContactId() { return ContactId; } public void setContactId(Long ContactId) { this.ContactId = ContactId; } public Boolean getIsVirtual() { return IsVirtual; } public void setIsVirtual(Boolean IsVirtual) { this.IsVirtual = IsVirtual; } /** To-one relationship, resolved on first access. */ public File getFile() { Long __key = this.FileId; if (file__resolvedKey == null || !file__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } FileDao targetDao = daoSession.getFileDao(); File fileNew = targetDao.load(__key); synchronized (this) { file = fileNew; file__resolvedKey = __key; } } return file; } public void setFile(File file) { synchronized (this) { this.file = file; FileId = file == null ? null : file.getId(); file__resolvedKey = FileId; } } /** To-one relationship, resolved on first access. */ public Contact getContact() { Long __key = this.ContactId; if (contact__resolvedKey == null || !contact__resolvedKey.equals(__key)) { if (daoSession == null) { throw new DaoException("Entity is detached from DAO context"); } ContactDao targetDao = daoSession.getContactDao(); Contact contactNew = targetDao.load(__key); synchronized (this) { contact = contactNew; contact__resolvedKey = __key; } } return contact; } public void setContact(Contact contact) { synchronized (this) { this.contact = contact; ContactId = contact == null ? null : contact.getId(); contact__resolvedKey = ContactId; } } /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */ public void delete() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.delete(this); } /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */ public void update() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.update(this); } /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */ public void refresh() { if (myDao == null) { throw new DaoException("Entity is detached from DAO context"); } myDao.refresh(this); } }
4,386
0.585499
0.585499
156
27.115385
24.93272
110
false
false
0
0
0
0
0
0
0.429487
false
false
15
06721df49c3e6e69606a540eda0979a80c3e91a8
9,285,719,344,988
4d1b18ef70d11ea784e0edafd82de3cc577eb10d
/app/src/main/java/cn/libery/designpatterns/abstractfactory/CarFactory.java
64a95a2037000fb3d54e3239b6de6403455c3a0f
[]
no_license
Thewhitelight/DesignPatterns-Demo
https://github.com/Thewhitelight/DesignPatterns-Demo
b1d54c90e1eec6643ef29b37cf2d65954b5ad1cb
d3225ff6931cdddedfdba42438827eb5524b0e3e
refs/heads/master
2021-01-19T07:57:58.286000
2017-03-14T13:11:11
2017-03-14T13:11:11
82,065,967
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.libery.designpatterns.abstractfactory; /** * Created by ibery on 2017/2/20. */ public abstract class CarFactory { public abstract Tire createTire(); public abstract Engine createEngine(); public abstract Brake createBrake(); }
UTF-8
Java
256
java
CarFactory.java
Java
[ { "context": "designpatterns.abstractfactory;\n\n/**\n * Created by ibery on 2017/2/20.\n */\n\npublic abstract class CarFacto", "end": 74, "score": 0.9996801018714905, "start": 69, "tag": "USERNAME", "value": "ibery" } ]
null
[]
package cn.libery.designpatterns.abstractfactory; /** * Created by ibery on 2017/2/20. */ public abstract class CarFactory { public abstract Tire createTire(); public abstract Engine createEngine(); public abstract Brake createBrake(); }
256
0.726563
0.699219
13
18.692308
19.475367
49
false
false
0
0
0
0
0
0
0.307692
false
false
15
693728c92a3c68ef07d1016b8c76172ac026fe52
34,445,637,737,364
165f4d48c35c50dc0150746aa8c86b989ab8e141
/Regular Expression/src/com/koolnigam/app7/App7_RegeDemo_MobileNo.java
d7592467a99364bb3d1b0cbfc8d460bcf9590c71
[]
no_license
daadestroyer/CoreJavaImportantPrograms
https://github.com/daadestroyer/CoreJavaImportantPrograms
dad5207197f6df99d83e6aaf197f9749f3df0a5d
357e7e6736cf5e731e62b8dd26229e7e032b280f
refs/heads/master
2022-07-15T03:38:25.088000
2020-05-15T12:47:30
2020-05-15T12:47:30
248,660,009
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.koolnigam.app7; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; /* Rules to check valid mobile no:- ----------------------------- 1. Every no.s should contain exactly 10 digit 2. The first digit should be 7,8 or 9 */ public class App7_RegeDemo_MobileNo { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter mobile no"); String no = sc.next(); /* // for 10 digit mobile no Pattern p = Pattern.compile("[789][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"); Matcher m = p.matcher(no); // OR // Pattern p = p.compile([7-9][0-9]{9}); // act like [0-9] 9 times */ /*====================================================================================================================*/ /* // If we want to represent both 10 and 11 digit mobile no Pattern p1 = Pattern.compile("0?[6-9][0-9]{9}"); // 0 6789 0123456789 Matcher m = p1.matcher(no); if(m.find()&&m.group()==no) { System.out.println("valid no"); } else { System.out.println("invalid no"); } */ /*====================================================================================================================*/ /* // If we want to represent both 10 , 11 , 12 digit mobile no Pattern p = Pattern.compile("(0|91)?[6-9][0-9]{9}"); Matcher m = p.matcher(no); if(m.find()&&m.group().equals(no)) { System.out.println("valid no"); } else { System.out.println("invalid no"); } */ } }
UTF-8
Java
1,598
java
App7_RegeDemo_MobileNo.java
Java
[]
null
[]
package com.koolnigam.app7; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; /* Rules to check valid mobile no:- ----------------------------- 1. Every no.s should contain exactly 10 digit 2. The first digit should be 7,8 or 9 */ public class App7_RegeDemo_MobileNo { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter mobile no"); String no = sc.next(); /* // for 10 digit mobile no Pattern p = Pattern.compile("[789][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"); Matcher m = p.matcher(no); // OR // Pattern p = p.compile([7-9][0-9]{9}); // act like [0-9] 9 times */ /*====================================================================================================================*/ /* // If we want to represent both 10 and 11 digit mobile no Pattern p1 = Pattern.compile("0?[6-9][0-9]{9}"); // 0 6789 0123456789 Matcher m = p1.matcher(no); if(m.find()&&m.group()==no) { System.out.println("valid no"); } else { System.out.println("invalid no"); } */ /*====================================================================================================================*/ /* // If we want to represent both 10 , 11 , 12 digit mobile no Pattern p = Pattern.compile("(0|91)?[6-9][0-9]{9}"); Matcher m = p.matcher(no); if(m.find()&&m.group().equals(no)) { System.out.println("valid no"); } else { System.out.println("invalid no"); } */ } }
1,598
0.480601
0.429912
64
23.96875
27.359852
121
false
false
0
0
0
0
116
0.145181
0.703125
false
false
15
435399dc75f3312f74aafcaeec72621d63edf293
34,059,090,678,067
90d90d140a9ab66f98dd931093f2332c727b3253
/src/main/java/br/com/bank/service/mapper/PersonMapper.java
c55b12504de77de3fe2c20fbd4d24f89ec4ec07d
[]
no_license
jimmmisss/bank-register
https://github.com/jimmmisss/bank-register
2e5a53101bcc5c16ff7a3639f6d32271dcff7c15
c2964f627deb0c6f2e09e08d087fa7ce8d35415e
refs/heads/main
2023-07-17T03:17:02.546000
2021-08-31T11:53:53
2021-08-31T11:53:53
401,681,823
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.bank.service.mapper; import br.com.bank.assembly.message.person.PersonProduceCreateDTO; import br.com.bank.assembly.request.PersonParserRequest; import br.com.bank.assembly.request.PersonRequest; import br.com.bank.assembly.response.PersonResponse; import br.com.bank.entity.Person; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; @Mapper(componentModel = "cdi") public interface PersonMapper { PersonResponse map(Person entity); Person map(PersonRequest request); Person map(PersonParserRequest request); Person map(PersonRequest request, @MappingTarget Person entity); PersonProduceCreateDTO toProducerCreated(String origin, String method, Person entity); }
UTF-8
Java
719
java
PersonMapper.java
Java
[]
null
[]
package br.com.bank.service.mapper; import br.com.bank.assembly.message.person.PersonProduceCreateDTO; import br.com.bank.assembly.request.PersonParserRequest; import br.com.bank.assembly.request.PersonRequest; import br.com.bank.assembly.response.PersonResponse; import br.com.bank.entity.Person; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; @Mapper(componentModel = "cdi") public interface PersonMapper { PersonResponse map(Person entity); Person map(PersonRequest request); Person map(PersonParserRequest request); Person map(PersonRequest request, @MappingTarget Person entity); PersonProduceCreateDTO toProducerCreated(String origin, String method, Person entity); }
719
0.803894
0.803894
23
30.26087
25.899836
90
false
false
0
0
0
0
0
0
0.695652
false
false
15
f9c18ec8cfb6263d783feeead019ebd200a9ce99
36,764,920,057,175
ffbddc47e049db44ef8b5a2645a12113a3162534
/app/src/main/java/com/exams/anthopoulos/book4thought/BaseActivity.java
28268aa052bddf00554a58851b9d2b406efa5055
[]
no_license
FotisAnthos/Book4Thought
https://github.com/FotisAnthos/Book4Thought
99a07c28ddbdd2269b1b50051d74ee285f17f671
79b9952318f9060dc37165c34b293f7bc2b6825b
refs/heads/master
2020-03-30T20:57:52.619000
2019-01-12T19:02:52
2019-01-12T19:02:52
151,603,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.exams.anthopoulos.book4thought; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ImageView; import android.widget.SearchView; import android.widget.TextView; import android.widget.Toast; import com.exams.anthopoulos.book4thought.DataBases.RetrieveBooksDBOperation; import com.exams.anthopoulos.book4thought.Fragments.DBBooks; import com.exams.anthopoulos.book4thought.Fragments.LoadingFragment; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInStatusCodes; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.common.api.Scope; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.squareup.picasso.Picasso; import java.util.List; import java.util.Objects; public abstract class BaseActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private static final String TAG = "BaseActivityTag"; private static final int RC_SIGN_IN = 9001; private NavigationView navigationView; private GoogleSignInClient mGoogleSignInClient; private boolean doubleBackToExitPressedOnce = false; private Menu menu; private LoadingFragment loadingFragment; private MainActivity child; //if the current Activity is not MainActivity, this will be null @Override protected void onCreate(Bundle savedInstanceState) { int layoutCode = savedInstanceState.getInt("layout"); Bundle savedInstanceStateDefault = savedInstanceState.getBundle("savedInstanceState"); setContentView(layoutCode); super.onCreate(savedInstanceStateDefault); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); // [START configure_signin] // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestScopes(new Scope("https://www.googleapis.com/auth/books")) .build(); // [END configure_signin] // [START build_client] // Build a GoogleSignInClient with the options specified by gso. mGoogleSignInClient = GoogleSignIn.getClient(this, gso); // [END build_client] } @Override protected void onStart() { super.onStart(); // Check for existing Google Sign In account, if the user is already signed in // the GoogleSignInAccount will be non-null. GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this); //update the UI accordingly updateUI(account); } private void signIn() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); loadingFragment = new LoadingFragment(); loadingFragment.show(transaction, "loadingFragment"); Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); loadingFragment.dismiss(); // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { // The Task returned from this call is always completed, no need to attach a listener. Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); handleSignInResult(task); } else { Log.e(TAG, "onActivityResult: requestCode != RC_SIGN_IN"); } } private void handleSignInResult(Task<GoogleSignInAccount> completedTask) { try { GoogleSignInAccount account = completedTask.getResult(ApiException.class); Log.w(TAG, "Sign in - success"); updateUI(account); if(child != null){ boolean isSignedIn = GoogleSignIn.hasPermissions(account, new Scope("https://www.googleapis.com/auth/books")); child.updateUI(account, isSignedIn); } } catch (ApiException e) { switch (e.getStatusCode()) { //https://github.com/googlesamples/google-services/issues/374 case GoogleSignInStatusCodes.CANCELED: Log.w(TAG, "Sign in - CANCELED"); break; case GoogleSignInStatusCodes.NETWORK_ERROR: Log.w(TAG, "Sign in - NETWORK_ERROR"); break; case GoogleSignInStatusCodes.SIGN_IN_CANCELLED: Log.w(TAG, "Sign in - SIGN_IN_CANCELLED"); break; case GoogleSignInStatusCodes.ERROR: Log.w(TAG, "Sign in - ERROR"); break; } updateUI(null); Log.w(TAG, "signInResult:failed code=" + e.getStatusCode()); } } private void signOutGoogle() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); loadingFragment = new LoadingFragment(); loadingFragment.show(transaction, "loadingFragment"); mGoogleSignInClient.signOut() .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { loadingFragment.dismiss(); updateUI(null); } }); if(child != null){ child.updateUI(null, false); } } private void revokeAccessGoogle() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); loadingFragment = new LoadingFragment(); loadingFragment.show(transaction, "loadingFragment"); mGoogleSignInClient.revokeAccess() .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { loadingFragment.dismiss(); updateUI(null); } }); if(child != null){ child.updateUI(null, false); } } private void updateUI(GoogleSignInAccount account) { Menu menu = navigationView.getMenu(); final ImageView profileImage = navigationView.getHeaderView(0).findViewById(R.id.navProfileImage); TextView userName = navigationView.getHeaderView(0).findViewById(R.id.navProfileUsername); TextView email = navigationView.getHeaderView(0).findViewById(R.id.navProfileMail); if (account != null) {//if signed in menu.findItem(R.id.nav_signIn).setVisible(false); menu.findItem(R.id.nav_signOut).setVisible(true); menu.findItem(R.id.nav_disconnect).setVisible(true); userName.setText(account.getDisplayName()); email.setText(account.getEmail()); try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String url = Objects.requireNonNull(account.getPhotoUrl()).toString(); Drawable placeholder = getDrawable(R.drawable.ic_launcher_background); Picasso.get() .load(url) .placeholder(placeholder) .into(profileImage); } } catch (Exception e) { Log.w(TAG, "Could not load profile image"); } /* if(profilePicture != null){ profileImage.setImageBitmap(profilePicture); profileImage.setScaleType(ImageView.ScaleType.CENTER_INSIDE); } else {//else if not locally available start download task if(account.getPhotoUrl() != null) { DownloadImageTask DIT = new DownloadImageTask(profileImage, new DownloadImageTask.AsyncResponse(){ @Override public void imageDownloadFinish(Bitmap output) { profilePicture = output; }//when Image is downloaded store it }); DIT.execute(account.getPhotoUrl().toString()); } } */ } else {//if not signed in menu.findItem(R.id.nav_signIn).setVisible(true); menu.findItem(R.id.nav_signOut).setVisible(false); menu.findItem(R.id.nav_disconnect).setVisible(false); userName.setText(R.string.app_name); email.setText(R.string.noString); profileImage.setImageResource(R.mipmap.ic_launcher_round); } } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_search) { MenuItem search = findViewById(R.id.action_search); search.isChecked(); return true; } return super.onOptionsItemSelected(item); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Handle navigation view item clicks here. int id; id = item.getItemId(); if (id == R.id.nav_signIn) { signIn(); } else if (id == R.id.nav_signOut) { signOutGoogle(); } else if (id == R.id.nav_disconnect) { revokeAccessGoogle(); } else if (id == R.id.nav_manage) { startActivity(new Intent(this, LoginActivity.class)); } else if (id == R.id.nav_saved_books) { showSavedBooks(); } DrawerLayout drawer = findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } private void showSavedBooks(){ try { RetrieveBooksDBOperation retrieve = new RetrieveBooksDBOperation(this, new RetrieveBooksDBOperation.AsyncResponse() { @Override public void booksRetrieved(List<BookData> savedBooks) { DBBooks dbBooks = new DBBooks(); dbBooks.setBookList(savedBooks); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment previousFragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container); transaction .replace(R.id.fragment_container, dbBooks, "dbBooks") .addToBackStack(previousFragment.getTag()) .commit(); } }); retrieve.execute(); }catch (Exception e) { //Probably database not found/created TODO } } @Override public boolean onCreateOptionsMenu(Menu menu) { this.menu = menu; // Inflate the menu //this is the search MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); final SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if(isConnected()){ //prepare the new intent Intent search = new Intent(getBaseContext(), SearchActivity.class); search.putExtra("query", query); //reset the searchView searchView.setQuery("", false); searchView.setIconified(true); searchView.clearFocus(); //start the new (search) activity startActivity(search); } else{ String warning = getResources().getString(R.string.not_connected); Toast.makeText(getBaseContext(), warning, Toast.LENGTH_SHORT).show(); } return true; } @Override public boolean onQueryTextChange(String s) { return false; } }); return true; } @Override public void onBackPressed() { DrawerLayout drawer = findViewById(R.id.drawer_layout); SearchView searchItem = (SearchView) menu.findItem(R.id.action_search).getActionView(); //if the drawer is open, close it if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else if (!searchItem.isIconified()) { searchItem.onActionViewCollapsed(); } //else if the current fragment is the "MainFragment" else if (child != null) { if (doubleBackToExitPressedOnce) { //if back button has already been pressed once super.onBackPressed(); } else { //update back button is already pressed once(revert to not pressed after 2secs) doubleBackToExitPressedOnce = true; Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce = false; } }, 2000);//execute (order 65) after 2secs } } else { //if any other fragments are the current ones, go back super.onBackPressed(); } } private boolean isConnected() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager != null) { if (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) { return true; } } return false; } void child(MainActivity mainActivity) { this.child = mainActivity; } }
UTF-8
Java
16,040
java
BaseActivity.java
Java
[ { "context": "tusCode()) {\n //https://github.com/googlesamples/google-services/issues/374\n case G", "end": 5855, "score": 0.9994252920150757, "start": 5842, "tag": "USERNAME", "value": "googlesamples" }, { "context": "alse);\n\n userName.set...
null
[]
package com.exams.anthopoulos.book4thought; import android.content.Context; import android.content.Intent; import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ImageView; import android.widget.SearchView; import android.widget.TextView; import android.widget.Toast; import com.exams.anthopoulos.book4thought.DataBases.RetrieveBooksDBOperation; import com.exams.anthopoulos.book4thought.Fragments.DBBooks; import com.exams.anthopoulos.book4thought.Fragments.LoadingFragment; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.auth.api.signin.GoogleSignInStatusCodes; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.common.api.Scope; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.squareup.picasso.Picasso; import java.util.List; import java.util.Objects; public abstract class BaseActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private static final String TAG = "BaseActivityTag"; private static final int RC_SIGN_IN = 9001; private NavigationView navigationView; private GoogleSignInClient mGoogleSignInClient; private boolean doubleBackToExitPressedOnce = false; private Menu menu; private LoadingFragment loadingFragment; private MainActivity child; //if the current Activity is not MainActivity, this will be null @Override protected void onCreate(Bundle savedInstanceState) { int layoutCode = savedInstanceState.getInt("layout"); Bundle savedInstanceStateDefault = savedInstanceState.getBundle("savedInstanceState"); setContentView(layoutCode); super.onCreate(savedInstanceStateDefault); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); // [START configure_signin] // Configure sign-in to request the user's ID, email address, and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestEmail() .requestScopes(new Scope("https://www.googleapis.com/auth/books")) .build(); // [END configure_signin] // [START build_client] // Build a GoogleSignInClient with the options specified by gso. mGoogleSignInClient = GoogleSignIn.getClient(this, gso); // [END build_client] } @Override protected void onStart() { super.onStart(); // Check for existing Google Sign In account, if the user is already signed in // the GoogleSignInAccount will be non-null. GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(this); //update the UI accordingly updateUI(account); } private void signIn() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); loadingFragment = new LoadingFragment(); loadingFragment.show(transaction, "loadingFragment"); Intent signInIntent = mGoogleSignInClient.getSignInIntent(); startActivityForResult(signInIntent, RC_SIGN_IN); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); loadingFragment.dismiss(); // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { // The Task returned from this call is always completed, no need to attach a listener. Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data); handleSignInResult(task); } else { Log.e(TAG, "onActivityResult: requestCode != RC_SIGN_IN"); } } private void handleSignInResult(Task<GoogleSignInAccount> completedTask) { try { GoogleSignInAccount account = completedTask.getResult(ApiException.class); Log.w(TAG, "Sign in - success"); updateUI(account); if(child != null){ boolean isSignedIn = GoogleSignIn.hasPermissions(account, new Scope("https://www.googleapis.com/auth/books")); child.updateUI(account, isSignedIn); } } catch (ApiException e) { switch (e.getStatusCode()) { //https://github.com/googlesamples/google-services/issues/374 case GoogleSignInStatusCodes.CANCELED: Log.w(TAG, "Sign in - CANCELED"); break; case GoogleSignInStatusCodes.NETWORK_ERROR: Log.w(TAG, "Sign in - NETWORK_ERROR"); break; case GoogleSignInStatusCodes.SIGN_IN_CANCELLED: Log.w(TAG, "Sign in - SIGN_IN_CANCELLED"); break; case GoogleSignInStatusCodes.ERROR: Log.w(TAG, "Sign in - ERROR"); break; } updateUI(null); Log.w(TAG, "signInResult:failed code=" + e.getStatusCode()); } } private void signOutGoogle() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); loadingFragment = new LoadingFragment(); loadingFragment.show(transaction, "loadingFragment"); mGoogleSignInClient.signOut() .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { loadingFragment.dismiss(); updateUI(null); } }); if(child != null){ child.updateUI(null, false); } } private void revokeAccessGoogle() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); loadingFragment = new LoadingFragment(); loadingFragment.show(transaction, "loadingFragment"); mGoogleSignInClient.revokeAccess() .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { loadingFragment.dismiss(); updateUI(null); } }); if(child != null){ child.updateUI(null, false); } } private void updateUI(GoogleSignInAccount account) { Menu menu = navigationView.getMenu(); final ImageView profileImage = navigationView.getHeaderView(0).findViewById(R.id.navProfileImage); TextView userName = navigationView.getHeaderView(0).findViewById(R.id.navProfileUsername); TextView email = navigationView.getHeaderView(0).findViewById(R.id.navProfileMail); if (account != null) {//if signed in menu.findItem(R.id.nav_signIn).setVisible(false); menu.findItem(R.id.nav_signOut).setVisible(true); menu.findItem(R.id.nav_disconnect).setVisible(true); userName.setText(account.getDisplayName()); email.setText(account.getEmail()); try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String url = Objects.requireNonNull(account.getPhotoUrl()).toString(); Drawable placeholder = getDrawable(R.drawable.ic_launcher_background); Picasso.get() .load(url) .placeholder(placeholder) .into(profileImage); } } catch (Exception e) { Log.w(TAG, "Could not load profile image"); } /* if(profilePicture != null){ profileImage.setImageBitmap(profilePicture); profileImage.setScaleType(ImageView.ScaleType.CENTER_INSIDE); } else {//else if not locally available start download task if(account.getPhotoUrl() != null) { DownloadImageTask DIT = new DownloadImageTask(profileImage, new DownloadImageTask.AsyncResponse(){ @Override public void imageDownloadFinish(Bitmap output) { profilePicture = output; }//when Image is downloaded store it }); DIT.execute(account.getPhotoUrl().toString()); } } */ } else {//if not signed in menu.findItem(R.id.nav_signIn).setVisible(true); menu.findItem(R.id.nav_signOut).setVisible(false); menu.findItem(R.id.nav_disconnect).setVisible(false); userName.setText(R.string.app_name); email.setText(R.string.noString); profileImage.setImageResource(R.mipmap.ic_launcher_round); } } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_search) { MenuItem search = findViewById(R.id.action_search); search.isChecked(); return true; } return super.onOptionsItemSelected(item); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Handle navigation view item clicks here. int id; id = item.getItemId(); if (id == R.id.nav_signIn) { signIn(); } else if (id == R.id.nav_signOut) { signOutGoogle(); } else if (id == R.id.nav_disconnect) { revokeAccessGoogle(); } else if (id == R.id.nav_manage) { startActivity(new Intent(this, LoginActivity.class)); } else if (id == R.id.nav_saved_books) { showSavedBooks(); } DrawerLayout drawer = findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } private void showSavedBooks(){ try { RetrieveBooksDBOperation retrieve = new RetrieveBooksDBOperation(this, new RetrieveBooksDBOperation.AsyncResponse() { @Override public void booksRetrieved(List<BookData> savedBooks) { DBBooks dbBooks = new DBBooks(); dbBooks.setBookList(savedBooks); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment previousFragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container); transaction .replace(R.id.fragment_container, dbBooks, "dbBooks") .addToBackStack(previousFragment.getTag()) .commit(); } }); retrieve.execute(); }catch (Exception e) { //Probably database not found/created TODO } } @Override public boolean onCreateOptionsMenu(Menu menu) { this.menu = menu; // Inflate the menu //this is the search MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); final SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if(isConnected()){ //prepare the new intent Intent search = new Intent(getBaseContext(), SearchActivity.class); search.putExtra("query", query); //reset the searchView searchView.setQuery("", false); searchView.setIconified(true); searchView.clearFocus(); //start the new (search) activity startActivity(search); } else{ String warning = getResources().getString(R.string.not_connected); Toast.makeText(getBaseContext(), warning, Toast.LENGTH_SHORT).show(); } return true; } @Override public boolean onQueryTextChange(String s) { return false; } }); return true; } @Override public void onBackPressed() { DrawerLayout drawer = findViewById(R.id.drawer_layout); SearchView searchItem = (SearchView) menu.findItem(R.id.action_search).getActionView(); //if the drawer is open, close it if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else if (!searchItem.isIconified()) { searchItem.onActionViewCollapsed(); } //else if the current fragment is the "MainFragment" else if (child != null) { if (doubleBackToExitPressedOnce) { //if back button has already been pressed once super.onBackPressed(); } else { //update back button is already pressed once(revert to not pressed after 2secs) doubleBackToExitPressedOnce = true; Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { doubleBackToExitPressedOnce = false; } }, 2000);//execute (order 65) after 2secs } } else { //if any other fragments are the current ones, go back super.onBackPressed(); } } private boolean isConnected() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager != null) { if (connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) { return true; } } return false; } void child(MainActivity mainActivity) { this.child = mainActivity; } }
16,040
0.616147
0.614339
385
40.65974
28.721703
130
false
false
0
0
0
0
0
0
0.602597
false
false
15
79d39da5db41963df764875d22a207ac9191a318
23,733,989,325,079
8d165adc8999438ad943633cda493db43b885ffd
/src/main/java/me/gorgeousone/tangledmaze/command/framework/argument/ArgValue.java
d623c91512c3402f25840ca66af22c931a5158bb
[ "MIT" ]
permissive
theblobinc/TangledMaze
https://github.com/theblobinc/TangledMaze
89130a6a8580cd03827ca708cb5bf535a851d98c
3663a57898ba8a086e292e9f331007fe896c0c34
refs/heads/master
2020-11-24T10:09:50.463000
2019-11-08T11:45:03
2019-11-08T11:45:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.gorgeousone.tangledmaze.command.framework.argument; import org.bukkit.ChatColor; public class ArgValue { private static final String argumentTypeException = ChatColor.RED + "'%value%' is not a %type%."; private String stringVal; private int intVal; private double decimalVal; public ArgValue(Argument argument, String value) { this(argument.getType(), value); } public ArgValue(ArgType type, String value) { setValue(type, value); } public String getString() { return stringVal; } public int getInt() { return intVal; } public double getDouble() { return decimalVal; } protected void setValue(ArgType type, String value) { try { switch (type) { case INTEGER: intVal = Integer.parseInt(value); case DECIMAL: decimalVal = Double.parseDouble(value); case STRING: stringVal = value; break; } } catch (NumberFormatException ex) { throw new IllegalArgumentException(argumentTypeException.replace("%value%", value).replace("%type%", type.simpleName())); } } }
UTF-8
Java
1,064
java
ArgValue.java
Java
[ { "context": "package me.gorgeousone.tangledmaze.command.framework.argument;\n\nimport o", "end": 22, "score": 0.9202869534492493, "start": 11, "tag": "USERNAME", "value": "gorgeousone" } ]
null
[]
package me.gorgeousone.tangledmaze.command.framework.argument; import org.bukkit.ChatColor; public class ArgValue { private static final String argumentTypeException = ChatColor.RED + "'%value%' is not a %type%."; private String stringVal; private int intVal; private double decimalVal; public ArgValue(Argument argument, String value) { this(argument.getType(), value); } public ArgValue(ArgType type, String value) { setValue(type, value); } public String getString() { return stringVal; } public int getInt() { return intVal; } public double getDouble() { return decimalVal; } protected void setValue(ArgType type, String value) { try { switch (type) { case INTEGER: intVal = Integer.parseInt(value); case DECIMAL: decimalVal = Double.parseDouble(value); case STRING: stringVal = value; break; } } catch (NumberFormatException ex) { throw new IllegalArgumentException(argumentTypeException.replace("%value%", value).replace("%type%", type.simpleName())); } } }
1,064
0.692669
0.692669
53
19.075472
24.397532
124
false
false
0
0
0
0
0
0
2.037736
false
false
15
77f5ca94c694718b6f9c119c04f773f4b334520c
17,824,114,330,363
b11c7f8c37fc873cf122ecf0a5b35c80a2f2b77f
/app/src/main/java/com/example/alexa/weather/Models/Adapters/BindingAdapters.java
e2a8af1b5183f31cd71566bdac1bf34b98f672ac
[]
no_license
AlexanderBesss/Weather
https://github.com/AlexanderBesss/Weather
3d9980e64d9cf3e9f1a085940e6f2a50117eb22e
766887214a2e76fea622a8e4bd589bec1192c267
refs/heads/master
2019-07-08T13:03:44.656000
2017-05-27T18:04:04
2017-05-27T18:04:04
88,793,554
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.alexa.weather.Models.Adapters; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.databinding.BindingAdapter; import android.databinding.ObservableArrayList; import android.databinding.ObservableBoolean; import android.graphics.Color; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.widget.CardView; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import com.example.alexa.weather.R; import com.example.alexa.weather.ViewModels.GoogleLoginActivityVM; import com.example.alexa.weather.Views.CurrencyFragment; import com.example.alexa.weather.Views.MainActivity; import com.example.alexa.weather.Views.NoteActivity; import com.example.alexa.weather.Views.NoteFragment; import com.example.alexa.weather.Views.WeatherDailyFragment; import com.example.alexa.weather.Views.WeatherHourlyFragment; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.support.v4.content.ContextCompat.getColor; public class BindingAdapters { @BindingAdapter("bind:animation") public static void setAnimation(FloatingActionButton view, ObservableBoolean isExtend) { Animation animation; if (isExtend.get()) { animation = AnimationUtils.loadAnimation(view.getContext(), R.anim.extend); animation.setRepeatMode(Animation.RELATIVE_TO_PARENT); view.startAnimation(animation); } else { animation = AnimationUtils.loadAnimation(view.getContext(), R.anim.collapse); animation.setRepeatMode(Animation.RELATIVE_TO_PARENT); view.startAnimation(animation); } } @BindingAdapter("bind:onClick") public static void bindOnClick(View view, final GoogleLoginActivityVM googleLoginActivityVM){ view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { googleLoginActivityVM.onLogin(); } }); } @BindingAdapter({"bind:handler"}) public static void bindViewPagerAdapter(final ViewPager view, final MainActivity activity) { final ViewPagerAdapter adapter = new ViewPagerAdapter(view.getContext(), activity.getSupportFragmentManager()); //adapter.addFragment(new WeatherHourlyFragment(), "Hourly"); adapter.addFragment(new WeatherDailyFragment(), "Погода"); adapter.addFragment(new CurrencyFragment(), "Курс валют"); adapter.addFragment(new NoteFragment(), "Заметки"); view.setAdapter(adapter); } @BindingAdapter({"bind:pager"}) public static void bindViewPagerTabs(final TabLayout view, final ViewPager pagerView) { view.setupWithViewPager(pagerView, true); } @BindingAdapter("bind:hourlyItems") public static void bindList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.RestService.JsonWeatherHourlyDataModel.List> list) { int orientation = view.getContext().getResources().getConfiguration().orientation; GridLayoutManager layoutManager; if(orientation == ORIENTATION_PORTRAIT) { layoutManager = new GridLayoutManager(view.getContext(), 2, LinearLayoutManager.VERTICAL, false); }else layoutManager = new GridLayoutManager(view.getContext(), 3, LinearLayoutManager.VERTICAL, false); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.hourly_weather)); } @BindingAdapter("bind:dailyItems") public static void dailyList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.RestService.JsonWeatherDailyDataModel.List> list) { LinearLayoutManager layoutManager ; layoutManager = new LinearLayoutManager (view.getContext()); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.daily_weather)); } @BindingAdapter("bind:currency") public static void currencyList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.RestService.JsonCurrencyModel.Currency> list) { LinearLayoutManager layoutManager ; layoutManager = new LinearLayoutManager (view.getContext()); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.currency)); } @BindingAdapter("bind:notes") public static void noteList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.DataBase.Note> list) { LinearLayoutManager layoutManager ; layoutManager = new LinearLayoutManager (view.getContext()); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.note)); } @SuppressLint("ResourceAsColor") @BindingAdapter("bind:color") public static void frameColor(FrameLayout frameLayout, Boolean isImportant){ if(isImportant) { frameLayout.setBackgroundColor(R.color.skinHigh); } } @BindingAdapter("bind:backgroundColor") public static void cardColor(CardView cardView, Boolean isImportant){ if(isImportant) { cardView.setCardBackgroundColor( Color.rgb(246, 247, 195)); } } @BindingAdapter("bind:backgroundEditText") public static void editTextColor(EditText editText, Boolean isImportant){ if(isImportant) { editText.setBackgroundColor( Color.rgb(246, 247, 195)); }else { editText.setBackgroundColor( Color.WHITE); } } @BindingAdapter("bind:image") public static void setResource(ImageView imageView, String resource) { switch (resource) { case "USD": imageView.setImageResource(R.drawable.usd); break; case "EUR": imageView.setImageResource(R.drawable.eur); break; case "BTC": imageView.setImageResource(R.drawable.btc); break; case "RUR": imageView.setImageResource(R.drawable.rur); break; case "UAH": imageView.setImageResource(R.drawable.uah); break; default: imageView.setImageResource(R.drawable.uah); break; } } @BindingAdapter("bind:src") public static void setImageViewResource(ImageView imageView, String resource) { switch (resource) { case "200": case "201": case "202": case "210": case "211": case "212": case "221": case "230": case "231": case "232": imageView.setImageResource(R.drawable.i11d); break; case "300": case "301": case "302": case "310": case "311": case "312": case "313": case "314": case "321": imageView.setImageResource(R.drawable.i09d); break; case "500": case "501": case "502": case "503": case "504": imageView.setImageResource(R.drawable.i10d); break; case "511": imageView.setImageResource(R.drawable.i13d); break; case "520": case "521": case "522": case "531": imageView.setImageResource(R.drawable.i09d); break; case "600": case "601": case "602": case "611": case "612": case "615": case "616": case "620": case "621": case "622": imageView.setImageResource(R.drawable.i13d); break; case "701": case "711": case "721": case "731": case "741": case "751": case "761": case "762": case "771": case "781": imageView.setImageResource(R.drawable.i50d); break; case "800": imageView.setImageResource(R.drawable.i01d); break; case "801": imageView.setImageResource(R.drawable.i02d); break; case "802": imageView.setImageResource(R.drawable.i03d); break; case "803": case "804": imageView.setImageResource(R.drawable.i04d); break; default: imageView.setImageResource(R.drawable.i10d); break; } } }
UTF-8
Java
9,395
java
BindingAdapters.java
Java
[]
null
[]
package com.example.alexa.weather.Models.Adapters; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.databinding.BindingAdapter; import android.databinding.ObservableArrayList; import android.databinding.ObservableBoolean; import android.graphics.Color; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.widget.CardView; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import com.example.alexa.weather.R; import com.example.alexa.weather.ViewModels.GoogleLoginActivityVM; import com.example.alexa.weather.Views.CurrencyFragment; import com.example.alexa.weather.Views.MainActivity; import com.example.alexa.weather.Views.NoteActivity; import com.example.alexa.weather.Views.NoteFragment; import com.example.alexa.weather.Views.WeatherDailyFragment; import com.example.alexa.weather.Views.WeatherHourlyFragment; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.support.v4.content.ContextCompat.getColor; public class BindingAdapters { @BindingAdapter("bind:animation") public static void setAnimation(FloatingActionButton view, ObservableBoolean isExtend) { Animation animation; if (isExtend.get()) { animation = AnimationUtils.loadAnimation(view.getContext(), R.anim.extend); animation.setRepeatMode(Animation.RELATIVE_TO_PARENT); view.startAnimation(animation); } else { animation = AnimationUtils.loadAnimation(view.getContext(), R.anim.collapse); animation.setRepeatMode(Animation.RELATIVE_TO_PARENT); view.startAnimation(animation); } } @BindingAdapter("bind:onClick") public static void bindOnClick(View view, final GoogleLoginActivityVM googleLoginActivityVM){ view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { googleLoginActivityVM.onLogin(); } }); } @BindingAdapter({"bind:handler"}) public static void bindViewPagerAdapter(final ViewPager view, final MainActivity activity) { final ViewPagerAdapter adapter = new ViewPagerAdapter(view.getContext(), activity.getSupportFragmentManager()); //adapter.addFragment(new WeatherHourlyFragment(), "Hourly"); adapter.addFragment(new WeatherDailyFragment(), "Погода"); adapter.addFragment(new CurrencyFragment(), "Курс валют"); adapter.addFragment(new NoteFragment(), "Заметки"); view.setAdapter(adapter); } @BindingAdapter({"bind:pager"}) public static void bindViewPagerTabs(final TabLayout view, final ViewPager pagerView) { view.setupWithViewPager(pagerView, true); } @BindingAdapter("bind:hourlyItems") public static void bindList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.RestService.JsonWeatherHourlyDataModel.List> list) { int orientation = view.getContext().getResources().getConfiguration().orientation; GridLayoutManager layoutManager; if(orientation == ORIENTATION_PORTRAIT) { layoutManager = new GridLayoutManager(view.getContext(), 2, LinearLayoutManager.VERTICAL, false); }else layoutManager = new GridLayoutManager(view.getContext(), 3, LinearLayoutManager.VERTICAL, false); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.hourly_weather)); } @BindingAdapter("bind:dailyItems") public static void dailyList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.RestService.JsonWeatherDailyDataModel.List> list) { LinearLayoutManager layoutManager ; layoutManager = new LinearLayoutManager (view.getContext()); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.daily_weather)); } @BindingAdapter("bind:currency") public static void currencyList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.RestService.JsonCurrencyModel.Currency> list) { LinearLayoutManager layoutManager ; layoutManager = new LinearLayoutManager (view.getContext()); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.currency)); } @BindingAdapter("bind:notes") public static void noteList(RecyclerView view, ObservableArrayList<com.example.alexa.weather.Models.DataBase.Note> list) { LinearLayoutManager layoutManager ; layoutManager = new LinearLayoutManager (view.getContext()); view.setLayoutManager(layoutManager); view.setAdapter(new RecyclerViewAdapter<>(list, R.layout.note)); } @SuppressLint("ResourceAsColor") @BindingAdapter("bind:color") public static void frameColor(FrameLayout frameLayout, Boolean isImportant){ if(isImportant) { frameLayout.setBackgroundColor(R.color.skinHigh); } } @BindingAdapter("bind:backgroundColor") public static void cardColor(CardView cardView, Boolean isImportant){ if(isImportant) { cardView.setCardBackgroundColor( Color.rgb(246, 247, 195)); } } @BindingAdapter("bind:backgroundEditText") public static void editTextColor(EditText editText, Boolean isImportant){ if(isImportant) { editText.setBackgroundColor( Color.rgb(246, 247, 195)); }else { editText.setBackgroundColor( Color.WHITE); } } @BindingAdapter("bind:image") public static void setResource(ImageView imageView, String resource) { switch (resource) { case "USD": imageView.setImageResource(R.drawable.usd); break; case "EUR": imageView.setImageResource(R.drawable.eur); break; case "BTC": imageView.setImageResource(R.drawable.btc); break; case "RUR": imageView.setImageResource(R.drawable.rur); break; case "UAH": imageView.setImageResource(R.drawable.uah); break; default: imageView.setImageResource(R.drawable.uah); break; } } @BindingAdapter("bind:src") public static void setImageViewResource(ImageView imageView, String resource) { switch (resource) { case "200": case "201": case "202": case "210": case "211": case "212": case "221": case "230": case "231": case "232": imageView.setImageResource(R.drawable.i11d); break; case "300": case "301": case "302": case "310": case "311": case "312": case "313": case "314": case "321": imageView.setImageResource(R.drawable.i09d); break; case "500": case "501": case "502": case "503": case "504": imageView.setImageResource(R.drawable.i10d); break; case "511": imageView.setImageResource(R.drawable.i13d); break; case "520": case "521": case "522": case "531": imageView.setImageResource(R.drawable.i09d); break; case "600": case "601": case "602": case "611": case "612": case "615": case "616": case "620": case "621": case "622": imageView.setImageResource(R.drawable.i13d); break; case "701": case "711": case "721": case "731": case "741": case "751": case "761": case "762": case "771": case "781": imageView.setImageResource(R.drawable.i50d); break; case "800": imageView.setImageResource(R.drawable.i01d); break; case "801": imageView.setImageResource(R.drawable.i02d); break; case "802": imageView.setImageResource(R.drawable.i03d); break; case "803": case "804": imageView.setImageResource(R.drawable.i04d); break; default: imageView.setImageResource(R.drawable.i10d); break; } } }
9,395
0.626054
0.603435
259
35.18919
28.532562
157
false
false
0
0
0
0
0
0
0.544402
false
false
15
7bd2af1425080f52ceae63a28809245f0f71af18
10,213,432,289,030
9986e9571999be4b597059f055071e65072b8ff3
/administration-ui/src/main/java/lt/tokenmill/crawling/adminui/view/HttpSourcesView.java
e3bf1359aadb65ae403d9493ac793a4ded8aa650
[ "Apache-2.0" ]
permissive
tokenmill/crawling-framework
https://github.com/tokenmill/crawling-framework
ce956e15fdf0e5ccab6b7455a1ac930df810d272
987100fee5965b43e178c9096ab3b2aa3a11fac7
refs/heads/master
2022-11-19T01:37:43.866000
2021-05-24T05:53:42
2021-05-24T05:53:42
103,384,901
26
2
NOASSERTION
false
2022-11-15T23:31:06
2017-09-13T10:12:37
2021-08-26T05:14:13
2022-11-15T23:31:02
940
22
2
24
Java
false
false
package lt.tokenmill.crawling.adminui.view; import com.google.common.base.Joiner; import com.vaadin.data.Item; import com.vaadin.data.util.BeanItemContainer; import com.vaadin.data.util.GeneratedPropertyContainer; import com.vaadin.data.util.PropertyValueGenerator; import com.vaadin.data.util.converter.Converter; import com.vaadin.event.ShortcutAction; import com.vaadin.ui.*; import com.vaadin.ui.renderers.ButtonRenderer; import com.vaadin.ui.renderers.HtmlRenderer; import lt.tokenmill.crawling.commonui.ElasticSearch; import lt.tokenmill.crawling.data.HttpSource; import lt.tokenmill.crawling.data.PageableList; import lt.tokenmill.crawling.es.model.DateHistogramValue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import java.util.Locale; import static com.vaadin.server.Sizeable.Unit.PERCENTAGE; import static com.vaadin.server.Sizeable.Unit.PIXELS; public class HttpSourcesView extends BaseView { private static final Logger LOG = LoggerFactory.getLogger(HttpSourcesView.class); private Grid itemsGrid = new Grid(new GeneratedPropertyContainer(new BeanItemContainer<>(HttpSource.class))); private Label totalCountLabel = new Label(); private TextField filterField = new TextField(); private HorizontalLayout pagingRow = new HorizontalLayout(); private long totalCount = 0; private int currentPage = 1; public HttpSourcesView() { super("HTTP Sources"); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setWidth(100, PERCENTAGE); mainLayout.setHeight(100, PERCENTAGE); mainLayout.setSpacing(true); VerticalLayout gridLayout = new VerticalLayout(); gridLayout.setSpacing(true); gridLayout.setWidth(100, PERCENTAGE); HttpSourceForm form = new HttpSourceForm() { @Override public void afterUpdate() { refreshGrid(filterField.getValue()); } }; form.setWidth(100, PERCENTAGE); // Search field and create new button filterField.setInputPrompt("Enter search text..."); filterField.addTextChangeListener(event -> { this.currentPage = 1; refreshGrid(event.getText()); }); Button addNewButton = new Button("Add New (Alt + N)"); addNewButton.addClickListener(event -> form.edit(new HttpSource())); addShortcutListener(new Button.ClickShortcut(addNewButton, ShortcutAction.KeyCode.N, ShortcutAction.ModifierKey.ALT)); HorizontalLayout actionHeader = new HorizontalLayout(filterField, addNewButton); actionHeader.setSpacing(true); actionHeader.setWidth(100, PERCENTAGE); filterField.setWidth(100, PERCENTAGE); actionHeader.setExpandRatio(filterField, 1.0f); gridLayout.addComponent(actionHeader); // Grid itemsGrid.setWidth(100, PERCENTAGE); itemsGrid.setHeight(750, PIXELS); itemsGrid.setSelectionMode(Grid.SelectionMode.SINGLE); itemsGrid.addSelectionListener( e -> form.edit((HttpSource) itemsGrid.getSelectedRow())); itemsGrid.getColumn("name").setConverter(new StringTrimmer(50)); itemsGrid.getColumn("url").setRenderer(new HtmlRenderer(), new UrlToLinkConverter()); itemsGrid.getColumn("enabled"); ((GeneratedPropertyContainer) itemsGrid.getContainerDataSource()) .addGeneratedProperty("test", new ButtonPropertyGenerator("Test")); ((GeneratedPropertyContainer) itemsGrid.getContainerDataSource()) .addGeneratedProperty("statistics", new StatsButtonPropertyGenerator("Stats")); itemsGrid.getColumn("test").setRenderer(new ButtonRenderer(e -> { HttpSource hs = (HttpSource) e.getItemId(); hs = ElasticSearch.getHttpSourceOperations().get(hs.getUrl()); UI.getCurrent().addWindow(new HttpSourceTestWindow(hs)); })); itemsGrid.getColumn("statistics").setRenderer(new ButtonRenderer(e -> { HttpSource hs = (HttpSource) e.getItemId(); UI.getCurrent().addWindow(new HttpSourceStatsWindow(hs.getUrl())); })); itemsGrid.setColumns("name", "url", "enabled", "test", "statistics"); gridLayout.addComponent(itemsGrid); gridLayout.addComponent(totalCountLabel); refreshGrid(filterField.getValue()); mainLayout.addComponent(gridLayout); mainLayout.setExpandRatio(gridLayout, 0.55f); mainLayout.addComponent(form); mainLayout.setExpandRatio(form, 0.45f); addComponent(mainLayout); gridLayout.addComponent(pagingRow); } private void refreshPagingRow() { pagingRow.removeAllComponents(); pagingRow.addComponent(new Label("Pages: ")); long amountOfPages = this.totalCount / 100; amountOfPages = amountOfPages + (this.totalCount % 100 != 0 ? 1 : 0); for (int i = 1; i <= amountOfPages; i++) { String buttonLabel = String.valueOf(i); Button button = new Button(); if (i == currentPage) { buttonLabel = ">>" + buttonLabel + "<<"; } button.setCaption(buttonLabel); button.setIconAlternateText(String.valueOf(i)); button.addClickListener(clickEvent -> { this.currentPage = (Integer.parseInt(clickEvent.getButton().getIconAlternateText())); refreshGrid(filterField.getValue()); }); pagingRow.addComponent(button); } } private int getOffset() { return (this.currentPage - 1) * 100; } private void refreshGrid(String text) { LOG.info("Refreshing grid using filter '{}'", text); PageableList<HttpSource> data = ElasticSearch.getHttpSourceOperations().filter(text, getOffset()); itemsGrid.getContainerDataSource().removeAllItems(); for (HttpSource source : data.getItems()) { itemsGrid.getContainerDataSource().addItem(source); } this.totalCount = data.getTotalCount(); totalCountLabel.setValue(String.format("Total count: %d", data.getTotalCount())); refreshPagingRow(); } private static class StringListConverter implements Converter<String, List> { @Override public List convertToModel(String s, Class<? extends List> aClass, Locale locale) throws ConversionException { return new ArrayList(); } @Override public String convertToPresentation(List list, Class<? extends String> aClass, Locale locale) throws ConversionException { return Joiner.on(", ").join(list); } @Override public Class<List> getModelType() { return List.class; } @Override public Class<String> getPresentationType() { return String.class; } } private static class StringTrimmer implements Converter<String, String> { private int maxLength; public StringTrimmer(int maxLength) { this.maxLength = maxLength; } @Override public String convertToModel(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return string; } @Override public String convertToPresentation(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return string != null && string.length() > maxLength ? string.substring(0, maxLength) + "..." : string; } @Override public Class<String> getModelType() { return String.class; } @Override public Class<String> getPresentationType() { return String.class; } } private static class UrlToLinkConverter implements Converter<String, String> { @Override public String convertToModel(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return string; } @Override public String convertToPresentation(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return String.format("<a href=\"%s\" target=\"_blank\">%s</a>", string, string); } @Override public Class<String> getModelType() { return String.class; } @Override public Class<String> getPresentationType() { return String.class; } } private static class StatsButtonPropertyGenerator extends PropertyValueGenerator<String> { private String name; public StatsButtonPropertyGenerator(String name) { this.name = name; } private Long lastHistogramValue(List<DateHistogramValue> coll) { return coll.size() == 0 ? 0 : coll.get(coll.size() - 1).getValue(); } @Override public String getValue(Item item, Object itemId, Object propertyId) { HttpSource hs = (HttpSource) itemId; List<DateHistogramValue> urls = ElasticSearch.getUrlOperations().calculateStats(hs.getUrl()); List<DateHistogramValue> documents = ElasticSearch.getDocumentOperations().calculateStats(hs.getUrl()); return String.format("%s (%4d/%4d)", name, lastHistogramValue(urls), lastHistogramValue(documents)); } @Override public Class<String> getType() { return String.class; } } private static class ButtonPropertyGenerator extends PropertyValueGenerator<String> { private String name; public ButtonPropertyGenerator(String name) { this.name = name; } @Override public String getValue(Item item, Object itemId, Object propertyId) { return name; } @Override public Class<String> getType() { return String.class; } } }
UTF-8
Java
10,065
java
HttpSourcesView.java
Java
[]
null
[]
package lt.tokenmill.crawling.adminui.view; import com.google.common.base.Joiner; import com.vaadin.data.Item; import com.vaadin.data.util.BeanItemContainer; import com.vaadin.data.util.GeneratedPropertyContainer; import com.vaadin.data.util.PropertyValueGenerator; import com.vaadin.data.util.converter.Converter; import com.vaadin.event.ShortcutAction; import com.vaadin.ui.*; import com.vaadin.ui.renderers.ButtonRenderer; import com.vaadin.ui.renderers.HtmlRenderer; import lt.tokenmill.crawling.commonui.ElasticSearch; import lt.tokenmill.crawling.data.HttpSource; import lt.tokenmill.crawling.data.PageableList; import lt.tokenmill.crawling.es.model.DateHistogramValue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import java.util.Locale; import static com.vaadin.server.Sizeable.Unit.PERCENTAGE; import static com.vaadin.server.Sizeable.Unit.PIXELS; public class HttpSourcesView extends BaseView { private static final Logger LOG = LoggerFactory.getLogger(HttpSourcesView.class); private Grid itemsGrid = new Grid(new GeneratedPropertyContainer(new BeanItemContainer<>(HttpSource.class))); private Label totalCountLabel = new Label(); private TextField filterField = new TextField(); private HorizontalLayout pagingRow = new HorizontalLayout(); private long totalCount = 0; private int currentPage = 1; public HttpSourcesView() { super("HTTP Sources"); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setWidth(100, PERCENTAGE); mainLayout.setHeight(100, PERCENTAGE); mainLayout.setSpacing(true); VerticalLayout gridLayout = new VerticalLayout(); gridLayout.setSpacing(true); gridLayout.setWidth(100, PERCENTAGE); HttpSourceForm form = new HttpSourceForm() { @Override public void afterUpdate() { refreshGrid(filterField.getValue()); } }; form.setWidth(100, PERCENTAGE); // Search field and create new button filterField.setInputPrompt("Enter search text..."); filterField.addTextChangeListener(event -> { this.currentPage = 1; refreshGrid(event.getText()); }); Button addNewButton = new Button("Add New (Alt + N)"); addNewButton.addClickListener(event -> form.edit(new HttpSource())); addShortcutListener(new Button.ClickShortcut(addNewButton, ShortcutAction.KeyCode.N, ShortcutAction.ModifierKey.ALT)); HorizontalLayout actionHeader = new HorizontalLayout(filterField, addNewButton); actionHeader.setSpacing(true); actionHeader.setWidth(100, PERCENTAGE); filterField.setWidth(100, PERCENTAGE); actionHeader.setExpandRatio(filterField, 1.0f); gridLayout.addComponent(actionHeader); // Grid itemsGrid.setWidth(100, PERCENTAGE); itemsGrid.setHeight(750, PIXELS); itemsGrid.setSelectionMode(Grid.SelectionMode.SINGLE); itemsGrid.addSelectionListener( e -> form.edit((HttpSource) itemsGrid.getSelectedRow())); itemsGrid.getColumn("name").setConverter(new StringTrimmer(50)); itemsGrid.getColumn("url").setRenderer(new HtmlRenderer(), new UrlToLinkConverter()); itemsGrid.getColumn("enabled"); ((GeneratedPropertyContainer) itemsGrid.getContainerDataSource()) .addGeneratedProperty("test", new ButtonPropertyGenerator("Test")); ((GeneratedPropertyContainer) itemsGrid.getContainerDataSource()) .addGeneratedProperty("statistics", new StatsButtonPropertyGenerator("Stats")); itemsGrid.getColumn("test").setRenderer(new ButtonRenderer(e -> { HttpSource hs = (HttpSource) e.getItemId(); hs = ElasticSearch.getHttpSourceOperations().get(hs.getUrl()); UI.getCurrent().addWindow(new HttpSourceTestWindow(hs)); })); itemsGrid.getColumn("statistics").setRenderer(new ButtonRenderer(e -> { HttpSource hs = (HttpSource) e.getItemId(); UI.getCurrent().addWindow(new HttpSourceStatsWindow(hs.getUrl())); })); itemsGrid.setColumns("name", "url", "enabled", "test", "statistics"); gridLayout.addComponent(itemsGrid); gridLayout.addComponent(totalCountLabel); refreshGrid(filterField.getValue()); mainLayout.addComponent(gridLayout); mainLayout.setExpandRatio(gridLayout, 0.55f); mainLayout.addComponent(form); mainLayout.setExpandRatio(form, 0.45f); addComponent(mainLayout); gridLayout.addComponent(pagingRow); } private void refreshPagingRow() { pagingRow.removeAllComponents(); pagingRow.addComponent(new Label("Pages: ")); long amountOfPages = this.totalCount / 100; amountOfPages = amountOfPages + (this.totalCount % 100 != 0 ? 1 : 0); for (int i = 1; i <= amountOfPages; i++) { String buttonLabel = String.valueOf(i); Button button = new Button(); if (i == currentPage) { buttonLabel = ">>" + buttonLabel + "<<"; } button.setCaption(buttonLabel); button.setIconAlternateText(String.valueOf(i)); button.addClickListener(clickEvent -> { this.currentPage = (Integer.parseInt(clickEvent.getButton().getIconAlternateText())); refreshGrid(filterField.getValue()); }); pagingRow.addComponent(button); } } private int getOffset() { return (this.currentPage - 1) * 100; } private void refreshGrid(String text) { LOG.info("Refreshing grid using filter '{}'", text); PageableList<HttpSource> data = ElasticSearch.getHttpSourceOperations().filter(text, getOffset()); itemsGrid.getContainerDataSource().removeAllItems(); for (HttpSource source : data.getItems()) { itemsGrid.getContainerDataSource().addItem(source); } this.totalCount = data.getTotalCount(); totalCountLabel.setValue(String.format("Total count: %d", data.getTotalCount())); refreshPagingRow(); } private static class StringListConverter implements Converter<String, List> { @Override public List convertToModel(String s, Class<? extends List> aClass, Locale locale) throws ConversionException { return new ArrayList(); } @Override public String convertToPresentation(List list, Class<? extends String> aClass, Locale locale) throws ConversionException { return Joiner.on(", ").join(list); } @Override public Class<List> getModelType() { return List.class; } @Override public Class<String> getPresentationType() { return String.class; } } private static class StringTrimmer implements Converter<String, String> { private int maxLength; public StringTrimmer(int maxLength) { this.maxLength = maxLength; } @Override public String convertToModel(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return string; } @Override public String convertToPresentation(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return string != null && string.length() > maxLength ? string.substring(0, maxLength) + "..." : string; } @Override public Class<String> getModelType() { return String.class; } @Override public Class<String> getPresentationType() { return String.class; } } private static class UrlToLinkConverter implements Converter<String, String> { @Override public String convertToModel(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return string; } @Override public String convertToPresentation(String string, Class<? extends String> aClass, Locale locale) throws ConversionException { return String.format("<a href=\"%s\" target=\"_blank\">%s</a>", string, string); } @Override public Class<String> getModelType() { return String.class; } @Override public Class<String> getPresentationType() { return String.class; } } private static class StatsButtonPropertyGenerator extends PropertyValueGenerator<String> { private String name; public StatsButtonPropertyGenerator(String name) { this.name = name; } private Long lastHistogramValue(List<DateHistogramValue> coll) { return coll.size() == 0 ? 0 : coll.get(coll.size() - 1).getValue(); } @Override public String getValue(Item item, Object itemId, Object propertyId) { HttpSource hs = (HttpSource) itemId; List<DateHistogramValue> urls = ElasticSearch.getUrlOperations().calculateStats(hs.getUrl()); List<DateHistogramValue> documents = ElasticSearch.getDocumentOperations().calculateStats(hs.getUrl()); return String.format("%s (%4d/%4d)", name, lastHistogramValue(urls), lastHistogramValue(documents)); } @Override public Class<String> getType() { return String.class; } } private static class ButtonPropertyGenerator extends PropertyValueGenerator<String> { private String name; public ButtonPropertyGenerator(String name) { this.name = name; } @Override public String getValue(Item item, Object itemId, Object propertyId) { return name; } @Override public Class<String> getType() { return String.class; } } }
10,065
0.652757
0.646895
270
36.277779
31.7854
134
false
false
0
0
0
0
0
0
0.659259
false
false
15
da6c5fceee2aa61c4a1cb25ae832bae44c4399b6
24,352,464,638,976
8fa6dfab14afca5af5a94918a9b970aeb2e01b71
/java/v2styx-lib/src/main/java/com/v2soft/styxlib/l5/messages/StyxRAttachMessage.java
7c59acd9ac328c123be2d0a06e92f5c696047bcd
[]
no_license
vshcryabets/V2StyxLib
https://github.com/vshcryabets/V2StyxLib
78790b96d286b5832686c3feba2a4cb394987151
21e294d7d53556bc8bc979d4be37861c9e26f262
refs/heads/master
2023-07-19T20:26:14.348000
2023-07-14T20:37:35
2023-07-14T20:37:35
2,674,217
3
0
null
false
2022-10-26T17:34:15
2011-10-30T07:30:28
2022-09-18T16:57:10
2022-10-26T17:34:12
2,091
3
0
3
Java
false
false
package com.v2soft.styxlib.l5.messages; import com.v2soft.styxlib.l5.messages.base.StyxRSingleQIDMessage; import com.v2soft.styxlib.l5.enums.MessageType; import com.v2soft.styxlib.l5.structs.StyxQID; public class StyxRAttachMessage extends StyxRSingleQIDMessage { public StyxRAttachMessage(int tag, StyxQID qid) { super(MessageType.Rattach, tag, qid); } }
UTF-8
Java
362
java
StyxRAttachMessage.java
Java
[]
null
[]
package com.v2soft.styxlib.l5.messages; import com.v2soft.styxlib.l5.messages.base.StyxRSingleQIDMessage; import com.v2soft.styxlib.l5.enums.MessageType; import com.v2soft.styxlib.l5.structs.StyxQID; public class StyxRAttachMessage extends StyxRSingleQIDMessage { public StyxRAttachMessage(int tag, StyxQID qid) { super(MessageType.Rattach, tag, qid); } }
362
0.812155
0.790055
11
31.90909
24.817348
65
false
false
0
0
0
0
0
0
1.090909
false
false
15
a7955b2bc685dd3e42f04a36b82a3a985bbd06e4
12,455,405,212,381
65bdb9d76c992fa4d931f54d48b386f028a37b97
/DataServer/src/main/java/com/selfach/processor/handlers/FileUtil.java
dd6c8d3f7f069516f331d47b3a4746c60a1ba0b7
[]
no_license
gekoreed/Selfach-server
https://github.com/gekoreed/Selfach-server
df5e6242690f3dc23a45b1164172138e68d48f9c
4f2f44680aaa56320cab69becb074a9126163127
refs/heads/master
2020-04-15T08:53:47.047000
2015-11-03T21:04:31
2015-11-03T21:04:31
42,359,936
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.selfach.processor.handlers; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; /** * By gekoreed on 9/26/15. */ public class FileUtil { public static byte[] loadFile(File file) { byte[] bytes = null; try { InputStream is = new FileInputStream(file); long length = file.length(); bytes = new byte[(int) length]; int offset = 0; int numRead; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } if (offset < bytes.length) { throw new IOException("Could not completely read file " + file.getName()); } is.close(); } catch (IOException e) { e.printStackTrace(); } return bytes; } }
UTF-8
Java
957
java
FileUtil.java
Java
[ { "context": "OException;\nimport java.io.InputStream;\n\n/**\n * By gekoreed on 9/26/15.\n */\npublic class FileUtil {\n\n publ", "end": 169, "score": 0.9996652007102966, "start": 161, "tag": "USERNAME", "value": "gekoreed" } ]
null
[]
package com.selfach.processor.handlers; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; /** * By gekoreed on 9/26/15. */ public class FileUtil { public static byte[] loadFile(File file) { byte[] bytes = null; try { InputStream is = new FileInputStream(file); long length = file.length(); bytes = new byte[(int) length]; int offset = 0; int numRead; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } if (offset < bytes.length) { throw new IOException("Could not completely read file " + file.getName()); } is.close(); } catch (IOException e) { e.printStackTrace(); } return bytes; } }
957
0.528736
0.521421
40
22.924999
21.861366
90
false
false
0
0
0
0
0
0
0.45
false
false
15
940ad089aaf8ead34ad892787be348b5ac5909c7
2,800,318,680,733
0a0b029e448779b1ba3b5ca0d99d16c18396e7da
/TP_01/app/src/main/java/com/example/haasi/tp_01/FilmeDAO.java
73bd62ae298f2dea895ba5aa11c3380ae6dfe65e
[]
no_license
RitaRez/TP-01
https://github.com/RitaRez/TP-01
548febad713a10221ecbc062e5bfca46e634fe93
96c1fb5d5f2ac9949ab7010e794800a755f8a4db
refs/heads/master
2021-05-25T11:59:12.262000
2018-04-16T16:14:42
2018-04-16T16:14:42
127,349,765
0
2
null
true
2018-04-16T12:12:06
2018-03-29T21:34:02
2018-04-14T15:27:08
2018-04-16T12:12:06
755
0
1
0
Java
false
null
package com.example.haasi.tp_01; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import java.util.ArrayList; /** * Created by riversong on 07/04/18. */ public class FilmeDAO { private final String TABLE_FILMES = "Filmes"; private SQLiteDatabase gw; public FilmeDAO(Context ctx){ gw = MainActivity.db; } // Adiciona o Filme na Data Base public boolean salvar(String movie, Integer type, Integer rate, String year, String director){ ContentValues cv = new ContentValues(); cv.put("Name", movie); cv.put("Type", type); cv.put("Rate", rate); cv.put("Year", year); cv.put("Director", director); return gw.insert(TABLE_FILMES, null, cv) > 0; } public boolean deletar(Integer id){ return gw.delete(TABLE_FILMES, "ID=?", new String[]{ id + "" }) > 0; } public Filme retornaFilme(Integer identify){ Cursor cursor = gw.rawQuery("SELECT * FROM Filmes", null); while(cursor.moveToNext()){ if(cursor.getInt(cursor.getColumnIndex("ID")) == identify) { int id = cursor.getInt(cursor.getColumnIndex("ID")); String name = cursor.getString(cursor.getColumnIndex("Name")); Integer type = cursor.getInt(cursor.getColumnIndex("Type")); String year = cursor.getString(cursor.getColumnIndex("Year")); Integer rate = cursor.getInt(cursor.getColumnIndex("Rate")); String director = cursor.getString(cursor.getColumnIndex("Director")); cursor.close(); return new Filme(id, name, type, rate, year, director); } } cursor.close(); return null; } //Retorna todos os filmes em um array list public ArrayList<Filme> retornarTodos(){ ArrayList<Filme> filmes = new ArrayList<>(); Cursor cursor = gw.rawQuery("SELECT * FROM Filmes", null); while(cursor.moveToNext()){ int id = cursor.getInt(cursor.getColumnIndex("ID")); String name = cursor.getString(cursor.getColumnIndex("Name")); Integer type = cursor.getInt(cursor.getColumnIndex("Type")); String year = cursor.getString(cursor.getColumnIndex("Year")); Integer rate = cursor.getInt(cursor.getColumnIndex("Rate")); String director = cursor.getString(cursor.getColumnIndex("Director")); filmes.add(new Filme(id, name, type, rate, year, director)); } cursor.close(); return filmes; } }
UTF-8
Java
2,668
java
FilmeDAO.java
Java
[ { "context": "e;\n\nimport java.util.ArrayList;\n\n/**\n * Created by riversong on 07/04/18.\n */\n\npublic class FilmeDAO {\n pri", "end": 240, "score": 0.9995737075805664, "start": 231, "tag": "USERNAME", "value": "riversong" } ]
null
[]
package com.example.haasi.tp_01; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import java.util.ArrayList; /** * Created by riversong on 07/04/18. */ public class FilmeDAO { private final String TABLE_FILMES = "Filmes"; private SQLiteDatabase gw; public FilmeDAO(Context ctx){ gw = MainActivity.db; } // Adiciona o Filme na Data Base public boolean salvar(String movie, Integer type, Integer rate, String year, String director){ ContentValues cv = new ContentValues(); cv.put("Name", movie); cv.put("Type", type); cv.put("Rate", rate); cv.put("Year", year); cv.put("Director", director); return gw.insert(TABLE_FILMES, null, cv) > 0; } public boolean deletar(Integer id){ return gw.delete(TABLE_FILMES, "ID=?", new String[]{ id + "" }) > 0; } public Filme retornaFilme(Integer identify){ Cursor cursor = gw.rawQuery("SELECT * FROM Filmes", null); while(cursor.moveToNext()){ if(cursor.getInt(cursor.getColumnIndex("ID")) == identify) { int id = cursor.getInt(cursor.getColumnIndex("ID")); String name = cursor.getString(cursor.getColumnIndex("Name")); Integer type = cursor.getInt(cursor.getColumnIndex("Type")); String year = cursor.getString(cursor.getColumnIndex("Year")); Integer rate = cursor.getInt(cursor.getColumnIndex("Rate")); String director = cursor.getString(cursor.getColumnIndex("Director")); cursor.close(); return new Filme(id, name, type, rate, year, director); } } cursor.close(); return null; } //Retorna todos os filmes em um array list public ArrayList<Filme> retornarTodos(){ ArrayList<Filme> filmes = new ArrayList<>(); Cursor cursor = gw.rawQuery("SELECT * FROM Filmes", null); while(cursor.moveToNext()){ int id = cursor.getInt(cursor.getColumnIndex("ID")); String name = cursor.getString(cursor.getColumnIndex("Name")); Integer type = cursor.getInt(cursor.getColumnIndex("Type")); String year = cursor.getString(cursor.getColumnIndex("Year")); Integer rate = cursor.getInt(cursor.getColumnIndex("Rate")); String director = cursor.getString(cursor.getColumnIndex("Director")); filmes.add(new Filme(id, name, type, rate, year, director)); } cursor.close(); return filmes; } }
2,668
0.616567
0.612819
73
35.561646
27.892645
98
false
false
0
0
0
0
0
0
0.876712
false
false
15
ba3e5e67abf918a4ef16cec411e1e21405d6b0b7
25,512,105,784,110
95f24ac2b6a0b7b8f463a607b6532974727afc6b
/src/main/java/com/hepolite/pangaea/instruction/InstructionInfoHunger.java
cf40ecb3b60f5393a1af1aa6ef755b9516a47475
[]
no_license
shroomdog27/Pangaea
https://github.com/shroomdog27/Pangaea
ec944f9e405b8137800ccfd4171b1ca1b23c41b4
39caf751b3486a0c6109201fa6952f471c7db447
refs/heads/master
2021-09-04T15:34:03.215000
2018-01-19T23:12:40
2018-01-19T23:12:40
67,257,198
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hepolite.pangaea.instruction; import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.hepolite.pangaea.Pangaea; import com.hepolite.pangaea.hunger.HungerNode; import com.hepolite.pangaea.hunger.HungerSettings; import com.hepolite.pillar.chat.Chat; public class InstructionInfoHunger extends Instruction { public InstructionInfoHunger() { super("hunger", "pangaea.basic"); } @Override public void addArgumentUsage(List<String> list) { list.add(""); } @Override public boolean onInvoke(CommandSender sender, List<String> arguments) { Player player = getPlayer(sender, arguments, 0); if (player == null) return true; HungerNode node = ((HungerSettings) Pangaea.getInstance().getHungerManager().getSettings()).getNode(player); Chat.message(player, String.format("Hunger %.0f/%.0f, saturation %.0f, exhaustion %.0f", node.hunger, node.max, node.saturation, node.exhaustion)); return false; } }
UTF-8
Java
987
java
InstructionInfoHunger.java
Java
[]
null
[]
package com.hepolite.pangaea.instruction; import java.util.List; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.hepolite.pangaea.Pangaea; import com.hepolite.pangaea.hunger.HungerNode; import com.hepolite.pangaea.hunger.HungerSettings; import com.hepolite.pillar.chat.Chat; public class InstructionInfoHunger extends Instruction { public InstructionInfoHunger() { super("hunger", "pangaea.basic"); } @Override public void addArgumentUsage(List<String> list) { list.add(""); } @Override public boolean onInvoke(CommandSender sender, List<String> arguments) { Player player = getPlayer(sender, arguments, 0); if (player == null) return true; HungerNode node = ((HungerSettings) Pangaea.getInstance().getHungerManager().getSettings()).getNode(player); Chat.message(player, String.format("Hunger %.0f/%.0f, saturation %.0f, exhaustion %.0f", node.hunger, node.max, node.saturation, node.exhaustion)); return false; } }
987
0.757852
0.752786
36
26.416666
32.2304
149
false
false
0
0
0
0
0
0
1.5
false
false
15
b4b5d5d4fd075fb33d8b3c9c89287d67c55beeb5
27,333,171,926,744
996b442072de5137cbbcfdd27f325f449175b510
/supplyloan_core/src/main/java/com/ojoin/trade/supplyloan_core/web/controller/TbSlStattaskRunresultController.java
f3ee2bb928da00c259f9305c267dcbd393f361b0
[]
no_license
liaowuhen88/18join
https://github.com/liaowuhen88/18join
68b6ba28fa407d8efb021ed9466e1014b60d4167
03dad800fb9f5a9fc23feb08296249b2729007c5
refs/heads/master
2020-03-05T21:53:24.304000
2017-10-26T05:58:38
2017-10-26T05:58:38
86,019,983
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ojoin.trade.supplyloan_core.web.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.ojoin.trade.common.exception.BusinessException; import com.ojoin.trade.common.utils.json.JSONUtils; import com.ojoin.trade.common.web.controller.SimpleBaseController; import com.ojoin.trade.common.web.domain.Result; import com.ojoin.trade.supplyloan_core.web.domain.TbSlStatetaskRunresultvo; import com.ojoin.trade.supplyloan_core.web.service.TbSlStattaskRunresultService; /** * Created with IntelliJ IDEA. * User: Administrator * Date: 15-11-11 * Time: 上午11:42 * To change this template use File | Settings | File Templates. */ @Controller @RequestMapping("/tattaskRunresult") public class TbSlStattaskRunresultController extends SimpleBaseController { private Logger log= LoggerFactory.getLogger(TbSlStattaskRunresultController.class); @Autowired private TbSlStattaskRunresultService tbSlStattaskRunresultService; //查询所有的监控数据 @ResponseBody @RequestMapping(value = "operate/queryalltbsltaskrunresulttoday", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Result queryAllTbSltaskRunresultToday(HttpServletRequest request,String platformName,String merchantUserId,String statDate,Pageable page){ log.info("platformName->"+platformName+"" + "merchantUserId->" + "statDate->"+statDate); try{ List<TbSlStatetaskRunresultvo> list=tbSlStattaskRunresultService.queryByPlatformAndMerchantUserIDAndDate(platformName, merchantUserId, statDate, page); log.info(JSONUtils.toJSONString(null != list ?list.size():null)); return new Result(Result.Status.OK,list); }catch(Exception e){ log.error("查询商户的监控信息出错,请重试",e); if(e instanceof BusinessException){ return new Result(Result.Status.ERROR,e.getMessage()); } return new Result(Result.Status.ERROR,"查询商户的监控信息,请重试"); } } }
UTF-8
Java
2,539
java
TbSlStattaskRunresultController.java
Java
[ { "context": "vice;\n\n/**\n * Created with IntelliJ IDEA.\n * User: Administrator\n * Date: 15-11-11\n * Time: 上午11:42\n * To change t", "end": 1019, "score": 0.9893807768821716, "start": 1006, "tag": "NAME", "value": "Administrator" } ]
null
[]
package com.ojoin.trade.supplyloan_core.web.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.ojoin.trade.common.exception.BusinessException; import com.ojoin.trade.common.utils.json.JSONUtils; import com.ojoin.trade.common.web.controller.SimpleBaseController; import com.ojoin.trade.common.web.domain.Result; import com.ojoin.trade.supplyloan_core.web.domain.TbSlStatetaskRunresultvo; import com.ojoin.trade.supplyloan_core.web.service.TbSlStattaskRunresultService; /** * Created with IntelliJ IDEA. * User: Administrator * Date: 15-11-11 * Time: 上午11:42 * To change this template use File | Settings | File Templates. */ @Controller @RequestMapping("/tattaskRunresult") public class TbSlStattaskRunresultController extends SimpleBaseController { private Logger log= LoggerFactory.getLogger(TbSlStattaskRunresultController.class); @Autowired private TbSlStattaskRunresultService tbSlStattaskRunresultService; //查询所有的监控数据 @ResponseBody @RequestMapping(value = "operate/queryalltbsltaskrunresulttoday", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Result queryAllTbSltaskRunresultToday(HttpServletRequest request,String platformName,String merchantUserId,String statDate,Pageable page){ log.info("platformName->"+platformName+"" + "merchantUserId->" + "statDate->"+statDate); try{ List<TbSlStatetaskRunresultvo> list=tbSlStattaskRunresultService.queryByPlatformAndMerchantUserIDAndDate(platformName, merchantUserId, statDate, page); log.info(JSONUtils.toJSONString(null != list ?list.size():null)); return new Result(Result.Status.OK,list); }catch(Exception e){ log.error("查询商户的监控信息出错,请重试",e); if(e instanceof BusinessException){ return new Result(Result.Status.ERROR,e.getMessage()); } return new Result(Result.Status.ERROR,"查询商户的监控信息,请重试"); } } }
2,539
0.765923
0.761055
64
37.515625
35.853867
158
false
false
0
0
0
0
0
0
0.796875
false
false
15
3b56103298b9c3887d5b40465e92e9f506048cea
12,532,714,612,951
246d7fd4b67fc844e048911fdeda61cfdf25535b
/src/main/java/com/lylBlog/common/util/CodeUtil.java
ccc80642b8177066263718a2271fa5c9e42d7065
[]
no_license
lylnzb/TimingTask
https://github.com/lylnzb/TimingTask
24c7b1691a25c8fc311e5934740072b1767fa979
2b1c3a41ae58db7fcbdf20733dd19f53c7fe7795
refs/heads/master
2023-03-21T14:12:03.771000
2021-03-12T07:31:41
2021-03-12T07:31:41
310,457,200
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lylBlog.common.util; import java.util.UUID; /** * 验证码生成工具类 * 类说明: 生成验证码 */ public class CodeUtil { /** * 成随机6位数 * @return */ public static String getcode(){ return (int) ((Math.random() * 9 + 1) * 100000)+""; } /** * 成随机4位数 * @return */ public static String getFour(){ return (int) ((Math.random() * 9 + 1) * 1000)+""; } }
UTF-8
Java
464
java
CodeUtil.java
Java
[]
null
[]
package com.lylBlog.common.util; import java.util.UUID; /** * 验证码生成工具类 * 类说明: 生成验证码 */ public class CodeUtil { /** * 成随机6位数 * @return */ public static String getcode(){ return (int) ((Math.random() * 9 + 1) * 100000)+""; } /** * 成随机4位数 * @return */ public static String getFour(){ return (int) ((Math.random() * 9 + 1) * 1000)+""; } }
464
0.5
0.461165
26
14.846154
16.138088
59
false
false
0
0
0
0
0
0
0.192308
false
false
15
dd83906f3b1a5540193094cda65e18adae3b70b8
12,532,714,615,933
b8c69cf173e3862200b354961d298edb644226c5
/app/src/main/java/com/hotelnow/adapter/ThemeSAllAdapter.java
b48c0942d51126aa63bc0626591d8d9a70c60abe
[]
no_license
Hwang02/android_renew
https://github.com/Hwang02/android_renew
76a7dba0313b492afe31d6d20d769dd021458934
cb44752fe713d929317493b2165b7ab1d70eb690
refs/heads/master
2020-06-23T10:33:27.494000
2019-07-29T06:31:13
2019-07-29T06:31:13
198,594,274
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hotelnow.adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.hotelnow.R; import com.hotelnow.activity.ThemeSAllActivity; import com.hotelnow.activity.ThemeSpecialActivityActivity; import com.hotelnow.activity.ThemeSpecialHotelActivity; import com.hotelnow.model.ThemeSpecialItem; import com.hotelnow.utils.DbOpenHelper; import com.koushikdutta.ion.Ion; import java.util.List; public class ThemeSAllAdapter extends ArrayAdapter<ThemeSpecialItem> { List<ThemeSpecialItem> mlist; DbOpenHelper dbHelper; Context mContext; public ThemeSAllAdapter(Context context, int textViewResourceId, List<ThemeSpecialItem> objects, DbOpenHelper dbHelper) { super(context, textViewResourceId, objects); mContext = context; mlist = objects; this.dbHelper = dbHelper; } @Override public int getCount() { return mlist.size(); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.layout_theme_special_item2, null); } ViewHolder holder = (ViewHolder) v.getTag(R.id.id_holder); if (holder == null) { holder = new ViewHolder(v); v.setTag(R.id.id_holder, holder); } ThemeSpecialItem entry = getItem(position); Ion.with(holder.iv_image).load(entry.getImg_background()); holder.tv_title.setText(entry.getTitle()); holder.tv_message.setText(entry.getSub_title()); holder.sel_item.setTag(position); holder.sel_item.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mlist.get((int) v.getTag()).getTheme_flag().equals("H")) { Intent intent = new Intent(mContext, ThemeSpecialHotelActivity.class); intent.putExtra("tid", mlist.get((int) v.getTag()).getId()); ((ThemeSAllActivity) mContext).startActivityForResult(intent, 80); } else if(mlist.get((int) v.getTag()).getTheme_flag().equals("Q")) { Intent intent = new Intent(mContext, ThemeSpecialActivityActivity.class); intent.putExtra("tid", mlist.get((int) v.getTag()).getId()); ((ThemeSAllActivity) mContext).startActivityForResult(intent, 80); } } }); if (mlist.size() - 1 == position) { holder.gap.setVisibility(View.VISIBLE); } else { holder.gap.setVisibility(View.GONE); } return v; } private class ViewHolder { ImageView iv_image; TextView tv_title, tv_message; LinearLayout sel_item; View gap; public ViewHolder(View v) { iv_image = (ImageView) v.findViewById(R.id.iv_image); tv_title = (TextView) v.findViewById(R.id.tv_title); tv_message = (TextView) v.findViewById(R.id.tv_message); sel_item = (LinearLayout) v.findViewById(R.id.sel_item); gap = (View) v.findViewById(R.id.gap); v.setTag(R.id.id_holder); } } }
UTF-8
Java
3,600
java
ThemeSAllAdapter.java
Java
[]
null
[]
package com.hotelnow.adapter; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.hotelnow.R; import com.hotelnow.activity.ThemeSAllActivity; import com.hotelnow.activity.ThemeSpecialActivityActivity; import com.hotelnow.activity.ThemeSpecialHotelActivity; import com.hotelnow.model.ThemeSpecialItem; import com.hotelnow.utils.DbOpenHelper; import com.koushikdutta.ion.Ion; import java.util.List; public class ThemeSAllAdapter extends ArrayAdapter<ThemeSpecialItem> { List<ThemeSpecialItem> mlist; DbOpenHelper dbHelper; Context mContext; public ThemeSAllAdapter(Context context, int textViewResourceId, List<ThemeSpecialItem> objects, DbOpenHelper dbHelper) { super(context, textViewResourceId, objects); mContext = context; mlist = objects; this.dbHelper = dbHelper; } @Override public int getCount() { return mlist.size(); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.layout_theme_special_item2, null); } ViewHolder holder = (ViewHolder) v.getTag(R.id.id_holder); if (holder == null) { holder = new ViewHolder(v); v.setTag(R.id.id_holder, holder); } ThemeSpecialItem entry = getItem(position); Ion.with(holder.iv_image).load(entry.getImg_background()); holder.tv_title.setText(entry.getTitle()); holder.tv_message.setText(entry.getSub_title()); holder.sel_item.setTag(position); holder.sel_item.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mlist.get((int) v.getTag()).getTheme_flag().equals("H")) { Intent intent = new Intent(mContext, ThemeSpecialHotelActivity.class); intent.putExtra("tid", mlist.get((int) v.getTag()).getId()); ((ThemeSAllActivity) mContext).startActivityForResult(intent, 80); } else if(mlist.get((int) v.getTag()).getTheme_flag().equals("Q")) { Intent intent = new Intent(mContext, ThemeSpecialActivityActivity.class); intent.putExtra("tid", mlist.get((int) v.getTag()).getId()); ((ThemeSAllActivity) mContext).startActivityForResult(intent, 80); } } }); if (mlist.size() - 1 == position) { holder.gap.setVisibility(View.VISIBLE); } else { holder.gap.setVisibility(View.GONE); } return v; } private class ViewHolder { ImageView iv_image; TextView tv_title, tv_message; LinearLayout sel_item; View gap; public ViewHolder(View v) { iv_image = (ImageView) v.findViewById(R.id.iv_image); tv_title = (TextView) v.findViewById(R.id.tv_title); tv_message = (TextView) v.findViewById(R.id.tv_message); sel_item = (LinearLayout) v.findViewById(R.id.sel_item); gap = (View) v.findViewById(R.id.gap); v.setTag(R.id.id_holder); } } }
3,600
0.635278
0.633611
107
32.644859
28.681053
125
false
false
0
0
0
0
0
0
0.682243
false
false
15
2a65649b8c26298fd21cbab83881f17c24de9e63
32,719,060,890,202
013e77e1f9541b7635e6adc20c2466fb9629629c
/project-services/service-consumer/consumer-web/src/main/java/in/hocg/consumer/web/service/impl/SeataServiceImpl.java
57d49a183b6c8ae3ca6ac99c62eed0f5801d9851
[]
no_license
moutainhigh/spring-cloud-alibaba-2
https://github.com/moutainhigh/spring-cloud-alibaba-2
cd862d7b75180887db20e574f6b8cd7d58d32d26
ec9aa798ada170281ebeca5ccc46fbe7b50bd854
refs/heads/master
2022-07-26T08:24:34.093000
2020-05-23T00:52:10
2020-05-23T00:52:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package in.hocg.consumer.web.service.impl; import in.hocg.consumer.basic.Conts; import in.hocg.consumer.spi.ConsumerSpi; import in.hocg.consumer.spi.SeataConsumerSpi; import in.hocg.consumer.web.service.SeataService; import in.hocg.producer.spi.ProducerSpi; import in.hocg.producer.spi.SeataProducerSpi; import io.seata.spring.annotation.GlobalTransactional; import lombok.RequiredArgsConstructor; import org.apache.dubbo.config.annotation.Reference; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * Created by hocgin on 2020/5/11. * email: hocgin@gmail.com * * @author hocgin */ @Service @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SeataServiceImpl implements SeataService { @Reference(version = Conts.DUBBO_VERSION) private ProducerSpi producerManager; @Reference(version = Conts.DUBBO_VERSION) private ConsumerSpi consumerManager; @Reference(version = Conts.DUBBO_VERSION) private SeataConsumerSpi seataConsumer; @Reference(version = Conts.DUBBO_VERSION) private SeataProducerSpi seataProducer; private final static ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); @Override @GlobalTransactional public Long planA(String message) { final Long id = producerManager.insertRecord(message); seataConsumer.throwException(String.format("%s 异常", message)); return id; } @Override @GlobalTransactional public Long planB(String message) { final Long producerId = producerManager.insertRecord(message); final Long consumerId = consumerManager.insertRecord(message); seataConsumer.throwException(String.format("%s 异常", message)); return null; } @Override @GlobalTransactional public Long planC(String message) throws InterruptedException { final Long producerId = producerManager.insertRecord(message); EXECUTOR_SERVICE.submit(() -> { producerManager.updateRecord(producerId, message + ":update"); }); // 保证线程被执行 Thread.sleep(500); throw new UnsupportedOperationException(String.format("%s 异常", message)); } @Override @GlobalTransactional public String planC2(String message) throws InterruptedException { final Long producerId = producerManager.insertRecord(message); EXECUTOR_SERVICE.submit(() -> { producerManager.updateRecordUseGT(producerId, message + ":update"); }); // 保证线程被执行 Thread.sleep(500); throw new UnsupportedOperationException(String.format("%s 异常", message)); } @Override @GlobalTransactional public String planD() throws InterruptedException { final Long producerId = producerManager.insertRecord("1"); EXECUTOR_SERVICE.submit(() -> { producerManager.updateRecord(producerId, "2"); }); // 保证线程被执行 Thread.sleep(500); final String context = producerManager.findContextById(producerId); return "ID: " + producerId + ", Context = " + context; } @Override @GlobalTransactional public String planE(String message) throws InterruptedException { final Long producerId = producerManager.insertRecord(message); EXECUTOR_SERVICE.submit(() -> { producerManager.insertRecordForProducerIdUseGT(producerId, ":INSERT"); }); // 保证线程被执行 Thread.sleep(500); throw new UnsupportedOperationException(String.format("%s 异常", message)); } }
UTF-8
Java
4,043
java
SeataServiceImpl.java
Java
[ { "context": " java.util.concurrent.TimeUnit;\n\n/**\n * Created by hocgin on 2020/5/11.\n * email: hocgin@gmail.com\n *\n * @a", "end": 757, "score": 0.9996519684791565, "start": 751, "tag": "USERNAME", "value": "hocgin" }, { "context": "\n\n/**\n * Created by hocgin on 2020/5/11.\n...
null
[]
package in.hocg.consumer.web.service.impl; import in.hocg.consumer.basic.Conts; import in.hocg.consumer.spi.ConsumerSpi; import in.hocg.consumer.spi.SeataConsumerSpi; import in.hocg.consumer.web.service.SeataService; import in.hocg.producer.spi.ProducerSpi; import in.hocg.producer.spi.SeataProducerSpi; import io.seata.spring.annotation.GlobalTransactional; import lombok.RequiredArgsConstructor; import org.apache.dubbo.config.annotation.Reference; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * Created by hocgin on 2020/5/11. * email: <EMAIL> * * @author hocgin */ @Service @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class SeataServiceImpl implements SeataService { @Reference(version = Conts.DUBBO_VERSION) private ProducerSpi producerManager; @Reference(version = Conts.DUBBO_VERSION) private ConsumerSpi consumerManager; @Reference(version = Conts.DUBBO_VERSION) private SeataConsumerSpi seataConsumer; @Reference(version = Conts.DUBBO_VERSION) private SeataProducerSpi seataProducer; private final static ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); @Override @GlobalTransactional public Long planA(String message) { final Long id = producerManager.insertRecord(message); seataConsumer.throwException(String.format("%s 异常", message)); return id; } @Override @GlobalTransactional public Long planB(String message) { final Long producerId = producerManager.insertRecord(message); final Long consumerId = consumerManager.insertRecord(message); seataConsumer.throwException(String.format("%s 异常", message)); return null; } @Override @GlobalTransactional public Long planC(String message) throws InterruptedException { final Long producerId = producerManager.insertRecord(message); EXECUTOR_SERVICE.submit(() -> { producerManager.updateRecord(producerId, message + ":update"); }); // 保证线程被执行 Thread.sleep(500); throw new UnsupportedOperationException(String.format("%s 异常", message)); } @Override @GlobalTransactional public String planC2(String message) throws InterruptedException { final Long producerId = producerManager.insertRecord(message); EXECUTOR_SERVICE.submit(() -> { producerManager.updateRecordUseGT(producerId, message + ":update"); }); // 保证线程被执行 Thread.sleep(500); throw new UnsupportedOperationException(String.format("%s 异常", message)); } @Override @GlobalTransactional public String planD() throws InterruptedException { final Long producerId = producerManager.insertRecord("1"); EXECUTOR_SERVICE.submit(() -> { producerManager.updateRecord(producerId, "2"); }); // 保证线程被执行 Thread.sleep(500); final String context = producerManager.findContextById(producerId); return "ID: " + producerId + ", Context = " + context; } @Override @GlobalTransactional public String planE(String message) throws InterruptedException { final Long producerId = producerManager.insertRecord(message); EXECUTOR_SERVICE.submit(() -> { producerManager.insertRecordForProducerIdUseGT(producerId, ":INSERT"); }); // 保证线程被执行 Thread.sleep(500); throw new UnsupportedOperationException(String.format("%s 异常", message)); } }
4,034
0.680867
0.674061
119
32.336136
24.649229
90
false
false
0
0
0
0
0
0
0.529412
false
false
15
42d5d047719a3e908e51d4d6a77f64b57c41a308
32,719,060,890,628
0caa60a46ffca33fbc0660c2e125151170d29b39
/app/src/main/java/com/github/onlynight/slidingconfict/viewpager/FragmentCommonMethod.java
c4f9a4c86ed258bd78c34393222682e2c9dcc019
[]
no_license
onlynight/SlidingConfict
https://github.com/onlynight/SlidingConfict
7af9773258f193c7fda7ab5a26103f3ff3b4a31b
2eff0dfaabbfacce1d6ae9d4649d38d9b2d7abce
refs/heads/master
2021-01-12T06:32:35.446000
2016-12-26T11:07:47
2016-12-26T11:07:47
77,377,898
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.onlynight.slidingconfict.viewpager; /** * Created by lion on 2016/12/21. */ public interface FragmentCommonMethod { String getPageTitle(); }
UTF-8
Java
169
java
FragmentCommonMethod.java
Java
[ { "context": "package com.github.onlynight.slidingconfict.viewpager;\n\n/**\n * Created by lion", "end": 28, "score": 0.9899404644966125, "start": 19, "tag": "USERNAME", "value": "onlynight" }, { "context": "night.slidingconfict.viewpager;\n\n/**\n * Created by lion on 2016/12/21.\n ...
null
[]
package com.github.onlynight.slidingconfict.viewpager; /** * Created by lion on 2016/12/21. */ public interface FragmentCommonMethod { String getPageTitle(); }
169
0.733728
0.686391
10
15.9
19.216919
54
false
false
0
0
0
0
0
0
0.2
false
false
15
1dd99dc94f167c8e1d008e9cf598b4f38d475190
15,272,903,738,153
d519c467f76da1943d71029e72cf4f9cd152110a
/taotao-sso/src/main/java/com/taotao/sso/controller/PageController.java
6c343c676aaa4a9030d4c6af3ac9863aa282d415
[]
no_license
wuyukai879293/taotao
https://github.com/wuyukai879293/taotao
b435075bffc3ddf1761f78d3a33264b47189fcec
c4fa6afdc2e58c93c88445016ddeb1345e1c461b
refs/heads/master
2019-06-17T05:38:18.029000
2017-12-15T13:56:34
2017-12-15T13:56:34
99,717,532
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.taotao.sso.controller; import com.taotao.sso.service.UserService; import com.taotao.utils.ExceptionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; /** * Created by wuyukai on 2017/8/16. */ @Controller @RequestMapping("/page") public class PageController { @RequestMapping("/register") public String showRegister() { return "register"; } @RequestMapping("/login") public String showLogin(String redirect, Model model) { model.addAttribute("redirect", redirect); return "login"; } }
UTF-8
Java
781
java
PageController.java
Java
[ { "context": "bind.annotation.RequestMapping;\n\n/**\n * Created by wuyukai on 2017/8/16.\n */\n@Controller\n@RequestMapping(\"/p", "end": 418, "score": 0.999539852142334, "start": 411, "tag": "USERNAME", "value": "wuyukai" } ]
null
[]
package com.taotao.sso.controller; import com.taotao.sso.service.UserService; import com.taotao.utils.ExceptionUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; /** * Created by wuyukai on 2017/8/16. */ @Controller @RequestMapping("/page") public class PageController { @RequestMapping("/register") public String showRegister() { return "register"; } @RequestMapping("/login") public String showLogin(String redirect, Model model) { model.addAttribute("redirect", redirect); return "login"; } }
781
0.745198
0.736236
30
25.033333
21.204533
62
false
false
0
0
0
0
0
0
0.433333
false
false
15
1e99ececbd1aec4310ecbc7c4976f01bef9d7360
20,968,030,372,755
26b4a100270045b980f7edfc6aa2098f4a7132aa
/src/main/java/csokicraft/forge110/atmospherecraft/item/ItemGasFilter.java
186dcc0674bd025d841b118b890c77b0700c3fb2
[]
no_license
bence98/AtmosphereCraft
https://github.com/bence98/AtmosphereCraft
b9c404846f7cd7c951cb0f8e816c9247f2f1ac53
565c31ef31be4a1009f217c8159e7f563c554e65
refs/heads/master
2020-06-24T02:09:41.207000
2018-01-25T18:53:33
2018-01-25T18:53:33
96,915,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package csokicraft.forge110.atmospherecraft.item; import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.*; public class ItemGasFilter extends Item{ public static final int metaCount=6; public ItemGasFilter(){ hasSubtypes=true; } @Override public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems){ for(int i=0;i<metaCount;i++){ subItems.add(new ItemStack(itemIn, 1, i)); } } public String getUnlocalizedName(ItemStack stack){ String s = getUnlocalizedName(); return s+"."+stack.getItemDamage(); } }
UTF-8
Java
594
java
ItemGasFilter.java
Java
[]
null
[]
package csokicraft.forge110.atmospherecraft.item; import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.*; public class ItemGasFilter extends Item{ public static final int metaCount=6; public ItemGasFilter(){ hasSubtypes=true; } @Override public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems){ for(int i=0;i<metaCount;i++){ subItems.add(new ItemStack(itemIn, 1, i)); } } public String getUnlocalizedName(ItemStack stack){ String s = getUnlocalizedName(); return s+"."+stack.getItemDamage(); } }
594
0.745791
0.73569
26
21.846153
21.700216
82
false
false
0
0
0
0
0
0
1.5
false
false
15
4c7c5da3b11230be77b849080bac65f226dfa366
1,563,368,108,609
d51744cbf6a90bb3e785d51a0da68d341f4b33cc
/src/Program.java
aff78cc8d26c5a86506aea7bbd1963901ed7f1a8
[]
no_license
Alexc0007/COMP1011-Lesson04
https://github.com/Alexc0007/COMP1011-Lesson04
c38e0a852e5557662f72fc342db905290e63f904
b22a6ee8da0c945db6b7bcf524972bc400f56a65
refs/heads/master
2021-01-13T00:49:26.672000
2015-10-13T13:03:45
2015-10-13T13:03:45
44,165,780
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** @author Alexc007 * */ import javax.swing.JOptionPane; public class Program { /** * @param args */ public static void main(String[] args) { String firstNumber = ""; String secondNumber = ""; try //the code is inside a Try - Catch block so that if you press CANCEL or insert INCORRECT VALUE // the java execution would not be interrupted by the exception - but handle it properly { firstNumber = JOptionPane.showInputDialog("Enter First Integer"); //pop out menu that ask to enter integer System.out.println(firstNumber); secondNumber = JOptionPane.showInputDialog("Enter Second Integer"); System.out.println(secondNumber); int number1 = Integer.parseInt(firstNumber); //convert an integer that has been inserted into a string int number2 = Integer.parseInt(secondNumber); //convert an integer that has been inserted into a string int sum = number1 + number2; JOptionPane.showMessageDialog(null, "The sum is " + sum + " Sum of two integers"); //open another message box that will show the sum of the numbers } catch (Exception e) //catch exception { //JOptionPane.showMessageDialog(null, "Incorrect Values Entered"); JOptionPane.showMessageDialog(null, "Incorrect Values Entered" , "Error Entry", JOptionPane.ERROR_MESSAGE); //display an error message box after getting an exception System.out.println(e); //print out the exception itself } // STOPPED AT END OF LESSON 4 } }
UTF-8
Java
1,557
java
Program.java
Java
[ { "context": "\r\n\r\n/** @author Alexc007\r\n*\r\n*/\r\n\r\nimport javax.swing.JOptionPane;\r\n\r\n\r\n\r\n", "end": 24, "score": 0.9979299306869507, "start": 16, "tag": "USERNAME", "value": "Alexc007" } ]
null
[]
/** @author Alexc007 * */ import javax.swing.JOptionPane; public class Program { /** * @param args */ public static void main(String[] args) { String firstNumber = ""; String secondNumber = ""; try //the code is inside a Try - Catch block so that if you press CANCEL or insert INCORRECT VALUE // the java execution would not be interrupted by the exception - but handle it properly { firstNumber = JOptionPane.showInputDialog("Enter First Integer"); //pop out menu that ask to enter integer System.out.println(firstNumber); secondNumber = JOptionPane.showInputDialog("Enter Second Integer"); System.out.println(secondNumber); int number1 = Integer.parseInt(firstNumber); //convert an integer that has been inserted into a string int number2 = Integer.parseInt(secondNumber); //convert an integer that has been inserted into a string int sum = number1 + number2; JOptionPane.showMessageDialog(null, "The sum is " + sum + " Sum of two integers"); //open another message box that will show the sum of the numbers } catch (Exception e) //catch exception { //JOptionPane.showMessageDialog(null, "Incorrect Values Entered"); JOptionPane.showMessageDialog(null, "Incorrect Values Entered" , "Error Entry", JOptionPane.ERROR_MESSAGE); //display an error message box after getting an exception System.out.println(e); //print out the exception itself } // STOPPED AT END OF LESSON 4 } }
1,557
0.675016
0.669878
59
24.322035
39.477711
167
false
false
0
0
0
0
0
0
1.813559
false
false
15
7e908a58d3945b8820fd11c480e9d5be37abbf5d
15,152,644,623,845
5cf15227491f43b238bb1c21f7ccc33ce502fbfc
/src/main/java/org/zhubao/service/impl/ArticleServiceImpl.java
03bb963b58dc28155edaf16f2a2d559d9368a6ef
[]
no_license
Jason0307/spring-redis-cache
https://github.com/Jason0307/spring-redis-cache
504dbe3e1ff37ff9e8736c91b7fc04500d95595e
d8bfa28e73a0b84ab0947dac854838bcf5497336
refs/heads/master
2020-03-26T03:48:29.875000
2015-07-17T07:06:07
2015-07-17T07:06:07
39,239,847
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.zhubao.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.zhubao.dao.ArticleDao; import org.zhubao.model.Article; import org.zhubao.service.ArticleService; @Service public class ArticleServiceImpl extends BaseServiceImpl<Article> implements ArticleService { private ArticleDao articleDao; @Autowired public void setArticleDao(ArticleDao articleDao) { super.setBaseDao(articleDao); this.articleDao = articleDao; } @Override @Cacheable(value = "articleCache", key = "#userId + 'articles'") public List<Article> findArticlesByUserId(int userId) { System.out.println("No cache go here!" + " ====== findArticlesByUserId"); return articleDao.findByUserId(userId); } @Override @CacheEvict(value = "articleCache", key = "#article.user.userId + 'articles'") public Article addArticle(Article article) { articleDao.save(article); return article; } }
UTF-8
Java
1,174
java
ArticleServiceImpl.java
Java
[]
null
[]
package org.zhubao.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.zhubao.dao.ArticleDao; import org.zhubao.model.Article; import org.zhubao.service.ArticleService; @Service public class ArticleServiceImpl extends BaseServiceImpl<Article> implements ArticleService { private ArticleDao articleDao; @Autowired public void setArticleDao(ArticleDao articleDao) { super.setBaseDao(articleDao); this.articleDao = articleDao; } @Override @Cacheable(value = "articleCache", key = "#userId + 'articles'") public List<Article> findArticlesByUserId(int userId) { System.out.println("No cache go here!" + " ====== findArticlesByUserId"); return articleDao.findByUserId(userId); } @Override @CacheEvict(value = "articleCache", key = "#article.user.userId + 'articles'") public Article addArticle(Article article) { articleDao.save(article); return article; } }
1,174
0.732538
0.732538
38
29.894737
26.512945
92
false
false
0
0
0
0
0
0
0.473684
false
false
15
09f029bfbe9e1109a1db086cca56fbb35caf9bff
6,854,767,819,537
8292d4b0ca60e3b4ad99e92fc5704837cfe7244c
/hadoop_code/query5/DayOfWeekDelayReduce.java
35e740aa89e36896dc4426aec30605fa51b1726c
[]
no_license
luca994/BigData
https://github.com/luca994/BigData
a5f0aee718062a4cf29dfdc3d763fc7549a9267b
2e3493b128e90686d6dba2fcbbf49e6bce8596f4
refs/heads/master
2020-06-27T21:35:12.286000
2018-05-29T16:54:01
2018-05-29T16:54:01
200,055,846
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package query5; import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.io.DoubleWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reducer; import org.apache.hadoop.mapred.Reporter; public class DayOfWeekDelayReduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, DoubleWritable>{ @Override public void reduce(Text arg0, Iterator<IntWritable> arg1, OutputCollector<Text, DoubleWritable> arg2, Reporter arg3) throws IOException { int tot = 0; double numDelay = 0; while(arg1.hasNext()) { IntWritable delay = arg1.next(); numDelay += delay.get(); tot++; } arg2.collect(arg0, new DoubleWritable((numDelay/tot)*100)); } }
UTF-8
Java
856
java
DayOfWeekDelayReduce.java
Java
[]
null
[]
package query5; import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.io.DoubleWritable; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reducer; import org.apache.hadoop.mapred.Reporter; public class DayOfWeekDelayReduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, DoubleWritable>{ @Override public void reduce(Text arg0, Iterator<IntWritable> arg1, OutputCollector<Text, DoubleWritable> arg2, Reporter arg3) throws IOException { int tot = 0; double numDelay = 0; while(arg1.hasNext()) { IntWritable delay = arg1.next(); numDelay += delay.get(); tot++; } arg2.collect(arg0, new DoubleWritable((numDelay/tot)*100)); } }
856
0.766355
0.75
30
27.533333
29.427576
117
false
false
0
0
0
0
0
0
1.7
false
false
15
7f0c261e523e0dbb4fb65abd05db74c4a6a524c8
3,985,729,657,559
622f2da3f7a736127d51274d8db5a83bf4888f58
/src/main/java/org/lewis/oauth/controller/RegisterController.java
e0249bdebf67b17007b57a2896864c2179ad2728
[]
no_license
lewis123456/oauth
https://github.com/lewis123456/oauth
ee89f8332e3f1e918b9050cfc65d2c42171f3ef2
120789b2210dd3c94c07f3a414293b314f6554f9
refs/heads/master
2020-03-26T23:47:26.669000
2018-08-21T13:28:15
2018-08-21T13:28:15
145,567,275
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.lewis.oauth.controller; public class RegisterController { }
UTF-8
Java
74
java
RegisterController.java
Java
[]
null
[]
package org.lewis.oauth.controller; public class RegisterController { }
74
0.797297
0.797297
5
13.8
16.509392
35
false
false
0
0
0
0
0
0
0.2
false
false
15
c063725b4f850bf4727951173ae98f6cea47be5d
28,896,539,995,321
b38df39d5fe44d36acaca9f11cb10f2a4da8b229
/.svn/pristine/c0/c063725b4f850bf4727951173ae98f6cea47be5d.svn-base
956cf4e2b08234db0252797640542191cb73eac1
[]
no_license
jacobQin/cre
https://github.com/jacobQin/cre
6447ac1ee07105d4064699c5d62253a40c4cc56b
eebe3cedbabda2017fafe74edf4eed3a56045cb0
refs/heads/master
2021-03-21T23:51:57.670000
2017-09-27T08:48:50
2017-09-27T08:48:50
104,985,697
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hd123.m3.cre.controller.account.payment.model; import com.hd123.m3.account.commons.Total; import com.hd123.m3.commons.biz.tax.TaxRate; import com.hd123.rumba.commons.biz.entity.Entity; import com.hd123.rumba.commons.biz.entity.UCN; /** * * 收付款单账款明细行滞纳金明细。 * * @author LiBin * */ public class BPaymentAccOverdue extends Entity { private static final long serialVersionUID = 9041600048864200670L; private UCN contract; private UCN subject; private int direction; private TaxRate taxRate; private Total total = Total.zero(); private boolean issueInvoice; public UCN getContract() { return contract; } public void setContract(UCN contract) { this.contract = contract; } public UCN getSubject() { return subject; } public void setSubject(UCN subject) { this.subject = subject; } public int getDirection() { return direction; } public void setDirection(int direction) { this.direction = direction; } public TaxRate getTaxRate() { return taxRate; } public void setTaxRate(TaxRate taxRate) { this.taxRate = taxRate; } public Total getTotal() { return total; } public void setTotal(Total total) { this.total = total; } public boolean isIssueInvoice() { return issueInvoice; } public void setIssueInvoice(boolean issueInvoice) { this.issueInvoice = issueInvoice; } }
UTF-8
Java
1,509
c063725b4f850bf4727951173ae98f6cea47be5d.svn-base
Java
[ { "context": ";\r\n\r\n/**\r\n * \r\n * 收付款单账款明细行滞纳金明细。\r\n * \r\n * @author LiBin\r\n * \r\n */\r\npublic class BPaymentAccOverdue extend", "end": 304, "score": 0.9705025553703308, "start": 299, "tag": "NAME", "value": "LiBin" } ]
null
[]
package com.hd123.m3.cre.controller.account.payment.model; import com.hd123.m3.account.commons.Total; import com.hd123.m3.commons.biz.tax.TaxRate; import com.hd123.rumba.commons.biz.entity.Entity; import com.hd123.rumba.commons.biz.entity.UCN; /** * * 收付款单账款明细行滞纳金明细。 * * @author LiBin * */ public class BPaymentAccOverdue extends Entity { private static final long serialVersionUID = 9041600048864200670L; private UCN contract; private UCN subject; private int direction; private TaxRate taxRate; private Total total = Total.zero(); private boolean issueInvoice; public UCN getContract() { return contract; } public void setContract(UCN contract) { this.contract = contract; } public UCN getSubject() { return subject; } public void setSubject(UCN subject) { this.subject = subject; } public int getDirection() { return direction; } public void setDirection(int direction) { this.direction = direction; } public TaxRate getTaxRate() { return taxRate; } public void setTaxRate(TaxRate taxRate) { this.taxRate = taxRate; } public Total getTotal() { return total; } public void setTotal(Total total) { this.total = total; } public boolean isIssueInvoice() { return issueInvoice; } public void setIssueInvoice(boolean issueInvoice) { this.issueInvoice = issueInvoice; } }
1,509
0.666667
0.64165
74
17.986486
17.945482
68
false
false
0
0
0
0
0
0
0.324324
false
false
15
20fb23ae8a854937bbd4d129ccc3e0357a40655c
32,736,240,730,646
4750d8d2312236456e95f76abe7415821e0b14e9
/06_InheritanceAndPolymorphism/homework_6.4/src/TopManager.java
7c0999fc8c4c424aa2cef55d25cbb29cf5f20869
[]
no_license
VictorGolovanov/skillboxJava
https://github.com/VictorGolovanov/skillboxJava
ac80b8122982998c120c75a6ea0946508f6dfdb2
0b7cdb7c461968d03a57ae3df1dc3492fa8e7d4a
refs/heads/master
2023-06-14T21:04:37.421000
2021-07-08T14:59:27
2021-07-08T14:59:27
368,211,983
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class TopManager implements Employee { private Company company; private static final double FIX_PART = 100000.0; private static final double BONUS_PERCENT = 1.5; private static final double LEVEL_FOR_BONUS = 10000000; @Override public double getMonthSalary() { if(company.getIncome() > LEVEL_FOR_BONUS){ return FIX_PART + (FIX_PART * BONUS_PERCENT); } else{ return FIX_PART; } } @Override public void setCompany(Company company) { this.company = company; } @Override public String toString() { return String.format(getMonthSalary() + " руб."); } }
UTF-8
Java
685
java
TopManager.java
Java
[]
null
[]
public class TopManager implements Employee { private Company company; private static final double FIX_PART = 100000.0; private static final double BONUS_PERCENT = 1.5; private static final double LEVEL_FOR_BONUS = 10000000; @Override public double getMonthSalary() { if(company.getIncome() > LEVEL_FOR_BONUS){ return FIX_PART + (FIX_PART * BONUS_PERCENT); } else{ return FIX_PART; } } @Override public void setCompany(Company company) { this.company = company; } @Override public String toString() { return String.format(getMonthSalary() + " руб."); } }
685
0.612903
0.587977
27
24.25926
20.648006
59
false
false
0
0
0
0
0
0
0.296296
false
false
15
0a6d4af21af4d710575e1d1f6e3516f4460cb1c9
32,676,111,243,899
20da1cb4869b3213b886cd184dd7abb0fa8e7d6c
/libpromise/src/main/java/com/imyeego/promise/UIAction.java
0f63d2f8e41e884737a52b1673ce4cd834cd5c0f
[]
no_license
imyeego/promise
https://github.com/imyeego/promise
e9985b0a83dd6806fdd56fcb96c6f0748f5b00c1
8eed97f79456b796162f5a03b64d34d2185fb6ae
refs/heads/master
2021-07-08T17:07:36.152000
2020-12-17T09:03:27
2020-12-17T09:03:27
220,174,134
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.imyeego.promise; public class UIAction<T> extends AbstractAction<T> { public UIAction(IAction<T> target, Action<T> action) { super(target, action); } @Override public void execute(T t) { if (target != null) { target.execute(t); } Utils.getMainHandler().post(new UIRunnable<T>(action, t)); } private static class UIRunnable<T> implements Runnable { private Action<T> action; private T t; public UIRunnable(Action<T> action, T t) { this.action = action; this.t = t; } @Override public void run() { action.call(t); } } }
UTF-8
Java
700
java
UIAction.java
Java
[]
null
[]
package com.imyeego.promise; public class UIAction<T> extends AbstractAction<T> { public UIAction(IAction<T> target, Action<T> action) { super(target, action); } @Override public void execute(T t) { if (target != null) { target.execute(t); } Utils.getMainHandler().post(new UIRunnable<T>(action, t)); } private static class UIRunnable<T> implements Runnable { private Action<T> action; private T t; public UIRunnable(Action<T> action, T t) { this.action = action; this.t = t; } @Override public void run() { action.call(t); } } }
700
0.545714
0.545714
31
21.580645
19.471691
66
false
false
0
0
0
0
0
0
0.419355
false
false
15
1686c996344b372eaaf940ace7c99c376ae55e96
35,622,458,786,637
a1c89f085ecf0502d4f5df1b5be6b91da53a6e1c
/src/week4/Assignment/QuickSort.java
778bdc3171d69fe181205b4c74089946d711d4cd
[]
no_license
arun786/JavaAlgorithm
https://github.com/arun786/JavaAlgorithm
1bcaa6c1f152592a3cbf235e9b1b7bc09b34c1c8
af55fceb77eacd4f6b4618080624940eb07b2663
refs/heads/master
2021-08-19T07:45:24.506000
2017-11-23T20:40:35
2017-11-23T20:40:35
108,526,081
0
0
null
false
2017-11-23T20:40:36
2017-10-27T09:22:32
2017-10-27T09:22:48
2017-11-23T20:40:36
35
0
0
0
Java
false
null
package week4.Assignment; import java.util.Scanner; public class QuickSort { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int size = scan.nextInt(); int[] a = new int[size]; for (int i = 0; i < size; i++) { a[i] = scan.nextInt(); } quickSort(a, 0, size - 1); for (int i = 0; i < size; i++) { System.out.print(a[i] + " "); } } public static void quickSort(int[] a, int lt, int rt) { if (lt >= rt) { return; } int m = partition(a, lt, rt); quickSort(a, lt, m - 1); quickSort(a, m + 1, rt); } private static int partition(int[] a, int lt, int rt) { int k = a[lt]; //pivotal int pointer = lt; //pointer which will swap the values. for (int i = lt + 1; i <= rt; i++) { if (a[i] <= k) { pointer++; int temp = a[i]; a[i] = a[pointer]; a[pointer] = temp; } } int t = a[lt]; a[lt] = a[pointer]; a[pointer] = t; return pointer; } }
UTF-8
Java
1,190
java
QuickSort.java
Java
[]
null
[]
package week4.Assignment; import java.util.Scanner; public class QuickSort { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int size = scan.nextInt(); int[] a = new int[size]; for (int i = 0; i < size; i++) { a[i] = scan.nextInt(); } quickSort(a, 0, size - 1); for (int i = 0; i < size; i++) { System.out.print(a[i] + " "); } } public static void quickSort(int[] a, int lt, int rt) { if (lt >= rt) { return; } int m = partition(a, lt, rt); quickSort(a, lt, m - 1); quickSort(a, m + 1, rt); } private static int partition(int[] a, int lt, int rt) { int k = a[lt]; //pivotal int pointer = lt; //pointer which will swap the values. for (int i = lt + 1; i <= rt; i++) { if (a[i] <= k) { pointer++; int temp = a[i]; a[i] = a[pointer]; a[pointer] = temp; } } int t = a[lt]; a[lt] = a[pointer]; a[pointer] = t; return pointer; } }
1,190
0.432773
0.42605
54
21.037037
17.944321
63
false
false
0
0
0
0
0
0
0.740741
false
false
15
a8997ed85a68a15fa5c3a67131da357f1155b6c1
35,622,458,789,266
50ad605698934d63ba895ee6a601cd8c7136776b
/src/com/dev/ui/HomePage.java
907150849d8acde6532fe579dba4eef3dfa2f1ae
[]
no_license
thulc567/SwingsKioskApp
https://github.com/thulc567/SwingsKioskApp
b0d80ddbe4230d827bd5cd507a207eb793dc0bd7
b7e35da3ee9ead3c847e5d4b7b5ef39774eb101a
refs/heads/master
2020-02-20T06:05:14.313000
2018-01-13T04:12:10
2018-01-13T04:12:10
126,165,609
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dev.ui; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; import org.apache.log4j.Logger; import com.dev.bean.Job; import com.dev.resources.Factory; public class HomePage extends JFrame{ private static final Logger LOGGER = Logger.getLogger(HomePage.class); private JPanel contentPane; private static List<Job> jobs; static HomePage frame; public static void main(String[] args) { try { jobs = Factory.createJobService().retrieveJobs(); } catch (Exception e1) { e1.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { try { frame = new HomePage(null); frame.setVisible(true); } catch (Exception e) { LOGGER.error("\nException Occured: "+e.getMessage()); LOGGER.error(e.getMessage(), e); } } }); } public HomePage(String subJob){ setResizable(true); setTitle("Job Portal..."); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(0,0,screenSize.width, screenSize.height); JPanel contentPane1 = new JPanel(null); contentPane = new JPanel(); contentPane.setBackground(new Color(0xFFFFFF)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(null); if(subJob!=null){ JButton home = new JButton("Home"); home.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try{ HomePage.frame = new HomePage(null); HomePage.frame.setVisible(true); setVisible(false); }catch(Exception e1){ LOGGER.error("\nException Occured: "+e1.getMessage()); LOGGER.error(e1.getMessage(), e1); } } }); home.setBackground(new Color(0xFFFFFF)); home.setForeground(new Color(0x000080)); home.setBorderPainted(false); home.setFont(new Font("Verdana",Font.BOLD,16)); home.setBounds(screenSize.width-screenSize.width/5, 60, 89, 30); contentPane.add(home); } JLabel jobDetailsLabel = new JLabel("Job Details"); jobDetailsLabel.setForeground(new Color(0x000080)); jobDetailsLabel.setBounds(10, 0, 500, 50); jobDetailsLabel.setFont(new Font("Verdana",Font.BOLD,24)); contentPane.add(jobDetailsLabel); JLabel space = new JLabel("________________________________________________________________"); space.setForeground(new Color(0x000080)); space.setFont(new Font("Verdana",Font.PLAIN,30)); contentPane.add(space); int x = 0; int y = 0; int z =0; List<Job> iterableJobs = null; if(subJob==null){ iterableJobs = new ArrayList<>(); for (Job job : jobs) { if(job.getJobLevel().equals("1")){ iterableJobs.add(job); } } } else{ String[] subJobArray = subJob.split(","); iterableJobs = new ArrayList<Job>(); for (String string : subJobArray) { for (Job job : jobs) { if(job.getJobCode().equals(string)){ iterableJobs.add(job); } } } } for (Job job : iterableJobs) { JButton jobCodeButton = new JButton(job.getJobTitle()); jobCodeButton.setBackground(new Color(0x000080)); jobCodeButton.setForeground(new Color(0xFFFFFF)); jobCodeButton.setBorderPainted(false); jobCodeButton.setBounds(screenSize.width/4+x,screenSize.height/3+y,200,60); jobCodeButton.setFont(new Font("Verdana",Font.BOLD,16)); contentPane.add(jobCodeButton); final String jc = job.getJobCode(); final Job finaljob = job; jobCodeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try{ if(finaljob.getSubJob()==null){ ApplyForJob.applyFrame = new ApplyForJob(jc); ApplyForJob.applyFrame.setVisible(true); setVisible(false); }else{ setVisible(false); HomePage.frame = new HomePage(finaljob.getSubJob()); HomePage.frame.setVisible(true); } }catch(Exception e1){ LOGGER.error("\nException Occured: "+e1.getMessage()); LOGGER.error(e1.getMessage(), e1); } } }); z++; x = x+210; if(z == 4){ y = y+100; x = 0; } JLabel space1 = new JLabel(" "); space1.setFont(new Font("Verdana",Font.PLAIN,16)); contentPane.add(space1); } JScrollPane scrollPane = new JScrollPane(contentPane); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); contentPane1.add(scrollPane); setContentPane(scrollPane); } }
UTF-8
Java
5,226
java
HomePage.java
Java
[]
null
[]
package com.dev.ui; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; import org.apache.log4j.Logger; import com.dev.bean.Job; import com.dev.resources.Factory; public class HomePage extends JFrame{ private static final Logger LOGGER = Logger.getLogger(HomePage.class); private JPanel contentPane; private static List<Job> jobs; static HomePage frame; public static void main(String[] args) { try { jobs = Factory.createJobService().retrieveJobs(); } catch (Exception e1) { e1.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { try { frame = new HomePage(null); frame.setVisible(true); } catch (Exception e) { LOGGER.error("\nException Occured: "+e.getMessage()); LOGGER.error(e.getMessage(), e); } } }); } public HomePage(String subJob){ setResizable(true); setTitle("Job Portal..."); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(0,0,screenSize.width, screenSize.height); JPanel contentPane1 = new JPanel(null); contentPane = new JPanel(); contentPane.setBackground(new Color(0xFFFFFF)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(null); if(subJob!=null){ JButton home = new JButton("Home"); home.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try{ HomePage.frame = new HomePage(null); HomePage.frame.setVisible(true); setVisible(false); }catch(Exception e1){ LOGGER.error("\nException Occured: "+e1.getMessage()); LOGGER.error(e1.getMessage(), e1); } } }); home.setBackground(new Color(0xFFFFFF)); home.setForeground(new Color(0x000080)); home.setBorderPainted(false); home.setFont(new Font("Verdana",Font.BOLD,16)); home.setBounds(screenSize.width-screenSize.width/5, 60, 89, 30); contentPane.add(home); } JLabel jobDetailsLabel = new JLabel("Job Details"); jobDetailsLabel.setForeground(new Color(0x000080)); jobDetailsLabel.setBounds(10, 0, 500, 50); jobDetailsLabel.setFont(new Font("Verdana",Font.BOLD,24)); contentPane.add(jobDetailsLabel); JLabel space = new JLabel("________________________________________________________________"); space.setForeground(new Color(0x000080)); space.setFont(new Font("Verdana",Font.PLAIN,30)); contentPane.add(space); int x = 0; int y = 0; int z =0; List<Job> iterableJobs = null; if(subJob==null){ iterableJobs = new ArrayList<>(); for (Job job : jobs) { if(job.getJobLevel().equals("1")){ iterableJobs.add(job); } } } else{ String[] subJobArray = subJob.split(","); iterableJobs = new ArrayList<Job>(); for (String string : subJobArray) { for (Job job : jobs) { if(job.getJobCode().equals(string)){ iterableJobs.add(job); } } } } for (Job job : iterableJobs) { JButton jobCodeButton = new JButton(job.getJobTitle()); jobCodeButton.setBackground(new Color(0x000080)); jobCodeButton.setForeground(new Color(0xFFFFFF)); jobCodeButton.setBorderPainted(false); jobCodeButton.setBounds(screenSize.width/4+x,screenSize.height/3+y,200,60); jobCodeButton.setFont(new Font("Verdana",Font.BOLD,16)); contentPane.add(jobCodeButton); final String jc = job.getJobCode(); final Job finaljob = job; jobCodeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try{ if(finaljob.getSubJob()==null){ ApplyForJob.applyFrame = new ApplyForJob(jc); ApplyForJob.applyFrame.setVisible(true); setVisible(false); }else{ setVisible(false); HomePage.frame = new HomePage(finaljob.getSubJob()); HomePage.frame.setVisible(true); } }catch(Exception e1){ LOGGER.error("\nException Occured: "+e1.getMessage()); LOGGER.error(e1.getMessage(), e1); } } }); z++; x = x+210; if(z == 4){ y = y+100; x = 0; } JLabel space1 = new JLabel(" "); space1.setFont(new Font("Verdana",Font.PLAIN,16)); contentPane.add(space1); } JScrollPane scrollPane = new JScrollPane(contentPane); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); contentPane1.add(scrollPane); setContentPane(scrollPane); } }
5,226
0.633946
0.615385
194
25.938145
21.437666
96
false
false
0
0
0
0
0
0
3.195876
false
false
15
7e3be884f1ff702d521a792152e27ee4d31530ff
17,222,818,919,937
49f9e007df2ad3eff722b174e3ec4c41858085df
/src/java/com/silvassa/bean/ReportQuery.java
812717174b6087ec20f249e3b8e176bcb40d6d76
[]
no_license
avnishbhardwaj-mmi/MCSilvassa_new
https://github.com/avnishbhardwaj-mmi/MCSilvassa_new
cc8d0ee25592b3ce3ed68a5edb6de244a4c5c7c9
8004579eb845b647b497e8e95b414a9f002cac9a
refs/heads/master
2020-11-28T05:40:19.278000
2019-12-23T11:06:46
2019-12-23T11:06:46
229,718,860
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.silvassa.bean; /** * * @author CEINFO */ public class ReportQuery { private String zone; private String propId; private String PAN; private String ADHAAR; private String propType; private String paymentStatus; private String arrear; private String minTaxAmount; private String maxTaxAmount; private String objectionFrom; private String objectionTo; private String objectionStatus; private String noticeStatus; private String ownerId; private String occupierId; private String objectionId; /** * @return the zone */ public String getZone() { return zone; } /** * @param zone the zone to set */ public void setZone(String zone) { this.zone = zone; } /** * @return the propId */ public String getPropId() { return propId; } /** * @param propId the propId to set */ public void setPropId(String propId) { this.propId = propId; } /** * @return the PAN */ public String getPAN() { return PAN; } /** * @param PAN the PAN to set */ public void setPAN(String PAN) { this.PAN = PAN; } /** * @return the ADHAAR */ public String getADHAAR() { return ADHAAR; } /** * @param ADHAAR the ADHAAR to set */ public void setADHAAR(String ADHAAR) { this.ADHAAR = ADHAAR; } /** * @return the propType */ public String getPropType() { return propType; } /** * @param propType the propType to set */ public void setPropType(String propType) { this.propType = propType; } /** * @return the paymentStatus */ public String getPaymentStatus() { return paymentStatus; } /** * @param paymentStatus the paymentStatus to set */ public void setPaymentStatus(String paymentStatus) { this.paymentStatus = paymentStatus; } /** * @return the arrear */ public String getArrear() { return arrear; } /** * @param arrear the arrear to set */ public void setArrear(String arrear) { this.arrear = arrear; } /** * @return the minTaxAmount */ public String getMinTaxAmount() { return minTaxAmount; } /** * @param minTaxAmount the minTaxAmount to set */ public void setMinTaxAmount(String minTaxAmount) { this.minTaxAmount = minTaxAmount; } /** * @return the maxTaxAmount */ public String getMaxTaxAmount() { return maxTaxAmount; } /** * @param maxTaxAmount the maxTaxAmount to set */ public void setMaxTaxAmount(String maxTaxAmount) { this.maxTaxAmount = maxTaxAmount; } /** * @return the objectionFrom */ public String getObjectionFrom() { return objectionFrom; } /** * @param objectionFrom the objectionFrom to set */ public void setObjectionFrom(String objectionFrom) { this.objectionFrom = objectionFrom; } /** * @return the objectionTo */ public String getObjectionTo() { return objectionTo; } /** * @param objectionTo the objectionTo to set */ public void setObjectionTo(String objectionTo) { this.objectionTo = objectionTo; } /** * @return the objectionStatus */ public String getObjectionStatus() { return objectionStatus; } /** * @param objectionStatus the objectionStatus to set */ public void setObjectionStatus(String objectionStatus) { this.objectionStatus = objectionStatus; } /** * @return the noticeStatus */ public String getNoticeStatus() { return noticeStatus; } /** * @param noticeStatus the noticeStatus to set */ public void setNoticeStatus(String noticeStatus) { this.noticeStatus = noticeStatus; } public String getOwnerId() { return ownerId; } public void setOwnerId(String ownerId) { this.ownerId = ownerId; } public String getOccupierId() { return occupierId; } public void setOccupierId(String occupierId) { this.occupierId = occupierId; } public String getObjectionId() { return objectionId; } public void setObjectionId(String objectionId) { this.objectionId = objectionId; } @Override public String toString() { return "ReportQuery{" + "zone=" + zone + ", propId=" + propId + ", PAN=" + PAN + ", ADHAAR=" + ADHAAR + ", propType=" + propType + ", paymentStatus=" + paymentStatus + ", arrear=" + arrear + ", minTaxAmount=" + minTaxAmount + ", maxTaxAmount=" + maxTaxAmount + ", objectionFrom=" + objectionFrom + ", objectionTo=" + objectionTo + ", objectionStatus=" + objectionStatus + ", noticeStatus=" + noticeStatus + ", ownerId=" + ownerId + ", occupierId=" + occupierId + ", objectionId=" + objectionId + '}'; } }
UTF-8
Java
5,313
java
ReportQuery.java
Java
[ { "context": " */\n\npackage com.silvassa.bean;\n\n/**\n *\n * @author CEINFO\n */\npublic class ReportQuery {\n \n private S", "end": 238, "score": 0.9994564056396484, "start": 232, "tag": "USERNAME", "value": "CEINFO" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.silvassa.bean; /** * * @author CEINFO */ public class ReportQuery { private String zone; private String propId; private String PAN; private String ADHAAR; private String propType; private String paymentStatus; private String arrear; private String minTaxAmount; private String maxTaxAmount; private String objectionFrom; private String objectionTo; private String objectionStatus; private String noticeStatus; private String ownerId; private String occupierId; private String objectionId; /** * @return the zone */ public String getZone() { return zone; } /** * @param zone the zone to set */ public void setZone(String zone) { this.zone = zone; } /** * @return the propId */ public String getPropId() { return propId; } /** * @param propId the propId to set */ public void setPropId(String propId) { this.propId = propId; } /** * @return the PAN */ public String getPAN() { return PAN; } /** * @param PAN the PAN to set */ public void setPAN(String PAN) { this.PAN = PAN; } /** * @return the ADHAAR */ public String getADHAAR() { return ADHAAR; } /** * @param ADHAAR the ADHAAR to set */ public void setADHAAR(String ADHAAR) { this.ADHAAR = ADHAAR; } /** * @return the propType */ public String getPropType() { return propType; } /** * @param propType the propType to set */ public void setPropType(String propType) { this.propType = propType; } /** * @return the paymentStatus */ public String getPaymentStatus() { return paymentStatus; } /** * @param paymentStatus the paymentStatus to set */ public void setPaymentStatus(String paymentStatus) { this.paymentStatus = paymentStatus; } /** * @return the arrear */ public String getArrear() { return arrear; } /** * @param arrear the arrear to set */ public void setArrear(String arrear) { this.arrear = arrear; } /** * @return the minTaxAmount */ public String getMinTaxAmount() { return minTaxAmount; } /** * @param minTaxAmount the minTaxAmount to set */ public void setMinTaxAmount(String minTaxAmount) { this.minTaxAmount = minTaxAmount; } /** * @return the maxTaxAmount */ public String getMaxTaxAmount() { return maxTaxAmount; } /** * @param maxTaxAmount the maxTaxAmount to set */ public void setMaxTaxAmount(String maxTaxAmount) { this.maxTaxAmount = maxTaxAmount; } /** * @return the objectionFrom */ public String getObjectionFrom() { return objectionFrom; } /** * @param objectionFrom the objectionFrom to set */ public void setObjectionFrom(String objectionFrom) { this.objectionFrom = objectionFrom; } /** * @return the objectionTo */ public String getObjectionTo() { return objectionTo; } /** * @param objectionTo the objectionTo to set */ public void setObjectionTo(String objectionTo) { this.objectionTo = objectionTo; } /** * @return the objectionStatus */ public String getObjectionStatus() { return objectionStatus; } /** * @param objectionStatus the objectionStatus to set */ public void setObjectionStatus(String objectionStatus) { this.objectionStatus = objectionStatus; } /** * @return the noticeStatus */ public String getNoticeStatus() { return noticeStatus; } /** * @param noticeStatus the noticeStatus to set */ public void setNoticeStatus(String noticeStatus) { this.noticeStatus = noticeStatus; } public String getOwnerId() { return ownerId; } public void setOwnerId(String ownerId) { this.ownerId = ownerId; } public String getOccupierId() { return occupierId; } public void setOccupierId(String occupierId) { this.occupierId = occupierId; } public String getObjectionId() { return objectionId; } public void setObjectionId(String objectionId) { this.objectionId = objectionId; } @Override public String toString() { return "ReportQuery{" + "zone=" + zone + ", propId=" + propId + ", PAN=" + PAN + ", ADHAAR=" + ADHAAR + ", propType=" + propType + ", paymentStatus=" + paymentStatus + ", arrear=" + arrear + ", minTaxAmount=" + minTaxAmount + ", maxTaxAmount=" + maxTaxAmount + ", objectionFrom=" + objectionFrom + ", objectionTo=" + objectionTo + ", objectionStatus=" + objectionStatus + ", noticeStatus=" + noticeStatus + ", ownerId=" + ownerId + ", occupierId=" + occupierId + ", objectionId=" + objectionId + '}'; } }
5,313
0.591003
0.591003
246
20.597561
35.568047
508
false
false
0
0
0
0
0
0
0.276423
false
false
15
204a67708932ea53b77167918c4dabc6cc5b0003
35,115,652,652,196
de26b308b2d79d4c9e56564148e8aa3184769b8c
/90-util/src/main/java/fr/univ/tours/siad/util/package-info.java
170dd43602abcbf325dd6ad250106f81cb6b711a
[]
no_license
ptitbob/siad2016
https://github.com/ptitbob/siad2016
72507e91172271f216f402c58330a507e25bb958
2dded6505a00e38c6ba81164328556bcc6d5bf3a
refs/heads/master
2020-12-28T19:08:27.078000
2017-02-16T00:21:01
2017-02-16T00:21:01
68,525,966
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by francois on 27/08/15. */ package fr.univ.tours.siad.util;
UTF-8
Java
76
java
package-info.java
Java
[ { "context": "/**\n * Created by francois on 27/08/15.\n */\npackage fr.univ.tours.siad.util;", "end": 26, "score": 0.9539303779602051, "start": 18, "tag": "NAME", "value": "francois" } ]
null
[]
/** * Created by francois on 27/08/15. */ package fr.univ.tours.siad.util;
76
0.671053
0.592105
4
18.25
15.28684
35
false
false
0
0
0
0
0
0
0.25
false
false
15
7fe08dceda10b485ed5f9624de1dfb7ad33568be
37,752,762,539,258
3baf801228919a64f2aca7b9892ccea4268e5ee4
/src/de/umass/idea/copyConstructor/GenerateCopyConstructorHandler.java
1ab17a0136e0c59a4daf3016231220ff5e9ad059
[ "MIT" ]
permissive
njleonzhang/CopyConstructorPlugin
https://github.com/njleonzhang/CopyConstructorPlugin
61a806c080c687accd21a38b578dc906624290a7
0fb02b6bbda71c77c0bdb7e8c0a2c44176e14b54
refs/heads/master
2020-12-03T01:47:24.270000
2017-06-30T08:47:55
2017-06-30T08:47:55
95,866,622
0
0
null
true
2017-06-30T08:23:46
2017-06-30T08:23:46
2016-08-26T04:11:43
2015-09-18T22:20:05
124
0
0
0
null
null
null
package de.umass.idea.copyConstructor; import java.util.Collections; import java.util.List; import com.intellij.codeInsight.generation.ClassMember; import com.intellij.codeInsight.generation.GenerateMembersHandlerBase; import com.intellij.codeInsight.generation.GenerationInfo; import com.intellij.codeInsight.generation.PsiFieldMember; import com.intellij.codeInsight.generation.PsiGenerationInfo; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.JavaPsiFacade; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElementFactory; import com.intellij.psi.PsiField; import com.intellij.psi.PsiMethod; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class GenerateCopyConstructorHandler extends GenerateMembersHandlerBase { public GenerateCopyConstructorHandler() { super(null); } @Override protected String getNothingFoundMessage() { return "Copy constructor already exists"; } @Override protected ClassMember[] getAllOriginalMembers(PsiClass aClass) { return toMembers(ConstructorUtil.getAllCopyableFields(aClass)); } @Nullable @Override protected ClassMember[] chooseMembers(ClassMember[] members, boolean allowEmptySelection, boolean copyJavadocCheckbox, Project project, @Nullable Editor editor) { return members; } @NotNull @Override protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members) throws IncorrectOperationException { PsiMethod copyConstructor = generateCopyConstructor(aClass, members); return Collections.singletonList(new PsiGenerationInfo<PsiMethod>(copyConstructor)); } @Override protected GenerationInfo[] generateMemberPrototypes(PsiClass aClass, ClassMember originalMember) throws IncorrectOperationException { return null; } private PsiMethod generateCopyConstructor(PsiClass psiClass, ClassMember[] copyableFields) { String parameterName = "other"; StringBuilder code = new StringBuilder(); code.append(String.format("public void set(%s %s) {", psiClass.getName(), parameterName)); boolean superclassHasCopyConstructor = ConstructorUtil.hasCopyConstructor(psiClass.getSuperClass()); if (superclassHasCopyConstructor) { code.append(String.format("super(%s);", parameterName)); } for (ClassMember fieldMember : copyableFields) { PsiField field = ((PsiFieldMember) fieldMember).getElement(); String name = field.getName(); code.append(String.format("this.%s = %s.%s;", name, parameterName, name)); } code.append("}"); PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiClass.getProject()); PsiMethod constructor = elementFactory.createMethodFromText(code.toString(), psiClass); return constructor; } private ClassMember[] toMembers(List<PsiField> allCopyableFields) { ClassMember[] classMembers = new ClassMember[allCopyableFields.size()]; for (int i = 0; i < allCopyableFields.size(); i++) { classMembers[i] = new PsiFieldMember(allCopyableFields.get(i)); } return classMembers; } }
UTF-8
Java
3,142
java
GenerateCopyConstructorHandler.java
Java
[]
null
[]
package de.umass.idea.copyConstructor; import java.util.Collections; import java.util.List; import com.intellij.codeInsight.generation.ClassMember; import com.intellij.codeInsight.generation.GenerateMembersHandlerBase; import com.intellij.codeInsight.generation.GenerationInfo; import com.intellij.codeInsight.generation.PsiFieldMember; import com.intellij.codeInsight.generation.PsiGenerationInfo; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.JavaPsiFacade; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElementFactory; import com.intellij.psi.PsiField; import com.intellij.psi.PsiMethod; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class GenerateCopyConstructorHandler extends GenerateMembersHandlerBase { public GenerateCopyConstructorHandler() { super(null); } @Override protected String getNothingFoundMessage() { return "Copy constructor already exists"; } @Override protected ClassMember[] getAllOriginalMembers(PsiClass aClass) { return toMembers(ConstructorUtil.getAllCopyableFields(aClass)); } @Nullable @Override protected ClassMember[] chooseMembers(ClassMember[] members, boolean allowEmptySelection, boolean copyJavadocCheckbox, Project project, @Nullable Editor editor) { return members; } @NotNull @Override protected List<? extends GenerationInfo> generateMemberPrototypes(PsiClass aClass, ClassMember[] members) throws IncorrectOperationException { PsiMethod copyConstructor = generateCopyConstructor(aClass, members); return Collections.singletonList(new PsiGenerationInfo<PsiMethod>(copyConstructor)); } @Override protected GenerationInfo[] generateMemberPrototypes(PsiClass aClass, ClassMember originalMember) throws IncorrectOperationException { return null; } private PsiMethod generateCopyConstructor(PsiClass psiClass, ClassMember[] copyableFields) { String parameterName = "other"; StringBuilder code = new StringBuilder(); code.append(String.format("public void set(%s %s) {", psiClass.getName(), parameterName)); boolean superclassHasCopyConstructor = ConstructorUtil.hasCopyConstructor(psiClass.getSuperClass()); if (superclassHasCopyConstructor) { code.append(String.format("super(%s);", parameterName)); } for (ClassMember fieldMember : copyableFields) { PsiField field = ((PsiFieldMember) fieldMember).getElement(); String name = field.getName(); code.append(String.format("this.%s = %s.%s;", name, parameterName, name)); } code.append("}"); PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(psiClass.getProject()); PsiMethod constructor = elementFactory.createMethodFromText(code.toString(), psiClass); return constructor; } private ClassMember[] toMembers(List<PsiField> allCopyableFields) { ClassMember[] classMembers = new ClassMember[allCopyableFields.size()]; for (int i = 0; i < allCopyableFields.size(); i++) { classMembers[i] = new PsiFieldMember(allCopyableFields.get(i)); } return classMembers; } }
3,142
0.797263
0.796945
86
35.534885
36.10247
163
false
false
0
0
0
0
0
0
1.662791
false
false
15
256d5482ce187bd6f48013dd23c2448d962fb9c6
36,447,092,496,655
3834a910bef7dc228b537069cd8edd2422f084ca
/src/com/wj/sell/util/HttpCallResultBack.java
b6b347c0b30182044394ee96c39a8092043ed8c4
[]
no_license
wangjian2254/Sell3
https://github.com/wangjian2254/Sell3
4adc69524daad4150b9366642bb8814afa23e62e
37490a3be861e6b03f11a5b703285f187834be15
refs/heads/master
2020-04-06T16:19:43.767000
2016-01-07T06:56:50
2016-01-07T06:56:50
12,211,754
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wj.sell.util; /** * Created by 黄海杰 on 2015/1/10. * 解析完成回调方法 * 增加失败 * by黄海杰 at:2015-2-25 */ public interface HttpCallResultBack { public void doresult(HttpResult result); public void dofailure(); }
UTF-8
Java
260
java
HttpCallResultBack.java
Java
[ { "context": "package com.wj.sell.util;\n\n/**\n * Created by 黄海杰 on 2015/1/10.\n * 解析完成回调方法\n * 增加失败\n * by黄海杰 at:201", "end": 48, "score": 0.9993569850921631, "start": 45, "tag": "NAME", "value": "黄海杰" } ]
null
[]
package com.wj.sell.util; /** * Created by 黄海杰 on 2015/1/10. * 解析完成回调方法 * 增加失败 * by黄海杰 at:2015-2-25 */ public interface HttpCallResultBack { public void doresult(HttpResult result); public void dofailure(); }
260
0.683036
0.620536
13
16.23077
14.884963
44
false
false
0
0
0
0
0
0
0.230769
false
false
15
dd558d1d4f5678d8c55c3e5d75b466a7ad47fd30
35,270,271,475,859
6b174fd53030906d33005c5637e6a636268cd548
/test/CircleTest.java
5e8964628408c412fb318cee8eb82a5b90673419
[]
no_license
kmculpepper/oo-recap
https://github.com/kmculpepper/oo-recap
64bdc5380b81e6317c664592ce8212771e06f943
985a252c9119af637d196a48ab1ff35caae158b0
refs/heads/master
2020-05-25T07:49:23.560000
2017-03-21T14:45:25
2017-03-21T14:45:25
84,923,617
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; /** * Created by kculpepp on 3/14/17. */ public class CircleTest { private Circle circle; @Test public void shouldReturn4PiForAreaIfRadiusIs2(){ circle = new Circle(2); assertThat(circle.area(), is(4*Math.PI)); } @Test public void shouldReturn9PiForAreaIfRadiusIs3(){ circle = new Circle(3); assertThat(circle.area(), is(9*Math.PI)); } @Test public void shouldReturn4PiForPerimeterIfRadiusIs2(){ circle = new Circle(2); assertThat(circle.perimeter(), is(4*Math.PI)); } @Test public void shouldReturn6PiForPerimeterIfRadiusIs3(){ circle = new Circle(3); assertThat(circle.perimeter(), is(6*Math.PI)); } }
UTF-8
Java
834
java
CircleTest.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n * Created by kculpepp on 3/14/17.\n */\npublic class CircleTest {\n\n pr", "end": 129, "score": 0.9996702075004578, "start": 121, "tag": "USERNAME", "value": "kculpepp" } ]
null
[]
import org.junit.Test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; /** * Created by kculpepp on 3/14/17. */ public class CircleTest { private Circle circle; @Test public void shouldReturn4PiForAreaIfRadiusIs2(){ circle = new Circle(2); assertThat(circle.area(), is(4*Math.PI)); } @Test public void shouldReturn9PiForAreaIfRadiusIs3(){ circle = new Circle(3); assertThat(circle.area(), is(9*Math.PI)); } @Test public void shouldReturn4PiForPerimeterIfRadiusIs2(){ circle = new Circle(2); assertThat(circle.perimeter(), is(4*Math.PI)); } @Test public void shouldReturn6PiForPerimeterIfRadiusIs3(){ circle = new Circle(3); assertThat(circle.perimeter(), is(6*Math.PI)); } }
834
0.639089
0.613909
41
19.365854
20.558964
57
false
false
0
0
0
0
0
0
0.390244
false
false
15
1135302672a2cb4dd600abf7b2b331eaaabef074
38,293,928,424,071
627a5ec2a9723b66c029878243bceb6fd8169881
/src/dao/GetDBDetailsDao.java
4cb7efba482d6fc18e9b84b3ee8bb3598c142c3e
[]
no_license
hiteshkhapre/SmartStreamJavaProject
https://github.com/hiteshkhapre/SmartStreamJavaProject
12f749ad35b0a7ae6ebef807f2915d8de067fd5a
b56690f51142582d71c057e70cdea6859bf8854b
refs/heads/master
2021-01-22T19:49:28.138000
2015-02-11T15:53:55
2015-02-11T15:53:55
30,655,636
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 dao; import beans.Order; import beans.Person; import java.util.ArrayList; import java.util.List; import java.util.Map; /** *Interface to get the person and order details * */ public interface GetDBDetailsDao { /** * Get the person details having at least one order * @return */ public List<Person> getPersonWithOneOrder(); /** * Get the order details for all the persons with at least one order * @param personList * @return */ public Map<String, ArrayList<Order>> getOrderDetails(List<Person> personList); }
UTF-8
Java
803
java
GetDBDetailsDao.java
Java
[]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package dao; import beans.Order; import beans.Person; import java.util.ArrayList; import java.util.List; import java.util.Map; /** *Interface to get the person and order details * */ public interface GetDBDetailsDao { /** * Get the person details having at least one order * @return */ public List<Person> getPersonWithOneOrder(); /** * Get the order details for all the persons with at least one order * @param personList * @return */ public Map<String, ArrayList<Order>> getOrderDetails(List<Person> personList); }
803
0.656289
0.656289
32
23.09375
23.979626
82
false
false
0
0
0
0
0
0
0.375
false
false
15
8123b2eaf4290111eef2d393452444bfc8f69664
34,144,990,050,074
b550a83a25c0813b00a85175c12737e0683126d4
/src/code/ConfigMenu.java
7db20a0cdf5abddc92c63c46f69b8113fc759d69
[]
no_license
ftuyama/Web-Bizuca
https://github.com/ftuyama/Web-Bizuca
8751589825b92467353b5d9a22039ad613dedd7b
268e96d58c7c3671aaad21187f47df623b18fed8
refs/heads/master
2021-01-21T22:29:05.636000
2015-06-27T12:08:14
2015-06-27T12:08:14
35,845,494
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package code; import java.awt.Color; import javax.swing.*; public class ConfigMenu extends JFrame { Config cfg = Config.getInstance(); public ConfigMenu() { getContentPane().setBackground(new Color(0, 0, 0)); initComponents(); jCheckBox1.setSelected(cfg.MusicOn); jTextField1.setText(""+cfg.Nbots); jTextField3.setText(""+cfg.recover); jTextField2.setText(""+cfg.Tmax); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jTextField4 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jCheckBox1 = new javax.swing.JCheckBox(); jTextField3 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jButton3 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jCheckBox2 = new javax.swing.JCheckBox(); jTextField4.setBackground(java.awt.Color.black); jTextField4.setForeground(java.awt.Color.white); jTextField4.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jButton2.setBackground(java.awt.Color.black); jButton2.setForeground(java.awt.Color.white); jButton2.setText("Save"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jTextField1.setBackground(java.awt.Color.black); jTextField1.setForeground(java.awt.Color.white); jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel1.setBackground(java.awt.Color.black); jLabel1.setForeground(java.awt.Color.white); jLabel1.setText("Nº Bots"); jTextField2.setBackground(java.awt.Color.black); jTextField2.setForeground(java.awt.Color.white); jTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER); jLabel2.setBackground(java.awt.Color.black); jLabel2.setForeground(java.awt.Color.white); jLabel2.setText("Tempo máximo"); jCheckBox1.setBackground(java.awt.Color.black); jCheckBox1.setForeground(java.awt.Color.white); jCheckBox1.setText("Música"); jTextField3.setBackground(java.awt.Color.black); jTextField3.setForeground(java.awt.Color.white); jTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); jLabel3.setBackground(java.awt.Color.black); jLabel3.setForeground(java.awt.Color.white); jLabel3.setText("Regeneração"); jButton3.setBackground(java.awt.Color.black); jButton3.setForeground(java.awt.Color.white); jButton3.setText("Reset"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jLabel4.setBackground(java.awt.Color.black); jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel4.setForeground(java.awt.Color.white); jLabel4.setText("Configurações de Jogo"); jSeparator1.setBackground(java.awt.Color.black); jSeparator1.setForeground(java.awt.Color.white); jCheckBox2.setBackground(java.awt.Color.black); jCheckBox2.setForeground(java.awt.Color.white); jCheckBox2.setText("Apocalipse"); jCheckBox2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox2ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jCheckBox1) .addComponent(jButton3)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jCheckBox2)))) .addGroup(layout.createSequentialGroup() .addGap(44, 44, 44) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(56, 56, 56) .addComponent(jLabel4)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField2) .addComponent(jTextField1) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(46, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(14, 14, 14) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 3, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jCheckBox1) .addComponent(jCheckBox2)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton3)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed cfg.MusicOn = jCheckBox1.isSelected(); cfg.Apocalipse = jCheckBox2.isSelected(); cfg.Nbots = Integer.parseInt(jTextField1.getText()); cfg.Tmax = Integer.parseInt(jTextField2.getText()); cfg.recover = Integer.parseInt(jTextField3.getText()); try { cfg.gerarXml(); } catch (Exception ex) {} this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { cfg.gerarXml(); } catch (Exception ex) {} }//GEN-LAST:event_jButton3ActionPerformed private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jCheckBox2ActionPerformed public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ConfigMenu().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JSeparator jSeparator1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables }
UTF-8
Java
12,121
java
ConfigMenu.java
Java
[]
null
[]
package code; import java.awt.Color; import javax.swing.*; public class ConfigMenu extends JFrame { Config cfg = Config.getInstance(); public ConfigMenu() { getContentPane().setBackground(new Color(0, 0, 0)); initComponents(); jCheckBox1.setSelected(cfg.MusicOn); jTextField1.setText(""+cfg.Nbots); jTextField3.setText(""+cfg.recover); jTextField2.setText(""+cfg.Tmax); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jTextField4 = new javax.swing.JTextField(); jButton2 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jCheckBox1 = new javax.swing.JCheckBox(); jTextField3 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jButton3 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jCheckBox2 = new javax.swing.JCheckBox(); jTextField4.setBackground(java.awt.Color.black); jTextField4.setForeground(java.awt.Color.white); jTextField4.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jButton2.setBackground(java.awt.Color.black); jButton2.setForeground(java.awt.Color.white); jButton2.setText("Save"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jTextField1.setBackground(java.awt.Color.black); jTextField1.setForeground(java.awt.Color.white); jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel1.setBackground(java.awt.Color.black); jLabel1.setForeground(java.awt.Color.white); jLabel1.setText("Nº Bots"); jTextField2.setBackground(java.awt.Color.black); jTextField2.setForeground(java.awt.Color.white); jTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER); jLabel2.setBackground(java.awt.Color.black); jLabel2.setForeground(java.awt.Color.white); jLabel2.setText("Tempo máximo"); jCheckBox1.setBackground(java.awt.Color.black); jCheckBox1.setForeground(java.awt.Color.white); jCheckBox1.setText("Música"); jTextField3.setBackground(java.awt.Color.black); jTextField3.setForeground(java.awt.Color.white); jTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); jLabel3.setBackground(java.awt.Color.black); jLabel3.setForeground(java.awt.Color.white); jLabel3.setText("Regeneração"); jButton3.setBackground(java.awt.Color.black); jButton3.setForeground(java.awt.Color.white); jButton3.setText("Reset"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jLabel4.setBackground(java.awt.Color.black); jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N jLabel4.setForeground(java.awt.Color.white); jLabel4.setText("Configurações de Jogo"); jSeparator1.setBackground(java.awt.Color.black); jSeparator1.setForeground(java.awt.Color.white); jCheckBox2.setBackground(java.awt.Color.black); jCheckBox2.setForeground(java.awt.Color.white); jCheckBox2.setText("Apocalipse"); jCheckBox2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox2ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jCheckBox1) .addComponent(jButton3)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jCheckBox2)))) .addGroup(layout.createSequentialGroup() .addGap(44, 44, 44) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(56, 56, 56) .addComponent(jLabel4)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField2) .addComponent(jTextField1) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(46, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(14, 14, 14) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 3, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jCheckBox1) .addComponent(jCheckBox2)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton3)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed cfg.MusicOn = jCheckBox1.isSelected(); cfg.Apocalipse = jCheckBox2.isSelected(); cfg.Nbots = Integer.parseInt(jTextField1.getText()); cfg.Tmax = Integer.parseInt(jTextField2.getText()); cfg.recover = Integer.parseInt(jTextField3.getText()); try { cfg.gerarXml(); } catch (Exception ex) {} this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { cfg.gerarXml(); } catch (Exception ex) {} }//GEN-LAST:event_jButton3ActionPerformed private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField4ActionPerformed private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jCheckBox2ActionPerformed public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ConfigMenu().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JSeparator jSeparator1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables }
12,121
0.646855
0.630097
250
47.456001
33.040703
164
false
false
0
0
0
0
0
0
0.608
false
false
15
980795fbd01b279ef9cf2d2ad64aaead452ba188
36,378,373,027,388
1b6cc19683b2e4512a6aa611b6c7bd1fa314136a
/[INC202]_Programacion_II/Certamen_1/2016/2doSem/RespuestaC1/CarvajalFelipeC1/Equipo.java
26b77c8d75fcabc75856edba954e439a795d5497
[]
no_license
EdGoll/clases-uv
https://github.com/EdGoll/clases-uv
9f37f43b8410896e62df5b806ee04e045cfffb5f
7a86c563d5e73bba490b64dbc8f49d35c2370ccd
refs/heads/master
2021-06-21T20:42:48.444000
2019-08-18T20:04:14
2019-08-18T20:04:14
104,955,406
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Random; public class Equipo{ Random rnd; private Jugador[] equipo=new Jugador[11]; private int ide; private int lvle; public void fillEquipo(){ Jugador player; for(int i=0;i<equipo.length;i++){ player=new Jugador(); equipo[i]=player; } } public void fillId(){ int aux=equipo.length; int[] numeros=new int[aux]; Random rnd=new Random(); int res; for(int i=0;i<equipo.length;i++){ numeros[i]=i+1; } for(int i=0;i<equipo.length;i++){ res=rnd.nextInt(aux); equipo[i].setId(numeros[res]); numeros[res]=numeros[aux-1]; aux--; } } @Override public String toString(){ String aux=""; for(int i=0;i<equipo.length;i++){ aux=aux+equipo[i].toString(); } return aux; } public void fillBr(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setBr(rnd.nextInt(100)+1); } } public void fillBg(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setBg(rnd.nextInt(100)+1); } } public void fillGc(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setGc(rnd.nextInt(100)+1); } } public void fillLvl(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setLvl((equipo[i].getBr()*20/100 + equipo[i].getBg()*35/100 + equipo[i].getGc()*45/100)); } } public void fillRol(){ int portero=0,defensas=0,laterales=0,centro=0,delanteros=0; for(int i=0;i<equipo.length;i++){ switch(rnd.nextInt(5)+1){ case 1: if(portero<1){ equipo[i].setTipo("Portero"); equipo[i].setGc(0); portero++; break; }else{ i--; break; } case 2: if(defensas<3){ equipo[i].setTipo("Defensa"); defensas++; break; }else{ i--; break; } case 3: if(laterales<2){ equipo[i].setTipo("Lateral"); laterales++; break; }else{ i--; break; } case 4: if(centro<2){ equipo[i].setTipo("Centro"); centro++; break; }else{ i--; break; } case 5: if(delanteros<3){ equipo[i].setTipo("Delantero"); delanteros++; break; }else{ i--; break; } } } } public void setIde(int ide){ this.ide=ide; } public int getIde(){ return ide; } public void setLvle(){ for(int i=0;i<equipo.length;i++){ lvle=lvle+equipo[i].getLvl(); } } public int getLvle(){ return lvle; } }
UTF-8
Java
3,997
java
Equipo.java
Java
[]
null
[]
import java.util.Random; public class Equipo{ Random rnd; private Jugador[] equipo=new Jugador[11]; private int ide; private int lvle; public void fillEquipo(){ Jugador player; for(int i=0;i<equipo.length;i++){ player=new Jugador(); equipo[i]=player; } } public void fillId(){ int aux=equipo.length; int[] numeros=new int[aux]; Random rnd=new Random(); int res; for(int i=0;i<equipo.length;i++){ numeros[i]=i+1; } for(int i=0;i<equipo.length;i++){ res=rnd.nextInt(aux); equipo[i].setId(numeros[res]); numeros[res]=numeros[aux-1]; aux--; } } @Override public String toString(){ String aux=""; for(int i=0;i<equipo.length;i++){ aux=aux+equipo[i].toString(); } return aux; } public void fillBr(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setBr(rnd.nextInt(100)+1); } } public void fillBg(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setBg(rnd.nextInt(100)+1); } } public void fillGc(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setGc(rnd.nextInt(100)+1); } } public void fillLvl(){ rnd=new Random(); for(int i=0;i<equipo.length;i++){ equipo[i].setLvl((equipo[i].getBr()*20/100 + equipo[i].getBg()*35/100 + equipo[i].getGc()*45/100)); } } public void fillRol(){ int portero=0,defensas=0,laterales=0,centro=0,delanteros=0; for(int i=0;i<equipo.length;i++){ switch(rnd.nextInt(5)+1){ case 1: if(portero<1){ equipo[i].setTipo("Portero"); equipo[i].setGc(0); portero++; break; }else{ i--; break; } case 2: if(defensas<3){ equipo[i].setTipo("Defensa"); defensas++; break; }else{ i--; break; } case 3: if(laterales<2){ equipo[i].setTipo("Lateral"); laterales++; break; }else{ i--; break; } case 4: if(centro<2){ equipo[i].setTipo("Centro"); centro++; break; }else{ i--; break; } case 5: if(delanteros<3){ equipo[i].setTipo("Delantero"); delanteros++; break; }else{ i--; break; } } } } public void setIde(int ide){ this.ide=ide; } public int getIde(){ return ide; } public void setLvle(){ for(int i=0;i<equipo.length;i++){ lvle=lvle+equipo[i].getLvl(); } } public int getLvle(){ return lvle; } }
3,997
0.344008
0.329247
139
27.741007
16.27256
110
false
false
0
0
0
0
0
0
0.597122
false
false
15
1ca60ebfa7a0a3727bb81674cf077044b5e971a5
39,247,411,153,372
ac8bfffa02a36521a23c97463f16edcfa4545cf0
/src/main/java/com/jstnf/bentoboxtestaddon/Main.java
3c3d4205cca9a695dcb9f30fc5de0ca4b1137b51
[]
no_license
jstnf/BentoBoxTestAddon
https://github.com/jstnf/BentoBoxTestAddon
151f0813aa0767e1bbdbadff7e6e5ba9ebbdb281
187e236f3079e56587cf464405a112ddc64ddd83
refs/heads/master
2020-05-02T22:37:20.165000
2019-03-29T01:27:34
2019-03-29T01:27:34
178,257,107
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jstnf.bentoboxtestaddon; import world.bentobox.bentobox.api.addons.Addon; public class Main extends Addon { @Override public void onEnable() { getLogger().info("Hello! This is a test BentoBox addon!"); } @Override public void onDisable() { } }
UTF-8
Java
269
java
Main.java
Java
[]
null
[]
package com.jstnf.bentoboxtestaddon; import world.bentobox.bentobox.api.addons.Addon; public class Main extends Addon { @Override public void onEnable() { getLogger().info("Hello! This is a test BentoBox addon!"); } @Override public void onDisable() { } }
269
0.724907
0.724907
18
14
18.190351
60
false
false
0
0
0
0
0
0
0.722222
false
false
15
6b861a21c6a460a3aecf56ea3d43b39111eb80ca
36,627,481,132,014
257deffb6e6ed9cbaa98f3a8092c6d4789d862d9
/Itwill/final-project-team1-avengers/src/main/java/com/avengers/user/mapper/ProductMapper.java
11cbae89922b232844850b1ab386011321dd553d
[]
no_license
freeman9998/MyCoding
https://github.com/freeman9998/MyCoding
243869478ff9ab6d386dc64a261ea71378108fd9
80ac4804839d626c64f2c0dbe2ddecec0c353893
refs/heads/master
2023-06-01T23:00:29.471000
2021-06-20T05:55:38
2021-06-20T05:55:38
373,729,884
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.avengers.user.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import com.avengers.user.dto.Product; public interface ProductMapper { public List<Product> findProductsAll() throws Exception; public List<Product> findByLowPrice(String product_category) throws Exception; public List<Product> findByHighPrice(String product_category) throws Exception; public List<Product> findNameDesc(String product_category) throws Exception; public List<Product> findNameAsc(String product_category) throws Exception; public List<Product> findByLowStar() throws Exception; public List<Product> findByHighStar() throws Exception; // public List<Product> findCompleteProduct(int user_no) throws Exception; public Product findByProductNo(int product_no) throws Exception; public int insertProduct(Product product) throws Exception; public int updateProductByNo(Product product) throws Exception; public int deleteProductByNo(int product_no) throws Exception; public List<Product> findProductCategory(String product_category) throws Exception; //여성,남성 제품 총 갯수 public int findAllCountByType(String type) throws Exception; public List<Product> findProductList(@Param("start") int start, @Param("last") int last , @Param("product_category") String product_category) throws Exception; public List<Product> findProductByCategory(@Param("start") int start, @Param("last") int last , @Param("category") String category) throws Exception; public int findProductListCountByCategory(@Param("category") String category ) throws Exception; }
UTF-8
Java
1,614
java
ProductMapper.java
Java
[]
null
[]
package com.avengers.user.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import com.avengers.user.dto.Product; public interface ProductMapper { public List<Product> findProductsAll() throws Exception; public List<Product> findByLowPrice(String product_category) throws Exception; public List<Product> findByHighPrice(String product_category) throws Exception; public List<Product> findNameDesc(String product_category) throws Exception; public List<Product> findNameAsc(String product_category) throws Exception; public List<Product> findByLowStar() throws Exception; public List<Product> findByHighStar() throws Exception; // public List<Product> findCompleteProduct(int user_no) throws Exception; public Product findByProductNo(int product_no) throws Exception; public int insertProduct(Product product) throws Exception; public int updateProductByNo(Product product) throws Exception; public int deleteProductByNo(int product_no) throws Exception; public List<Product> findProductCategory(String product_category) throws Exception; //여성,남성 제품 총 갯수 public int findAllCountByType(String type) throws Exception; public List<Product> findProductList(@Param("start") int start, @Param("last") int last , @Param("product_category") String product_category) throws Exception; public List<Product> findProductByCategory(@Param("start") int start, @Param("last") int last , @Param("category") String category) throws Exception; public int findProductListCountByCategory(@Param("category") String category ) throws Exception; }
1,614
0.794486
0.794486
45
34.466667
41.104527
160
false
false
0
0
0
0
0
0
1.177778
false
false
15
ec0edc4983b73eb9c0c0b880ea37e987a0cf56ab
4,844,723,152,289
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/linkedin/impl/metrics/MetricsFactory.java
1398cbf838781b2c35199ca636b7970d812eb551
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
Azure/azure-sdk-for-java
https://github.com/Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821000
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
false
2023-09-14T21:37:15
2011-12-06T23:33:56
2023-09-14T17:19:10
2023-09-14T21:37:14
3,043,660
1,994
1,854
1,435
Java
false
false
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.cosmos.benchmark.linkedin.impl.metrics; import com.azure.cosmos.benchmark.Configuration; import com.azure.cosmos.benchmark.linkedin.impl.Metrics; import com.azure.cosmos.benchmark.linkedin.impl.models.CollectionKey; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Preconditions; import java.time.Clock; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Nonnull; import org.apache.commons.lang3.StringUtils; public class MetricsFactory { private static final int DEFAULT_INITIAL_CAPACITY = 10; private final MetricRegistry _metricsRegistry; private final Clock _clock; private final Configuration.Environment _environment; // Local cache enables reusing the same Metric instance // {CollectionKey -> {OperationName -> Metrics} map} private final Map<CollectionKey, Map<String, Metrics>> _collectionKeyToMetricsMap; public MetricsFactory(final MetricRegistry metricsRegistry, final Clock clock, final Configuration.Environment environment) { Preconditions.checkNotNull(metricsRegistry, "The MetricsRegistry can not be null"); Preconditions.checkNotNull(clock, "Need a non-null Clock instance for latency tracking"); Preconditions.checkNotNull(environment, "Need a valid value for the CTL environment"); _metricsRegistry = metricsRegistry; _clock = clock; _environment = environment; _collectionKeyToMetricsMap = new ConcurrentHashMap<>(DEFAULT_INITIAL_CAPACITY); } public Metrics getMetrics(@Nonnull final CollectionKey collectionKey, @Nonnull final String operationName) { Preconditions.checkNotNull(collectionKey, "The CollectionKey can not be null"); Preconditions.checkArgument(StringUtils.isNotBlank(operationName), "The operationName can not be an empty string. Pass a non-empty operation name to fetch the Metrics"); final Map<String, Metrics> operationMetricsMap = _collectionKeyToMetricsMap.computeIfAbsent(collectionKey, key -> new ConcurrentHashMap<>(DEFAULT_INITIAL_CAPACITY)); return operationMetricsMap.computeIfAbsent(operationName, operation -> new MetricsImpl(_metricsRegistry, _clock, collectionKey, operation, _environment)); } }
UTF-8
Java
2,427
java
MetricsFactory.java
Java
[]
null
[]
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.cosmos.benchmark.linkedin.impl.metrics; import com.azure.cosmos.benchmark.Configuration; import com.azure.cosmos.benchmark.linkedin.impl.Metrics; import com.azure.cosmos.benchmark.linkedin.impl.models.CollectionKey; import com.codahale.metrics.MetricRegistry; import com.google.common.base.Preconditions; import java.time.Clock; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Nonnull; import org.apache.commons.lang3.StringUtils; public class MetricsFactory { private static final int DEFAULT_INITIAL_CAPACITY = 10; private final MetricRegistry _metricsRegistry; private final Clock _clock; private final Configuration.Environment _environment; // Local cache enables reusing the same Metric instance // {CollectionKey -> {OperationName -> Metrics} map} private final Map<CollectionKey, Map<String, Metrics>> _collectionKeyToMetricsMap; public MetricsFactory(final MetricRegistry metricsRegistry, final Clock clock, final Configuration.Environment environment) { Preconditions.checkNotNull(metricsRegistry, "The MetricsRegistry can not be null"); Preconditions.checkNotNull(clock, "Need a non-null Clock instance for latency tracking"); Preconditions.checkNotNull(environment, "Need a valid value for the CTL environment"); _metricsRegistry = metricsRegistry; _clock = clock; _environment = environment; _collectionKeyToMetricsMap = new ConcurrentHashMap<>(DEFAULT_INITIAL_CAPACITY); } public Metrics getMetrics(@Nonnull final CollectionKey collectionKey, @Nonnull final String operationName) { Preconditions.checkNotNull(collectionKey, "The CollectionKey can not be null"); Preconditions.checkArgument(StringUtils.isNotBlank(operationName), "The operationName can not be an empty string. Pass a non-empty operation name to fetch the Metrics"); final Map<String, Metrics> operationMetricsMap = _collectionKeyToMetricsMap.computeIfAbsent(collectionKey, key -> new ConcurrentHashMap<>(DEFAULT_INITIAL_CAPACITY)); return operationMetricsMap.computeIfAbsent(operationName, operation -> new MetricsImpl(_metricsRegistry, _clock, collectionKey, operation, _environment)); } }
2,427
0.757314
0.756077
53
44.792454
34.926533
114
false
false
0
0
0
0
0
0
0.830189
false
false
15
abc3cc27f7284cff47dd0afbf10da9c6d4d4e0d8
38,886,633,926,954
3cd83fabfc25fc6e2524bf7dd2cc16ca744e6d59
/app/src/main/java/com/dkzy/areaparty/phone/bluetoothxie/ChangeDevice.java
57cf85139c2efb220aad60be80882840a52a69fb
[]
no_license
YTparker/LabAndroidpro
https://github.com/YTparker/LabAndroidpro
e003e6963849225a1145fcc51fed59ce34b01e56
0dd9b60faa519961d7b71c748c00426293e802ef
refs/heads/master
2020-03-10T21:25:53.605000
2018-04-15T09:43:26
2018-04-15T09:43:26
129,594,173
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dkzy.areaparty.phone.bluetoothxie; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.view.InputDevice; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Created by XIE on 2017/5/18. */ public class ChangeDevice { public static ChangeDevice instance; private MyDatabaseHelper dbHelper; public synchronized static ChangeDevice getInstance(){ if (null == instance){ instance = new ChangeDevice(); } return instance; } //根据数据库修改DeviceList对象中checked,name,idName,type字段 public DeviceList changeChecked(DeviceList list, Context ctx){ String pairedDevice= ""; dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getWritableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); if (cursor.moveToFirst()){ do { String s = cursor.getString(cursor.getColumnIndex("name")); String name = list.getName(); if (s.equals(name)) { if (cursor.getInt(cursor.getColumnIndex("checked"))>0) list.setChecked(1); else list.setChecked(0); list.setName(cursor.getString(cursor.getColumnIndex("name"))); list.setIdName(cursor.getString(cursor.getColumnIndex("idname"))); list.setType(cursor.getInt(cursor.getColumnIndex("type"))); break; } }while (cursor.moveToNext()); } cursor.close(); BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Set<BluetoothDevice> device = mBluetoothAdapter.getBondedDevices(); //判断已配对设备是否已连接,是否为输入输出设备 for (BluetoothDevice device1 : device){ if (device1.getName().equals(list.getName())&&device1.getBluetoothClass().getMajorDeviceClass() == BluetoothClass.Device.Major.PERIPHERAL){ pairedDevice = device1.getName(); } int[] devices = InputDevice.getDeviceIds(); for (int i = 0; i < devices.length; i++) { InputDevice device2 = InputDevice.getDevice(devices[i]); if (device2 != null&&device2.getName().equals(pairedDevice)) { list.setConnected(1); } } } return list; } //添加设备名字符串到DeviceList对象的list中,并添加checked,name,idname,type字段 public void addList(List<DeviceList> list, String name, Context ctx){ DeviceList dlist = new DeviceList(name,name,0,4,0);//获取到tv,手机,pc的设备名称列表,初始化DeviceList,将name和idname均设为原来设备名称,然后访问数据库根据数据库修改 changeChecked(dlist,ctx); //若数据库中没有设备信息,就默认为原设备名,并且设备checked状态为0,type默认为4即未知设备类型 list.add(dlist); } //将List<String>转化未List<DeviceList>并添加checked,name,idname,type字段 public List<DeviceList> changeList(List<String> list, Context ctx){ List<DeviceList> deviceLists = new ArrayList<DeviceList>(); for (int i = 0;i<list.size();++i){ DeviceList dlist = new DeviceList(list.get(i),list.get(i),0,4,0); changeChecked(dlist ,ctx); deviceLists.add(dlist); } return deviceLists; } //查询数据库,将可连接设备名改为用户自定义名称 public List<String> changeNameString(List<String> list,Context ctx){ List<String> list1 = new ArrayList<String>(); list1.addAll(list); for (int i = 0;i<list.size();++i){ MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); if (cursor.moveToFirst()){ do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i))) { String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.set(i,idname); break; } }while (cursor.moveToNext()); } } return list1; } //查询数据库,将已连接设备名称改为用户自定义名称,已连接设备名包含checked字段,所以使用List<DeviceList> public List<DeviceList> changeName(List<DeviceList> list, Context ctx){ List<DeviceList> list1 = new ArrayList<DeviceList>(); list1.addAll(list); for (int i = 0;i<list.size();++i){ MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); if (cursor.moveToFirst()){ do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i).getName())) { String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.get(i).setIdName(idname); break; } }while (cursor.moveToNext()); } } return list1; } //查询数据库,将list里面checked的键鼠设备保留,其余去除,返回新的list1,里面元素复制list并将设备名称替换成用户自定义名称,deviceType表示要显示的设备类型,在Activity启动时传递这个参数 public List<String> removeDeviceString(int deviceType,List<String> list,Context ctx){ List<String> list1 = new ArrayList<>(); list1.addAll(list); MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); for (int i=0;i<list.size();++i) { boolean exist = false; if (cursor.moveToFirst()) { do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i))) { if (deviceType == 1){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0&&cursor.getInt(cursor.getColumnIndex("type"))<2){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.set(i,idname); } }else if (deviceType == 3){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.set(i,idname); } } break; } } while (cursor.moveToNext()); } if (!exist) { list.remove(i); list1.remove(i); i = i-1; } } cursor.close(); return list1; } //查询数据库,将list里面checked的键鼠设备保留,其余去除,并将设备名称替换成用户自定义名称 public List<DeviceList> removeDevice(int deviceType, List<DeviceList> list, Context ctx){ MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); for (int i=0;i<list.size();++i) { boolean exist = false; if (cursor.moveToFirst()) { do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i).getName())) { if (deviceType == 1){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0&&cursor.getInt(cursor.getColumnIndex("type"))<2){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list.get(i).setIdName(idname); } }else if (deviceType == 3){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list.get(i).setIdName(idname); } } break; } } while (cursor.moveToNext()); } if (!exist) { list.remove(i); i = i-1; } } cursor.close(); return list; } }
UTF-8
Java
9,709
java
ChangeDevice.java
Java
[ { "context": "til.List;\nimport java.util.Set;\n\n/**\n * Created by XIE on 2017/5/18.\n */\n\npublic class ChangeDevice {\n ", "end": 414, "score": 0.9993324875831604, "start": 411, "tag": "USERNAME", "value": "XIE" } ]
null
[]
package com.dkzy.areaparty.phone.bluetoothxie; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.view.InputDevice; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Created by XIE on 2017/5/18. */ public class ChangeDevice { public static ChangeDevice instance; private MyDatabaseHelper dbHelper; public synchronized static ChangeDevice getInstance(){ if (null == instance){ instance = new ChangeDevice(); } return instance; } //根据数据库修改DeviceList对象中checked,name,idName,type字段 public DeviceList changeChecked(DeviceList list, Context ctx){ String pairedDevice= ""; dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getWritableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); if (cursor.moveToFirst()){ do { String s = cursor.getString(cursor.getColumnIndex("name")); String name = list.getName(); if (s.equals(name)) { if (cursor.getInt(cursor.getColumnIndex("checked"))>0) list.setChecked(1); else list.setChecked(0); list.setName(cursor.getString(cursor.getColumnIndex("name"))); list.setIdName(cursor.getString(cursor.getColumnIndex("idname"))); list.setType(cursor.getInt(cursor.getColumnIndex("type"))); break; } }while (cursor.moveToNext()); } cursor.close(); BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Set<BluetoothDevice> device = mBluetoothAdapter.getBondedDevices(); //判断已配对设备是否已连接,是否为输入输出设备 for (BluetoothDevice device1 : device){ if (device1.getName().equals(list.getName())&&device1.getBluetoothClass().getMajorDeviceClass() == BluetoothClass.Device.Major.PERIPHERAL){ pairedDevice = device1.getName(); } int[] devices = InputDevice.getDeviceIds(); for (int i = 0; i < devices.length; i++) { InputDevice device2 = InputDevice.getDevice(devices[i]); if (device2 != null&&device2.getName().equals(pairedDevice)) { list.setConnected(1); } } } return list; } //添加设备名字符串到DeviceList对象的list中,并添加checked,name,idname,type字段 public void addList(List<DeviceList> list, String name, Context ctx){ DeviceList dlist = new DeviceList(name,name,0,4,0);//获取到tv,手机,pc的设备名称列表,初始化DeviceList,将name和idname均设为原来设备名称,然后访问数据库根据数据库修改 changeChecked(dlist,ctx); //若数据库中没有设备信息,就默认为原设备名,并且设备checked状态为0,type默认为4即未知设备类型 list.add(dlist); } //将List<String>转化未List<DeviceList>并添加checked,name,idname,type字段 public List<DeviceList> changeList(List<String> list, Context ctx){ List<DeviceList> deviceLists = new ArrayList<DeviceList>(); for (int i = 0;i<list.size();++i){ DeviceList dlist = new DeviceList(list.get(i),list.get(i),0,4,0); changeChecked(dlist ,ctx); deviceLists.add(dlist); } return deviceLists; } //查询数据库,将可连接设备名改为用户自定义名称 public List<String> changeNameString(List<String> list,Context ctx){ List<String> list1 = new ArrayList<String>(); list1.addAll(list); for (int i = 0;i<list.size();++i){ MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); if (cursor.moveToFirst()){ do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i))) { String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.set(i,idname); break; } }while (cursor.moveToNext()); } } return list1; } //查询数据库,将已连接设备名称改为用户自定义名称,已连接设备名包含checked字段,所以使用List<DeviceList> public List<DeviceList> changeName(List<DeviceList> list, Context ctx){ List<DeviceList> list1 = new ArrayList<DeviceList>(); list1.addAll(list); for (int i = 0;i<list.size();++i){ MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); if (cursor.moveToFirst()){ do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i).getName())) { String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.get(i).setIdName(idname); break; } }while (cursor.moveToNext()); } } return list1; } //查询数据库,将list里面checked的键鼠设备保留,其余去除,返回新的list1,里面元素复制list并将设备名称替换成用户自定义名称,deviceType表示要显示的设备类型,在Activity启动时传递这个参数 public List<String> removeDeviceString(int deviceType,List<String> list,Context ctx){ List<String> list1 = new ArrayList<>(); list1.addAll(list); MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); for (int i=0;i<list.size();++i) { boolean exist = false; if (cursor.moveToFirst()) { do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i))) { if (deviceType == 1){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0&&cursor.getInt(cursor.getColumnIndex("type"))<2){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.set(i,idname); } }else if (deviceType == 3){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list1.set(i,idname); } } break; } } while (cursor.moveToNext()); } if (!exist) { list.remove(i); list1.remove(i); i = i-1; } } cursor.close(); return list1; } //查询数据库,将list里面checked的键鼠设备保留,其余去除,并将设备名称替换成用户自定义名称 public List<DeviceList> removeDevice(int deviceType, List<DeviceList> list, Context ctx){ MyDatabaseHelper dbHelper = new MyDatabaseHelper(ctx, "Device.db", null, 1); SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query("Device", null, null, null, null, null ,null); for (int i=0;i<list.size();++i) { boolean exist = false; if (cursor.moveToFirst()) { do { String s = cursor.getString(cursor.getColumnIndex("name")); if (s.equals(list.get(i).getName())) { if (deviceType == 1){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0&&cursor.getInt(cursor.getColumnIndex("type"))<2){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list.get(i).setIdName(idname); } }else if (deviceType == 3){ if (cursor.getInt(cursor.getColumnIndex("checked"))>0){ exist = true; String idname = cursor.getString(cursor.getColumnIndex("idname")); list.get(i).setIdName(idname); } } break; } } while (cursor.moveToNext()); } if (!exist) { list.remove(i); i = i-1; } } cursor.close(); return list; } }
9,709
0.537878
0.530841
200
44.474998
29.305279
151
false
false
0
0
0
0
0
0
1.005
false
false
15
19b194c4838bd5c25694e205cca5844be7c59f7b
39,109,972,217,443
74571d3e484aafc827d22a3f769f7210b8ac161a
/app/src/main/java/com/example/maadela/FishOrderRequestList.java
c7d2770d4ed6e047c5aaa9719d170b323fc7e04e
[]
no_license
HDLLakshan/Maadela
https://github.com/HDLLakshan/Maadela
ffd314154b917bba6456ea8238a308bab21071e6
20c270b877ced8be69fc21a7c970d5527254dd92
refs/heads/master
2020-06-29T18:27:28.045000
2019-09-23T22:55:46
2019-09-23T22:55:46
200,591,619
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.maadela; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import java.util.List; public class FishOrderRequestList extends ArrayAdapter<OrderClass> { private Activity context; private List<OrderClass> orderListreq; public FishOrderRequestList(Activity context , List<OrderClass> orderListreq){ super(context ,R.layout.fish_orequest_list,orderListreq ); this.context = context; this.orderListreq = orderListreq; } @NonNull @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View orreqderListview = inflater.inflate(R.layout.fish_orequest_list,null,true); TextView orrqfishtype = orreqderListview.findViewById(R.id.orrtype); TextView orrqsellername = orreqderListview.findViewById(R.id.orrcname); TextView orrqamount = orreqderListview.findViewById(R.id.orramount); TextView orrqdate = orreqderListview.findViewById(R.id.orrdate); TextView orrqstatus = orreqderListview.findViewById(R.id.orrstatus); TextView orrqContact = orreqderListview.findViewById(R.id.orrContact); TextView orrqpricetot = orreqderListview.findViewById(R.id.orrTotprice); OrderClass oqrderClass = orderListreq.get(position); orrqfishtype.setText(" Fish Type : "+oqrderClass.getType()); orrqsellername.setText(" Seller Name : "+oqrderClass.getSellerName()); orrqamount.setText(" Amount : "+new Double(oqrderClass.getAmount()).toString()+ "Kg"); orrqdate.setText(" Date Requested : "+oqrderClass.getDate()); orrqstatus.setText(" Status : "+oqrderClass.getStatus()); orrqContact.setText(" Seller Contact : "+oqrderClass.getSellerContact()); orrqpricetot.setText(" Total Price : "+oqrderClass.getTotprice()); return orreqderListview; } }
UTF-8
Java
2,119
java
FishOrderRequestList.java
Java
[]
null
[]
package com.example.maadela; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import java.util.List; public class FishOrderRequestList extends ArrayAdapter<OrderClass> { private Activity context; private List<OrderClass> orderListreq; public FishOrderRequestList(Activity context , List<OrderClass> orderListreq){ super(context ,R.layout.fish_orequest_list,orderListreq ); this.context = context; this.orderListreq = orderListreq; } @NonNull @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View orreqderListview = inflater.inflate(R.layout.fish_orequest_list,null,true); TextView orrqfishtype = orreqderListview.findViewById(R.id.orrtype); TextView orrqsellername = orreqderListview.findViewById(R.id.orrcname); TextView orrqamount = orreqderListview.findViewById(R.id.orramount); TextView orrqdate = orreqderListview.findViewById(R.id.orrdate); TextView orrqstatus = orreqderListview.findViewById(R.id.orrstatus); TextView orrqContact = orreqderListview.findViewById(R.id.orrContact); TextView orrqpricetot = orreqderListview.findViewById(R.id.orrTotprice); OrderClass oqrderClass = orderListreq.get(position); orrqfishtype.setText(" Fish Type : "+oqrderClass.getType()); orrqsellername.setText(" Seller Name : "+oqrderClass.getSellerName()); orrqamount.setText(" Amount : "+new Double(oqrderClass.getAmount()).toString()+ "Kg"); orrqdate.setText(" Date Requested : "+oqrderClass.getDate()); orrqstatus.setText(" Status : "+oqrderClass.getStatus()); orrqContact.setText(" Seller Contact : "+oqrderClass.getSellerContact()); orrqpricetot.setText(" Total Price : "+oqrderClass.getTotprice()); return orreqderListview; } }
2,119
0.722039
0.722039
65
31.6
32.658512
95
false
false
0
0
0
0
0
0
0.6
false
false
15
624dc5b19d41d2234f85c3254c3fd4794410db19
27,376,121,598,300
089583dcf109129ba304e927d2d6d88bf9a7b909
/ChatWindowClient.java
7975089a0e860df7abdfc41fad106c08b72f0b2d
[]
no_license
zabela/Chat
https://github.com/zabela/Chat
7ed934cecefd33f1f7f270ab5479a9d2c44c3726
93e0555bf7147691ab2d4c3b473f1b2b8a4bcb57
refs/heads/master
2016-09-07T11:39:56.854000
2013-07-05T12:14:53
2013-07-05T12:14:53
11,198,935
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package dchat; public interface ChatWindowClient { //This method is called when text is available public void textAvailable(String arg) throws Exception; //This method is called when the window is closed public void windowClosed(); //This method is called when the window is started public void windowOpened(); }
UTF-8
Java
324
java
ChatWindowClient.java
Java
[]
null
[]
package dchat; public interface ChatWindowClient { //This method is called when text is available public void textAvailable(String arg) throws Exception; //This method is called when the window is closed public void windowClosed(); //This method is called when the window is started public void windowOpened(); }
324
0.771605
0.771605
12
26
21.067352
56
false
false
0
0
0
0
0
0
1
false
false
15
337a4940c51ab5d5216b3d002397a11a155e34b8
37,546,604,119,693
64ab96091427ca8c2927a953d4eca0023a550e47
/app/src/main/java/com/randomappsinc/travelbuddy/home/MainActivity.java
73af928d017416b6a199601dfb56a905ad693b4b
[]
no_license
Gear61/Travel-Buddy
https://github.com/Gear61/Travel-Buddy
775ca61893198832d9370e4c3d8928c215dec2a3
47213b1ee3583b96c05aa5bbb49cd3db6aae3636
refs/heads/master
2020-08-29T02:51:31.145000
2019-10-31T07:01:00
2019-10-31T07:01:00
217,901,074
6
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.randomappsinc.travelbuddy.home; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.joanzapata.iconify.IconDrawable; import com.joanzapata.iconify.fonts.IoniconsIcons; import com.randomappsinc.travelbuddy.R; import com.randomappsinc.travelbuddy.addnote.AddNoteActivity; import com.randomappsinc.travelbuddy.common.Constants; import com.randomappsinc.travelbuddy.common.Note; import com.randomappsinc.travelbuddy.common.PictureFullViewActivity; import com.randomappsinc.travelbuddy.common.StandardActivity; import com.randomappsinc.travelbuddy.persistence.DataSource; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class MainActivity extends StandardActivity implements NotesAdapter.Listener { @BindView(R.id.no_notes_text) TextView noNotesView; @BindView(R.id.notes) RecyclerView notesList; @BindView(R.id.add_note) FloatingActionButton addNote; private NotesAdapter notesAdapter; private DataSource dataSource; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); dataSource = new DataSource(this); addNote.setImageDrawable( new IconDrawable(this, IoniconsIcons.ion_android_add) .colorRes(R.color.white)); notesAdapter = new NotesAdapter(this); notesList.setAdapter(notesAdapter); } @OnClick(R.id.add_note) public void addNote() { startActivity(new Intent(this, AddNoteActivity.class)); } @Override public void onResume() { super.onResume(); List<Note> notes = dataSource.getAllNotes(); notesAdapter.setNotes(notes); noNotesView.setVisibility(notesAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE); } @Override public void onMediaClicked(Note note) { Intent intent = new Intent(this, PictureFullViewActivity.class) .putExtra(Constants.IMAGE_URL_KEY, note.getImagePath()) .putExtra(Constants.CAPTION_KEY, note.getTitle()); startActivity(intent); overridePendingTransition(R.anim.fade_in, 0); } }
UTF-8
Java
2,472
java
MainActivity.java
Java
[]
null
[]
package com.randomappsinc.travelbuddy.home; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.joanzapata.iconify.IconDrawable; import com.joanzapata.iconify.fonts.IoniconsIcons; import com.randomappsinc.travelbuddy.R; import com.randomappsinc.travelbuddy.addnote.AddNoteActivity; import com.randomappsinc.travelbuddy.common.Constants; import com.randomappsinc.travelbuddy.common.Note; import com.randomappsinc.travelbuddy.common.PictureFullViewActivity; import com.randomappsinc.travelbuddy.common.StandardActivity; import com.randomappsinc.travelbuddy.persistence.DataSource; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class MainActivity extends StandardActivity implements NotesAdapter.Listener { @BindView(R.id.no_notes_text) TextView noNotesView; @BindView(R.id.notes) RecyclerView notesList; @BindView(R.id.add_note) FloatingActionButton addNote; private NotesAdapter notesAdapter; private DataSource dataSource; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); dataSource = new DataSource(this); addNote.setImageDrawable( new IconDrawable(this, IoniconsIcons.ion_android_add) .colorRes(R.color.white)); notesAdapter = new NotesAdapter(this); notesList.setAdapter(notesAdapter); } @OnClick(R.id.add_note) public void addNote() { startActivity(new Intent(this, AddNoteActivity.class)); } @Override public void onResume() { super.onResume(); List<Note> notes = dataSource.getAllNotes(); notesAdapter.setNotes(notes); noNotesView.setVisibility(notesAdapter.getItemCount() == 0 ? View.VISIBLE : View.GONE); } @Override public void onMediaClicked(Note note) { Intent intent = new Intent(this, PictureFullViewActivity.class) .putExtra(Constants.IMAGE_URL_KEY, note.getImagePath()) .putExtra(Constants.CAPTION_KEY, note.getTitle()); startActivity(intent); overridePendingTransition(R.anim.fade_in, 0); } }
2,472
0.737055
0.736246
72
33.333332
24.85737
95
false
false
0
0
0
0
0
0
0.638889
false
false
15
0b79cfc7e7bf33439bddb24e58186298057ff1c1
13,460,427,568,870
994467617f8f2599b639e9b85f40e4784414c310
/src/main/java/com/waadbait/service/mapper/HouseConfigurationMapper.java
bf80505e173fc041b6f60449dabb241c8ab4461a
[]
no_license
renka/waadbait
https://github.com/renka/waadbait
dc246bc84b59f2b0738a09d5a970b3a3c9d428e4
3a50a5090fe431275237e9e26471f48ff4a61584
refs/heads/master
2022-12-23T23:35:11.774000
2019-10-09T19:35:38
2019-10-09T19:35:38
213,642,136
0
0
null
false
2022-12-16T05:06:14
2019-10-08T12:55:52
2019-10-09T19:35:58
2022-12-16T05:06:11
1,949
0
0
6
Java
false
false
package com.waadbait.service.mapper; import com.waadbait.domain.*; import com.waadbait.service.dto.HouseConfigurationDTO; import org.mapstruct.*; /** * Mapper for the entity {@link HouseConfiguration} and its DTO {@link HouseConfigurationDTO}. */ @Mapper(componentModel = "spring", uses = {}) public interface HouseConfigurationMapper extends EntityMapper<HouseConfigurationDTO, HouseConfiguration> { default HouseConfiguration fromId(Long id) { if (id == null) { return null; } HouseConfiguration houseConfiguration = new HouseConfiguration(); houseConfiguration.setId(id); return houseConfiguration; } }
UTF-8
Java
674
java
HouseConfigurationMapper.java
Java
[]
null
[]
package com.waadbait.service.mapper; import com.waadbait.domain.*; import com.waadbait.service.dto.HouseConfigurationDTO; import org.mapstruct.*; /** * Mapper for the entity {@link HouseConfiguration} and its DTO {@link HouseConfigurationDTO}. */ @Mapper(componentModel = "spring", uses = {}) public interface HouseConfigurationMapper extends EntityMapper<HouseConfigurationDTO, HouseConfiguration> { default HouseConfiguration fromId(Long id) { if (id == null) { return null; } HouseConfiguration houseConfiguration = new HouseConfiguration(); houseConfiguration.setId(id); return houseConfiguration; } }
674
0.715134
0.715134
24
27.083334
30.119093
107
false
false
0
0
0
0
0
0
0.416667
false
false
15
760895faaced838738b308be46cda1927cade73f
36,352,603,226,634
d5eb9e5dc0528fb0b0b763b7c19cbfa69c9924fa
/backup/SearchFriendViewgroup.java
db5982390694310e33894b12904b8cbc22918036
[]
no_license
zqjia/Xpread
https://github.com/zqjia/Xpread
689f6c210531ba9b1289ba18c0a836bb337be02b
ef235d1d7100e1a1d6f699b45bfc2b6a228bd8eb
refs/heads/master
2021-01-10T21:33:58.816000
2015-06-21T09:08:00
2015-06-21T09:08:00
35,142,955
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ucweb.xpread.widget; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.ucweb.xpread.util.ScreenUtil; public class SearchFriendViewgroup extends ViewGroup { private static final String TAG = "SearchFriendViewgroup"; private Context mContext; private int mScreenWidth; private int mScreenHeight; public SearchFriendViewgroup(Context context) { super(context); this.mContext = context; } public SearchFriendViewgroup(Context context, AttributeSet attrs) { super(context, attrs); this.mContext = context; } public SearchFriendViewgroup(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.mContext = context; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { //底部圆圈 View circleBackgroud = getChildAt(0); circleBackgroud.layout(0, dip2px(-50), this.mScreenWidth, this.mScreenHeight); //用户头像 View userIcon = getChildAt(1); userIcon.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2-dip2px(110), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(40)); //用户名称 TextView userName =(TextView) getChildAt(2); userName.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2+dip2px(50), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(90)); //朋友1 View friendOneIcon = getChildAt(3); friendOneIcon.layout(dip2px(25), this.mScreenWidth/2+dip2px(95), dip2px(105), this.mScreenWidth/2+dip2px(175)); TextView friendOneName = (TextView)getChildAt(4); friendOneName.layout(dip2px(20), this.mScreenWidth/2+dip2px(180), dip2px(110), this.mScreenWidth/2+dip2px(205)); //朋友2 View friendTwoIcon = getChildAt(5); friendTwoIcon.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(95), this.mScreenWidth/2+dip2px(40), this.mScreenWidth/2+dip2px(175)); TextView friendTwoName = (TextView)getChildAt(6); friendTwoName.layout(this.mScreenWidth/2-dip2px(45), this.mScreenWidth/2+dip2px(180), this.mScreenWidth/2+dip2px(45), this.mScreenWidth/2+dip2px(205)); //朋友3 View friendThreeIcon = getChildAt(7); friendThreeIcon.layout(this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(95), this.mScreenWidth/2+dip2px(155), this.mScreenWidth/2+dip2px(175)); TextView friendThreeName = (TextView)getChildAt(8); friendThreeName.layout(this.mScreenWidth/2+dip2px(70), this.mScreenWidth/2+dip2px(180), this.mScreenWidth/2 + dip2px(160), this.mScreenWidth/2+dip2px(205)); //朋友4 View friendFourIcon = getChildAt(9); friendFourIcon.layout(dip2px(25), this.mScreenWidth/2+dip2px(220), dip2px(105), this.mScreenWidth/2+dip2px(300)); TextView friendFourName = (TextView)getChildAt(10); friendFourName.layout(dip2px(20), this.mScreenWidth/2+dip2px(305), dip2px(110), this.mScreenWidth/2+dip2px(330)); //朋友5 View friendfiveIcon = getChildAt(11); friendfiveIcon.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(220), this.mScreenWidth/2 + dip2px(40), this.mScreenWidth/2+dip2px(300)); TextView friendFiveName = (TextView)getChildAt(12); friendFiveName.layout(this.mScreenWidth/2-dip2px(45), this.mScreenWidth/2+dip2px(305), this.mScreenWidth/2 + dip2px(45), this.mScreenWidth/2+dip2px(330)); //朋友6 View friendSixIcon = getChildAt(13); friendSixIcon.layout(this.mScreenWidth/2 + dip2px(75), this.mScreenWidth/2 + dip2px(220), this.mScreenWidth/2 + dip2px(155), this.mScreenWidth/2 + dip2px(300)); TextView friendSixName = (TextView)getChildAt(14); friendSixName.layout(this.mScreenWidth/2 + dip2px(70), this.mScreenWidth/2 + dip2px(305), this.mScreenWidth/2 + dip2px(160), this.mScreenWidth/2 + dip2px(330)); /* //底部圆圈 View circleBackgroud = getChildAt(0); circleBackgroud.layout(0, 0, this.mScreenWidth, this.mScreenHeight); //用户头像 View userIcon = getChildAt(1); userIcon.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(75)); //用户名称 TextView userName =(TextView) getChildAt(2); userName.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2+dip2px(100), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(140)); userName.setText("Sara"); //朋友1 View friendOneIcon = getChildAt(3); friendOneIcon.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(160), this.mScreenWidth/2+dip2px(40), this.mScreenWidth/2+dip2px(240)); TextView friendOneName = (TextView)getChildAt(4); friendOneName.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(245), this.mScreenWidth/2+dip2px(40), this.mScreenWidth/2+dip2px(275)); //朋友2 View friendTwoIcon = getChildAt(5); friendTwoIcon.layout(dip2px(20), this.mScreenWidth/2+dip2px(60), dip2px(90), this.mScreenWidth/2+dip2px(130)); TextView friendTwoName = (TextView)getChildAt(6); friendTwoName.layout(dip2px(20), this.mScreenWidth/2+dip2px(135), dip2px(90), this.mScreenWidth+dip2px(160)); //朋友3 View friendThreeIcon = getChildAt(7); friendThreeIcon.layout(this.mScreenWidth/2 - dip2px(40), dip2px(10), this.mScreenWidth/2+dip2px(20), dip2px(70)); TextView friendThreeName = (TextView)getChildAt(8); friendThreeName.layout(this.mScreenWidth/2 - dip2px(40), dip2px(75), this.mScreenWidth/2 + dip2px(20), this.mScreenWidth/2+dip2px(95)); //朋友4 View friendFourIcon = getChildAt(9); friendFourIcon.layout(dip2px(40), dip2px(80), dip2px(90), dip2px(130)); TextView friendFourName = (TextView)getChildAt(10); friendFourName.layout(dip2px(40), dip2px(135), dip2px(90), dip2px(155)); //朋友5 View friendfiveIcon = getChildAt(11); friendfiveIcon.layout(this.mScreenWidth/2 + dip2px(105), dip2px(100), this.mScreenWidth/2 + dip2px(165), dip2px(160)); TextView friendFiveName = (TextView)getChildAt(12); friendFiveName.layout(this.mScreenWidth/2 + dip2px(105), dip2px(165), this.mScreenWidth/2 + dip2px(165), dip2px(190)); //朋友6 View friendSixIcon = getChildAt(13); friendSixIcon.layout(this.mScreenWidth/2 + dip2px(75), this.mScreenWidth/2 + dip2px(70), this.mScreenWidth/2 + dip2px(145), this.mScreenWidth/2 + dip2px(140)); TextView friendSixName = (TextView)getChildAt(14); friendSixName.layout(this.mScreenWidth/2 + dip2px(75), this.mScreenWidth/2 + dip2px(145), this.mScreenWidth/2 + dip2px(145), this.mScreenWidth/2 + dip2px(175));*/ } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // TODO Auto-generated method stub super.onMeasure(widthMeasureSpec, heightMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int count = getChildCount(); this.mScreenWidth = ScreenUtil.getScreenWidth(getContext()); this.mScreenHeight = ScreenUtil.getScreenHeight(getContext()); for(int i=0; i<count; ++i) { MeasureSpec.makeMeasureSpec(this.mScreenWidth, MeasureSpec.EXACTLY); MeasureSpec.makeMeasureSpec(this.mScreenHeight, MeasureSpec.EXACTLY); } setMeasuredDimension(widthSize, heightSize); } public static int px2dip(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int)(pxValue / scale +0.5f); } public int dip2px(float dipValue) { final float scale = this.mContext.getResources().getDisplayMetrics().density; return (int)(dipValue * scale +0.5f); } }
UTF-8
Java
9,036
java
SearchFriendViewgroup.java
Java
[ { "context": "enWidth/2+dip2px(140));\n userName.setText(\"Sara\");\n \n //朋友1\n View friendOneI", "end": 5154, "score": 0.9821809530258179, "start": 5150, "tag": "USERNAME", "value": "Sara" } ]
null
[]
package com.ucweb.xpread.widget; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.ucweb.xpread.util.ScreenUtil; public class SearchFriendViewgroup extends ViewGroup { private static final String TAG = "SearchFriendViewgroup"; private Context mContext; private int mScreenWidth; private int mScreenHeight; public SearchFriendViewgroup(Context context) { super(context); this.mContext = context; } public SearchFriendViewgroup(Context context, AttributeSet attrs) { super(context, attrs); this.mContext = context; } public SearchFriendViewgroup(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.mContext = context; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { //底部圆圈 View circleBackgroud = getChildAt(0); circleBackgroud.layout(0, dip2px(-50), this.mScreenWidth, this.mScreenHeight); //用户头像 View userIcon = getChildAt(1); userIcon.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2-dip2px(110), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(40)); //用户名称 TextView userName =(TextView) getChildAt(2); userName.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2+dip2px(50), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(90)); //朋友1 View friendOneIcon = getChildAt(3); friendOneIcon.layout(dip2px(25), this.mScreenWidth/2+dip2px(95), dip2px(105), this.mScreenWidth/2+dip2px(175)); TextView friendOneName = (TextView)getChildAt(4); friendOneName.layout(dip2px(20), this.mScreenWidth/2+dip2px(180), dip2px(110), this.mScreenWidth/2+dip2px(205)); //朋友2 View friendTwoIcon = getChildAt(5); friendTwoIcon.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(95), this.mScreenWidth/2+dip2px(40), this.mScreenWidth/2+dip2px(175)); TextView friendTwoName = (TextView)getChildAt(6); friendTwoName.layout(this.mScreenWidth/2-dip2px(45), this.mScreenWidth/2+dip2px(180), this.mScreenWidth/2+dip2px(45), this.mScreenWidth/2+dip2px(205)); //朋友3 View friendThreeIcon = getChildAt(7); friendThreeIcon.layout(this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(95), this.mScreenWidth/2+dip2px(155), this.mScreenWidth/2+dip2px(175)); TextView friendThreeName = (TextView)getChildAt(8); friendThreeName.layout(this.mScreenWidth/2+dip2px(70), this.mScreenWidth/2+dip2px(180), this.mScreenWidth/2 + dip2px(160), this.mScreenWidth/2+dip2px(205)); //朋友4 View friendFourIcon = getChildAt(9); friendFourIcon.layout(dip2px(25), this.mScreenWidth/2+dip2px(220), dip2px(105), this.mScreenWidth/2+dip2px(300)); TextView friendFourName = (TextView)getChildAt(10); friendFourName.layout(dip2px(20), this.mScreenWidth/2+dip2px(305), dip2px(110), this.mScreenWidth/2+dip2px(330)); //朋友5 View friendfiveIcon = getChildAt(11); friendfiveIcon.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(220), this.mScreenWidth/2 + dip2px(40), this.mScreenWidth/2+dip2px(300)); TextView friendFiveName = (TextView)getChildAt(12); friendFiveName.layout(this.mScreenWidth/2-dip2px(45), this.mScreenWidth/2+dip2px(305), this.mScreenWidth/2 + dip2px(45), this.mScreenWidth/2+dip2px(330)); //朋友6 View friendSixIcon = getChildAt(13); friendSixIcon.layout(this.mScreenWidth/2 + dip2px(75), this.mScreenWidth/2 + dip2px(220), this.mScreenWidth/2 + dip2px(155), this.mScreenWidth/2 + dip2px(300)); TextView friendSixName = (TextView)getChildAt(14); friendSixName.layout(this.mScreenWidth/2 + dip2px(70), this.mScreenWidth/2 + dip2px(305), this.mScreenWidth/2 + dip2px(160), this.mScreenWidth/2 + dip2px(330)); /* //底部圆圈 View circleBackgroud = getChildAt(0); circleBackgroud.layout(0, 0, this.mScreenWidth, this.mScreenHeight); //用户头像 View userIcon = getChildAt(1); userIcon.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(75)); //用户名称 TextView userName =(TextView) getChildAt(2); userName.layout(this.mScreenWidth/2-dip2px(75), this.mScreenWidth/2+dip2px(100), this.mScreenWidth/2+dip2px(75), this.mScreenWidth/2+dip2px(140)); userName.setText("Sara"); //朋友1 View friendOneIcon = getChildAt(3); friendOneIcon.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(160), this.mScreenWidth/2+dip2px(40), this.mScreenWidth/2+dip2px(240)); TextView friendOneName = (TextView)getChildAt(4); friendOneName.layout(this.mScreenWidth/2-dip2px(40), this.mScreenWidth/2+dip2px(245), this.mScreenWidth/2+dip2px(40), this.mScreenWidth/2+dip2px(275)); //朋友2 View friendTwoIcon = getChildAt(5); friendTwoIcon.layout(dip2px(20), this.mScreenWidth/2+dip2px(60), dip2px(90), this.mScreenWidth/2+dip2px(130)); TextView friendTwoName = (TextView)getChildAt(6); friendTwoName.layout(dip2px(20), this.mScreenWidth/2+dip2px(135), dip2px(90), this.mScreenWidth+dip2px(160)); //朋友3 View friendThreeIcon = getChildAt(7); friendThreeIcon.layout(this.mScreenWidth/2 - dip2px(40), dip2px(10), this.mScreenWidth/2+dip2px(20), dip2px(70)); TextView friendThreeName = (TextView)getChildAt(8); friendThreeName.layout(this.mScreenWidth/2 - dip2px(40), dip2px(75), this.mScreenWidth/2 + dip2px(20), this.mScreenWidth/2+dip2px(95)); //朋友4 View friendFourIcon = getChildAt(9); friendFourIcon.layout(dip2px(40), dip2px(80), dip2px(90), dip2px(130)); TextView friendFourName = (TextView)getChildAt(10); friendFourName.layout(dip2px(40), dip2px(135), dip2px(90), dip2px(155)); //朋友5 View friendfiveIcon = getChildAt(11); friendfiveIcon.layout(this.mScreenWidth/2 + dip2px(105), dip2px(100), this.mScreenWidth/2 + dip2px(165), dip2px(160)); TextView friendFiveName = (TextView)getChildAt(12); friendFiveName.layout(this.mScreenWidth/2 + dip2px(105), dip2px(165), this.mScreenWidth/2 + dip2px(165), dip2px(190)); //朋友6 View friendSixIcon = getChildAt(13); friendSixIcon.layout(this.mScreenWidth/2 + dip2px(75), this.mScreenWidth/2 + dip2px(70), this.mScreenWidth/2 + dip2px(145), this.mScreenWidth/2 + dip2px(140)); TextView friendSixName = (TextView)getChildAt(14); friendSixName.layout(this.mScreenWidth/2 + dip2px(75), this.mScreenWidth/2 + dip2px(145), this.mScreenWidth/2 + dip2px(145), this.mScreenWidth/2 + dip2px(175));*/ } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // TODO Auto-generated method stub super.onMeasure(widthMeasureSpec, heightMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int count = getChildCount(); this.mScreenWidth = ScreenUtil.getScreenWidth(getContext()); this.mScreenHeight = ScreenUtil.getScreenHeight(getContext()); for(int i=0; i<count; ++i) { MeasureSpec.makeMeasureSpec(this.mScreenWidth, MeasureSpec.EXACTLY); MeasureSpec.makeMeasureSpec(this.mScreenHeight, MeasureSpec.EXACTLY); } setMeasuredDimension(widthSize, heightSize); } public static int px2dip(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int)(pxValue / scale +0.5f); } public int dip2px(float dipValue) { final float scale = this.mContext.getResources().getDisplayMetrics().density; return (int)(dipValue * scale +0.5f); } }
9,036
0.630537
0.570134
213
40.957745
32.029667
126
false
false
0
0
0
0
0
0
0.938967
false
false
15
b5cc7b0f824faa8a99c3ebd8d4d24d933650fe13
36,730,560,355,378
a4b7cdbd24541cea72c97ee7c050a52013198ef9
/Automata/src/main/java/com/view/MainView.java
029ac65f8bfae14858a67f855dd5361d8ae66b8c
[]
no_license
mgltorsa/Automata
https://github.com/mgltorsa/Automata
bc160c6a692eaefb5143806c3b08d88a62c6dc0d
d40a7421b4453d1fa1a2fdacfe15e3f3c9b65250
refs/heads/master
2020-03-28T11:23:26.796000
2018-09-24T05:22:45
2018-09-24T05:22:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.view; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import com.manager.AutomataManager; @SuppressWarnings("serial") public class MainView extends JFrame implements ActionListener { /** * A command that indicate save action. */ public final String SAVE = "Guardar"; /** * A command that indicate create states machine action. */ public final String CREATE_SM = "Crear maquina de estados"; /** * A command that indicate create equivalent automaton action. */ public final String CREATE_AT = "Crear automata"; /** * The viewer where are the two automata views (view for states machine and equivalent automaton). */ private AutomataViewer viewer; /** * An automata manager that provides functions to manage the states machine and automaton. */ private AutomataManager automataManager; /** * An instance of this class (this class use Singleton pattern) */ private static MainView mainView; /** * Main view with the automata viewer. */ private MainView() { setResizable(true); automataManager = new AutomataManager(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setMinimumSize(new Dimension(960, 700)); setPreferredSize(new Dimension(960, 700)); ViewFactory.createDefaultFrame(this); createMenuBar(); pack(); } /** * Create a menu options for this view. */ private void createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu("Archivo"); JMenuItem load = new JMenuItem("Cargar"); load.setActionCommand(PerformerView.LOAD); load.addActionListener(this); JMenuItem save = new JMenuItem("Guardar"); save.setActionCommand(SAVE); save.addActionListener(this); file.add(load); file.add(save); JMenu create = new JMenu("Crear"); JMenuItem statesM = new JMenuItem(CREATE_SM); statesM.setActionCommand(CREATE_SM); statesM.addActionListener(this); JMenuItem autom = new JMenuItem(CREATE_AT); autom.setActionCommand(CREATE_AT); autom.addActionListener(this); create.add(statesM); JMenu about = new JMenu("Información"); JMenuItem aboutUs = new JMenuItem("Acerca del programa"); aboutUs.setActionCommand(PerformerView.ABOUT); aboutUs.addActionListener(this); about.add(aboutUs); menuBar.add(file); menuBar.add(create); menuBar.add(about); this.setJMenuBar(menuBar); getContentPane().setLayout(new BorderLayout()); viewer = new AutomataViewer(this); getContentPane().add(viewer, BorderLayout.CENTER); } /** * Get instance of this class. * @return mainView, mainView with automata viewer. */ public static MainView getInstance() { if (mainView == null) { mainView = new MainView(); } return mainView; } @Override public void setVisible(boolean b) { super.setVisible(b); this.setExtendedState(NORMAL); } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(CREATE_SM)) { if (viewer != null) { int option = JOptionPane.showConfirmDialog(null, "Borrara todo lo ingresado en la maquina, ¿desea hacerlo?"); if (option == JOptionPane.YES_OPTION) { viewer.clear(); } } } else if (e.getActionCommand().equals(PerformerView.ABOUT)) { PerformerView.getInstance().showAboutPane(); } else if (e.getActionCommand().equals(PerformerView.LOAD)) { load(); } else if (e.getActionCommand().equals(SAVE)) { save(); } } /** * Load a file and show in automata viewer the correspond states machine view. */ public void load() { String path = PerformerView.getInstance().showLoadDialog(); if(path!=null) { try { automataManager.load(path); viewer.loadMachine(); PerformerView.getInstance().showCreateMachine(); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Error al cargar el archivo", "Fail load", JOptionPane.INFORMATION_MESSAGE); } } } /** * Save the current states machine in a file. */ private void save() { if (automataManager.canSerializeMachine()) { String path = PerformerView.getInstance().showSaveDialog(); if(path!=null) { try { automataManager.serializeMachine(path); JOptionPane.showMessageDialog(this, "Se ha guardado el archivo", "Correcto!", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(this, "No se logró gurdar el archivo", "Fail load", JOptionPane.INFORMATION_MESSAGE); e.printStackTrace(); } } } } @Override public void dispose() { super.dispose(); PerformerView.getInstance().setExtendedState(NORMAL); } /** * Return the current automata manager. * @return automataManager, manager that provides function to manipulate current autamata. */ public AutomataManager getAutomataManager() { return automataManager; } }
UTF-8
Java
4,976
java
MainView.java
Java
[]
null
[]
package com.view; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import com.manager.AutomataManager; @SuppressWarnings("serial") public class MainView extends JFrame implements ActionListener { /** * A command that indicate save action. */ public final String SAVE = "Guardar"; /** * A command that indicate create states machine action. */ public final String CREATE_SM = "Crear maquina de estados"; /** * A command that indicate create equivalent automaton action. */ public final String CREATE_AT = "Crear automata"; /** * The viewer where are the two automata views (view for states machine and equivalent automaton). */ private AutomataViewer viewer; /** * An automata manager that provides functions to manage the states machine and automaton. */ private AutomataManager automataManager; /** * An instance of this class (this class use Singleton pattern) */ private static MainView mainView; /** * Main view with the automata viewer. */ private MainView() { setResizable(true); automataManager = new AutomataManager(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setMinimumSize(new Dimension(960, 700)); setPreferredSize(new Dimension(960, 700)); ViewFactory.createDefaultFrame(this); createMenuBar(); pack(); } /** * Create a menu options for this view. */ private void createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu("Archivo"); JMenuItem load = new JMenuItem("Cargar"); load.setActionCommand(PerformerView.LOAD); load.addActionListener(this); JMenuItem save = new JMenuItem("Guardar"); save.setActionCommand(SAVE); save.addActionListener(this); file.add(load); file.add(save); JMenu create = new JMenu("Crear"); JMenuItem statesM = new JMenuItem(CREATE_SM); statesM.setActionCommand(CREATE_SM); statesM.addActionListener(this); JMenuItem autom = new JMenuItem(CREATE_AT); autom.setActionCommand(CREATE_AT); autom.addActionListener(this); create.add(statesM); JMenu about = new JMenu("Información"); JMenuItem aboutUs = new JMenuItem("Acerca del programa"); aboutUs.setActionCommand(PerformerView.ABOUT); aboutUs.addActionListener(this); about.add(aboutUs); menuBar.add(file); menuBar.add(create); menuBar.add(about); this.setJMenuBar(menuBar); getContentPane().setLayout(new BorderLayout()); viewer = new AutomataViewer(this); getContentPane().add(viewer, BorderLayout.CENTER); } /** * Get instance of this class. * @return mainView, mainView with automata viewer. */ public static MainView getInstance() { if (mainView == null) { mainView = new MainView(); } return mainView; } @Override public void setVisible(boolean b) { super.setVisible(b); this.setExtendedState(NORMAL); } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(CREATE_SM)) { if (viewer != null) { int option = JOptionPane.showConfirmDialog(null, "Borrara todo lo ingresado en la maquina, ¿desea hacerlo?"); if (option == JOptionPane.YES_OPTION) { viewer.clear(); } } } else if (e.getActionCommand().equals(PerformerView.ABOUT)) { PerformerView.getInstance().showAboutPane(); } else if (e.getActionCommand().equals(PerformerView.LOAD)) { load(); } else if (e.getActionCommand().equals(SAVE)) { save(); } } /** * Load a file and show in automata viewer the correspond states machine view. */ public void load() { String path = PerformerView.getInstance().showLoadDialog(); if(path!=null) { try { automataManager.load(path); viewer.loadMachine(); PerformerView.getInstance().showCreateMachine(); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Error al cargar el archivo", "Fail load", JOptionPane.INFORMATION_MESSAGE); } } } /** * Save the current states machine in a file. */ private void save() { if (automataManager.canSerializeMachine()) { String path = PerformerView.getInstance().showSaveDialog(); if(path!=null) { try { automataManager.serializeMachine(path); JOptionPane.showMessageDialog(this, "Se ha guardado el archivo", "Correcto!", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(this, "No se logró gurdar el archivo", "Fail load", JOptionPane.INFORMATION_MESSAGE); e.printStackTrace(); } } } } @Override public void dispose() { super.dispose(); PerformerView.getInstance().setExtendedState(NORMAL); } /** * Return the current automata manager. * @return automataManager, manager that provides function to manipulate current autamata. */ public AutomataManager getAutomataManager() { return automataManager; } }
4,976
0.714458
0.712045
183
26.174864
24.511
120
false
false
0
0
0
0
0
0
2.060109
false
false
15
9c77b1a73d39d65ece1151a0e38c0a20263f015c
33,517,924,848,162
e29a56990b99dd977d45588d1990b0236fc874fa
/src/test/java/seedu/address/model/cinema/TheaterTest.java
b86392ff63bb0d31937ebbc789178662f08bdf5c
[ "MIT" ]
permissive
CS2103JAN2018-W11-B2/main
https://github.com/CS2103JAN2018-W11-B2/main
1ecd24f356e5d322c28e3519468696432fc209e4
b1dbceb661726e5aede752fe1ba1fc0ee351552e
refs/heads/master
2021-01-25T11:15:37.650000
2018-04-15T15:36:17
2018-04-15T15:36:17
123,388,194
1
4
null
true
2018-04-15T15:24:59
2018-03-01T05:46:02
2018-04-15T15:17:50
2018-04-15T15:24:58
23,310
1
4
10
Java
false
null
package seedu.address.model.cinema; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; import seedu.address.testutil.Assert; //@@author tinyjy94 public class TheaterTest { @Test public void constructor_invalidTheaterNumber_throwsIllegalArgumentException() { int invalidTheaterNumber = 0; Assert.assertThrows(IllegalArgumentException.class, () -> new Theater(invalidTheaterNumber)); } @Test public void isValidTheaterNumber() { // invalid theater numbers assertFalse(Theater.isValidTheater("")); // empty string assertFalse(Theater.isValidTheater(" ")); // spaces only assertFalse(Theater.isValidTheater("phone")); // non-numeric assertFalse(Theater.isValidTheater("a9011p041")); // alphabets and digits assertFalse(Theater.isValidTheater("9312 1534")); // spaces within digits // valid theater numbers assertTrue(Theater.isValidTheater("1")); // 1 digit assertTrue(Theater.isValidTheater("123456")); // multiple digits } }
UTF-8
Java
1,101
java
TheaterTest.java
Java
[ { "context": "\n\nimport seedu.address.testutil.Assert;\n//@@author tinyjy94\npublic class TheaterTest {\n\n @Test\n public ", "end": 206, "score": 0.999528706073761, "start": 198, "tag": "USERNAME", "value": "tinyjy94" } ]
null
[]
package seedu.address.model.cinema; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; import seedu.address.testutil.Assert; //@@author tinyjy94 public class TheaterTest { @Test public void constructor_invalidTheaterNumber_throwsIllegalArgumentException() { int invalidTheaterNumber = 0; Assert.assertThrows(IllegalArgumentException.class, () -> new Theater(invalidTheaterNumber)); } @Test public void isValidTheaterNumber() { // invalid theater numbers assertFalse(Theater.isValidTheater("")); // empty string assertFalse(Theater.isValidTheater(" ")); // spaces only assertFalse(Theater.isValidTheater("phone")); // non-numeric assertFalse(Theater.isValidTheater("a9011p041")); // alphabets and digits assertFalse(Theater.isValidTheater("9312 1534")); // spaces within digits // valid theater numbers assertTrue(Theater.isValidTheater("1")); // 1 digit assertTrue(Theater.isValidTheater("123456")); // multiple digits } }
1,101
0.705722
0.682107
31
34.483871
30.010612
101
false
false
0
0
0
0
0
0
0.483871
false
false
15
4efca546522cd276ffb66982a5c8f30eeea8fccd
6,184,752,966,280
e766c07c9724a29a913a6fc3172db48ee245da4e
/src/test/java/com/hellofunc/spy/portal/daum/$DaumCafe.java
a1caf14bd50a8e1e33b797fe3ad47ce38bf62bf5
[]
no_license
hellofunc/web
https://github.com/hellofunc/web
6fe217e1ab76375f209db1bc24a32752384790df
bd0ec6baa261cff02df905f8bd555d1ada805763
refs/heads/master
2018-04-23T00:05:34.094000
2018-01-30T06:26:07
2018-01-30T06:26:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hellofunc.spy.portal.daum; import com.hellofunc.spy.$Helper; import com.hellofunc.spy._Commons; import com.hellofunc.spy._Matcher; import static com.hellofunc.support.util.IRegExp.*; import com.hellofunc.support.util.web.Spy; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; /** * Created by hellofunc on 2017-06-21. */ public abstract class $DaumCafe extends $Helper { private static final Pattern r_tbody = Pattern.compile("<table class=\"bbsList\".*?tbody(.*?)<\\/tbody"), r_list = Pattern.compile("<tr class.*?datanum=(\\d+).*?<\\/tr"), r_view_datas = Pattern.compile("(<xmp id=\"template_xmp\".*?<\\/xmp>).*?\"subject\".*?\"b\">([^<]+).*?\"article_writer\".*?([^<>]+)<\\/a.*?(\\d{4}[\\d\\.\\s:]+:\\d{2})"), r_subject_img = Pattern.compile("<title>(.*?)<\\/title>.*?img src='([^']+)"); protected String cafeName; protected String cafeId; public $DaumCafe(String path) throws Exception { super(path); this.cafeName = path.replaceAll(".*\\/", ""); this.cafeId = _Matcher.match("grpid=([^\"\\&]+)", Spy.get("http://cafe.daum.net/" + cafeName, "euc-kr"))[1]; header = _Commons.readHeader( Paths.get(getClass().getClassLoader().getResource(cafeName + "-request.txt").toURI()) ); } public List<String> list(String fldid, int page, IUUID a) throws Exception { return $list(header, cafeId, fldid, page, a); } public String view(String boardId, String datanum, ViewData a) throws Exception { String html = $view(header, cafeId, boardId, datanum); forEach(r_view_datas, html, (i,g,content, subject, user, datetime) -> { a.accept(subject, user, datetime, content); }); return html; } public static final List<String> $list(Map<String, String> header, String grpid, String fldid, int page) throws Exception { return $list(header, grpid, fldid, page, (a, i) -> true); } public static final List<String> $list(Map<String, String> header, String grpid, String fldid, int page, IUUID a) throws Exception { List<String> result = new ArrayList<>(); String[] query = { "grpid=" + grpid, "fldid=" + fldid, "mgrpid=", "firstbbsdepth=003", "lastbbsdepth=003", "listnum=50", "prev_page=1", "page=" + page, }; String url = "http://cafe.daum.net/_c21_/bbs_list?" + String.join("&", query), html = Spy.get(url, header, "euc-kr"); forEach(r_tbody, html, (i1, g1, content) -> { forEach(r_list, content, (i2, g2, uuid) -> { if (a.check(g2, uuid)) result.add(uuid); }); }); return result; } public static final String $view(Map<String, String> header, String name, String group, String datanum) throws Exception { String _url = "http://cafe.daum.net/" + name + "/" + group + "/" + datanum, _html = Spy.get(_url, header, "euc-kr"), url = _Matcher.match("content=\"([^\"]+referer[^\"]+)\"", _html)[1], html = Spy.get(url, header, "euc-kr"); return html; } interface IUUID { boolean check(String content, String uuid) throws Exception; } interface ViewData { void accept(String subject, String nick, String datetime, String cotent) throws Exception; } }
UTF-8
Java
3,605
java
$DaumCafe.java
Java
[ { "context": "import java.util.regex.Pattern;\n\n/**\n * Created by hellofunc on 2017-06-21.\n */\npublic abstract class $DaumCaf", "end": 401, "score": 0.9990665912628174, "start": 392, "tag": "USERNAME", "value": "hellofunc" }, { "context": "wData {\n void accept(String subj...
null
[]
package com.hellofunc.spy.portal.daum; import com.hellofunc.spy.$Helper; import com.hellofunc.spy._Commons; import com.hellofunc.spy._Matcher; import static com.hellofunc.support.util.IRegExp.*; import com.hellofunc.support.util.web.Spy; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; /** * Created by hellofunc on 2017-06-21. */ public abstract class $DaumCafe extends $Helper { private static final Pattern r_tbody = Pattern.compile("<table class=\"bbsList\".*?tbody(.*?)<\\/tbody"), r_list = Pattern.compile("<tr class.*?datanum=(\\d+).*?<\\/tr"), r_view_datas = Pattern.compile("(<xmp id=\"template_xmp\".*?<\\/xmp>).*?\"subject\".*?\"b\">([^<]+).*?\"article_writer\".*?([^<>]+)<\\/a.*?(\\d{4}[\\d\\.\\s:]+:\\d{2})"), r_subject_img = Pattern.compile("<title>(.*?)<\\/title>.*?img src='([^']+)"); protected String cafeName; protected String cafeId; public $DaumCafe(String path) throws Exception { super(path); this.cafeName = path.replaceAll(".*\\/", ""); this.cafeId = _Matcher.match("grpid=([^\"\\&]+)", Spy.get("http://cafe.daum.net/" + cafeName, "euc-kr"))[1]; header = _Commons.readHeader( Paths.get(getClass().getClassLoader().getResource(cafeName + "-request.txt").toURI()) ); } public List<String> list(String fldid, int page, IUUID a) throws Exception { return $list(header, cafeId, fldid, page, a); } public String view(String boardId, String datanum, ViewData a) throws Exception { String html = $view(header, cafeId, boardId, datanum); forEach(r_view_datas, html, (i,g,content, subject, user, datetime) -> { a.accept(subject, user, datetime, content); }); return html; } public static final List<String> $list(Map<String, String> header, String grpid, String fldid, int page) throws Exception { return $list(header, grpid, fldid, page, (a, i) -> true); } public static final List<String> $list(Map<String, String> header, String grpid, String fldid, int page, IUUID a) throws Exception { List<String> result = new ArrayList<>(); String[] query = { "grpid=" + grpid, "fldid=" + fldid, "mgrpid=", "firstbbsdepth=003", "lastbbsdepth=003", "listnum=50", "prev_page=1", "page=" + page, }; String url = "http://cafe.daum.net/_c21_/bbs_list?" + String.join("&", query), html = Spy.get(url, header, "euc-kr"); forEach(r_tbody, html, (i1, g1, content) -> { forEach(r_list, content, (i2, g2, uuid) -> { if (a.check(g2, uuid)) result.add(uuid); }); }); return result; } public static final String $view(Map<String, String> header, String name, String group, String datanum) throws Exception { String _url = "http://cafe.daum.net/" + name + "/" + group + "/" + datanum, _html = Spy.get(_url, header, "euc-kr"), url = _Matcher.match("content=\"([^\"]+referer[^\"]+)\"", _html)[1], html = Spy.get(url, header, "euc-kr"); return html; } interface IUUID { boolean check(String content, String uuid) throws Exception; } interface ViewData { void accept(String subject, String nick, String datetime, String cotent) throws Exception; } }
3,605
0.568377
0.56061
99
35.404041
36.604885
182
false
false
0
0
0
0
0
0
1.141414
false
false
15
916934a7bc07dd30e9a83ad819cd7aacbae08a87
8,126,078,182,155
adc1c6c8a3b7b3b2a503b262c45b8ef3ecbcec8d
/Montacié Programmation Objet et Groupware/src/atelier06/Chat.java
0012e52c9d972ce75039306a2f15b28e3a396027
[]
no_license
LangueetInformatique/Montacie
https://github.com/LangueetInformatique/Montacie
4f9e769231750754a076fa04ae00def60174fd7e
fd7a00fb6ac3766b9aea349b16459b231cab5734
refs/heads/master
2021-06-02T06:24:07.931000
2021-05-12T11:23:45
2021-05-12T11:23:45
119,543,415
8
4
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package atelier06; /** * @author tyratron * */ public class Chat extends Felin implements Domesticable { private String nom; /** * @param type */ public Chat(String nom) { super("chats"); domestiquer(nom); } /** presentation des caracteristiques du chat */ public void presente() { super.presente(); // appel de la m�thode de la sur-classe System.out.println("et je m'appelle " + nom()); } @Override public void domestiquer(String nom) { domestique = true; this.nom = nom; } @Override public String nom() { // TODO Auto-generated method stub return this.nom; } /** cri du chat */ public void crie() { System.out.println("et je miaule"); } }
UTF-8
Java
707
java
Chat.java
Java
[ { "context": "/**\n * \n */\npackage atelier06;\n\n/**\n * @author tyratron\n *\n */\npublic class Chat extends Felin implements", "end": 55, "score": 0.9979014992713928, "start": 47, "tag": "USERNAME", "value": "tyratron" } ]
null
[]
/** * */ package atelier06; /** * @author tyratron * */ public class Chat extends Felin implements Domesticable { private String nom; /** * @param type */ public Chat(String nom) { super("chats"); domestiquer(nom); } /** presentation des caracteristiques du chat */ public void presente() { super.presente(); // appel de la m�thode de la sur-classe System.out.println("et je m'appelle " + nom()); } @Override public void domestiquer(String nom) { domestique = true; this.nom = nom; } @Override public String nom() { // TODO Auto-generated method stub return this.nom; } /** cri du chat */ public void crie() { System.out.println("et je miaule"); } }
707
0.635461
0.632624
45
14.666667
16.291784
60
false
false
0
0
0
0
0
0
1.066667
false
false
15
59d2fac4d33e072a8779dbc1c6dbcffdc6c4cc1d
37,271,726,210,403
46c14b75ee0fcbeecf8acdfa05cae87fc7a7de92
/app/src/main/java/com/example/ricyclerviewapplication/MainActivity.java
17d7d50a681f17d4386d0751e72be703a4b99f06
[]
no_license
g84silva/RecyclerView-estudo-android
https://github.com/g84silva/RecyclerView-estudo-android
109b3bf1b28a6e900434fbfd599613e2b165d056
de01fa5d6063d8a1821f02994bcb63bff7b8db1c
refs/heads/master
2022-11-30T17:10:34.810000
2020-08-01T22:58:51
2020-08-01T22:58:51
284,352,835
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.ricyclerviewapplication; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import com.example.ricyclerviewapplication.model.Receitas; import java.util.LinkedList; public class MainActivity extends AppCompatActivity { private LinkedList<Receitas> listaDeReceitas = new LinkedList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listaDeReceitas.add(new Receitas("Pao", "Quentinho bla bla bla bla bla bla bla", getResources().getIdentifier("pao", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Bife", "Suculento bla bla bla bla bla bla bla", getResources().getIdentifier("bife", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Pipoca", "Crocante bla bla bla bla bla bla bla", getResources().getIdentifier("pipoca", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Batatas", "Rústicas bla bla bla bla bla bla bla", getResources().getIdentifier("batatas", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Bolo", "Fofinho bla bla bla bla bla bla bla", getResources().getIdentifier("bolo", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Salada", "Mista bla bla bla bla bla bla bla", getResources().getIdentifier("salada", "drawable", getPackageName()))); RecyclerView recyclerView = findViewById(R.id.recycler_view); ListagemAdapter adapter = new ListagemAdapter(this, listaDeReceitas); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); } }
UTF-8
Java
1,941
java
MainActivity.java
Java
[]
null
[]
package com.example.ricyclerviewapplication; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Bundle; import com.example.ricyclerviewapplication.model.Receitas; import java.util.LinkedList; public class MainActivity extends AppCompatActivity { private LinkedList<Receitas> listaDeReceitas = new LinkedList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listaDeReceitas.add(new Receitas("Pao", "Quentinho bla bla bla bla bla bla bla", getResources().getIdentifier("pao", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Bife", "Suculento bla bla bla bla bla bla bla", getResources().getIdentifier("bife", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Pipoca", "Crocante bla bla bla bla bla bla bla", getResources().getIdentifier("pipoca", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Batatas", "Rústicas bla bla bla bla bla bla bla", getResources().getIdentifier("batatas", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Bolo", "Fofinho bla bla bla bla bla bla bla", getResources().getIdentifier("bolo", "drawable", getPackageName()))); listaDeReceitas.add(new Receitas("Salada", "Mista bla bla bla bla bla bla bla", getResources().getIdentifier("salada", "drawable", getPackageName()))); RecyclerView recyclerView = findViewById(R.id.recycler_view); ListagemAdapter adapter = new ListagemAdapter(this, listaDeReceitas); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); } }
1,941
0.707732
0.707732
41
46.341465
35.027245
91
false
false
0
0
0
0
0
0
1.097561
false
false
15
5a0d5429d1854ae1d1bb39de6e0406bb64a53bf5
1,932,735,331,435
98e741db53c0cfce9fd97ddec6424d3f5a1053ac
/yacine-pi/yacine-pi-web/src/main/java/bean/Identity.java
3316da6daafad9e9015f98f2670c9fe1d8b68218
[]
no_license
yacinefekih/miniature-fortnight
https://github.com/yacinefekih/miniature-fortnight
93864b442dec96654a5c68a2bcb725edbefa58c7
bdbc326301431a705f168d1041153f7f2fed971c
refs/heads/master
2021-08-29T01:40:33.465000
2017-12-13T09:48:26
2017-12-13T09:48:26
114,102,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package bean; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import persistence.User; import persistence.UserAssos; import persistence.UserRefugee; import persistence.UserSponsor; import services.UserManagementLocal; @ManagedBean @SessionScoped public class Identity { public static User user = new User(); private boolean loggedIn = false; @EJB private UserManagementLocal UsermanagementLocal; public String doLogin() { String navigateTo = ""; User userLoggedIn = UsermanagementLocal.login1(user.getUsername(), user.getPassword()); if (userLoggedIn != null) { user = userLoggedIn; loggedIn = true; if (userLoggedIn instanceof UserAssos) { navigateTo = "/pages/assosiation/home?faces-redirect=true"; } else if (userLoggedIn instanceof UserSponsor) { navigateTo = "/allEvent?faces-redirect=true"; }else if (userLoggedIn instanceof UserRefugee) { navigateTo = "/refugeeSpace?faces-redirect=true";} } else { navigateTo = "/login?faces-redirect=true"; } return navigateTo; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public boolean isLoggedIn() { return loggedIn; } public void setLoggedIn(boolean loggedIn) { this.loggedIn = loggedIn; } }
UTF-8
Java
1,369
java
Identity.java
Java
[ { "context": "er userLoggedIn = UsermanagementLocal.login1(user.getUsername(), user.getPassword());\r\n\t\tif (userLoggedIn != nu", "end": 596, "score": 0.9796160459518433, "start": 585, "tag": "USERNAME", "value": "getUsername" } ]
null
[]
package bean; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import persistence.User; import persistence.UserAssos; import persistence.UserRefugee; import persistence.UserSponsor; import services.UserManagementLocal; @ManagedBean @SessionScoped public class Identity { public static User user = new User(); private boolean loggedIn = false; @EJB private UserManagementLocal UsermanagementLocal; public String doLogin() { String navigateTo = ""; User userLoggedIn = UsermanagementLocal.login1(user.getUsername(), user.getPassword()); if (userLoggedIn != null) { user = userLoggedIn; loggedIn = true; if (userLoggedIn instanceof UserAssos) { navigateTo = "/pages/assosiation/home?faces-redirect=true"; } else if (userLoggedIn instanceof UserSponsor) { navigateTo = "/allEvent?faces-redirect=true"; }else if (userLoggedIn instanceof UserRefugee) { navigateTo = "/refugeeSpace?faces-redirect=true";} } else { navigateTo = "/login?faces-redirect=true"; } return navigateTo; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public boolean isLoggedIn() { return loggedIn; } public void setLoggedIn(boolean loggedIn) { this.loggedIn = loggedIn; } }
1,369
0.705625
0.704894
57
22.017544
19.782583
89
false
false
0
0
0
0
0
0
1.578947
false
false
15
7f6385974597355d54976bbbeaff86d77ad55417
34,196,529,635,867
e5c6c370746c000383dd0f5dbfee0ce6057d0252
/common/src/main/java/com/wyc/common/com/wyc/common/session/com/wyc/common/session/socket/vo/RegisterVo.java
3ecb3af14f9bcfbaf399110e81c6dc3886a63290
[]
no_license
wangyuchuan12/battle_new
https://github.com/wangyuchuan12/battle_new
b5394f0c6200ed9bcdc6e6e7be2c399f688c506a
81ae27dc245f887c5c2e31f4abc9a802b4de2d88
refs/heads/master
2020-08-02T17:45:45.461000
2019-10-03T09:02:45
2019-10-03T09:02:45
211,451,886
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wyc.common.com.wyc.common.session.com.wyc.common.session.socket.vo; import lombok.Data; import java.util.Map; @Data public class RegisterVo { private String key; private boolean isPass; private Map<String,Object> data; private Map<String,Object> conditon; }
UTF-8
Java
302
java
RegisterVo.java
Java
[]
null
[]
package com.wyc.common.com.wyc.common.session.com.wyc.common.session.socket.vo; import lombok.Data; import java.util.Map; @Data public class RegisterVo { private String key; private boolean isPass; private Map<String,Object> data; private Map<String,Object> conditon; }
302
0.711921
0.711921
13
21.23077
21.462503
79
false
false
0
0
0
0
0
0
0.692308
false
false
15
baf0b2f233632e453b360859ce855fe3a65f4edf
34,196,529,637,001
aa706e76a0c9307c6fe56255bde374bc3a92dd23
/src/main/java/pl/daniel/ug/bi/services/CarService.java
53f54e4ca2c60b86d990300ff205f23c8c56a694
[]
no_license
malyszdan/vaadin
https://github.com/malyszdan/vaadin
4e11e93674db732b1f5872e936e44c3ee3411734
efc2c302e0da073cc7d7cd7bedea2d9400ae2fa7
refs/heads/master
2021-01-10T07:48:32.250000
2016-04-07T22:03:00
2016-04-07T22:03:00
53,077,345
0
0
null
false
2016-04-07T22:03:00
2016-03-03T19:32:10
2016-03-03T19:32:10
2016-04-07T22:03:00
54,344
0
0
0
null
null
null
package pl.daniel.ug.bi.services; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import pl.daniel.ug.bi.domain.Car; import pl.daniel.ug.bi.domain.Car.Brand; public class CarService { private List<Car> database = new ArrayList<Car>(); private CarService() { database.add(new Car("E32",2010, 20000, Brand.BMW)); database.add(new Car("FOCUS", 2000, 150000, Brand.FORD)); database.add(new Car("FIESTA", 2004, 120430, Brand.FORD)); } private static CarService instance = new CarService(); public static CarService getInstance() { return instance; } public List<Car> getAllCars(){ return database; } public void addCar(Car copy) { database.add(copy); } public void remove(Car car) { database.remove(car); } }
UTF-8
Java
784
java
CarService.java
Java
[]
null
[]
package pl.daniel.ug.bi.services; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import pl.daniel.ug.bi.domain.Car; import pl.daniel.ug.bi.domain.Car.Brand; public class CarService { private List<Car> database = new ArrayList<Car>(); private CarService() { database.add(new Car("E32",2010, 20000, Brand.BMW)); database.add(new Car("FOCUS", 2000, 150000, Brand.FORD)); database.add(new Car("FIESTA", 2004, 120430, Brand.FORD)); } private static CarService instance = new CarService(); public static CarService getInstance() { return instance; } public List<Car> getAllCars(){ return database; } public void addCar(Car copy) { database.add(copy); } public void remove(Car car) { database.remove(car); } }
784
0.697704
0.658163
46
16.043478
19.065056
60
false
false
0
0
0
0
0
0
1.23913
false
false
15
cb51def64472aa1e2f6e95a1b961391ce98a2299
36,429,912,631,852
6f89d395aaf5e56c6c785ccf11f4ed04dca0c98d
/.svn/pristine/cb/cb51def64472aa1e2f6e95a1b961391ce98a2299.svn-base
eb4ed343bf3a43b72b109de7808c96bfcde25570
[]
no_license
xiasiliang-hit/hzpf
https://github.com/xiasiliang-hit/hzpf
ebb7218d25a49d3ad14a672ed4ed8115332b470b
3d3297450ba49ccacae5bf3721866b22bc21c1a8
refs/heads/master
2021-05-03T23:25:16.367000
2016-11-05T09:36:33
2016-11-05T09:36:33
71,720,175
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.line.bqxd.platform.v2.manager.impl; import com.line.bqxd.platform.client.dataobject.PfUserAdminDO; import com.line.bqxd.platform.client.dataobject.query.PfUserAdminQueryDO; import com.line.bqxd.platform.dao.PfUserAdminDAO; import com.line.bqxd.platform.v2.manager.PfUserAdminManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import java.util.List; /** * Created by huangjianfei on 16/9/9. */ public class PfUserAdminManagerImpl implements PfUserAdminManager { private static final Logger logger = LoggerFactory.getLogger(PfUserAdminManagerImpl.class); @Autowired private PfUserAdminDAO<PfUserAdminDO> pfUserAdminDAO; @Override public PfUserAdminDO getPfUserAdminDOByLoginName(String loginName) { PfUserAdminQueryDO pfUserAdminQueryDO = new PfUserAdminQueryDO(); pfUserAdminQueryDO.setLoginName(loginName); List<PfUserAdminDO> list = pfUserAdminDAO.selectByQuery(pfUserAdminQueryDO); if (CollectionUtils.isEmpty(list)) { return null; } else { return list.get(0); } } @Override public boolean insert(PfUserAdminDO pfUserAdminDO) { long rt = pfUserAdminDAO.insert(pfUserAdminDO); return rt > 0 ? true : false; } @Override public boolean update(PfUserAdminDO pfUserAdminDO) { return pfUserAdminDAO.update(pfUserAdminDO); } }
UTF-8
Java
1,514
cb51def64472aa1e2f6e95a1b961391ce98a2299.svn-base
Java
[ { "context": "nUtils;\n\nimport java.util.List;\n\n/**\n * Created by huangjianfei on 16/9/9.\n */\npublic class PfUserAdminManagerImp", "end": 521, "score": 0.9848376512527466, "start": 509, "tag": "USERNAME", "value": "huangjianfei" } ]
null
[]
package com.line.bqxd.platform.v2.manager.impl; import com.line.bqxd.platform.client.dataobject.PfUserAdminDO; import com.line.bqxd.platform.client.dataobject.query.PfUserAdminQueryDO; import com.line.bqxd.platform.dao.PfUserAdminDAO; import com.line.bqxd.platform.v2.manager.PfUserAdminManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import java.util.List; /** * Created by huangjianfei on 16/9/9. */ public class PfUserAdminManagerImpl implements PfUserAdminManager { private static final Logger logger = LoggerFactory.getLogger(PfUserAdminManagerImpl.class); @Autowired private PfUserAdminDAO<PfUserAdminDO> pfUserAdminDAO; @Override public PfUserAdminDO getPfUserAdminDOByLoginName(String loginName) { PfUserAdminQueryDO pfUserAdminQueryDO = new PfUserAdminQueryDO(); pfUserAdminQueryDO.setLoginName(loginName); List<PfUserAdminDO> list = pfUserAdminDAO.selectByQuery(pfUserAdminQueryDO); if (CollectionUtils.isEmpty(list)) { return null; } else { return list.get(0); } } @Override public boolean insert(PfUserAdminDO pfUserAdminDO) { long rt = pfUserAdminDAO.insert(pfUserAdminDO); return rt > 0 ? true : false; } @Override public boolean update(PfUserAdminDO pfUserAdminDO) { return pfUserAdminDAO.update(pfUserAdminDO); } }
1,514
0.744386
0.737781
45
32.644444
27.437326
95
false
false
0
0
0
0
0
0
0.444444
false
false
15
37504fbefe6ceaaca6c1d8bffcac3dc1bd206dff
23,733,989,347,311
f1583d686b6a721c0999243a7b506125cff4fbc7
/src/com/frame/dip/ImagePanel.java
2f399ca201e83a6a41ef8d6a8506120be7d97429
[]
no_license
WSUOilSpill/OilSpill
https://github.com/WSUOilSpill/OilSpill
266701ec277406040f90db24b63e921d4a3f12c0
2d70eca4e645edcb50f15be0ba4f61c8583a235c
refs/heads/master
2020-05-07T17:45:02.404000
2011-11-08T20:14:45
2011-11-08T20:14:45
2,734,505
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.frame.dip; /** ImagePanel.java * ImagePanel will create an area for displaying an image Read Java API for methods defined in BufferedImage and Graphics */ import java.awt.*; import javax.swing.*; import java.awt.image.BufferedImage; public class ImagePanel extends JPanel { final int DRAWAREA = 400; private BufferedImage image; private Graphics2D page2; public ImagePanel ( ) { setBackground (Color.white); setMinimumSize (new Dimension(DRAWAREA, DRAWAREA)); setPreferredSize (new Dimension(DRAWAREA, DRAWAREA)); } public void paint (Graphics page) { page2 = (Graphics2D)page; if (image != null) //assure a valid image //drawImage(Image img, int x, int y, ImageObserver observer) page2.drawImage ( image, 0, 0, null ); } public void setImage (BufferedImage image) { this.image = image; int width = image.getWidth(); int height = image.getHeight(); repaint(); } }
UTF-8
Java
1,021
java
ImagePanel.java
Java
[]
null
[]
package com.frame.dip; /** ImagePanel.java * ImagePanel will create an area for displaying an image Read Java API for methods defined in BufferedImage and Graphics */ import java.awt.*; import javax.swing.*; import java.awt.image.BufferedImage; public class ImagePanel extends JPanel { final int DRAWAREA = 400; private BufferedImage image; private Graphics2D page2; public ImagePanel ( ) { setBackground (Color.white); setMinimumSize (new Dimension(DRAWAREA, DRAWAREA)); setPreferredSize (new Dimension(DRAWAREA, DRAWAREA)); } public void paint (Graphics page) { page2 = (Graphics2D)page; if (image != null) //assure a valid image //drawImage(Image img, int x, int y, ImageObserver observer) page2.drawImage ( image, 0, 0, null ); } public void setImage (BufferedImage image) { this.image = image; int width = image.getWidth(); int height = image.getHeight(); repaint(); } }
1,021
0.649363
0.639569
38
25.868422
21.537203
72
false
false
0
0
0
0
0
0
0.684211
false
false
15
2c298caf2630ed41cef671e741f9dc7878edd68b
31,198,642,493,297
14a5ee84f5a4fed90c6e1b203113cae35bf9ffd8
/src/test/java/com/inetBanking/pageObjects/AddCustomerPage.java
7bca00095828a1fb21e73a00028fdf0ccfd3466f
[]
no_license
AsipiRavi/inetBankingV1
https://github.com/AsipiRavi/inetBankingV1
4367b66c5e3628658dd6ff883b80cecb35f93e6e
8ee7a3ad838ee6f55649a92535fa1adfaf395541
refs/heads/master
2023-07-09T10:35:31.729000
2021-08-13T06:32:09
2021-08-13T06:32:09
394,948,980
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.inetBanking.pageObjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.How; import org.openqa.selenium.support.PageFactory; public class AddCustomerPage { WebDriver ldriver; public AddCustomerPage(WebDriver rdriver) { ldriver = rdriver; PageFactory.initElements(rdriver, this); // page factory model initilisation } @FindBy(how=How.XPATH, using="/html/body/div[3]/div/ul/li[2]/a") WebElement lAddNewCustomer; @FindBy(how=How.NAME, using="name") WebElement tCustomerName; @FindBy(how=How.NAME, using="rad1") WebElement rGender; @FindBy(how=How.ID, using="dob") WebElement dDOB; @FindBy(how=How.NAME, using="addr") WebElement tAddress; @FindBy(how=How.NAME, using="city") WebElement tCity; @FindBy(how=How.NAME, using="state") WebElement tState; @FindBy(how=How.NAME, using="pinno") WebElement tPinNumber; @FindBy(how=How.NAME, using="telephoneno") WebElement tTelephoneno; @FindBy(how=How.NAME, using="emailid") WebElement tEmailid; @FindBy(how=How.NAME, using="password") WebElement tPassword; @FindBy(how=How.NAME, using="sub") WebElement bSubmit; @FindBy(how=How.XPATH, using="//*[@id=\"customer\"]/tbody/tr[4]/td[2]") WebElement tCustomerId; public void clickAddNewCustomer() { lAddNewCustomer.click(); } public void setCustomerName(String name) { tCustomerName.sendKeys(name); } public void setGender(String cgender) { rGender.click(); } public void setDOB(String mm,String dd,String yy) { dDOB.sendKeys(mm+'/'+dd+'/'+yy); // dDOB.sendKeys(dd); // dDOB.sendKeys(yy); } public void setAddress(String address) { tAddress.sendKeys(address); } public void setCity(String city) { tCity.sendKeys(city); } public void setState(String state) { tState.sendKeys(state); } public void setPinNo(String pinno) { tPinNumber.sendKeys(pinno); } public void setTelephoneno(String telephone) { tTelephoneno.sendKeys(telephone); } public void setEmailid(String email) { tEmailid.sendKeys(email); } public void setPassword(String password) { tPassword.sendKeys(password); } public void clickSubmit() { bSubmit.click(); } public String getCustomerID() { return tCustomerId.getText(); } }
UTF-8
Java
2,335
java
AddCustomerPage.java
Java
[]
null
[]
package com.inetBanking.pageObjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.How; import org.openqa.selenium.support.PageFactory; public class AddCustomerPage { WebDriver ldriver; public AddCustomerPage(WebDriver rdriver) { ldriver = rdriver; PageFactory.initElements(rdriver, this); // page factory model initilisation } @FindBy(how=How.XPATH, using="/html/body/div[3]/div/ul/li[2]/a") WebElement lAddNewCustomer; @FindBy(how=How.NAME, using="name") WebElement tCustomerName; @FindBy(how=How.NAME, using="rad1") WebElement rGender; @FindBy(how=How.ID, using="dob") WebElement dDOB; @FindBy(how=How.NAME, using="addr") WebElement tAddress; @FindBy(how=How.NAME, using="city") WebElement tCity; @FindBy(how=How.NAME, using="state") WebElement tState; @FindBy(how=How.NAME, using="pinno") WebElement tPinNumber; @FindBy(how=How.NAME, using="telephoneno") WebElement tTelephoneno; @FindBy(how=How.NAME, using="emailid") WebElement tEmailid; @FindBy(how=How.NAME, using="password") WebElement tPassword; @FindBy(how=How.NAME, using="sub") WebElement bSubmit; @FindBy(how=How.XPATH, using="//*[@id=\"customer\"]/tbody/tr[4]/td[2]") WebElement tCustomerId; public void clickAddNewCustomer() { lAddNewCustomer.click(); } public void setCustomerName(String name) { tCustomerName.sendKeys(name); } public void setGender(String cgender) { rGender.click(); } public void setDOB(String mm,String dd,String yy) { dDOB.sendKeys(mm+'/'+dd+'/'+yy); // dDOB.sendKeys(dd); // dDOB.sendKeys(yy); } public void setAddress(String address) { tAddress.sendKeys(address); } public void setCity(String city) { tCity.sendKeys(city); } public void setState(String state) { tState.sendKeys(state); } public void setPinNo(String pinno) { tPinNumber.sendKeys(pinno); } public void setTelephoneno(String telephone) { tTelephoneno.sendKeys(telephone); } public void setEmailid(String email) { tEmailid.sendKeys(email); } public void setPassword(String password) { tPassword.sendKeys(password); } public void clickSubmit() { bSubmit.click(); } public String getCustomerID() { return tCustomerId.getText(); } }
2,335
0.720343
0.718201
111
20.045046
18.293102
78
false
false
0
0
0
0
0
0
1.522523
false
false
15
d55885eb2e7fc2ff4dbc661bc4fa1808b2f5f304
34,308,198,803,657
4dadc4fdc8a052bdaed4fbd2f3dd012562f7e239
/app/src/main/java/com/sds/android/ttpod/media/audiofx/TTTrebleBoost.java
24f79ea9cc0c7a306d21fdfb489db3d616920c97
[]
no_license
liupeng110/musicplayer
https://github.com/liupeng110/musicplayer
2025e4279c7fb09185120d9d6a53859d25e959e2
423ec5fb92377166da8b71be684533428a307abe
refs/heads/master
2021-08-23T14:05:57.958000
2017-12-05T05:30:40
2017-12-05T05:30:40
104,458,651
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sds.android.ttpod.media.audiofx; public class TTTrebleBoost extends TTAudioEffect { public TTTrebleBoost() { super(EffectUUID.EFFECT_ID_TREBLEBOOST); } public boolean getStrengthSupported() { return true; } public void setStrength(short s) { TTAudioEffect.setEffectParams(EffectUUID.EFFECT_ID_TREBLEBOOST, new int[]{1}, new short[]{s}); } public short getRoundedStrength() { short[] sArr = new short[]{(short) 0}; TTAudioEffect.getEffectParams(EffectUUID.EFFECT_ID_TREBLEBOOST, new int[]{1}, sArr); return sArr[0]; } }
UTF-8
Java
614
java
TTTrebleBoost.java
Java
[]
null
[]
package com.sds.android.ttpod.media.audiofx; public class TTTrebleBoost extends TTAudioEffect { public TTTrebleBoost() { super(EffectUUID.EFFECT_ID_TREBLEBOOST); } public boolean getStrengthSupported() { return true; } public void setStrength(short s) { TTAudioEffect.setEffectParams(EffectUUID.EFFECT_ID_TREBLEBOOST, new int[]{1}, new short[]{s}); } public short getRoundedStrength() { short[] sArr = new short[]{(short) 0}; TTAudioEffect.getEffectParams(EffectUUID.EFFECT_ID_TREBLEBOOST, new int[]{1}, sArr); return sArr[0]; } }
614
0.664495
0.65798
21
28.285715
28.908958
102
false
false
0
0
0
0
0
0
0.52381
false
false
15
dfcf880f77330e2d7f67bd1e27db0372a9fa3eae
25,220,048,010,135
e037596c10b356c2163896bcecdc7cc82eecb8b0
/app/src/main/java/com/hengye/share/module/template/TemplateContract.java
e2440c5fc9d0787faa742e4eb9b1f717046a9721
[]
no_license
yugai/Share
https://github.com/yugai/Share
1b06f55b18316d0c8cb75b3a22ba5f42c1129d3e
25f4264dfbd092ca162d1afbef6f680bf717dcd9
refs/heads/master
2019-04-08T07:49:36.607000
2018-11-11T18:19:57
2018-11-11T18:19:57
87,764,064
3
2
null
true
2017-04-10T03:48:49
2017-04-10T03:48:49
2017-03-19T10:20:46
2017-02-24T04:53:22
12,902
0
0
0
null
null
null
package com.hengye.share.module.template; import com.hengye.share.module.util.encapsulation.mvp.MvpPresenter; import com.hengye.share.module.util.encapsulation.mvp.MvpView; /** * Created by yuhy on 2017/1/16. */ public interface TemplateContract { interface View extends MvpView { } interface Presenter extends MvpPresenter<View> { } }
UTF-8
Java
359
java
TemplateContract.java
Java
[ { "context": "util.encapsulation.mvp.MvpView;\n\n/**\n * Created by yuhy on 2017/1/16.\n */\n\npublic interface TemplateContr", "end": 197, "score": 0.999278724193573, "start": 193, "tag": "USERNAME", "value": "yuhy" } ]
null
[]
package com.hengye.share.module.template; import com.hengye.share.module.util.encapsulation.mvp.MvpPresenter; import com.hengye.share.module.util.encapsulation.mvp.MvpView; /** * Created by yuhy on 2017/1/16. */ public interface TemplateContract { interface View extends MvpView { } interface Presenter extends MvpPresenter<View> { } }
359
0.743733
0.724234
17
20.117647
23.579359
67
false
false
0
0
0
0
0
0
0.176471
false
false
15
a9c409b284268a94ef4d299b24a756d02d1cf5d4
25,220,048,009,162
bd876f4d643e05179de0bc30e2250b47402cabc5
/javascript/src/main/java/com/springboot/javascript/domain/RequestBody.java
bae346bd95928dd46286ed1304902609e2812b49
[]
no_license
MrWJB/springboot-parent
https://github.com/MrWJB/springboot-parent
189ce0184bb183e1facacb117ee2c35f0a40fae5
39e93a9800280ff1af4dccca557a2be0769e5f6c
refs/heads/master
2023-05-15T01:44:07.186000
2021-06-06T14:28:12
2021-06-06T14:28:12
372,244,538
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.springboot.javascript.domain; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; import java.util.Date; @Data public class RequestBody implements Serializable { private String prov; private String city; private String mobile; private String name; private Double price; @JsonFormat(pattern = "yyyy-MM-dd") private String date; private Sale sale; }
UTF-8
Java
445
java
RequestBody.java
Java
[]
null
[]
package com.springboot.javascript.domain; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; import java.util.Date; @Data public class RequestBody implements Serializable { private String prov; private String city; private String mobile; private String name; private Double price; @JsonFormat(pattern = "yyyy-MM-dd") private String date; private Sale sale; }
445
0.746067
0.746067
20
21.25
15.836271
51
false
false
0
0
0
0
0
0
0.6
false
false
15
af69bdcff79638ced9e2c7ca88dc099542a4c84e
37,271,726,216,694
5cefdb0dc4dcac17c50c0f7349160ad5d5b2c477
/src/servlet/ProductImageServlet.java
2ea00b5a8e543b0b5e25eec8bad87c9eb603a053
[]
no_license
AzeroCoder/mytmall
https://github.com/AzeroCoder/mytmall
367532d118f0e02542577d575153e00c3624ddfa
0842d68d451199e399577082a5394d06c3cc1468
refs/heads/master
2020-03-26T01:24:21.503000
2018-08-11T07:37:24
2018-08-11T07:37:25
144,365,517
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package servlet; import DAO.ProductImageDAO; import bean.Category; import bean.Product; import bean.ProductImage; import org.apache.commons.fileupload.FileUploadException; import util.ImageUtil; import util.Page; import javax.imageio.ImageIO; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.*; import java.util.HashMap; import java.util.List; import java.util.Map; public class ProductImageServlet extends BaseBackServlet { @Override public String add(HttpServletRequest request, HttpServletResponse response, Page page) { Map<String, String> map = new HashMap<>(); String res = ""; try { InputStream in = ImageUtil.upload(request, map); // System.out.println(in); ProductImage image = new ProductImage(); String type = map.get("type"); int pid = Integer.parseInt(map.get("pid")); Product product = productDAO.get(pid); image.setProduct(product); image.setType(type); productImageDAO.add(image); // System.out.println(category); int id = image.getId(); ServletContext sc = request.getServletContext(); String productsPath; String products_smallPath = ""; String products_middlePath =""; if(type.equals("type_single")) { productsPath = sc.getRealPath("img/productSingle"); products_smallPath = sc.getRealPath("img/productSingle_small"); products_middlePath = sc.getRealPath("img/productSingle_middle"); } else { productsPath = sc.getRealPath("img/productDetail"); } File desc = new File(productsPath); if (!desc.exists()) { desc.mkdirs(); } String fileName = id + ".jpg"; File file = new File(desc, fileName); FileOutputStream out = new FileOutputStream(file); ImageUtil.copyFile(in, out); BufferedImage img = ImageUtil.change2jpg(file); ImageIO.write(img, "jpg", file); if(type.equals("type_single")) { File desc_small = new File(products_smallPath,fileName); File desc_middle = new File(products_middlePath,fileName); ImageUtil.resizeImage(file, 56, 56, desc_small); ImageUtil.resizeImage(file, 217, 190, desc_middle); } res = "@admin_productImage_list?pid="+pid; } catch (FileUploadException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return res; } @Override public String delete(HttpServletRequest request, HttpServletResponse respone, Page page) { int id = Integer.parseInt(request.getParameter("piid")); boolean result = false; String str = ""; ProductImage image = productImageDAO.get(id); productImageDAO.delete(id); String type = image.getType(); type=type.substring(type.indexOf("_")+1); type.replace(type.charAt(0),type.toUpperCase().charAt(0)); // System.out.println(type); String path = request.getServletContext().getRealPath("img/product"+type); ImageUtil.delFile(path,id); if(type.equals(ProductImageDAO.type_single)) { String path1 = request.getServletContext().getRealPath("img/product"+type+"_small"); ImageUtil.delFile(path,id); String path2 = request.getServletContext().getRealPath("img/product"+type+"_middle"); ImageUtil.delFile(path,id); } str = "@admin_productImage_list?cid="+image.getProduct().getCategory().getId()+"&pid="+image.getProduct().getId(); return str; } @Override public String edit(HttpServletRequest request, HttpServletResponse response, Page page) { return null; } @Override public String update(HttpServletRequest request, HttpServletResponse response, Page page) { return null; } @Override public String list(HttpServletRequest request, HttpServletResponse response, Page page) { int start = page.getStart(); int count = page.getCount(); int pid = Integer.parseInt(request.getParameter("pid")); int total = productImageDAO.getTotal(); page.setTotal(total); // System.out.println(start+"--"+count+"--"+total); Product product = productDAO.get(pid); List<ProductImage> images1 = productImageDAO.list(product,"type_single",start,count); List<ProductImage> images2 = productImageDAO.list(product,"type_detail",start,count); request.setAttribute("images1", images1); request.setAttribute("images2", images2); request.setAttribute("product",product); request.setAttribute("page", page); return "jsp/admin/listProductImage.jsp"; } }
UTF-8
Java
5,216
java
ProductImageServlet.java
Java
[]
null
[]
package servlet; import DAO.ProductImageDAO; import bean.Category; import bean.Product; import bean.ProductImage; import org.apache.commons.fileupload.FileUploadException; import util.ImageUtil; import util.Page; import javax.imageio.ImageIO; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.*; import java.util.HashMap; import java.util.List; import java.util.Map; public class ProductImageServlet extends BaseBackServlet { @Override public String add(HttpServletRequest request, HttpServletResponse response, Page page) { Map<String, String> map = new HashMap<>(); String res = ""; try { InputStream in = ImageUtil.upload(request, map); // System.out.println(in); ProductImage image = new ProductImage(); String type = map.get("type"); int pid = Integer.parseInt(map.get("pid")); Product product = productDAO.get(pid); image.setProduct(product); image.setType(type); productImageDAO.add(image); // System.out.println(category); int id = image.getId(); ServletContext sc = request.getServletContext(); String productsPath; String products_smallPath = ""; String products_middlePath =""; if(type.equals("type_single")) { productsPath = sc.getRealPath("img/productSingle"); products_smallPath = sc.getRealPath("img/productSingle_small"); products_middlePath = sc.getRealPath("img/productSingle_middle"); } else { productsPath = sc.getRealPath("img/productDetail"); } File desc = new File(productsPath); if (!desc.exists()) { desc.mkdirs(); } String fileName = id + ".jpg"; File file = new File(desc, fileName); FileOutputStream out = new FileOutputStream(file); ImageUtil.copyFile(in, out); BufferedImage img = ImageUtil.change2jpg(file); ImageIO.write(img, "jpg", file); if(type.equals("type_single")) { File desc_small = new File(products_smallPath,fileName); File desc_middle = new File(products_middlePath,fileName); ImageUtil.resizeImage(file, 56, 56, desc_small); ImageUtil.resizeImage(file, 217, 190, desc_middle); } res = "@admin_productImage_list?pid="+pid; } catch (FileUploadException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return res; } @Override public String delete(HttpServletRequest request, HttpServletResponse respone, Page page) { int id = Integer.parseInt(request.getParameter("piid")); boolean result = false; String str = ""; ProductImage image = productImageDAO.get(id); productImageDAO.delete(id); String type = image.getType(); type=type.substring(type.indexOf("_")+1); type.replace(type.charAt(0),type.toUpperCase().charAt(0)); // System.out.println(type); String path = request.getServletContext().getRealPath("img/product"+type); ImageUtil.delFile(path,id); if(type.equals(ProductImageDAO.type_single)) { String path1 = request.getServletContext().getRealPath("img/product"+type+"_small"); ImageUtil.delFile(path,id); String path2 = request.getServletContext().getRealPath("img/product"+type+"_middle"); ImageUtil.delFile(path,id); } str = "@admin_productImage_list?cid="+image.getProduct().getCategory().getId()+"&pid="+image.getProduct().getId(); return str; } @Override public String edit(HttpServletRequest request, HttpServletResponse response, Page page) { return null; } @Override public String update(HttpServletRequest request, HttpServletResponse response, Page page) { return null; } @Override public String list(HttpServletRequest request, HttpServletResponse response, Page page) { int start = page.getStart(); int count = page.getCount(); int pid = Integer.parseInt(request.getParameter("pid")); int total = productImageDAO.getTotal(); page.setTotal(total); // System.out.println(start+"--"+count+"--"+total); Product product = productDAO.get(pid); List<ProductImage> images1 = productImageDAO.list(product,"type_single",start,count); List<ProductImage> images2 = productImageDAO.list(product,"type_detail",start,count); request.setAttribute("images1", images1); request.setAttribute("images2", images2); request.setAttribute("product",product); request.setAttribute("page", page); return "jsp/admin/listProductImage.jsp"; } }
5,216
0.61714
0.612922
133
38.218044
26.149178
122
false
false
0
0
0
0
0
0
0.947368
false
false
15
1d02c9681ecf2a85f80ce000199abb2f2febef86
37,589,553,789,824
04bed7422f3764e3828e3cfa0582abdef1b16958
/src/devisor/grid/trianglemeshrepair/TreePopupRemoveMouseListener.java
a7f466cb3eb59cab376f7840633079fe9c858459
[]
no_license
rmuenste/grid3
https://github.com/rmuenste/grid3
4fc885445c5b45f19c62082f47db59fa2142d36e
2d981e84e2ed8a4bf0bc33670d0607d3ba4ad0f3
HEAD
2018-01-10T19:40:04.923000
2016-01-24T12:49:19
2016-01-24T12:49:19
50,287,651
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package devisor.grid.trianglemeshrepair; import devisor.foundation.base.DomainItem; import devisor.foundation.domain.Domain; import devisor.grid.main.DomainManager; import java.awt.event.*; import javax.swing.*; import javax.swing.tree.*; /** * This class manages popup menu creation and subsequent tree and domain changes * for popup menus with REMOVE entry. * * @author dom */ class TreePopupRemoveMouseListener implements MouseListener, ActionListener { private JTree tree; private Domain domain; private DefaultMutableTreeNode node; private Object target; public TreePopupRemoveMouseListener(JTree tree, Domain domain) { this.tree = tree; this.domain = domain; } public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { // figure out what was hit TreePath path = tree.getPathForLocation(e.getX(), e.getY()); node = (DefaultMutableTreeNode) path.getLastPathComponent(); target = node.getUserObject(); if (target instanceof String) return; // display popup menu JPopupMenu menu = new JPopupMenu(); JMenuItem item = new JMenuItem("Set focus to this element..."); item.setActionCommand("FOCUS"); item.addActionListener(this); menu.add(item); item = new JMenuItem("Remove this node from the domain..."); item.addActionListener(this); item.setActionCommand("REMOVE"); menu.add(item); menu.show(tree, e.getX(), e.getY()); } } public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("FOCUS")) { DomainManager.sharedInstance().setFocusTo(domain, target); return; } else if (e.getActionCommand().equals("REMOVE")) { domain.remove((DomainItem) target); node.setUserObject("REMOVED"); tree.repaint(); } } }
UTF-8
Java
2,246
java
TreePopupRemoveMouseListener.java
Java
[ { "context": " for popup menus with REMOVE entry.\n * \n * @author dom\n */\nclass TreePopupRemoveMouseListener implements", "end": 382, "score": 0.9839614629745483, "start": 379, "tag": "USERNAME", "value": "dom" } ]
null
[]
package devisor.grid.trianglemeshrepair; import devisor.foundation.base.DomainItem; import devisor.foundation.domain.Domain; import devisor.grid.main.DomainManager; import java.awt.event.*; import javax.swing.*; import javax.swing.tree.*; /** * This class manages popup menu creation and subsequent tree and domain changes * for popup menus with REMOVE entry. * * @author dom */ class TreePopupRemoveMouseListener implements MouseListener, ActionListener { private JTree tree; private Domain domain; private DefaultMutableTreeNode node; private Object target; public TreePopupRemoveMouseListener(JTree tree, Domain domain) { this.tree = tree; this.domain = domain; } public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { // figure out what was hit TreePath path = tree.getPathForLocation(e.getX(), e.getY()); node = (DefaultMutableTreeNode) path.getLastPathComponent(); target = node.getUserObject(); if (target instanceof String) return; // display popup menu JPopupMenu menu = new JPopupMenu(); JMenuItem item = new JMenuItem("Set focus to this element..."); item.setActionCommand("FOCUS"); item.addActionListener(this); menu.add(item); item = new JMenuItem("Remove this node from the domain..."); item.addActionListener(this); item.setActionCommand("REMOVE"); menu.add(item); menu.show(tree, e.getX(), e.getY()); } } public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("FOCUS")) { DomainManager.sharedInstance().setFocusTo(domain, target); return; } else if (e.getActionCommand().equals("REMOVE")) { domain.remove((DomainItem) target); node.setUserObject("REMOVED"); tree.repaint(); } } }
2,246
0.621549
0.621104
76
28.552631
22.982485
80
false
false
0
0
0
0
0
0
0.5
false
false
15
e15e49356c2a95330d801b92f97fa60b50896cd7
38,740,605,048,510
15271dfd2e026513ac3ed34db433409d17a75d03
/app/src/main/java/com/oxilo/oioindia/view/fragments/HelpFragment.java
223b10c0c97ac383658c1d0c11554abac28cf4a0
[]
no_license
yaju1234/partha1
https://github.com/yaju1234/partha1
e6cb6ccaf3ae2e67068800edd26794b0c225f44d
f14f5f0f2b042842df74f1d63f38129b2a5c20c9
refs/heads/master
2018-09-16T08:24:07.744000
2018-06-07T02:43:41
2018-06-07T02:43:41
120,775,028
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.oxilo.oioindia.view.fragments; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.AppCompatButton; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.TextView; import com.oxilo.oioindia.AppController; import com.oxilo.oioindia.R; import com.oxilo.oioindia.handlers.CustomSSLSocketFactory; import com.oxilo.oioindia.handlers.CustomX509TrustManager; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntity; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import java.security.SecureRandom; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; public class HelpFragment extends Fragment { public HelpFragment() { // Required empty public constructor } // TODO: Rename and change types and number of parameters public static HelpFragment newInstance() { HelpFragment fragment = new HelpFragment(); Bundle args = new Bundle(); // args.putString(ARG_PARAM1, param1); //args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_help, container, false); Toolbar toolbar = (Toolbar) v.findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { getActivity().getSupportFragmentManager().popBackStack(); } }); return v; } }
UTF-8
Java
2,632
java
HelpFragment.java
Java
[]
null
[]
package com.oxilo.oioindia.view.fragments; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.AppCompatButton; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.TextView; import com.oxilo.oioindia.AppController; import com.oxilo.oioindia.R; import com.oxilo.oioindia.handlers.CustomSSLSocketFactory; import com.oxilo.oioindia.handlers.CustomX509TrustManager; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ClientConnectionManager; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.conn.ssl.SSLSocketFactory; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntity; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import java.security.SecureRandom; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; public class HelpFragment extends Fragment { public HelpFragment() { // Required empty public constructor } // TODO: Rename and change types and number of parameters public static HelpFragment newInstance() { HelpFragment fragment = new HelpFragment(); Bundle args = new Bundle(); // args.putString(ARG_PARAM1, param1); //args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_help, container, false); Toolbar toolbar = (Toolbar) v.findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { getActivity().getSupportFragmentManager().popBackStack(); } }); return v; } }
2,632
0.729103
0.725304
93
27.301075
22.748642
76
false
false
0
0
0
0
0
0
0.548387
false
false
15
9b16c209c9c5ab1a2f5b027124949df2f89462e7
35,381,940,611,173
fd3f437280714ddfc81d511d4b4e0f25da1c627f
/app/src/main/java/com/example/lijiapeng20190218_zhoukao1/retrofitutils/RetrofitService.java
710b89b2d29be13195e61155162a90105282df72
[]
no_license
18201119203/mastitem
https://github.com/18201119203/mastitem
d5ed368a2db897a070cb2c0cd9a96061c21e4053
40605b31babe9bd2482d4369132bfb25ccfed239
refs/heads/master
2020-04-23T15:35:18.427000
2019-02-18T11:19:08
2019-02-18T11:19:08
171,270,629
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.lijiapeng20190218_zhoukao1.retrofitutils; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Url; public interface RetrofitService { @GET Call<ResponseBody> getReg(@Url String url); }
UTF-8
Java
264
java
RetrofitService.java
Java
[]
null
[]
package com.example.lijiapeng20190218_zhoukao1.retrofitutils; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Url; public interface RetrofitService { @GET Call<ResponseBody> getReg(@Url String url); }
264
0.795455
0.746212
11
23
18.954491
61
false
false
0
0
0
0
0
0
0.545455
false
false
15