blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
2ff96d802e605bd185edb29532e661b221bee5e4
1c78aa4295ecbb93630ca79912f47c7f386d7361
/gulimall-order/src/main/java/com/atguigu/gulimall/order/service/OrderSettingService.java
cd59cb7d8490a2e93781f228a74f4e0401e08f4d
[ "Apache-2.0" ]
permissive
zhixun996/gulimall-service
c01b5250074a9fea94b4505561446b3d0970f17f
63372f15ac16ba478237aa85abceba6a45d3b1bf
refs/heads/master
2022-12-18T21:12:06.783448
2020-09-13T15:49:28
2020-09-13T15:49:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.atguigu.gulimall.order.service; import com.baomidou.mybatisplus.extension.service.IService; import com.atguigu.common.utils.PageUtils; import com.atguigu.gulimall.order.entity.OrderSettingEntity; import java.util.Map; /** * 订单配置信息 * * @author xuxing * @email [email protected] * @date 2020-06-07 19:51:35 */ public interface OrderSettingService extends IService<OrderSettingEntity> { PageUtils queryPage(Map<String, Object> params); }
e8b97775f17d25f945f17901e8fe438202372e5a
696a1e136540be22e427b7726e8c9932a9770989
/Bit_Manipulation/201/Solution.java
239cae16b9dae37c0e7b1e2af48a7626b0369f00
[]
no_license
yangmei555/LeetCode-Solutions
4ee574a26b1559c18816f199cd03af239c16dad5
c29e7d4cba68cebaa34635f5c42bd20d77705cf6
refs/heads/master
2021-05-25T12:01:40.361095
2019-02-24T04:55:34
2019-02-24T04:55:34
127,357,115
0
0
null
null
null
null
UTF-8
Java
false
false
870
java
class Solution { public int rangeBitwiseAnd(int m, int n) { int res = 0, mask = 0; for (int i = 31; i >= 0; i--) { mask = 1 << i; if ((m & mask) != 0 && (n & mask) != 0) res += mask; if ((m & mask) == 0 && (n & mask) != 0) break; } return res; } } class Solution { public int rangeBitwiseAnd(int m, int n) { int res = 0, mask = 1; while (m != n && m != 0) { m >>= 1; n >>= 1; mask <<= 1; } return m * mask; } } class Solution { public int rangeBitwiseAnd(int m, int n) { return m == n ? m : rangeBitwiseAnd(m/2, n/2) << 1; } } class Solution { public int rangeBitwiseAnd(int m, int n) { while (m < n) n &= (n-1); return n; } }
8ae925b79c4e3cd73bf13ef64f0dfcb5d590a761
deeb9768678ff5217286a507e89102004ba6743d
/SPLjava/src/spl/SPL_SettingsIBEA.java
744e6c4998eb108bbb23b3a7b9801f39836ae904
[]
no_license
ai-se/SPL
3259874ea3cbb123f7b51da988230216c89a7788
b287a64526514e842b27f9c378b8d01fc3e14b0d
refs/heads/master
2020-04-12T01:39:35.919988
2016-10-10T19:15:26
2016-10-10T19:15:26
44,613,155
2
1
null
2016-05-02T16:33:12
2015-10-20T14:47:14
Python
UTF-8
Java
false
false
14,255
java
/* * Author : Christopher Henard ([email protected]) * Date : 01/03/14 * Copyright 2013 University of Luxembourg – Interdisciplinary Centre for Security Reliability and Trust (SnT) * All rights reserved * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package spl; import jmetal.core.Algorithm; import jmetal.core.Operator; import jmetal.experiments.Settings; import jmetal.metaheuristics.ibea.IBEA; import jmetal.operators.selection.BinaryTournament; import jmetal.util.JMException; import jmetal.util.comparators.FitnessComparator; import java.util.HashMap; import java.util.List; import jmetal.core.Problem; /** * Settings class of algorithm IBEA */ public class SPL_SettingsIBEA extends Settings { public int populationSize_; public int maxEvaluations_; public int archiveSize_; public double mutationProbability_; public double crossoverProbability_; public double crossoverDistributionIndex_; public double mutationDistributionIndex_; /** * Constructor */ public SPL_SettingsIBEA(Problem p) { super(p.getName()); problem_ = p; // Default experiments.settings } // IBEA_Settings public Algorithm configureASE2013(long maxRunTimeMS) throws JMException { populationSize_ = 300; archiveSize_ = 300; mutationProbability_ = 0.001; crossoverProbability_ = 0.05; Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; HashMap parameters; // Operator parameters algorithm = new SATIBEA_IBEATimeLimited(problem_,maxRunTimeMS); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new BitFlipMutation(parameters); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } public Algorithm configureIBEASEED(int maxEvaluations_) throws JMException { populationSize_ = 300; archiveSize_ = 300; mutationProbability_ = 0.001; crossoverProbability_ = 0.05; Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; HashMap parameters; // Operator parameters algorithm = new IBEA(problem_); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new BitFlipMutation(parameters); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } public Algorithm configureICSE15(long maxRunTimeMS, String fm, int numFeat, List<List<Integer>> constr) throws JMException { // The configureSATIBEA with time limitation populationSize_ = 300; archiveSize_ = 300; mutationProbability_ = 0.001; crossoverProbability_ = 0.05; Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; HashMap parameters; // Operator parameters algorithm = new SATIBEA_IBEATimeLimited(problem_,maxRunTimeMS); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new SATIBEA_NewMutation(parameters, fm, numFeat, constr); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } public Algorithm configureSATIBEA(int maxEvaluation, String fm, int numFeat, List<List<Integer>> constr) throws JMException { populationSize_ = 300; archiveSize_ = 300; maxEvaluations_ = maxEvaluation; mutationProbability_ = 0.001; crossoverProbability_ = 0.05; Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; HashMap parameters; // Operator parameters algorithm = new IBEA(problem_); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new SATIBEA_NewMutation(parameters, fm, numFeat, constr); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } public Algorithm configureICSE2013(int maxEvaluations_) throws JMException { populationSize_ = 100; //maxEvaluations_ = 1000; archiveSize_ = 100; mutationProbability_ = 0.05; crossoverProbability_ = 0.9; Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; HashMap parameters; // Operator parameters algorithm = new IBEA(problem_); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new BitFlipMutation(parameters); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } // configure public Algorithm configureSIPIBEA(int maxEvaluations_) throws JMException { populationSize_ = 100; //maxEvaluations_ = 1000; archiveSize_ = 100; mutationProbability_ = 0.05; crossoverProbability_ = 0.9; Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; HashMap parameters; // Operator parameters algorithm = new SIP_IBEA(problem_); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new BitFlipMutation(parameters); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } // configure // public Algorithm configureTest(int maxEvaluations_) throws JMException { // // populationSize_ = 100; // //maxEvaluations_ = 1000; // archiveSize_ = 100; // // mutationProbability_ = 0.05; // crossoverProbability_ = 0.9; // // Algorithm algorithm; // Operator selection; // Operator crossover; // Operator mutation; // // HashMap parameters; // Operator parameters // // algorithm = new TT_I(problem_); // // // Algorithm parameters // algorithm.setInputParameter("populationSize", populationSize_); // algorithm.setInputParameter("maxEvaluations", maxEvaluations_); // algorithm.setInputParameter("archiveSize", archiveSize_); // // // Mutation and Crossover for Real codification // parameters = new HashMap(); // parameters.put("probability", crossoverProbability_); // crossover = new SPL_SinglePointCrossover(parameters); // // parameters = new HashMap(); // parameters.put("probability", mutationProbability_); // mutation = new BitFlipMutation(parameters); // // /* Selection Operator */ // parameters = new HashMap(); // parameters.put("comparator", new FitnessComparator()); // selection = new BinaryTournament(parameters); // // // Add the operators to the algorithm // algorithm.addOperator("crossover", crossover); // algorithm.addOperator("mutation", mutation); // algorithm.addOperator("selection", selection); // // return algorithm; // } // configure /** * Configure IBEA with user-defined parameter experiments.settings * * @return A IBEA algorithm object * @throws jmetal.util.JMException */ public Algorithm configure() throws JMException { Algorithm algorithm; Operator selection; Operator crossover; Operator mutation; populationSize_ = 100; maxEvaluations_ = 1000; archiveSize_ = 100; mutationProbability_ = 0.05; crossoverProbability_ = 0.9; HashMap parameters; // Operator parameters algorithm = new IBEA(problem_); // Algorithm parameters algorithm.setInputParameter("populationSize", populationSize_); algorithm.setInputParameter("maxEvaluations", maxEvaluations_); algorithm.setInputParameter("archiveSize", archiveSize_); // Mutation and Crossover for Real codification parameters = new HashMap(); parameters.put("probability", crossoverProbability_); crossover = new SPL_SinglePointCrossover(parameters); parameters = new HashMap(); parameters.put("probability", mutationProbability_); mutation = new BitFlipMutation(parameters); /* Selection Operator */ parameters = new HashMap(); parameters.put("comparator", new FitnessComparator()); selection = new BinaryTournament(parameters); // Add the operators to the algorithm algorithm.addOperator("crossover", crossover); algorithm.addOperator("mutation", mutation); algorithm.addOperator("selection", selection); return algorithm; } // configure } // IBEA_Settings
5fdb9e947801d42a9c8cbaf06972f7bc997b512b
0b200e6f6fe24e81e9be8de4189328ef6cf398f3
/src/test/java/projSpecificUtilities/Rethink_query.java
f95c1c09dc5b5d057cd1cc4dceb95e9541bb0590
[]
no_license
devx359/Fanta
76d6f99d36f46590c6799d4aa13a47c9acf190bc
bc2d5940d2cf7ab3d803f4e5e0c429c04a4a7b91
refs/heads/master
2022-07-15T09:42:34.038737
2019-06-06T13:53:36
2019-06-06T13:53:36
159,177,067
1
0
null
2022-06-29T17:04:46
2018-11-26T13:50:30
Java
UTF-8
Java
false
false
16,882
java
package projSpecificUtilities; import java.util.Map; import com.jayway.jsonpath.JsonPath; import com.rethinkdb.RethinkDB; import com.rethinkdb.net.Connection; import com.rethinkdb.net.Cursor; import config.PathUtility; public class Rethink_query { Connection conn; RethinkDB r; String node_tsk_id = null; String task_code = null; String reques_id = null; String user_code = null; String response_status = "Submit"; String Reqstatus = null; public Rethink_query() { r = RethinkDB.r; // conn = // r.connection().hostname("104.196.151.173").port(28015).authKey("passW0rd#123").connect(); conn = r.connection().hostname(PathUtility.RethinkUrl).port(PathUtility.RethinkPort) .authKey(PathUtility.RethinkPassword).connect(); } public void tableDelete(String jobCode) { try { r.db(PathUtility.RethinkDB).table("task_request").filter(r.hashMap("job_code", jobCode)).delete().run(conn); r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("job_code", jobCode)).delete() .run(conn); r.db(PathUtility.RethinkDB).table("node_wise_task_data").filter(r.hashMap("job_code", jobCode)).delete() .run(conn); //r.db(PathUtility.RethinkDB).table("user_task").filter(r.hashMap("job_code", jobCode)).delete().run(conn); //r.db(PathUtility.RethinkDB).table("task_response").filter(r.hashMap("job_code", jobCode)).delete().run(conn); r.db(PathUtility.RethinkDB).table("analytics").filter(r.hashMap("job_code", jobCode)).delete().run(conn); r.db(PathUtility.RethinkDB).table("task_ready_counter").filter(r.hashMap("job_code", jobCode)).delete() .run(conn); r.db(PathUtility.RethinkDB).table("user_task_log").filter(r.hashMap("job_code", jobCode)).delete() .run(conn); System.out.println("All Rethinks tables 1)main_task_list 2)task_request 3)node_wise_task_data 4)analytics 5)task_ready_counter 6)user_task_log for job code: "+jobCode+" truncated"); } catch (Exception e) { System.out.println("Rethink table truncate issue " + e); } } public Object task_request_node_task_id_extract2(String jobcode, String node, String usercode) { Object result = null; String Reqstatus = "dumb"; int time = 0; while (!Reqstatus.equalsIgnoreCase("dispatched") && (time < 60000)) { // wait max 1 minute for task to be // dispatched // System.out.println("Checking Task request table for any dispatched task.."); try { Cursor cur2 = r .db(PathUtility.RethinkDB).table("task_request").filter(r.hashMap("user_code", usercode) .with("job_code", jobcode).with("node_id", node).with("status", "dispatched")) .run(conn); for (Object doc2 : cur2) { Map map1 = (Map) doc2; Reqstatus = map1.get("status").toString(); System.out.println("reqstatus " + Reqstatus); if (Reqstatus.equalsIgnoreCase("dispatched")) { node_tsk_id = map1.get("node_task_id").toString(); } result = doc2; } System.out.println("Waiting 3sec for task to be dispatched in task Request table.."); Thread.sleep(3000); time = time + 3000; } catch (Exception e) { e.printStackTrace(); System.out.println("Unable to get node_tsk_id from task_request table"); } } if (time >= 60000) { System.out.println("No Tasks were dispatched"); } return result; } public Object task_request_node_task_id_extract(String Request_id) { Object result = null; Reqstatus = "pending"; try { System.out.println("reth1"); Cursor cur2 = r.db(PathUtility.RethinkDB).table("task_request").filter(r.hashMap("request_id", Request_id)) .run(conn); for (Object doc2 : cur2) { Map map1 = (Map) doc2; Reqstatus = map1.get("status").toString(); System.out.println("reqstatus " + Reqstatus); if (Reqstatus.equalsIgnoreCase("dispatched")) { node_tsk_id = map1.get("node_task_id").toString(); } result = doc2; } while (Reqstatus.equalsIgnoreCase("pending")) { Cursor cur1 = r.db(PathUtility.RethinkDB).table("task_request") .filter(r.hashMap("request_id", Request_id)).run(conn); System.out.println("reth4"); for (Object doc1 : cur1) { System.out.println("reth4a"); Map map = (Map) doc1; Reqstatus = map.get("status").toString(); System.out.println("reqstatus " + Reqstatus); if (Reqstatus.equalsIgnoreCase("dispatched")) { node_tsk_id = map.get("node_task_id").toString(); } result = doc1; System.out.println( "Querying for Task request status to change for Request_ID: " + Request_id + "..."); } } } catch (Exception e) { System.out.println("Unable to get node_tsk_id from task_request table"); // result=false; } return result; } public Object task_request(String Request_id) { Object result = null; try { Cursor cur1 = r.db(PathUtility.RethinkDB).table("task_request").filter(r.hashMap("request_id", Request_id)) .run(conn); for (Object doc1 : cur1) { // System.out.println("Task Request Table " + doc1.toString() + " for " + // user_code); Map map = (Map) doc1; node_tsk_id = map.get("node_task_id").toString(); result = doc1; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("task_request Rethink query error or data not found"); } return result; } // Node wise task data details public Object node_wise_task_data(String Request_id) { Object result = null; try { Cursor cur33 = r.db(PathUtility.RethinkDB).table("node_wise_task_data") .filter(r.hashMap("request_id", Request_id)) .map(val -> val.toJson()).run(conn); for (Object doc1 : cur33) { result = doc1; String res = doc1.toString(); task_code = JsonPath.read(res, "$.task_code"); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("node_wise_task_data Rethink query error or data not found"); } return result; } public Object main_task_list() { Object result = null; try { Cursor cur4 = r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("task_code", task_code)) .map(val -> val.toJson()).run(conn); for (Object doc1 : cur4) { // System.out.println("Table main_task_list data " + doc1.toString() + " for " + // user_code); // Map map= (Map) doc1; // task_code=map.get("task_code").toString(); // node_tsk_id=doc1.toString(); result = doc1; } } catch (Exception e) { e.printStackTrace(); System.out.println("main_task_list Rethink query error or data not found"); } return result; } public Object main_task_list(String task_code) { Object result = null; try { Cursor cur4 = r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("task_code", task_code)) .map(val -> val.toJson()).run(conn); if (cur4.hasNext() == false) { result = "no_data"; } else { for (Object doc1 : cur4) { result = doc1; } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("main_task_list Rethink query error or data not found"); } return result; } public Object node_wise_task_data_usingNodeTaskId(String node_task_id) { Object result = null; try { Cursor cur4 = r.db(PathUtility.RethinkDB).table("node_wise_task_data") .filter(r.hashMap("node_task_id", node_task_id)).map(val -> val.toJson()).run(conn); if (cur4.hasNext() == false) { result = "no_data"; } else { for (Object doc1 : cur4) { result = doc1; } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("main_task_list Rethink query error or data not found"); } return result; } public Object task_request_usingNodeTaskId(String node_task_id) { Object result = null; try { Cursor cur4 = r.db(PathUtility.RethinkDB).table("task_request") .filter(r.hashMap("node_task_id", node_task_id)).map(val -> val.toJson()).run(conn); if (cur4.hasNext() == false) { result = "no_data"; } else { for (Object doc1 : cur4) { result = doc1; } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("main_task_list Rethink query error or data not found"); } return result; } public Object task_response_usingNodeTaskId(String node_task_id) { Object result = null; try { Cursor cur4 = r.db(PathUtility.RethinkDB).table("task_response") .filter(r.hashMap("node_task_id", node_task_id)).map(val -> val.toJson()).run(conn); if (cur4.hasNext() == false) { result = "no_data"; } else { for (Object doc1 : cur4) { result = doc1; } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("main_task_list Rethink query error or data not found"); } return result; } // user_task table public Object user_task() { Object result = null; try { Cursor cur5 = r.db(PathUtility.RethinkDB).table("user_task").filter(r.hashMap("node_task_id", node_tsk_id)) // .map(val -> val.toJson()) .run(conn); for (Object doc1 : cur5) { result = doc1; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("user_task Rethink query error or data not found"); } return result; } // task response public Object task_response() { Object result = null; try { Cursor cur6 = r.db(PathUtility.RethinkDB).table("task_response") .filter(r.hashMap("node_task_id", node_tsk_id)).run(conn); for (Object doc1 : cur6) { result = doc1; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("task_response Rethink query error or data not found"); } return result; } public Object task_response_with_status_change_processed(String SubmitType) { Object result = null; response_status = "Submit"; String statusToCheck = null; if (SubmitType.equalsIgnoreCase("p_submit")) { statusToCheck = "p_submit"; } else { statusToCheck = "processed"; } try { while (!response_status.equalsIgnoreCase(statusToCheck)) { Cursor cur6 = r.db(PathUtility.RethinkDB).table("task_response") .filter(r.hashMap("node_task_id", node_tsk_id)).run(conn); for (Object doc1 : cur6) { System.out.println("Querying task_response table for change of status for " + reques_id + " node_tsk_id:" + node_tsk_id + "......"); Map map = (Map) doc1; response_status = map.get("status").toString(); result = doc1; Thread.sleep(5000);// wait for 5 seconds before checking again } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("task_response_with_status_change_processed Rethink query error or data not found"); } return result; } public Object task_response_with_status_change_processed_GiveUp() { Object result = null; response_status = "give_up"; try { while (response_status.equalsIgnoreCase("give_up")) { Cursor cur6 = r.db(PathUtility.RethinkDB).table("task_response") .filter(r.hashMap("node_task_id", node_tsk_id)).run(conn); for (Object doc1 : cur6) { System.out.println("Querying task_response table for change of status for " + reques_id + " node_tsk_id:" + node_tsk_id + "......"); Map map = (Map) doc1; response_status = map.get("status").toString(); result = doc1; Thread.sleep(5000);// wait for 5 seconds before checking again } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("task_response_with_status_change_processed Rethink query error or data not found"); } return result; } /* * String OpOrQc pass :either OP or QC as value String nodeId pass :node id for * example c6 or c10 String Requiredkey :pass the json key for example * node_status,distribute_count etc String RequiredStatus :Desired status you * need to find count of for example bufferer ,ready ,delivered */ public int main_task_list_status_count(String JobCode, String nodeId, int nodenumber, String Requiredkey, String RequiredStatus) { int result = 0; String status = null; int count = 0; int i = 0; /* * if (OpOrQc.equalsIgnoreCase("qc")) { i = 1; } */ i = nodenumber; // This is just for json path used below try { Cursor cursor = r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("job_code", JobCode)) .pluck("dependency_table").map(val -> val.toJson()).run(conn); for (Object doc : cursor) { // System.out.println(doc.toString()); String str = doc.toString(); status = JsonPath.read(str, "$.dependency_table.[" + i + "]." + nodeId + "." + Requiredkey); if (status.equalsIgnoreCase(RequiredStatus)) { count++; } } } catch (Exception e) { e.printStackTrace(); } result = count; return result; } // Counts Number of tasks in Rethink public int main_task_list_job_count(String JobCode_TaskCode_MasterTaskCode) { int count = 99; try { if(JobCode_TaskCode_MasterTaskCode.startsWith("JC-")) { String JobCode=JobCode_TaskCode_MasterTaskCode; Object cursor = r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("job_code", JobCode)) .count().run(conn); count = Integer.parseInt(cursor.toString()); } if(JobCode_TaskCode_MasterTaskCode.startsWith("TC-")) { String task_code=JobCode_TaskCode_MasterTaskCode; Object cursor = r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("task_code", task_code)) .count().run(conn); count = Integer.parseInt(cursor.toString()); } if(JobCode_TaskCode_MasterTaskCode.startsWith("TM-")) { String task_master_id=JobCode_TaskCode_MasterTaskCode; Object cursor = r.db(PathUtility.RethinkDB).table("main_task_list").filter(r.hashMap("task_master_id", task_master_id)) .count().run(conn); count = Integer.parseInt(cursor.toString()); } } catch (Exception e) { e.printStackTrace(); } return count; } public String main_task_list_QCnode_status(String task_code, String nodeId) { String status = null; int i = 1; try { Cursor cursor = r.db(PathUtility.RethinkDB).table("main_task_list") .filter(r.hashMap("task_code", task_code)).pluck("dependency_table").map(val -> val.toJson()) .run(conn); for (Object doc : cursor) { String str = doc.toString(); status = JsonPath.read(str, "$.dependency_table.[" + i + "]." + nodeId + ".node_status"); } } catch (Exception e) { e.printStackTrace(); } return status; } //you can pass node_task_id or task_code public String main_task_list_status_check_with_TMid(String taskcodeOrNodetaskId, String nodeId,int nodeserial) { String status = null; int i = nodeserial; try { if(taskcodeOrNodetaskId.startsWith("NT-", 1)) { Cursor cur = r.db(PathUtility.RethinkDB).table("node_wise_task_data") .filter(r.hashMap("node_task_id", node_tsk_id)).pluck("task_code").map(val -> val.toJson()) .run(conn); for (Object doc : cur) { System.out.println(doc.toString()); // Map map1 = (Map) doc; String str = doc.toString(); task_code = JsonPath.read(str, "$.task_code" ); } Cursor cursor = r.db(PathUtility.RethinkDB).table("main_task_list") .filter(r.hashMap("task_code", task_code)).pluck("dependency_table").map(val -> val.toJson()) .run(conn); for (Object doc : cursor) { String str = doc.toString(); status = JsonPath.read(str, "$.dependency_table.[" + i + "]." + nodeId + ".node_status"); } } else { this.task_code=taskcodeOrNodetaskId; Cursor cursor = r.db(PathUtility.RethinkDB).table("main_task_list") .filter(r.hashMap("task_code", task_code)).pluck("dependency_table").map(val -> val.toJson()) .run(conn); for (Object doc : cursor) { String str = doc.toString(); status = JsonPath.read(str, "$.dependency_table.[" + i + "]." + nodeId + ".node_status"); } } } catch (Exception e) { e.printStackTrace(); } return status; } public String main_task_list_status_check_taskStatus(String task_code) { String status = null; try { Cursor cursor = r.db(PathUtility.RethinkDB).table("main_task_list") .filter(r.hashMap("task_code", task_code)).map(val -> val.toJson()).run(conn); for (Object doc : cursor) { System.out.println(doc.toString()); // Map map1 = (Map) doc; String str = doc.toString(); status = JsonPath.read(str, "$.task_status"); } } catch (Exception e) { e.printStackTrace(); } return status; } }
64a285e1322492f11eeda602d1d9ca57f0176357
6916ecf9dc37d4adbb44efb98ef76ea200bf951b
/Carlos/Carlos/obj/Release/80/android/src/md5499a6e3b6edc0cc5af5780076c2e1d37/RestRowViewHolder.java
c19356a871cd9ed5472e2e84fb4f97c85d6e4e17
[]
no_license
smrgillani/xamarin-pos-restaurant-ver-android
65fc5da42bca88a37619faf305fb0eee17a490e0
8d0716ec90abf9e46a3a6f8fc427ece1f73afede
refs/heads/main
2022-12-27T08:43:28.718310
2020-10-10T17:46:26
2020-10-10T17:46:26
302,957,981
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package md5499a6e3b6edc0cc5af5780076c2e1d37; public class RestRowViewHolder extends java.lang.Object implements mono.android.IGCUserPeer { /** @hide */ public static final String __md_methods; static { __md_methods = ""; mono.android.Runtime.register ("Carlos.RestRowViewHolder, Carlos", RestRowViewHolder.class, __md_methods); } public RestRowViewHolder () { super (); if (getClass () == RestRowViewHolder.class) mono.android.TypeManager.Activate ("Carlos.RestRowViewHolder, Carlos", "", this, new java.lang.Object[] { }); } private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
c60e463f5ecd3e8841280305c2ba11b144dad26f
0726590a47602f9a242c088d6908a2c70880ebf4
/app/src/androidTest/java/edu/csullivan/example/sequencegame/ExampleInstrumentedTest.java
c417bda0eac5fc2de1c99cd8cc676607ceda15c1
[]
no_license
Csullivan321/MadFinalProject
3fb0e26c591fe8dc13c609bef35712738d7de73e
672d960f6958eb829d0ab62d0f3a94d3dc5eda2f
refs/heads/master
2023-02-08T14:48:31.634420
2020-12-23T17:18:22
2020-12-23T17:18:22
323,945,928
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package edu.csullivan.example.sequencegame; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("edu.csullivan.example.sequencegame", appContext.getPackageName()); } }
30197f4dd1af19cd44e944436a2ed4a68bb90ae4
933e3aa63eb22624182e11eaada547c0a7ed56d4
/Source Code/commands/PrintDocumentation.java
53b0b86158aaffad5e6a30d5a1e9e0b227927c6a
[]
no_license
hemant3434/MockUnixShell
42e9d4d552c77bc9c644e0c0efac6a237a265fc1
198af2f41131152671d4b4ca05a814fec0659e68
refs/heads/master
2020-07-22T12:00:44.965432
2019-09-09T04:40:34
2019-09-09T04:40:34
207,195,391
3
0
null
null
null
null
UTF-8
Java
false
false
7,325
java
package commands; import fileSystem.FileSystemDriver; import stackSystem.StackDriver; /** * Represents the man command in the mock UNIX shell */ public class PrintDocumentation implements Command { /** * {@inheritDoc} * * Represents the man command. * */ @Override public String execute(String[] cmd, FileSystemDriver drive, RecentCommands history, StackDriver stack) { String manString = cmd[0] + "\n"; String input = ""; if (cmd.length > 2) { return "ERROR: Invalid Paramaters."; } else if (cmd.length > 1) { input = cmd[1]; manString = manString + cmd[1] + "\n"; } else { return "ERROR: Missing command."; } if (input.equals("man") || input.equals("echo") || input.equals("get")) { manString = manString + manualManEchoGet(input); } else if (input.equals("exit") || input.equals("mkdir") || input.equals("save")) { manString = manString + manualExitMkdirSave(input); } else if (input.equals("cd") || input.equals("ls") || input.equals("load")) { manString = manString + manualCdLsLoad(input); } else if (input.equals("pwd") || input.equals("pushd") || input.equals("find")) { manString = manString + manualPwdPushdFind(input); } else if (input.equals("popd") || input.equals("history") || input.equals("tree")) { manString = manString + manualPopdHistoryTree(input); } else if (input.equals("cat") || input.equals("mv") || input.equals("cp")) { manString = manString + manualCatMvCp(input); } else { return "ERROR: Inputted command is not in manual."; } return manString; } /** * Returns the manual for redirection. * * @return A string containing redirection */ private String manualOutfile() { return ("> OUTFILE, >> OUTFILE" + "\n" + "> OUTFILE: Replace file contents with STRING." + "\n" + ">> OUTFILE: Append STRING to file contents." + "\n" + "If command does not return a string, does not create OUTFILE." + "\n"); } /** * Checks the input, then returns either the correct manual. * * @param input A string containing either "man" or "echo" or "get" * @return A string containing the correct manual */ private String manualManEchoGet(String input) { if (input.equals("man")) { return ("Print documentation for inputted command." + "\n" + manualOutfile()); } else if (input.equals("echo")) { return ("Prints the inputted string." + "\n" + manualOutfile()); } else { return ("Retrives file at given URL and adds it to the current working directory." + "\n" + manualOutfile()); } } /** * Checks the input, then returns either the correct manual. * * @param input A string containing either "exit" or "mkdir" or "save" * @return A string containing the correct manual */ private String manualExitMkdirSave(String input) { if (input.equals("exit")) { return ("Quit the program." + "\n"); } else if (input.equals("mkdir")) { return ("Creates a directory relative to current diectory or in a given path." + "\n" + manualOutfile()); } else { return ("Saves the current state of the shell into an actual file in your computer." + " This file can then be later loaded with load." + "\n" + manualOutfile()); } } /** * Checks the input, then returns either the correct manual. * * @param input A string containing either "cd" or "ls" or "load" * @return A string containing the correct manual */ private String manualCdLsLoad(String input) { if (input.equals("cd")) { return ("Change directory relative to current directory or full path." + "\n" + manualOutfile()); } else if (input.equals("ls")) { return ("If no paths are given, print the contents of file or " + "current directory." + "\n" + "If a path is given, if" + " the path specifies a file, print the name of file" + "\n" + "If a path is given and it is a directory, " + "prints the name of the directory, and its contents" + "\n" + "If -R is present, recurively list all subdirectories." + "\n" + manualOutfile()); } else { return ("Loads the state of the shell from a file on your computer." + " This command is disabled if it is not the first command inputted into shell." + "\n" + manualOutfile()); } } /** * Checks the input, then returns either the correct manual. * * @param input A string containing either "pwd" or "pushd" or "find" * @return A string containing the correct manual */ private String manualPwdPushdFind(String input) { if (input.equals("pwd")) { return ("Print current working directory (whole path)." + "\n" + manualOutfile()); } else if (input.equals("pushd")) { return ("Saves current working directory into a stack, then " + "change new current working directory to input." + "\n" + "If input directory does not exist, returns an error message." + "\n" + manualOutfile()); } else { return ("find path ... -type [f|d] -name expression" + "\n" + "Find will find files (given by type, f = file, d = directory) " + "in the given path(s) to find ALL the files with the inputted name." + "\n" + manualOutfile()); } } /** * Checks the input, then returns either the correct manual. * * @param input A string containing either "popd" or "history" or "tree" * @return A string containing the correct manual */ private String manualPopdHistoryTree(String input) { if (input.equals("popd")) { return ("Returns the topmost item in the pushd stack, then " + "changes the current directory to it." + "\n" + "If stack is empty, returns an error message." + "\n" + manualOutfile()); } else if (input.equals("history")) { return ("Returns the most recent commands done from inputted number" + "(if given). Otherwise, return all commands in history." + "\n" + manualOutfile()); } else { return ("Returns a tree diagram of the state of the shell, starting from root." + "\n" + manualOutfile()); } } /** * Checks the input, then returns either the correct manual. * * @param input A string containing either "cat" or "mv" or "cp" * @return A string containing the correct manual */ private String manualCatMvCp(String input) { if (input.equals("cat")) { return ("Displays contents of given file. If more than one file is " + "provided, also display those file contents, " + "seperated by line breaks." + "\n" + manualOutfile()); } else if (input.equals("mv")) { return ("mv OLDPATH NEWPATH" + "\n" + "Moves the file or directory given in OLDPATH" + "(including the files inside the directory itself) into NEWPATH. The file in " + "OLDPATH will no longer be there." + "\n" + manualOutfile()); } else { return ("cp OLDPATH NEWPATH" + "\n" + "Copies the file or directory given in OLDPATH" + "(including the directory itself if given, and the files inside directory) " + "into NEWPATH. The file in OLDPATH will still exist." + "\n" + manualOutfile()); } } }
bfe4295d2cbb7daf90bf2675cc3b62effd569dce
0c924da07ca254aab652b67532d8b7e57dc1cf52
/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/ComputeDeleteHistoricCaseInstanceIdsJobHandler.java
c380f1dc2446e93b8cbd0d4cd966707ef3e65e25
[ "Apache-2.0" ]
permissive
qiudaoke/flowable-engine
60c9e11346af7b0dcd35f06a18f66806903a4f88
1a755206b4ced583a77f5c247c7906652b201718
refs/heads/master
2022-12-22T16:27:19.408600
2022-02-22T16:03:08
2022-02-22T16:03:08
148,082,646
2
0
Apache-2.0
2018-09-18T08:01:34
2018-09-10T01:31:14
Java
UTF-8
Java
false
false
25,613
java
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.flowable.cmmn.engine.impl.delete; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.exception.ExceptionUtils; import org.flowable.batch.api.Batch; import org.flowable.batch.api.BatchPart; import org.flowable.batch.api.BatchService; import org.flowable.cmmn.api.history.HistoricCaseInstance; import org.flowable.cmmn.api.history.HistoricCaseInstanceQuery; import org.flowable.cmmn.engine.CmmnEngineConfiguration; import org.flowable.cmmn.engine.impl.util.CommandContextUtil; import org.flowable.common.engine.api.FlowableException; import org.flowable.common.engine.api.FlowableIllegalArgumentException; import org.flowable.common.engine.api.scope.ScopeTypes; import org.flowable.common.engine.impl.interceptor.CommandContext; import org.flowable.common.engine.impl.interceptor.EngineConfigurationConstants; import org.flowable.common.engine.impl.util.ExceptionUtil; import org.flowable.job.service.JobHandler; import org.flowable.job.service.JobService; import org.flowable.job.service.impl.history.async.AsyncHistoryDateUtil; import org.flowable.job.service.impl.persistence.entity.JobEntity; import org.flowable.variable.api.delegate.VariableScope; import org.flowable.variable.api.types.ValueFields; import org.flowable.variable.api.types.VariableType; import org.flowable.variable.service.impl.QueryOperator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; /** * @author Filip Hrisafov */ public class ComputeDeleteHistoricCaseInstanceIdsJobHandler implements JobHandler { public static final String TYPE = "compute-delete-historic-case-ids"; @Override public String getType() { return TYPE; } @Override public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) { CmmnEngineConfiguration engineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext); BatchService batchService = engineConfiguration.getBatchServiceConfiguration().getBatchService(); BatchPart batchPart = batchService.getBatchPart(configuration); if (batchPart == null) { throw new FlowableIllegalArgumentException("There is no batch part with the id " + configuration); } Batch batch = batchService.getBatch(batchPart.getBatchId()); JsonNode batchConfiguration = getBatchConfiguration(batch, engineConfiguration); boolean sequentialExecution = batchConfiguration.path("sequential").booleanValue(); JsonNode queryNode = batchConfiguration.path("query"); if (queryNode.isMissingNode()) { failBatchPart(engineConfiguration, batchService, batchPart, batch, prepareFailedResultAsJsonString("Batch configuration has no query definition", engineConfiguration), sequentialExecution); return; } JsonNode batchSizeNode = batchConfiguration.path("batchSize"); if (batchSizeNode.isMissingNode()) { failBatchPart(engineConfiguration, batchService, batchPart, batch, prepareFailedResultAsJsonString("Batch configuration has no batch size", engineConfiguration), sequentialExecution); return; } HistoricCaseInstanceQuery query; try { query = createQuery(queryNode, engineConfiguration); } catch (FlowableException exception) { failBatchPart(engineConfiguration, batchService, batchPart, batch, prepareFailedResultAsJsonString("Failed to create query", exception, engineConfiguration), sequentialExecution); return; } int batchSize = batchSizeNode.intValue(); int batchPartNumber = Integer.parseInt(batchPart.getSearchKey()); // The first result is the batch part number multiplied by the batch size // e.g. if this is the 5th batch part (batch part number 4) and the batch size is 100 the first result should start from 400 int firstResult = batchPartNumber * batchSize; List<HistoricCaseInstance> caseInstances = query.listPage(firstResult, batchSize); ObjectNode resultNode = engineConfiguration.getObjectMapper().createObjectNode(); ArrayNode idsToDelete = resultNode.putArray("caseInstanceIdsToDelete"); for (HistoricCaseInstance caseInstance : caseInstances) { idsToDelete.add(caseInstance.getId()); } BatchPart batchPartForDelete = engineConfiguration.getCmmnManagementService() .createBatchPartBuilder(batch) .type(DeleteCaseInstanceBatchConstants.BATCH_PART_DELETE_CASE_INSTANCES_TYPE) .searchKey(batchPart.getId()) .searchKey2(batchPart.getSearchKey()) .status(DeleteCaseInstanceBatchConstants.STATUS_WAITING) .create(); resultNode.put("deleteBatchPart", batchPartForDelete.getId()); if (sequentialExecution) { resultNode.put("sequential", true); // If the computation was sequential we need to schedule the next job List<BatchPart> nextComputeParts = engineConfiguration.getCmmnManagementService() .createBatchPartQuery() .batchId(batch.getId()) .status(DeleteCaseInstanceBatchConstants.STATUS_WAITING) .type(DeleteCaseInstanceBatchConstants.BATCH_PART_COMPUTE_IDS_TYPE) .listPage(0, 2); // We are only going to start deletion if the batch is not failed boolean startDeletion = !DeleteCaseInstanceBatchConstants.STATUS_FAILED.equals(batch.getStatus()); for (BatchPart nextComputePart : nextComputeParts) { if (!nextComputePart.getId().equals(batchPart.getId())) { startDeletion = false; JobService jobService = engineConfiguration.getJobServiceConfiguration().getJobService(); JobEntity nextComputeJob = jobService.createJob(); nextComputeJob.setJobHandlerType(ComputeDeleteHistoricCaseInstanceIdsJobHandler.TYPE); nextComputeJob.setJobHandlerConfiguration(nextComputePart.getId()); nextComputeJob.setScopeType(ScopeTypes.CMMN); jobService.createAsyncJob(nextComputeJob, false); jobService.scheduleAsyncJob(nextComputeJob); break; } } if (startDeletion) { JobService jobService = engineConfiguration.getJobServiceConfiguration().getJobService(); JobEntity nextDeleteJob = jobService.createJob(); nextDeleteJob.setJobHandlerType(DeleteHistoricCaseInstanceIdsJobHandler.TYPE); nextDeleteJob.setJobHandlerConfiguration(batchPartForDelete.getId()); nextDeleteJob.setScopeType(ScopeTypes.CMMN); jobService.createAsyncJob(nextDeleteJob, false); jobService.scheduleAsyncJob(nextDeleteJob); } } batchService.completeBatchPart(batchPart.getId(), DeleteCaseInstanceBatchConstants.STATUS_COMPLETED, resultNode.toString()); } private void failBatchPart(CmmnEngineConfiguration engineConfiguration, BatchService batchService, BatchPart batchPart, Batch batch, String resultJson, boolean sequentialExecution) { batchService.completeBatchPart(batchPart.getId(), DeleteCaseInstanceBatchConstants.STATUS_FAILED, resultJson); if (sequentialExecution) { completeBatch(batch, DeleteCaseInstanceBatchConstants.STATUS_FAILED, engineConfiguration); } } protected void completeBatch(Batch batch, String status, CmmnEngineConfiguration engineConfiguration) { engineConfiguration.getBatchServiceConfiguration() .getBatchService() .completeBatch(batch.getId(), status); } protected HistoricCaseInstanceQuery createQuery(JsonNode queryNode, CmmnEngineConfiguration engineConfiguration) { HistoricCaseInstanceQuery query = engineConfiguration.getCmmnHistoryService() .createHistoricCaseInstanceQuery(); populateQuery(queryNode, query, engineConfiguration); return query; } protected void populateQuery(JsonNode queryNode, HistoricCaseInstanceQuery query, CmmnEngineConfiguration engineConfiguration) { Iterator<Map.Entry<String, JsonNode>> fieldIterator = queryNode.fields(); while (fieldIterator.hasNext()) { Map.Entry<String, JsonNode> field = fieldIterator.next(); String property = field.getKey(); JsonNode value = field.getValue(); switch (property) { case "caseDefinitionId": query.caseDefinitionId(value.textValue()); break; case "caseDefinitionKey": query.caseDefinitionKey(value.textValue()); break; case "caseDefinitionKeys": query.caseDefinitionKeys(asStringSet(value)); break; case "caseDefinitionIds": query.caseDefinitionIds(asStringSet(value)); break; case "caseDefinitionName": query.caseDefinitionName(value.textValue()); break; case "caseDefinitionCategory": query.caseDefinitionCategory(value.textValue()); break; case "caseDefinitionVersion": query.caseDefinitionVersion(value.intValue()); break; case "caseInstanceId": query.caseInstanceId(value.textValue()); break; case "caseInstanceIds": query.caseInstanceIds(asStringSet(value)); break; case "caseInstanceNameLikeIgnoreCase": query.caseInstanceNameLikeIgnoreCase(value.textValue()); break; case "businessKey": query.caseInstanceBusinessKey(value.textValue()); break; case "businessStatus": query.caseInstanceBusinessStatus(value.textValue()); break; case "caseInstanceParentId": query.caseInstanceParentId(value.textValue()); break; case "withoutCaseInstanceParentId": if (value.booleanValue()) { query.withoutCaseInstanceParent(); } break; case "deploymentId": query.deploymentId(value.textValue()); break; case "deploymentIds": query.deploymentIds(asStringList(value)); break; case "finished": if (value.booleanValue()) { query.finished(); } break; case "unfinished": if (value.booleanValue()) { query.unfinished(); } break; case "startedBefore": query.startedBefore(AsyncHistoryDateUtil.parseDate(value.textValue())); break; case "startedAfter": query.startedAfter(AsyncHistoryDateUtil.parseDate(value.textValue())); break; case "finishedBefore": query.finishedBefore(AsyncHistoryDateUtil.parseDate(value.textValue())); break; case "finishedAfter": query.finishedAfter(AsyncHistoryDateUtil.parseDate(value.textValue())); break; case "startedBy": query.startedBy(value.textValue()); break; case "lastReactivatedBefore": query.lastReactivatedBefore(AsyncHistoryDateUtil.parseDate(value.textValue())); break; case "lastReactivatedAfter": query.lastReactivatedAfter(AsyncHistoryDateUtil.parseDate(value.textValue())); case "lastReactivatedBy": query.lastReactivatedBy(value.textValue()); break; case "callbackId": query.caseInstanceCallbackId(value.textValue()); break; case "callbackType": query.caseInstanceCallbackType(value.textValue()); break; case "withoutCallbackId": if (value.booleanValue()) { query.withoutCaseInstanceCallbackId(); } break; case "referenceId": query.caseInstanceReferenceId(value.textValue()); break; case "referenceType": query.caseInstanceReferenceType(value.textValue()); break; case "tenantId": query.caseInstanceTenantId(value.textValue()); break; case "withoutTenantId": if (value.booleanValue()) { query.caseInstanceWithoutTenantId(); } break; case "activePlanItemDefinitionId": query.activePlanItemDefinitionId(value.textValue()); break; case "activePlanItemDefinitionIds": query.activePlanItemDefinitionIds(asStringSet(value)); break; case "involvedUser": query.involvedUser(value.textValue()); break; case "involvedUserIdentityLink": query.involvedUser(value.path("userId").textValue(), value.path("type").textValue()); break; case "involvedGroups": query.involvedGroups(asStringSet(value)); break; case "involvedGroupIdentityLink": query.involvedUser(value.path("groupId").textValue(), value.path("type").textValue()); break; case "queryVariableValues": populateQueryVariableValues(value, query, engineConfiguration); break; case "orQueryObjects": populateOrQueryObjects(value, query, engineConfiguration); break; default: throw new FlowableIllegalArgumentException("Query property " + property + " is not supported"); } } } protected void populateOrQueryObjects(JsonNode orQueryObjectsNode, HistoricCaseInstanceQuery query, CmmnEngineConfiguration engineConfiguration) { if (orQueryObjectsNode.isArray()) { for (JsonNode orQueryObjectNode : orQueryObjectsNode) { HistoricCaseInstanceQuery orQuery = query.or(); populateQuery(orQueryObjectNode, orQuery, engineConfiguration); query.endOr(); } } } protected void populateQueryVariableValues(JsonNode variableValuesNode, HistoricCaseInstanceQuery query, CmmnEngineConfiguration engineConfiguration) { if (variableValuesNode.isArray()) { for (JsonNode variableValue : variableValuesNode) { String operatorString = variableValue.path("operator").asText(null); if (operatorString == null) { throw new FlowableIllegalArgumentException("The variable value does not contain an operator value"); } QueryOperator operator = QueryOperator.valueOf(operatorString); String variableName = variableValue.path("name").textValue(); switch (operator) { case EQUALS: if (variableName != null) { query.variableValueEquals(variableName, extractVariableValue(variableValue, engineConfiguration)); } else { query.variableValueEquals(extractVariableValue(variableValue, engineConfiguration)); } break; case NOT_EQUALS: query.variableValueNotEquals(variableName, extractVariableValue(variableValue, engineConfiguration)); break; case GREATER_THAN: query.variableValueGreaterThan(variableName, extractVariableValue(variableValue, engineConfiguration)); break; case GREATER_THAN_OR_EQUAL: query.variableValueGreaterThanOrEqual(variableName, extractVariableValue(variableValue, engineConfiguration)); break; case LESS_THAN: query.variableValueLessThan(variableName, extractVariableValue(variableValue, engineConfiguration)); break; case LESS_THAN_OR_EQUAL: query.variableValueLessThanOrEqual(variableName, extractVariableValue(variableValue, engineConfiguration)); break; case LIKE: query.variableValueLike(variableName, (String) extractVariableValue(variableValue, engineConfiguration)); break; case LIKE_IGNORE_CASE: query.variableValueLikeIgnoreCase(variableName, (String) extractVariableValue(variableValue, engineConfiguration)); break; case EQUALS_IGNORE_CASE: query.variableValueEqualsIgnoreCase(variableName, (String) extractVariableValue(variableValue, engineConfiguration)); break; case EXISTS: query.variableExists(variableName); break; case NOT_EXISTS: query.variableNotExists(variableName); break; case NOT_EQUALS_IGNORE_CASE: //Not exposed on the public API //query.variableValueNotEqualsIgnoreCase(variableName, (String) extractVariableValue(variableValue, engineConfiguration)); //break; default: throw new FlowableIllegalArgumentException("Operator " + operator + " is not supported for the variable value"); } } } } protected Object extractVariableValue(JsonNode variableValueNode, CmmnEngineConfiguration engineConfiguration) { String type = variableValueNode.path("type").asText(null); if (type == null) { throw new FlowableIllegalArgumentException("The variable value does not have a type"); } VariableType variableType = engineConfiguration.getVariableTypes() .getVariableType(type); return variableType.getValue(new VariableValueJsonNodeValueFields(variableValueNode)); } protected List<String> asStringList(JsonNode node) { if (node != null && node.isArray() && node.size() > 0) { List<String> values = new ArrayList<>(node.size()); for (JsonNode element : node) { values.add(element.textValue()); } return values; } return null; } protected Set<String> asStringSet(JsonNode node) { if (node != null && node.isArray() && node.size() > 0) { List<String> values = new ArrayList<>(node.size()); for (JsonNode element : node) { values.add(element.textValue()); } return new HashSet<>(values); } return null; } protected JsonNode getBatchConfiguration(Batch batch, CmmnEngineConfiguration engineConfiguration) { try { return engineConfiguration.getObjectMapper() .readTree(batch.getBatchDocumentJson(EngineConfigurationConstants.KEY_CMMN_ENGINE_CONFIG)); } catch (JsonProcessingException e) { ExceptionUtil.sneakyThrow(e); return null; } } protected String prepareFailedResultAsJsonString(String errorMessage, CmmnEngineConfiguration engineConfiguration) { return prepareFailedResultAsJsonString(errorMessage, null, engineConfiguration); } protected String prepareFailedResultAsJsonString(String errorMessage, FlowableException exception, CmmnEngineConfiguration engineConfiguration) { ObjectNode resultNode = engineConfiguration.getObjectMapper() .createObjectNode(); resultNode.put("errorMessage", errorMessage); if (exception != null) { resultNode.put("errorStacktrace", ExceptionUtils.getStackTrace(exception)); } return resultNode.toString(); } protected static class VariableValueJsonNodeValueFields implements ValueFields { protected final JsonNode node; public VariableValueJsonNodeValueFields(JsonNode node) { this.node = node; } @Override public String getName() { return node.path("name").textValue(); } @Override public String getProcessInstanceId() { throw new UnsupportedOperationException("Not supported to get process instance id"); } @Override public String getExecutionId() { throw new UnsupportedOperationException("Not supported to get execution id"); } @Override public String getScopeId() { throw new UnsupportedOperationException("Not supported to get scope id"); } @Override public String getSubScopeId() { throw new UnsupportedOperationException("Not supported to get sub scope id"); } @Override public String getScopeType() { throw new UnsupportedOperationException("Not supported to scope type"); } @Override public String getTaskId() { throw new UnsupportedOperationException("Not supported to get task id"); } @Override public String getTextValue() { return node.path("textValue").textValue(); } @Override public void setTextValue(String textValue) { throw new UnsupportedOperationException("Not supported to set text value"); } @Override public String getTextValue2() { return node.path("textValues").textValue(); } @Override public void setTextValue2(String textValue2) { throw new UnsupportedOperationException("Not supported to set text value2"); } @Override public Long getLongValue() { JsonNode longNode = node.path("longValue"); if (longNode.isNumber()) { return longNode.longValue(); } return null; } @Override public void setLongValue(Long longValue) { throw new UnsupportedOperationException("Not supported to set long value"); } @Override public Double getDoubleValue() { JsonNode doubleNode = node.path("doubleValue"); if (doubleNode.isNumber()) { return doubleNode.doubleValue(); } return null; } @Override public void setDoubleValue(Double doubleValue) { throw new UnsupportedOperationException("Not supported to set double value"); } @Override public byte[] getBytes() { throw new UnsupportedOperationException("Not supported to get bytes"); } @Override public void setBytes(byte[] bytes) { throw new UnsupportedOperationException("Not supported to set bytes"); } @Override public Object getCachedValue() { throw new UnsupportedOperationException("Not supported to set get cached value"); } @Override public void setCachedValue(Object cachedValue) { throw new UnsupportedOperationException("Not supported to set cached value"); } } }
6b55be0ef130eb0e61234cdaec21f0a3ad1804ce
93e31226c9f43b74a46812d70309269956485a6a
/src/main/java/SearchObj.java
c12c23c5ee896cbb44cc54cf8a78ff77dde90df7
[]
no_license
shijundai/I18nUtils
9c1681cde19ca3238f3682e146edbd6843a95583
51acb6ac7b7a31692d188ddf343cdfcefb29f3cf
refs/heads/master
2022-11-29T15:23:23.183130
2020-08-06T01:25:17
2020-08-06T01:25:17
285,442,130
0
0
null
null
null
null
UTF-8
Java
false
false
729
java
/** * @author Administrator * @Title: Controller * @Description: * @date 2020/2/27 */ /** *@ClassName SearchObj *@Description TODO *@Author Administrator *@Date 2020/2/27 18:08 *@Version 1.0 **/ public class SearchObj { private String filePath; private String row; private String value; public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getRow() { return row; } public void setRow(String row) { this.row = row; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
07c0cfc7988f2e61f31e5872e80e7388ffb96920
e0b27229e759e15118c48172b5d3b66c4b768dfa
/demo/src/main/java/com/example/demo/api/ClienteAPI.java
9480dcd13de2e57780f0b9009484ea6a0ef3ac4d
[]
no_license
odraudek99/microservices_demo
44f775086eddfb38809ac6d84e4ec15f6bb21ffc
27ea7bbac2b05e73f568821d7108a0fd11eb8c25
refs/heads/master
2020-04-19T15:04:04.507942
2019-01-30T03:22:11
2019-01-30T03:22:11
168,263,634
0
0
null
null
null
null
UTF-8
Java
false
false
877
java
package com.example.demo.api; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.example.demo.model.Cliente; import com.example.demo.repository.ClienteRespository; @RestController @RequestMapping("/api/v1/cliente") public class ClienteAPI { @Autowired private ClienteRespository clienteRespository; @GetMapping public List<Cliente> getAll() { return clienteRespository.findAll(); } @PostMapping public Cliente add(@RequestBody Cliente cliente) { return clienteRespository.add(cliente); } }
8d4a8252ace4fd4c6d465b1c15de4cb5e3813c25
748dc6bfede90148569b90cc95f3b11c3997e5a5
/src/main/java/br/com/fullstack/cursofullstack/services/SmtpEmailService.java
cd682eccd47a1413c409881f4ecaab0f52b22553
[]
no_license
leojavadev/javawebfullstack
2ccbdfffd2f89fe0ecb156894c2c7650f69d1eb7
ac26588c347431b6653ff0a703217f19d771b607
refs/heads/master
2022-08-24T07:47:16.865313
2020-12-29T02:03:34
2020-12-29T02:03:34
252,468,192
0
0
null
2022-07-15T21:08:55
2020-04-02T13:48:22
Java
UTF-8
Java
false
false
921
java
package br.com.fullstack.cursofullstack.services; import javax.mail.internet.MimeMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailSender; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; public class SmtpEmailService extends AbstractEmailService { @Autowired private MailSender mailSender; @Autowired private JavaMailSender javaMailSender; private static final Logger LOG = LoggerFactory.getLogger(SmtpEmailService.class); @Override public void sendEmail(SimpleMailMessage msg) { LOG.info("Enviando email..."); mailSender.send(msg); LOG.info("Email enviado!"); } @Override public void sendHtmlEmail(MimeMessage msg) { LOG.info("Enviando email HTML..."); javaMailSender.send(msg); LOG.info("Email enviado!"); } }
861df1ffc7dbf9dc9156a5eea447cc34ce7b33ae
1455d6127ff247f8a65d4e5fff285a0c11b2e412
/src/main/java/com/leone/util/bcrypt/PBE.java
ed40ef2c18eddac2178e27017f071e427d7891a6
[ "Apache-2.0" ]
permissive
cdb156/java-utils
e18a7b49ab26f5905753318116d619985e578fa0
29b1de78a152f39f3385618d9d1b754ac0ccc0e0
refs/heads/master
2020-06-09T09:54:09.532201
2019-06-22T10:12:07
2019-06-22T10:12:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package com.leone.util.bcrypt; import org.apache.commons.codec.binary.Base64; import javax.crypto.Cipher; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.PBEParameterSpec; import java.security.Key; import java.security.SecureRandom; /** * @author Leone * @since 2018-04-04 **/ public class PBE { /** * PBE算法结合了消息摘要算法和对称加密算法的优点,是一种特殊的对称加密算法。Password Based Encryption,基于口令的加密。因为口令是比较好记的,就容易通过穷举、猜测的方式获得口令——针对这种情况,我们采用的方式是加盐(Salt),通过加入一些额外的内容(通常是随机字符)去扰乱。实现的方式有2种:JDK和BC。 */ private static String src="Hello PBE"; public static void jdkPBE(){ try { //初始化盐 SecureRandom random=new SecureRandom(); byte[] salt = random.generateSeed(8); //指定为8位的盐 (盐就是干扰码,通过添加干扰码增加安全) //口令和密钥 String password="lynu"; //口令 PBEKeySpec pbeKeySpec=new PBEKeySpec(password.toCharArray()); SecretKeyFactory factory=SecretKeyFactory.getInstance("PBEWITHMD5andDES"); Key key=factory.generateSecret(pbeKeySpec); //密钥 //加密 PBEParameterSpec pbeParameterSpec=new PBEParameterSpec(salt, 100); //参数规范,第一个参数是盐,第二个是迭代次数(经过散列函数多次迭代) Cipher cipher=Cipher.getInstance("PBEWITHMD5andDES"); cipher.init(Cipher.ENCRYPT_MODE, key,pbeParameterSpec); byte[] result = cipher.doFinal(src.getBytes()); System.out.println("jdk PBE加密: "+Base64.encodeBase64String(result)); //解密 cipher.init(Cipher.DECRYPT_MODE, key,pbeParameterSpec); result = cipher.doFinal(result); System.out.println("jdk PBE解密: "+new String(result)); } catch (Exception e) { e.printStackTrace(); } } }
00835d90f30d2ad2aa39d42bb60de38d258e9178
285f7b40926bf0b8498617d03b8be6d6f9ffe902
/Online-Shop/src/AAA/Service/PageCatServiceImpl.java
bb012d87fea78f6735e9544f9889269314c2e747
[]
no_license
Bitowen13/onlineshop
3752d7df84d8df22c4e65a8cb02403a01891dcad
086ed9ca5e5f6deb2bfc483556caa91238fa9832
refs/heads/master
2022-12-24T21:15:05.870782
2019-07-06T20:31:03
2019-07-06T20:31:03
195,580,357
0
0
null
2022-12-16T10:56:07
2019-07-06T20:26:00
Java
UTF-8
Java
false
false
310
java
package AAA.Service; import AAA.ServiceInterface.PageCatWebService; import baseService.baseUCServiceImpl; import AAA.Entity.Aapagecat; import org.springframework.stereotype.Service; @Service public class PageCatServiceImpl extends baseUCServiceImpl<Aapagecat> implements PageCatWebService { }
[ "bitowen13@DESKTOP-VARKUBG" ]
bitowen13@DESKTOP-VARKUBG
cad0c43d778c0971811a4d50e7d2ac119f4d9d44
37a90b815798b2f3a944d00bf95ac38644641385
/app/src/main/java/com/example/thithirat/test/AddEventMapsReminderActivity.java
7cafede9d8461611fd1d64a1c0be77bacb3f27dc
[]
no_license
THITHIRAT/project-android
bd21d12a8a585ae6aa3055e5b3d159326fd4421b
64fa758846fb7c5e7a3cc3961a3c64ee2d38a1fd
refs/heads/master
2021-04-03T08:35:46.918477
2018-05-10T09:31:26
2018-05-10T09:31:26
125,025,647
0
0
null
null
null
null
UTF-8
Java
false
false
10,600
java
package com.example.thithirat.test; import android.content.Intent; import android.location.Location; import android.support.design.widget.FloatingActionButton; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.util.Log; import android.view.View; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.common.api.Status; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlaceAutocomplete; import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment; import com.google.android.gms.location.places.ui.PlaceSelectionListener; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import org.json.JSONException; import org.json.JSONObject; import java.io.UnsupportedEncodingException; public class AddEventMapsReminderActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; PlaceAutocompleteFragment placeAutoComplete; private GPSTracker gpsTracker; private Location mLocation; double latitude, longtitude; double latitudefromselect, longtitudefromselect; String placename; Marker marker; int PLACE_AUTOCOMPLETE_REQUEST_CODE = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_event_maps_reminder); gpsTracker = new GPSTracker(getApplicationContext()); mLocation = gpsTracker.getLocation(); latitude = mLocation.getLatitude(); longtitude = mLocation.getLongitude(); FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); placeAutoComplete = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(R.id.marker_map); placeAutoComplete.setOnPlaceSelectedListener(new PlaceSelectionListener() { @Override public void onPlaceSelected(Place place) { LatLng getLatLng = place.getLatLng(); latitudefromselect = getLatLng.latitude; longtitudefromselect = getLatLng.longitude; placename = (String) place.getName(); geoLocation(latitudefromselect, longtitudefromselect, place); Log.d("LatLngLocation", latitudefromselect + ", " + longtitudefromselect + ", " + placename); connect_location(latitudefromselect, longtitudefromselect, placename); } @Override public void onError(Status status) { Log.d("Maps", "An error occurred: " + status); } }); FloatingActionButton fab_place_done_reminder = (FloatingActionButton)findViewById(R.id.fab_place_done); fab_place_done_reminder.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Log.d("Onclick", "Complete"); if(placename != null) { Bundle args = new Bundle(); args.putString("PlaceName", placename); AddEventFragment.putArguments(args); } finish(); } }); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } private void connect_location(double latitudefromselect, double longtitudefromselect, String placename) { try { RequestQueue requestQueue = Volley.newRequestQueue(AddEventMapsReminderActivity.this); String URL = ConnectAPI.getUrl() + "place/location"; JSONObject jsonBody = new JSONObject(); jsonBody.put("latitude", latitudefromselect); jsonBody.put("longtitude", longtitudefromselect); jsonBody.put("name", placename); final String requestBody = jsonBody.toString(); StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.i("VOLLEY", response); JSONObject json = null; try { json = new JSONObject(response); String msg_location = json.getString("msg"); Log.i("VOLLEY", msg_location); if(msg_location.equals("place/location : insert location complete")) { Toast.makeText(AddEventMapsReminderActivity.this, "Success", Toast.LENGTH_LONG).show(); }else { Toast.makeText(AddEventMapsReminderActivity.this, "Already", Toast.LENGTH_LONG).show(); } }catch (JSONException e){ e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.e("VOLLEY", error.toString()); } }) { @Override public String getBodyContentType() { return "application/json; charset=utf-8"; } @Override public byte[] getBody() throws AuthFailureError { try { return requestBody == null ? null : requestBody.getBytes("utf-8"); } catch (UnsupportedEncodingException uee) { VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s", requestBody, "utf-8"); return null; } } }; requestQueue.add(stringRequest); }catch (JSONException e){ e.printStackTrace(); } } private void geoLocation(double latitudefromselect, double longtitudefromselect, Place place) { setMarker(place); goToLocationZoom(latitude, longtitude, 11); } private void goToLocationZoom(double latitude, double longtitude, int zoom) { LatLng latlng = new LatLng(latitude, longtitude); CameraUpdate update = CameraUpdateFactory.newLatLngZoom(latlng, zoom); mMap.moveCamera(update); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Sydney and move the camera LatLng current = new LatLng(latitude, longtitude); mMap.addMarker(new MarkerOptions() .position(current).title("You are here") .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_action_person_red))); mMap.moveCamera(CameraUpdateFactory.newLatLng(current)); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(current,(float) 7.0)); } public void setMarker(Place place) { if(marker != null) { marker.remove(); } marker = mMap.addMarker(new MarkerOptions() .position(place.getLatLng()) .draggable(true) .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_action_marker_red)) .title("Select here : " + place.getName())); } private void callPlaceAutocompleteActivityIntent() { try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); //PLACE_AUTOCOMPLETE_REQUEST_CODE is integer for request code } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //autocompleteFragment.onActivityResult(requestCode, resultCode, data); if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE) { if (resultCode == RESULT_OK) { Place place = PlaceAutocomplete.getPlace(this, data); Log.i("maps", "Place:" + place.toString()); } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) { Status status = PlaceAutocomplete.getStatus(this, data); Log.i("maps", status.getStatusMessage()); } else if (resultCode == RESULT_CANCELED) { } } } }
643cbdd2dfe9f8bfc9d5f7b4dee163c13448bd28
740c90de28087d2db38afda82c45dff5d6b2af61
/app/src/main/java/com/app/pm10/Pm10Widget.java
8fd7840eaf79f7955700641d4f7b6cd70c646d17
[]
no_license
ohy3264/pm10
bc63b0b3ec8c83aad9bf3331436582ad6c553c2e
c9aa5e1a492b829032487faa6355d3d030a23d81
refs/heads/master
2021-04-26T16:47:43.621492
2016-04-15T08:54:11
2016-04-15T08:54:11
55,981,255
0
0
null
null
null
null
UTF-8
Java
false
false
6,966
java
package com.app.pm10; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.RemoteViews; import utill.Constant; import utill.HYPreference; /** * <pre> * @author : oh * @Day : 2014. 11. 18. * @Time : 오후 12:44:28 * @Explanation : 위젯 * * 호출 순서 * 1. onUpdate() * 2. updateAppWidget() * 3. onReceive() * 3-1. android.appwidget.action.APPWIDGET_UPDATE * 4. removePreviousAlarm * * </pre> * */ public class Pm10Widget extends AppWidgetProvider { // Log private static final String TAG = "Pm10Widget"; private static final boolean DEBUG = false; private static final boolean INFO = true; // DataSet private Context context; // Utill private HYPreference mPref; @Override public void onEnabled(Context context) { // TODO Auto-generated method stub if (INFO) Log.i(TAG, "onEnabled()"); mPref = new HYPreference(context); mPref.put(mPref.KEY_WIDGET_STATE, "enabled"); super.onEnabled(context); } @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // TODO Auto-generated method stub if (INFO) Log.i(TAG, "onUpdate()"); super.onUpdate(context, appWidgetManager, appWidgetIds); this.context = context; this.mPref = new HYPreference(context); // 현재 클래스로 등록된 모든 위젯의 리스트를 가져옴 appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName( context, getClass())); final int N = appWidgetIds.length; for (int i = 0; i < N; i++) { int appWidgetId = appWidgetIds[i]; updateAppWidgetUI(context, appWidgetManager, appWidgetId); } } @Override public void onDeleted(Context context, int[] appWidgetIds) { // TODO Auto-generated method stub if (INFO) Log.i(TAG, "onDeleted()"); super.onDeleted(context, appWidgetIds); } @Override public void onDisabled(Context context) { // TODO Auto-generated method stub if (INFO) Log.i(TAG, "onDisabled()"); this.mPref = new HYPreference(context); mPref.put(mPref.KEY_WIDGET_STATE, "disabled"); super.onDisabled(context); } @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub super.onReceive(context, intent); if (INFO) Log.i(TAG, "onReceive()"); String action = intent.getAction(); // Default Recevier switch (action) { case AppWidgetManager.ACTION_APPWIDGET_ENABLED: if (INFO) Log.i(TAG, "수신 액션 : android.appwidget.action.APPWIDGET_ENABLED"); break; case AppWidgetManager.ACTION_APPWIDGET_UPDATE: if (INFO) Log.i(TAG, "수신 액션 : android.appwidget.action.APPWIDGET_UPDATE"); AppWidgetManager manager = AppWidgetManager.getInstance(context); this.onUpdate(context, manager, manager .getAppWidgetIds(new ComponentName(context, getClass()))); break; case AppWidgetManager.ACTION_APPWIDGET_DELETED: if (INFO) Log.i(TAG, "수신 액션 : android.appwidget.action.APPWIDGET_DELETED"); break; case Constant.ACTION_EVENT: if (INFO) Log.i(TAG, "수신 액션 : com.widget.ACTION_EVENT"); break; case Constant.ACTION_CALL_ACTIVITY: if (INFO) Log.i(TAG, "수신 액션 : com.widget.ACTION_CALL_ACTIVITY"); callActivity(context); break; } } /** * @author : oh * @MethodName : updateAppWidget * @Day : 2014. 11. 18. * @Time : 오후 12:39:28 * @Explanation : Widget UI 설정 이벤트 * * @param context * @param appWidgetManager * @param appWidgetId */ public void updateAppWidgetUI(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { if (INFO) Log.i(TAG, "updateAppWidget()"); RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget_pm10); Intent activityIntent = new Intent(Constant.ACTION_CALL_ACTIVITY); PendingIntent activityPIntent = PendingIntent.getBroadcast(context, 0, activityIntent, 0); updateViews .setOnClickPendingIntent(R.id.call_activity, activityPIntent); updateViews.setTextViewText(R.id.widget_station, mPref.getValue(mPref.KEY_STATION, "")); updateViews.setTextViewText(R.id.widget_pm10_value, mPref.getValue(mPref.KEY_KHAIVALUE, "")); updateViews.setTextViewText(R.id.widget_date, mPref.getValue(mPref.KEY_DATE, "")); switch (mPref.getValue(mPref.KEY_KHAIGRADE, "")) { case "1": updateViews.setTextViewText(R.id.widget_pm10_grade, context .getResources().getString(R.string.air_index_good)); updateViews.setTextColor(R.id.widget_pm10_value, context .getResources().getColor(R.color.good)); updateViews.setTextColor(R.id.widget_pm10_grade, context .getResources().getColor(R.color.good)); break; case "2": updateViews.setTextViewText(R.id.widget_pm10_grade, context .getResources().getString(R.string.air_index_usually)); updateViews.setTextColor(R.id.widget_pm10_value, context .getResources().getColor(R.color.usually)); updateViews.setTextColor(R.id.widget_pm10_grade, context .getResources().getColor(R.color.usually)); break; /*case "3": updateViews.setTextViewText(R.id.widget_pm10_grade, context .getResources().getString(R.string.air_index_slightly_bad)); updateViews.setTextColor(R.id.widget_pm10_value, context .getResources().getColor(R.color.slightly_bad)); updateViews.setTextColor(R.id.widget_pm10_grade, context .getResources().getColor(R.color.slightly_bad)); break;*/ case "3": updateViews.setTextViewText(R.id.widget_pm10_grade, context .getResources().getString(R.string.air_index_bad)); updateViews.setTextColor(R.id.widget_pm10_value, context .getResources().getColor(R.color.bad)); updateViews.setTextColor(R.id.widget_pm10_grade, context .getResources().getColor(R.color.bad)); break; case "4": updateViews.setTextViewText(R.id.widget_pm10_grade, context .getResources().getString(R.string.air_index_very_bad)); updateViews.setTextColor(R.id.widget_pm10_value, context .getResources().getColor(R.color.very_bad)); updateViews.setTextColor(R.id.widget_pm10_grade, context .getResources().getColor(R.color.very_bad)); break; } appWidgetManager.updateAppWidget(appWidgetId, updateViews); } /** * @author : oh * @MethodName : callActivity * @Day : 2014. 11. 15. * @Time : 오후 2:39:59 * @Explanation : Activity 호출 (Intent.FLAG_ACTIVITY_NEW_TASK) * * @param context */ private void callActivity(Context context) { if (INFO) Log.i(TAG, "callActivity()"); Intent intent = new Intent("com.widget.CALL_ACTIVITY"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }
6ffcb53f3d668a61ca1fac3de1c6f70365cb4c65
157f9d9cccd1dfd3c4b53047fb64a7b2a79a92cd
/test-rocketmq/rocketmq-producer/src/main/java/cn/lx/rocketmq/domain/OrderExt.java
da5ffb058351408b1b8b9d88a8e86bca95926cf9
[]
no_license
lx972/FlashPayment
ebc6d70e13c252961034ffa5161a7b20220655f3
d71ad5178e0f2c9adf3224d00a15cc812e23ebdb
refs/heads/master
2022-12-28T20:08:52.726015
2020-10-20T02:34:39
2020-10-20T02:34:39
297,837,488
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package cn.lx.rocketmq.domain; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; import java.io.Serializable; import java.util.Date; @Data @NoArgsConstructor @AllArgsConstructor @ToString public class OrderExt implements Serializable { private String id; private Date createTime; private Long money; private String title; }
39262435a353b57bc3bc18fb1f604a6d1b35b574
b5193135dfdb20986f663dc7ff70219709cbe25a
/src/test/java/com/learning/reactivespring/controller/FluxControllerTest.java
3ed0ae9ae480a0bb0a449855afae2f610b1c30e6
[]
no_license
abhishyam21/reactive-spring-learn
2898b2743d2ca930cfe846b4e00efa08221375b0
39f0f1845243709b7ddebad9b57dde41eb6d004d
refs/heads/master
2022-11-28T07:05:12.231470
2020-08-02T16:02:49
2020-08-02T16:02:49
284,244,572
0
0
null
null
null
null
UTF-8
Java
false
false
3,098
java
package com.learning.reactivespring.controller; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; import org.springframework.http.MediaType; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.reactive.server.EntityExchangeResult; import org.springframework.test.web.reactive.server.WebTestClient; import reactor.core.publisher.Flux; import reactor.test.StepVerifier; import java.util.Arrays; import java.util.List; /** * @author Abhishyam.c on 01/08/20 */ @ExtendWith(SpringExtension.class) @WebFluxTest public class FluxControllerTest { @Autowired private WebTestClient webTestClient; @Test public void testFluxApproach1(){ Flux<Integer> integerFlux = webTestClient .get() .uri("/flux") .accept(MediaType.APPLICATION_STREAM_JSON) .exchange() .expectStatus().isOk() .returnResult(Integer.class) .getResponseBody(); StepVerifier .create(integerFlux) .expectSubscription() .expectNext(1) .expectNext(2) .expectNext(3) .expectNext(4) .expectNext(5) .verifyComplete(); } @Test public void testFluxApproach2(){ webTestClient .get() .uri("/flux-stream") .accept(MediaType.APPLICATION_STREAM_JSON) .exchange() .expectStatus().isOk() .expectHeader() .contentType(MediaType.APPLICATION_STREAM_JSON) .expectBodyList(Integer.class) .hasSize(5); } @Test public void testFluxApproach3(){ List<Integer> expected = Arrays.asList(1, 2, 3, 4, 5); EntityExchangeResult<List<Integer>> actualResult = webTestClient .get() .uri("/flux-stream") .accept(MediaType.APPLICATION_STREAM_JSON) .exchange() .expectStatus().isOk() .expectBodyList(Integer.class) .returnResult(); Assertions.assertEquals(expected,actualResult.getResponseBody()); } @Test public void testInfiniteFlux(){ Flux<Long> fluxOfLong = webTestClient .get() .uri("/flux-infinite") .accept(MediaType.APPLICATION_STREAM_JSON) .exchange() .expectStatus().isOk() .returnResult(Long.class) .getResponseBody(); StepVerifier .create(fluxOfLong) .expectNext(0L) .expectNext(1L) .expectNext(2L) .expectNext(3L) .thenCancel() .verify(); } }
560c8298e0684b08696d02247324b7541209082d
eabac3d150136c2d6d649cba687db0830e1e2e48
/powermock/src/test/java/com/wdxxl/powermock/basic09/foreach/MockStaticMehtodForEachTest.java
5afdaf99707adab9361032bd8ee97cc48db1f305
[]
no_license
wdxxl/wdxxl_demo
0f84a64c60dbe5d609812666e0e71d34d94a795e
be2be8e7d1999298353dff0e3b1922abb3825651
refs/heads/master
2021-05-16T06:40:40.123476
2018-04-20T03:51:31
2018-04-20T03:51:31
42,219,318
0
1
null
null
null
null
UTF-8
Java
false
false
1,308
java
package com.wdxxl.powermock.basic09.foreach; import java.util.Iterator; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) public class MockStaticMehtodForEachTest { @Test @PrepareForTest(StaticMethodReturnList.class) public void testForEach() { // Build for forEach iterator mock List<String> mockList = PowerMockito.mock(List.class); Iterator<String> mockIter = PowerMockito.mock(Iterator.class); PowerMockito.when(mockList.size()).thenReturn(2); PowerMockito.when(mockList.iterator()).thenReturn(mockIter); PowerMockito.when(mockIter.hasNext()).thenReturn(true, true, true, false); PowerMockito.when(mockIter.next()).thenReturn("mockIter 1", "mockIter 2", "mockIter 3"); PowerMockito.mockStatic(StaticMethodReturnList.class); PowerMockito.when(StaticMethodReturnList.getList()).thenReturn(mockList); CallStaticMethodWithList callStaticMethodWithList = Mockito.spy(CallStaticMethodWithList.class); callStaticMethodWithList.runForEach(); } }
7cacf549b3c18515918686dd11c3e2cf76abe6d0
5e2541fbdc5833d88eac283714201fddfa95412f
/ShenkunTest/src/com/erong/model/DataInformation061.java
40695c1a4127d9609f750fe7327a4b485ab22a8a
[]
no_license
jprothwell/tclportal
c68690e5669864cd81ae71532e3da49a77d94f59
b2ea8c4a25af989fccd3e1774afb1e1398e54222
refs/heads/master
2021-01-22T02:42:55.767880
2011-12-15T07:49:03
2011-12-15T07:49:03
41,405,377
0
0
null
null
null
null
GB18030
Java
false
false
291
java
package com.erong.model; import java.util.Date; import com.erong.model.util.CommercialDraft; public class DataInformation061 extends CommercialDraft { // 票据数据下发报文 // 数据变更 private String DataClss; // 数据内容 private String DataCnt; }
[ "shenkun918@c6af81f7-2453-10f0-c55f-1a1256d94624" ]
shenkun918@c6af81f7-2453-10f0-c55f-1a1256d94624
396b7d0424ba215a12b5dfe5ad1c079945fba0c8
d5c41a24c4aa0b3129abc2e2b6cdd7ddbb1fd5c8
/app/src/main/java/com/example/cricketapp/BdTeamCustomAdapter.java
3f26c65735e6ae31548b0ce12b76da4933aba60e
[]
no_license
ashikurrahmanbd/cricketApp
eb4ce3bceb783293fa7dbb191ead1fe626daf335
4df58687231a21fd781696848519b58745a037cb
refs/heads/master
2020-09-05T17:59:07.585738
2019-11-07T07:17:09
2019-11-07T07:17:09
220,174,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
package com.example.cricketapp; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; public class BdTeamCustomAdapter extends RecyclerView.Adapter<BdTeamListViewHolder> { Context context; ArrayList<String> bdPlayerNames; BdTeamCustomAdapter(Context context, ArrayList<String> bdPlayerNames){ this.context = context; this.bdPlayerNames = bdPlayerNames; } @NonNull @Override public BdTeamListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.bdteamlist_custom_layout, parent, false); BdTeamListViewHolder viewHolder = new BdTeamListViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull BdTeamListViewHolder holder, int position) { holder.bdTeamMemberList.setText(bdPlayerNames.get(position)); } @Override public int getItemCount() { return bdPlayerNames.size(); } }
8b7a47eae321ba84e897ef7c0e5a65f9ef31ab1e
3de12c321aed216c5819db5f22add1f73f68c6d6
/danrenbanmohe/src/main/java/com/xiaojun/danrenbanmohe/dialog/XiuGaiDiZhiDialog.java
b850e92622ba77f46732d74dab000c0eaac23186
[]
no_license
yoyo89757001/MyApplication_all
3b4b681107519f3eb61a25b95252b5020b5d0f41
0d8b4fdd42a654673ac3f4cb6a19ac30f640bfa5
refs/heads/master
2020-04-03T19:36:55.009363
2018-12-29T11:52:01
2018-12-29T11:52:02
155,528,943
0
1
null
null
null
null
UTF-8
Java
false
false
2,084
java
package com.xiaojun.danrenbanmohe.dialog; import android.app.Dialog; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.EditText; import com.xiaojun.danrenbanmohe.R; /** * @Function: 自定义对话框 * @Date: 2013-10-28 * @Time: 下午12:37:43 * @author Tom.Cai */ public class XiuGaiDiZhiDialog extends Dialog { // private TextView title2; private Button l1,l2; private EditText jiudianname,idid; public XiuGaiDiZhiDialog(Context context) { super(context, R.style.dialog_style2); setCustomDialog(); } private void setCustomDialog() { View mView = LayoutInflater.from(getContext()).inflate(R.layout.xiugaidialog_dizhi, null); jiudianname= (EditText) mView.findViewById(R.id.xiangce); idid= (EditText)mView.findViewById(R.id.idid); // title2= (TextView) mView.findViewById(R.id.title2); l1= (Button)mView. findViewById(R.id.queren); l2= (Button) mView.findViewById(R.id.quxiao); super.setContentView(mView); } public void setContents(String ss, String s3){ if (ss!=null) idid.setText(ss); if (s3!=null) jiudianname.setText(s3); } public String getUrl(){ return idid.getText().toString().trim(); } @Override public void setContentView(int layoutResID) { } @Override public void setContentView(View view, LayoutParams params) { } @Override public void setContentView(View view) { } /** * 确定键监听器 * @param listener */ public void setOnQueRenListener(View.OnClickListener listener){ l1.setOnClickListener(listener); } /** * 取消键监听器 * @param listener */ public void setQuXiaoListener(View.OnClickListener listener){ l2.setOnClickListener(listener); } }
369e4f9f00626574ef021992a9c7a69271ed2e45
12f1d19dc4530c3872ed7dc653db7f2c9d79306c
/src/test/java/tests/SearchUsingAutoSuggestTest.java
f89d06834b87e36b9e4a4ca0e230bfb54d72ac86
[]
no_license
M-Maxo/SeleniumPOM_Full_Regression_TestSuite
4817c19b56b7a5d6cf4f2f2e023696f54c08f319
7033b412a6edad3fd53d2b5562b7aec00622aebc
refs/heads/main
2023-04-23T12:07:50.486920
2021-05-07T00:23:46
2021-05-07T00:23:46
365,067,391
1
0
null
null
null
null
UTF-8
Java
false
false
612
java
package tests; import org.testng.Assert; import org.testng.annotations.Test; import pages.ProductDetailsPage; import pages.SearchPage; public class SearchUsingAutoSuggestTest extends TestBase{ String prodcutName = "Apple MacBook Pro 13-inch"; SearchPage searchObject; ProductDetailsPage detailsObject; @Test public void UserCanSelectFromList() throws InterruptedException { searchObject = new SearchPage(driver); searchObject.ProductSearchAutoSuggest("MacB"); detailsObject = new ProductDetailsPage(driver); Assert.assertEquals(detailsObject.productNameAppear.getText(), prodcutName); } }
71e954ef2a919cf211e6dc44ad69fe176f05a654
e965e8b6c3c3f2af7d887bf7a7b8f92c7f7f9776
/src/main/java/didi/reversestring/ReverseSentence.java
ea3478e38951bdf4b9bba6f18456dc80a89baeb8
[]
no_license
tarscode/CodeBase
1af2908d1bf95bdbb3df01bffafd33c126ba816a
8998877bceda5e7faefc52e0547c4ba1ec43c4cc
refs/heads/master
2021-01-01T20:39:14.990875
2017-07-31T16:02:53
2017-07-31T16:02:53
98,907,019
0
0
null
null
null
null
UTF-8
Java
false
false
1,291
java
package didi.reversestring; /** * 工程: CodeOffer 包名: PACKAGE_NAME 类名: ReverseSentence * 作者: liuyang * 时间: 16/9/21 下午3:03 * 题目: 翻转单词顺序列 * 内容: * 版本: V1.1 * 运行时间: * 备注: 用翻转函数代替栈,额外空间复杂度O(2) */ public class ReverseSentence { public String ReverseSentence(String str) { char[] arr = str.toCharArray(); int len = str.length(); int begin =0; int end; for(int i=0;i<len;i++){ if(arr[i]==' '){ end = i; Reverse(arr,begin,end-1); begin=end+1; } if(i==len-1){ Reverse(arr,begin,i); } } arr = Reverse(arr,0,len-1); str = String.valueOf(arr); return str; } public char[] Reverse(char[] arr,int begin,int end){ while(begin<end){ char temp = arr[begin]; arr[begin++]=arr[end]; arr[end--] = temp; } return arr; } public static void main(String[] args) { String str = "Student. heu am I"; ReverseSentence t = new ReverseSentence(); System.out.println(t.ReverseSentence(str)); System.out.println(str); } }
67b37501982bd62fab2ea0c8692118696f5fea76
51cf675220f03e6e67c1f14dbc4218d0672e41b3
/decomp_muvi_apk/muvi_apk/app/src/main/java/com/arcsoft/util/tool/FileDelete$DeleteAsyncTask.java
47022eb8bf00ed45dd3a4aa1a00a9c77ca47a7c7
[]
no_license
guminov/muvi_kseries_research
3da0aa0d7e770d9fc261ebafc67565e59eb858f3
8c282872c9050eca546297e4ebfe5daf85555c6d
refs/heads/master
2022-01-09T14:44:41.420243
2015-03-28T18:36:06
2015-03-28T18:36:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,700
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.arcsoft.util.tool; import android.os.AsyncTask; import com.arcsoft.util.debug.Log; // Referenced classes of package com.arcsoft.util.tool: // FileDelete private class <init> extends AsyncTask { final FileDelete this$0; protected transient Integer doInBackground(Integer ainteger[]) { Log.e("FileDelete", "doDeleteRemote doInBackground"); if (FileDelete.access$100(FileDelete.this)) { return Integer.valueOf(FileDelete.access$200(FileDelete.this, ainteger[0].intValue())); } else { return Integer.valueOf(FileDelete.access$300(FileDelete.this, ainteger[0].intValue())); } } protected volatile Object doInBackground(Object aobj[]) { return doInBackground((Integer[])aobj); } protected void onPostExecute(Integer integer) { Log.e("FileDelete", (new StringBuilder()).append("DeleteAsyncTask onPostExecute sucNum = ").append(integer).append(" deleteNum = ").append(FileDelete.access$400(FileDelete.this)).toString()); FileDelete.access$500(FileDelete.this).onDeleted(integer.intValue(), FileDelete.access$400(FileDelete.this)); FileDelete.access$600(FileDelete.this); super.onPostExecute(integer); } protected volatile void onPostExecute(Object obj) { onPostExecute((Integer)obj); } private () { this$0 = FileDelete.this; super(); } this._cls0(this._cls0 _pcls0) { this(); } }
cf551337f51884c2b7dda700d13393d46fcbec2a
b0de820fccb97e80553d76dcc72a0f65263d9a75
/src/main/java/ar/com/supervielle/personas/modelo/Pais.java
321da0ea805d1a4e89eabbec6bf9bf9038ff1064
[]
no_license
damiancomba/Personas
d4f2c3a03a3d55b8107ac5d1089126798876451c
d4f89b56d7170f6c3b89e28854ef38f06b295439
refs/heads/master
2020-04-09T10:30:24.111443
2018-12-05T12:17:14
2018-12-05T12:17:14
159,610,731
0
0
null
null
null
null
UTF-8
Java
false
false
1,063
java
package ar.com.supervielle.personas.modelo; import java.util.Objects; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Pais { @Id private int id; private String nombre; public Pais() {} public Pais(String nombre) { this.nombre = nombre; } public Pais(int id, String nombre) { this.id = id; this.nombre = nombre; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof Pais)) { return false; } Pais pais = (Pais) o; return Objects.equals(id, pais.getId()) && Objects.equals(nombre, pais.getNombre()); } @Override public int hashCode() { return Objects.hash(id, nombre); } }
[ "damia@DESKTOP-83UJH5U" ]
damia@DESKTOP-83UJH5U
c4d9eee04ddf3c4f691b631009d4e4d813bc2dc8
77d776f1d716e13dd9e40f2c885a26ad89b8f178
/0429update/src/com/boco/PUB/service/ITbQuotaApplyService.java
c3744c12e1b709358df3eb391a9b47aeaad8258f
[]
no_license
AlessaVoid/studyCode
076dc132b7e24cb341d5a262f8f96d7fa78c848b
0b8806a537a081535992a467ad4ae7d5dcf7ab3e
refs/heads/master
2022-12-18T20:40:47.169951
2020-09-18T08:28:02
2020-09-18T08:28:02
null
0
0
null
null
null
null
GB18030
Java
false
false
1,135
java
package com.boco.PUB.service; import java.util.HashMap; import java.util.List; import java.util.Map; import com.boco.SYS.entity.TbQuotaApply; import com.boco.SYS.base.IGenericService; /** * 超限额申请信息表业务服务层接口(父接口已实现增、删、改、查操作,只有特殊业务时需要自定义方法) * * <pre> * 修改日期 修改人 修改原因 * 2019-09-19 txn 批量新建 * </pre> */ public interface ITbQuotaApplyService extends IGenericService<TbQuotaApply, Integer> { /** * 联想输入申请编号 * * @param tbQuotaApply * @return <pre> * 修改日期 修改人 修改原因 * 2019年月10日 txn 新建 * </pre> */ public List<Map<String, Integer>> selectQaId(TbQuotaApply tbQuotaApply); /** * 联想输入所属周期. * * @param tbQuotaApply * @return <pre> * 修改日期 修改人 修改原因 * 2019年9月19日 txn 新建 * </pre> */ public List<Map<String, String>> selectQaMonth(TbQuotaApply tbQuotaApply); }
c70174ed148add192598af9c5d12b3530f17df19
49a99d5086f214569a71fda857c36f06cc4c7c85
/sxr-arpet/app/src/main/java/com/samsungxr/arpet/mode/sharinganchor/view/IWaitingForHostView.java
164dbd66ab3b529e2644d1149710f38322c9824a
[]
no_license
sxrsdk/sxrsdk-demos
60ebe59bf2a76c7dbc175ac68ab3fd792e737e6e
7fcfaac1f33b9f46a3aaa80a434a99d966e10e9e
refs/heads/master
2020-03-31T14:35:43.432554
2020-01-07T00:57:12
2020-01-07T00:57:12
152,301,665
7
22
null
2020-01-07T00:57:13
2018-10-09T18:32:20
Java
UTF-8
Java
false
false
855
java
/* * Copyright 2015 Samsung Electronics Co., LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.samsungxr.arpet.mode.sharinganchor.view; import android.view.View; import com.samsungxr.arpet.view.IView; public interface IWaitingForHostView extends IView { void setCancelClickListener(View.OnClickListener listener); }
d45a222c41efd2bb2350a790e207db8883e40b2a
06b50012fd9337dd6af0221d37f3c46e9bc08506
/app/src/main/java/com/container/test/other/SSecondFragment.java
c3376a0901d1eb3a235cfff5c28a2abb5d647e70
[]
no_license
jakkypan/XFragment
821da3fa055ed365dabb78d578d298021b53e5a4
867d851cae66515050377c48cf9feefa9c740288
refs/heads/master
2021-01-02T22:29:20.987476
2018-06-07T09:38:09
2018-06-07T09:38:09
99,328,407
1
0
null
null
null
null
UTF-8
Java
false
false
1,634
java
package com.container.test.other; import android.graphics.Color; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.container.R; import com.container.test.FourFragemnt; import com.container.test.MainActivity; import com.xfragment.FragmentAnimBean; import com.xfragment.RootFragment; /** * Created by panda on 2017/7/25. */ public class SSecondFragment extends RootFragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { LinearLayout layout = new LinearLayout(container.getContext()); layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); layout.setBackgroundColor(Color.CYAN); layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle bundle = new Bundle(); bundle.putString("test", "i come from other activity"); FragmentAnimBean animBean = new FragmentAnimBean(); animBean.enter = R.anim.in; animBean.exit = R.anim.out; animBean.popEnter = R.anim.fadein; animBean.popExit = R.anim.fadeout; gotoActivityFragmentForResult(MainActivity.class, FourFragemnt.class, null, animBean, 10000); } }); return layout; } }
f4b11024506ba14c6ded6858837f217c74e5dce1
a8e2115b9410d1a86e04d1b644232bb3766aa81b
/app/src/main/java/com/ksytech/zjbspot/activity/PositiveActivity.java
81c6a451f028a41f5d4e0d4a1303bae4105d4323
[]
no_license
caiguangyi/idCardSpot
bdf5a9309de704263eac538260a26e6e27c89c93
1d79d6c28d73398adbf27fdea5ec3361f57b54c0
refs/heads/master
2021-09-07T18:12:30.819016
2018-02-27T06:00:50
2018-02-27T06:00:50
111,775,297
17
3
null
null
null
null
UTF-8
Java
false
false
5,692
java
package com.ksytech.zjbspot.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.Toast; import com.ksytech.zjbspot.R; import com.ksytech.zjbspot.util.DisplayUtil; import com.ksytech.zjbspot.util.UrlUtils; import java.io.File; import java.io.FileInputStream; public class PositiveActivity extends Activity implements View.OnClickListener { private EditText et_name, et_sex, et_nation, et_address, et_citizenship_number; private EditText et_year, et_month, et_day; private ImageView iv_mg; private RelativeLayout rl_back_front; private SharedPreferences sp; private Context context; private Activity activity; private ImageView iv_id_f_sure; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_positive); context = this; activity = this; sp = PreferenceManager.getDefaultSharedPreferences(context); initView(); Bundle bundle = getIntent().getBundleExtra("bundle"); if (bundle != null) { String gender = bundle.getString("gender"); String name = bundle.getString("name"); String id_card_number = bundle.getString("id_card_number"); String birthday = bundle.getString("birthday"); String race = bundle.getString("race"); String address = bundle.getString("address"); String path = bundle.getString("img_path"); int direction = bundle.getInt("direction"); et_name.setText(name); DisplayUtil.showSoftInputFromWindow(activity, et_name); et_sex.setText(gender); et_address.setText(address); et_citizenship_number.setText(id_card_number); et_nation.setText(race); int length = birthday.length(); String year = birthday.substring(0, 4); String month = birthday.substring(4, 6); String day = birthday.substring(6, length); et_year.setText(year); et_month.setText(month); et_day.setText(day); if (!TextUtils.isEmpty(path)) { try { File file = new File(path); FileInputStream inStream = null; inStream = new FileInputStream(file); Bitmap bitmap = BitmapFactory.decodeStream(inStream); if (direction == 1) { //逆时针90度 bitmap = UrlUtils.rotatePicture(bitmap, 90); } else if (direction == 2) { //逆时针180度 bitmap = UrlUtils.rotatePicture(bitmap, 180); } else if (direction == 3) { //逆时针270度 bitmap = UrlUtils.rotatePicture(bitmap, 270); } iv_mg.setImageBitmap(bitmap); inStream.close(); boolean b = UrlUtils.saveBmpToPath(bitmap, path); Log.v("PhotoGraphActivity", direction + "," + b); sp.edit().putString("id_card_front", path).commit(); } catch (Exception e) { e.printStackTrace(); } } } } public void initView() { iv_id_f_sure = (ImageView) findViewById(R.id.iv_id_f_sure); rl_back_front = (RelativeLayout) findViewById(R.id.rl_back_front); et_year = (EditText) findViewById(R.id.et_year); et_month = (EditText) findViewById(R.id.et_month); et_day = (EditText) findViewById(R.id.et_day); et_name = (EditText) findViewById(R.id.et_name); et_sex = (EditText) findViewById(R.id.et_sex); et_nation = (EditText) findViewById(R.id.et_nation); et_address = (EditText) findViewById(R.id.et_address); et_citizenship_number = (EditText) findViewById(R.id.et_citizenship_number); iv_mg = (ImageView) findViewById(R.id.iv_mg); rl_back_front.setOnClickListener(this); iv_id_f_sure.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.rl_back_front: finish(); break; case R.id.iv_id_f_sure: Toast.makeText(context, "信息保存成功!", Toast.LENGTH_LONG).show(); Intent intent = new Intent("com.from.call.back.id.card.front"); intent.putExtra("name", et_name.getText().toString()); intent.putExtra("birthday", et_year.getText().toString() + "年" + et_month.getText().toString() + "月" + et_day.getText().toString() + "日"); intent.putExtra("sex", et_sex.getText().toString()); intent.putExtra("address", et_address.getText().toString()); intent.putExtra("nation", et_nation.getText().toString()); intent.putExtra("id_number", et_citizenship_number.getText().toString()); sendBroadcast(intent); break; default: break; } } }
[ "cgy123" ]
cgy123
e02351fa6deb846dfbc0be8bc482e1b99b88d820
a09c6ecac5fc9956dd5d974db90a4f05d6dd8ed4
/easytravel-master/easytravel-googlegeocode-ws-client/src/main/java/com/armandorv/easytravel/googlegeocodewsclient/parser/GeometryJaxbParser.java
961100db0e826e0e1932b54addcef32cfb3ace7a
[]
no_license
vs70/easytravel
7c843b7604ebdfb93f39b4ea36d7dfe47032242a
5b2efe142fe7196f3d916942491a11ee70b2eb27
refs/heads/master
2021-01-18T00:10:53.260476
2014-03-15T21:45:16
2014-03-15T21:45:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,661
java
package com.armandorv.easytravel.googlegeocodewsclient.parser; import javax.xml.bind.JAXBException; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import com.armandorv.easytravel.googlegeocodewsclient.Parser; import com.armandorv.easytravel.googlegeocodewsclient.exception.GoogleGeocodingException; import com.armandorv.easytravel.googlegeocodewsclient.jaxb.GeocodeResponse; import com.armandorv.easytravel.googlegeocodewsclient.jaxb.GeocodeResponse.Result.Geometry.Location; import com.armandorv.easytravel.googlegeocodewsclient.model.Geometry; /** * Class to parse String from the google geocoding service. * * @author armandorv * */ @Component @Qualifier("geometryParser") class GeometryJaxbParser extends ParserTemplate<GeocodeResponse> implements Parser<Geometry> { private static Logger log = Logger.getLogger(GeometryJaxbParser.class); @Override public Geometry parse(String xml) throws GoogleGeocodingException { assertNotNullOrEmpty(xml); try { GeocodeResponse response = (GeocodeResponse) unmarshaller( GeocodeResponse.class).unmarshal(asIs(xml)); return geometry(response); } catch (JAXBException | IllegalArgumentException e) { log.error("Error parsing xml content :" + e.getMessage(), e); throw new GoogleGeocodingException("Error parsing xml content :" + e.getMessage(), e); } } private Geometry geometry(GeocodeResponse response) { assertStatus(response); Location location = response.getResult().getGeometry().getLocation(); return new Geometry(location.getLat(), location.getLng()); } }
090b47f8701d8abc8df99f7148b6697dc6327db8
37d7cbbdffd621b8552659c64b7363e5f774c65b
/app/src/main/java/org/celanova/euler/CalcButtonListener.java
11dd1cc0bb28f197f4882abb3d2346d8c3b335dc
[]
no_license
Celanova/Euler
96a9cfa552dbf7ec44b2930fa298ee9345e7e7c2
b3821cee7480a804ce3b6e58a3c06d3266a991d8
refs/heads/master
2016-09-06T16:09:57.631059
2014-11-13T20:43:17
2014-11-13T20:43:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package org.celanova.euler; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; /** * Created by Cory on 10/9/2014. */ public class CalcButtonListener implements OnClickListener { Button button; public CalcButtonListener(Button b) { button = b; button.setOnClickListener(this); } public void onClick(View v) { //this will need to change once multichar operations/functions (like sin/cos/tan) are used CalcIO.addUserInput(button.getText().charAt(0)); } }
b286155b8e899d753665ff339f7ee1a187462ef5
81d5599232131f863763aba58415322ca222c5bd
/src/main/java/com/qingyi/model/UpdateRoomNetmodeResult.java
6e9f7a982af8338d12c09e946fa29d63a9e70a88
[]
no_license
chentao199052/smartlock
b843c211f9f3aba69e7ae911f1d2ccbc5279215e
fb56df0335b2c86f4c92b9893e413af55eaf6f23
refs/heads/master
2020-04-22T08:19:21.039759
2019-02-12T01:18:14
2019-02-12T01:18:14
170,240,082
0
0
null
null
null
null
UTF-8
Java
false
false
4,993
java
package com.qingyi.model; /** * 门锁联网模式 * @author Administrator * */ public class UpdateRoomNetmodeResult { private String orderid; private Integer resultstatus; private Integer filetype; private Integer locklca; private Integer lockstatus; private Integer lockstatus2; private String channelid; private String channel; private String powerlev; private Integer networkmode; private Integer workmode; private Integer locktype; private Integer figernum; private Integer recordnum; private String lockver; private Integer lockcharge; private String type; private Integer no; private String order; private String result; private String space; private String osdate; // 下发时间 public UpdateRoomNetmodeResult() { super(); // TODO Auto-generated constructor stub } public UpdateRoomNetmodeResult(String orderid, Integer resultstatus, Integer filetype, Integer locklca, Integer lockstatus, Integer lockstatus2, String channelid, String channel, String powerlev, Integer networkmode, Integer workmode, Integer locktype, Integer figernum, Integer recordnum, String lockver, Integer lockcharge, String type, Integer no, String order, String result, String space, String osdate) { super(); this.orderid = orderid; this.resultstatus = resultstatus; this.filetype = filetype; this.locklca = locklca; this.lockstatus = lockstatus; this.lockstatus2 = lockstatus2; this.channelid = channelid; this.channel = channel; this.powerlev = powerlev; this.networkmode = networkmode; this.workmode = workmode; this.locktype = locktype; this.figernum = figernum; this.recordnum = recordnum; this.lockver = lockver; this.lockcharge = lockcharge; this.type = type; this.no = no; this.order = order; this.result = result; this.space = space; this.osdate = osdate; } public String getOrderid() { return orderid; } public void setOrderid(String orderid) { this.orderid = orderid; } public Integer getResultstatus() { return resultstatus; } public void setResultstatus(Integer resultstatus) { this.resultstatus = resultstatus; } public Integer getFiletype() { return filetype; } public void setFiletype(Integer filetype) { this.filetype = filetype; } public Integer getLocklca() { return locklca; } public void setLocklca(Integer locklca) { this.locklca = locklca; } public Integer getLockstatus() { return lockstatus; } public void setLockstatus(Integer lockstatus) { this.lockstatus = lockstatus; } public Integer getLockstatus2() { return lockstatus2; } public void setLockstatus2(Integer lockstatus2) { this.lockstatus2 = lockstatus2; } public String getChannelid() { return channelid; } public void setChannelid(String channelid) { this.channelid = channelid; } public String getChannel() { return channel; } public void setChannel(String channel) { this.channel = channel; } public String getPowerlev() { return powerlev; } public void setPowerlev(String powerlev) { this.powerlev = powerlev; } public Integer getNetworkmode() { return networkmode; } public void setNetworkmode(Integer networkmode) { this.networkmode = networkmode; } public Integer getWorkmode() { return workmode; } public void setWorkmode(Integer workmode) { this.workmode = workmode; } public Integer getLocktype() { return locktype; } public void setLocktype(Integer locktype) { this.locktype = locktype; } public Integer getFigernum() { return figernum; } public void setFigernum(Integer figernum) { this.figernum = figernum; } public Integer getRecordnum() { return recordnum; } public void setRecordnum(Integer recordnum) { this.recordnum = recordnum; } public String getLockver() { return lockver; } public void setLockver(String lockver) { this.lockver = lockver; } public Integer getLockcharge() { return lockcharge; } public void setLockcharge(Integer lockcharge) { this.lockcharge = lockcharge; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Integer getNo() { return no; } public void setNo(Integer no) { this.no = no; } public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public String getSpace() { return space; } public void setSpace(String space) { this.space = space; } public String getOsdate() { return osdate; } public void setOsdate(String osdate) { this.osdate = osdate; } }
[ "zhanglinbo@f4b23244-d49f-f54a-bd88-39d1c6949392" ]
zhanglinbo@f4b23244-d49f-f54a-bd88-39d1c6949392
6d4dd83d6db6236ccbb340ded28b6759825fc0c1
aa8bfeb580b9048ca17f0a57fc6478a3e456629a
/src/main/java/com/sun/corba/se/spi/activation/LocatorPackage/ServerLocationPerORBHolder.java
606317894ebbf2bbf28bda500cd86df9da6fe9c0
[]
no_license
KunkkaCoco/java7-source
619f87ab0eca49cbeba09280e4d89e165dfc4ed2
1d59690d3f1f7c792b5de4f8a3941ad0326434f9
refs/heads/master
2016-09-05T12:03:58.162623
2014-07-17T04:31:23
2014-07-17T04:31:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,245
java
package com.sun.corba.se.spi.activation.LocatorPackage; /** * com/sun/corba/se/spi/activation/LocatorPackage/ServerLocationPerORBHolder.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from ../../../../src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Wednesday, December 18, 2013 6:35:01 PM PST */ public final class ServerLocationPerORBHolder implements org.omg.CORBA.portable.Streamable { public com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB value = null; public ServerLocationPerORBHolder () { } public ServerLocationPerORBHolder (com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB initialValue) { value = initialValue; } public void _read (org.omg.CORBA.portable.InputStream i) { value = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.read (i); } public void _write (org.omg.CORBA.portable.OutputStream o) { com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.write (o, value); } public org.omg.CORBA.TypeCode _type () { return com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.type (); } }
a37bf39d42701f99c3f469c30ffe7ea561c042c5
98f1fb1ebb29d47010614f3ae12e05151f08b435
/modules/activiti-engine/src/main/java/org/activiti/impl/ProcessServiceImpl.java
aa6fd382c1b509a379e867534c68aacb93b549ea
[]
no_license
NURGALIYESMUKHAMEDOV/activiti-git
f2e7d23bd53e4bf26f45003398153c071420a1b0
db5fe84c664f8bcad5801d6695213c48c44d4afd
refs/heads/master
2020-03-09T18:26:11.926930
2010-07-08T10:22:16
2010-07-08T10:22:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,052
java
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.activiti.impl; import java.io.InputStream; import java.util.HashMap; import java.util.List; import java.util.Map; import org.activiti.Deployment; import org.activiti.DeploymentBuilder; import org.activiti.Execution; import org.activiti.ProcessDefinition; import org.activiti.ProcessInstance; import org.activiti.ProcessInstanceQuery; import org.activiti.ProcessService; import org.activiti.impl.cmd.DeleteDeploymentCmd; import org.activiti.impl.cmd.DeleteProcessInstanceCmd; import org.activiti.impl.cmd.DeployCmd; import org.activiti.impl.cmd.FindDeploymentResourcesCmd; import org.activiti.impl.cmd.FindDeploymentsCmd; import org.activiti.impl.cmd.FindExecutionCmd; import org.activiti.impl.cmd.FindExecutionInActivityCmd; import org.activiti.impl.cmd.FindProcessDefinitionCmd; import org.activiti.impl.cmd.FindProcessDefinitionsCmd; import org.activiti.impl.cmd.FindProcessInstanceCmd; import org.activiti.impl.cmd.GetDeploymentResourceCmd; import org.activiti.impl.cmd.GetExecutionVariableCmd; import org.activiti.impl.cmd.GetExecutionVariablesCmd; import org.activiti.impl.cmd.GetFormCmd; import org.activiti.impl.cmd.SendEventCmd; import org.activiti.impl.cmd.SetExecutionVariablesCmd; import org.activiti.impl.cmd.StartProcessInstanceCmd; import org.activiti.impl.execution.ProcessInstanceQueryImpl; import org.activiti.impl.interceptor.CommandExecutor; import org.activiti.impl.repository.DeployerManager; import org.activiti.impl.repository.DeploymentBuilderImpl; import org.activiti.impl.repository.DeploymentImpl; import org.activiti.impl.scripting.ScriptingEngines; /** * @author Tom Baeyens */ public class ProcessServiceImpl implements ProcessService { private final CommandExecutor commandExecutor; private final DeployerManager deployerManager; private final ScriptingEngines scriptingEngines; public ProcessServiceImpl(CommandExecutor commandExecutor, DeployerManager deployerManager, ScriptingEngines scriptingEngines) { this.commandExecutor = commandExecutor; this.deployerManager = deployerManager; this.scriptingEngines = scriptingEngines; } public DeploymentBuilder createDeployment() { return new DeploymentBuilderImpl(this); } public ProcessInstance findProcessInstanceById(String id) { return commandExecutor.execute(new FindProcessInstanceCmd(id)); } public Execution findExecutionById(String id) { return commandExecutor.execute(new FindExecutionCmd(id)); } public void deleteDeployment(String deploymentId) { commandExecutor.execute(new DeleteDeploymentCmd(deploymentId, false)); } public void deleteDeploymentCascade(String deploymentId) { commandExecutor.execute(new DeleteDeploymentCmd(deploymentId, true)); } public void deleteProcessInstance(String processInstanceId) { commandExecutor.execute(new DeleteProcessInstanceCmd(processInstanceId)); } public ProcessInstance startProcessInstanceByKey(String processDefinitionKey) { return commandExecutor.execute(new StartProcessInstanceCmd<ProcessInstance>(processDefinitionKey, null, null)); } public ProcessInstance startProcessInstanceByKey(String processDefinitionKey, Map<String, Object> variables) { return commandExecutor.execute(new StartProcessInstanceCmd<ProcessInstance>(processDefinitionKey, null, variables)); } public ProcessInstance startProcessInstanceById(String processDefinitionId) { return commandExecutor.execute(new StartProcessInstanceCmd<ProcessInstance>(null, processDefinitionId, null)); } public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables) { return commandExecutor.execute(new StartProcessInstanceCmd<ProcessInstance>(null, processDefinitionId, variables)); } public Deployment deploy(DeploymentImpl deployment) { return commandExecutor.execute(new DeployCmd<Deployment>(deployerManager, deployment)); } @SuppressWarnings("unchecked") public List<ProcessDefinition> findProcessDefinitions() { return commandExecutor.execute(new FindProcessDefinitionsCmd()); } public ProcessDefinition findProcessDefinitionById(String processDefinitionId) { return commandExecutor.execute(new FindProcessDefinitionCmd(processDefinitionId)); } @SuppressWarnings("unchecked") public List<Deployment> findDeployments() { return commandExecutor.execute(new FindDeploymentsCmd()); } @SuppressWarnings("unchecked") public List<String> findDeploymentResources(String deploymentId) { return commandExecutor.execute(new FindDeploymentResourcesCmd(deploymentId)); } public InputStream getDeploymentResourceContent(String deploymentId, String resourceName) { return commandExecutor.execute(new GetDeploymentResourceCmd(deploymentId, resourceName)); } public ProcessInstanceQuery createProcessInstanceQuery() { return new ProcessInstanceQueryImpl(commandExecutor); } public Map<String, Object> getVariables(String executionId) { return commandExecutor.execute(new GetExecutionVariablesCmd(executionId)); } public Object getVariable(String executionId, String variableName) { return commandExecutor.execute(new GetExecutionVariableCmd(executionId, variableName)); } public void setVariable(String executionId, String variableName, Object value) { Map<String, Object> variables = new HashMap<String, Object>(); variables.put(variableName, value); commandExecutor.execute(new SetExecutionVariablesCmd(executionId, variables)); } public void setVariables(String executionId, Map<String, Object> variables) { commandExecutor.execute(new SetExecutionVariablesCmd(executionId, variables)); } public Object getStartFormById(String processDefinitionId) { return commandExecutor.execute(new GetFormCmd(scriptingEngines, processDefinitionId, null, null)); } public Object getStartFormByKey(String processDefinitionKey) { return commandExecutor.execute(new GetFormCmd(scriptingEngines, null, processDefinitionKey, null)); } public void sendEvent(String executionId) { commandExecutor.execute(new SendEventCmd(executionId, null)); } public void sendEvent(String executionId, Object eventData) { commandExecutor.execute(new SendEventCmd(executionId, eventData)); } public Execution findExecutionInActivity(String processInstanceId, String activityId) { return commandExecutor.execute(new FindExecutionInActivityCmd(processInstanceId, activityId)); } }
8c0a48a71b4bd06c9bedfb3b49ae55fef30fcc83
12c469d2d500e8dd22aa9054ad42d22e0e2e87c6
/src/test/java/de/sebdas/PainterTest.java
a9246a9395af6d126a6ccadbcbed2fa23ee29276
[]
no_license
sebastian-dasse/snake-javafx
28f0bf98c731e9ff616206a026b6dd374605841a
2360c8f8c907a0df29f451c7ed4f32f55766a8ba
refs/heads/master
2020-04-22T00:05:09.178276
2019-03-21T02:22:32
2019-03-21T02:22:32
169,967,125
0
0
null
null
null
null
UTF-8
Java
false
false
3,269
java
package de.sebdas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Paint; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static de.sebdas.SnakeGame.TILE_SIZE; import static de.sebdas.SnakeGame.scale; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; @DisplayName("Painter") @ExtendWith(MockitoExtension.class) class PainterTest { @Mock private GraphicsContext graphicsContextMock; private World worldSpy; private Painter painterSpy; @BeforeEach void setup() { worldSpy = spy(new World()); painterSpy = spy(new Painter(graphicsContextMock, TILE_SIZE, worldSpy)); } @Nested @DisplayName("paint()") class Testing_paint { @Test @DisplayName("should clear the canvas") void test_paint_clears_canvas() { painterSpy.paint(); verify(painterSpy).clearCanvas(); verify(graphicsContextMock).fillRect(0.0, 0.0, scale(worldSpy.getWidth()), scale(worldSpy.getHeight())); } @Test @DisplayName("should paint the food") void test_paint_food() { painterSpy.paint(); verify(painterSpy).paintFood(); verify(worldSpy).getFood(); } @SuppressWarnings("ResultOfMethodCallIgnored") // we just want to verify that the method was called at all @Test @DisplayName("should paint the snake") void test_paint_snake() { painterSpy.paint(); verify(painterSpy).paintSnake(); verify(worldSpy).getSnake(); } } @Nested @DisplayName("toggleWarningColor() should actually toggle") class Testing_toggleWarningColor { private Paint initialWarningColor; @BeforeEach void setup() { initialWarningColor = painterSpy.getWarningColor(); } @Test @DisplayName("should change the warning color for an odd number of calls") void test_toggleWarningColor_odd() { painterSpy.toggleWarningColor(); assertThat(painterSpy.getWarningColor()).isNotEqualTo(initialWarningColor); painterSpy.toggleWarningColor(); painterSpy.toggleWarningColor(); assertThat(painterSpy.getWarningColor()).isNotEqualTo(initialWarningColor); } @Test @DisplayName("should change the warning color back to the initial value for an even number of calls") void test_toggleWarningColor_even() { painterSpy.toggleWarningColor(); painterSpy.toggleWarningColor(); assertThat(painterSpy.getWarningColor()).isEqualTo(initialWarningColor); painterSpy.toggleWarningColor(); painterSpy.toggleWarningColor(); assertThat(painterSpy.getWarningColor()).isEqualTo(initialWarningColor); } } @Test @DisplayName("showWarning() should draw a flashing rectangle") void test_showWarning_twice() { painterSpy.showWarning(); painterSpy.showWarning(); painterSpy.showWarning(); verify(graphicsContextMock, times(3)).strokeRect(0.0, 0.0, scale(worldSpy.getWidth()), scale(worldSpy.getHeight())); verify(painterSpy, times(3)).toggleWarningColor(); } }
3a9b3e52c483c71d6bd394b84ecdc3818540c5b8
c25f4c7649f88e97a935c6c31d501d5e3cc7ae0f
/redis-spring-boot-starter/src/test/java/com/spring/boot/tutorial/redis/CreateJedisCommands.java
81657e7072265ab3e458398e3503992732af36cd
[]
no_license
chendurex/spring-boot-tutorial
a7f25d13ac622b323ac25a4c041b7d98778c246b
360fbb257c49c835d8eea812125013e14fed4fc9
refs/heads/master
2022-12-28T19:40:05.810152
2020-10-15T03:03:05
2020-10-15T03:03:05
115,687,352
0
0
null
null
null
null
UTF-8
Java
false
false
1,698
java
package com.spring.boot.tutorial.redis; import org.springframework.core.env.MapPropertySource; import org.springframework.data.redis.connection.RedisClusterConfiguration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.util.StringUtils; import redis.clients.jedis.JedisCluster; import redis.clients.jedis.JedisCommands; import java.lang.reflect.Field; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; /** * @author cheny.huang * @date 2018-09-12 11:42. */ class CreateJedisCommands { static JedisCommands generator() { Collection<String> nodes = Collections.singletonList("192.168.1.117:7000,192.168.1.117:7001,192.168.1.117:7002," + "192.168.1.117:7003,192.168.1.117:7004,192.168.1.117:7005,192.168.1.117:7006"); Map<String, Object> map = new HashMap<>(); map.put("spring.redis.cluster.nodes", StringUtils.collectionToCommaDelimitedString(nodes)); map.put("spring.redis.cluster.max-redirects", 3); JedisConnectionFactory connectionFactory = new JedisConnectionFactory( new RedisClusterConfiguration(new MapPropertySource("RedisClusterConfiguration", map))); connectionFactory.afterPropertiesSet(); try { Field field = JedisConnectionFactory.class.getDeclaredField("cluster"); field.setAccessible(true); return (JedisCluster) field.get(connectionFactory); } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); throw new RuntimeException("获取RedisCluster失败,", e); } } }
505a275cc5d144b53ad075183b375861fc6f6cb5
cb0a7284066e3e3dc6310a49b10443424f6a326b
/FacilityManagementSystem-Spring-Hibernate/src/main/java/com/facilitymanagement/model/facility/IReservation.java
300749f18e7000ba726a0bd59bd302e7af1692a1
[]
no_license
AbrahamCalderon/FacilityManagement
008c2cac2f6121dd9f39cc8704728c02d49c6dba
780fa54c0286a45222a0e95f5d4eaf1dbf371a43
refs/heads/master
2020-04-23T17:14:21.042270
2014-04-23T04:57:58
2014-04-23T04:57:58
19,057,449
1
1
null
null
null
null
UTF-8
Java
false
false
366
java
package com.facilitymanagement.model.facility; import java.sql.Date; public interface IReservation { void setReservationId(int id); int getReservationId(); void setReservationMadeDate(Date date); Date getReservationMadeDate(); void setCheckInDate(Date checkInDate); Date getCheckInDate(); void setCheckOutDate(Date checkOutDate); Date getCheckOutDate(); }
35c2c5d00c9a551418a547652445795815f33878
223887267068d4399f11899f7432f84794f60bcb
/Profile2.java
f427f3a3b75493d936f2c52597cd0b0d1db79dfd
[]
no_license
logbasetwo/EconoMeme
fbf106c78c8a18738c91d64cf97a68db1b7c1a1b
499ea4518d76b5779f1e7bf333ad729478287c2a
refs/heads/master
2020-05-03T12:36:28.819813
2019-03-31T17:25:50
2019-03-31T17:25:50
178,630,766
0
1
null
null
null
null
UTF-8
Java
false
false
4,479
java
package economeme; import java.util.ArrayList; //import java.util.Scanner; public class Profile{ private String username; private String password; public int cash = 100; public ArrayList<MemeStock> memes; private static int date; private ArrayList<Integer> amounts; public Profile(String username, String password)//int cash, ArrayList<MemeStock> memes, ArrayList<Integer> amounts) { this.username = username; this.password = password; this.cash = cash; //this.memes = memes; //this.date = date; //this.amounts = amounts; } private int getPrice(Integer[] meme, int date){ return meme[date]; } public Boolean correctTransaction(Integer[] meme, int day, int userCash, int shares){ int price = getPrice(meme, day); int totalCost = price * shares; if(totalCost >= userCash){ return true; } else { return false; } } public int sellDifference(Integer[] meme, int startDate, int currentDate){ //could implement a percentage value or total difference in price int ogPrice = getPrice(meme, startDate); int currentPrice = getPrice(meme, currentDate); int difference = currentPrice - ogPrice; return difference; } public static void setDate(int today) { date = today; } private int indexOfMeme(MemeStock other) { int index = -1; for(int i = 0; i < memes.size(); i++) { boolean jawn = other.equals(memes.get(i)); if(jawn == true) { index = i; break; } } return index; } public void buy(Integer[] meme, int amount) //MemeStock meme, int amount { if(indexOfMeme(meme) > -1) { amounts.set(indexOfMeme(meme), amounts.get(indexOfMeme(meme)) + amount); } else { memes.add(meme); amounts.add(amount); } cash -= meme.getValue(date)*amount; } public void sell(int index, int amount) { if(index < 0 || index >= memes.size()) { throw new IndexOutOfBoundsException(); } else { cash += memes.get(index).getValue(date)*amount; if(amount < amounts.get(index)) { amounts.set(index, amounts.get(index) - amount); } else { memes.remove(index); amounts.remove(index); } } /** else if(amount < amounts.get(index)) { //amountIndex = amounts.get(index); amounts.set(index, amounts.get(index) - amount); cash += memes.get(index).getValue(date)*amount; } else { memes.remove(index); amounts.remove(index); } **/ } public String getLogin() { return username; } public String getPassword() { return password; // long term don't store as plain text, but we don't need to worry about that for a demo } public int worth() { int worth = cash; for(int i = 0; i < memes.size(); i++) { worth += memes.get(i).getValue(date)*amounts.get(i); } return worth; } /* public String toString() { String memeString = "Meme Stocks:\n"; for (MemeStock meme: memes) { memeString += meme; } return "Profile for: " + username + "\ncash: " + cash + "\ntotalValue } */ public void printInfo() { System.out.println("cash: " + cash); System.out.println("worth: " + worth()); System.out.println("********MEME STOCKS********"); for(int i = 0; i < memes.size(); i++) { System.out.println("\n" + memes.get(i) + "\n\tshares: " + amounts.get(i)); } System.out.println("****************************\n"); } /* public static void main(String[] args) { int meme1array[] = {10, 12, 18, 29, 22, 23, 9, 11}; int meme2array[] = {5, 9, 25, 39, 27, 15, 15, 7}; int meme3array[] = {30, 20, 18, 24, 10, 5, 8, 22}; int meme4array[] = {5, 9, 25, 39, 27, 15, 15, 7}; MemeStock meme1 = new MemeStock("$SP", meme1array); MemeStock meme2 = new MemeStock("$DRK", meme2array); MemeStock meme3 = new MemeStock("$TOM", meme3array); MemeStock meme4 = new MemeStock("$DRK", meme4array); ArrayList<MemeStock> memes = new ArrayList<MemeStock>(); memes.add(meme1); memes.add(meme2); ArrayList<Integer> amounts = new ArrayList<Integer>(); amounts.add(4); amounts.add(1); Profile p = new Profile("dyeh", "dyeh", 200, memes, amounts); Profile.setDate(5); p.printInfo(); p.buy(meme3, 3); p.printInfo(); p.sell(2, 3); p.printInfo(); p.buy(meme4, 2); p.printInfo(); } */ }
dea42cbbe4ad098c81ea62bfd6f8498f5a5e9f31
cbfd4f0cd49499389f65b1ff1c9385acb200efa6
/test/com/urise/webapp/storage/AbstractArrayStorageTest.java
fb23e50d53400e98712a9d143e1a1e9923b88ce5
[]
no_license
KorEugene/ResumeManagingSystem
7d1a05bf24e4c103e2d3756b9148c57d4e949633
5371c98b6f5da9591a7fb96a11b2ecfddcc682d2
refs/heads/master
2023-04-04T23:15:41.647951
2021-04-18T17:49:36
2021-04-18T17:49:36
359,214,478
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package com.urise.webapp.storage; import com.urise.webapp.exception.StorageException; import com.urise.webapp.model.Resume; import org.junit.Test; import static org.junit.Assert.*; public abstract class AbstractArrayStorageTest extends AbstractStorageTest { protected AbstractArrayStorageTest(Storage storage) { super(storage); } @Test(expected = StorageException.class) public void storageIsOverflow() { int limit = AbstractArrayStorage.getStorageLimit(); try { for (int i = 3; i < limit; i++) { storage.save(new Resume("Employee")); } } catch (StorageException e) { fail("ERROR: storage is overflow!"); } storage.save(new Resume("Employee")); } }
38e475a613a0d77616671970f599fe6fea66862e
183744d6f703314a0a3b5cf414912fc7de5fca92
/src/mapreduce/hi/api/MRJobConfig.java
334e2ccd36183cba79195d76253739b1fdf667da
[]
no_license
thomachan/Hadoop-Hbase
682ed2a7327c3aaefeb5153c57d6ba6736543d47
cee9de1bf080dbbda223352a17b5c595893ad2af
refs/heads/master
2020-11-26T15:28:36.219778
2014-06-23T10:26:27
2014-06-23T10:26:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
28,850
java
package mapreduce.hi.api; import org.apache.hadoop.util.Shell; public interface MRJobConfig { // Put all of the attribute names in here so that Job and JobContext are // consistent. public static final String INPUT_FORMAT_CLASS_ATTR = "mapreduce.job.inputformat.class"; public static final String MAP_CLASS_ATTR = "mapreduce.job.map.class"; public static final String MAP_OUTPUT_COLLECTOR_CLASS_ATTR = "mapreduce.job.map.output.collector.class"; public static final String COMBINE_CLASS_ATTR = "mapreduce.job.combine.class"; public static final String REDUCE_CLASS_ATTR = "mapreduce.job.reduce.class"; public static final String OUTPUT_FORMAT_CLASS_ATTR = "mapreduce.job.outputformat.class"; public static final String PARTITIONER_CLASS_ATTR = "mapreduce.job.partitioner.class"; public static final String SETUP_CLEANUP_NEEDED = "mapreduce.job.committer.setup.cleanup.needed"; public static final String TASK_CLEANUP_NEEDED = "mapreduce.job.committer.task.cleanup.needed"; public static final String JAR = "mapreduce.job.jar"; public static final String ID = "mapreduce.job.id"; public static final String JOB_NAME = "mapreduce.job.name"; public static final String JAR_UNPACK_PATTERN = "mapreduce.job.jar.unpack.pattern"; public static final String USER_NAME = "mapreduce.job.user.name"; public static final String PRIORITY = "mapreduce.job.priority"; public static final String QUEUE_NAME = "mapreduce.job.queuename"; public static final String JVM_NUMTASKS_TORUN = "mapreduce.job.jvm.numtasks"; public static final String SPLIT_FILE = "mapreduce.job.splitfile"; public static final String SPLIT_METAINFO_MAXSIZE = "mapreduce.job.split.metainfo.maxsize"; public static final long DEFAULT_SPLIT_METAINFO_MAXSIZE = 10000000L; public static final String NUM_MAPS = "mapreduce.job.maps"; public static final String MAX_TASK_FAILURES_PER_TRACKER = "mapreduce.job.maxtaskfailures.per.tracker"; public static final String COMPLETED_MAPS_FOR_REDUCE_SLOWSTART = "mapreduce.job.reduce.slowstart.completedmaps"; public static final String NUM_REDUCES = "mapreduce.job.reduces"; public static final String SKIP_RECORDS = "mapreduce.job.skiprecords"; public static final String SKIP_OUTDIR = "mapreduce.job.skip.outdir"; public static final String SPECULATIVE_SLOWNODE_THRESHOLD = "mapreduce.job.speculative.slownodethreshold"; public static final String SPECULATIVE_SLOWTASK_THRESHOLD = "mapreduce.job.speculative.slowtaskthreshold"; public static final String SPECULATIVECAP = "mapreduce.job.speculative.speculativecap"; public static final String JOB_LOCAL_DIR = "mapreduce.job.local.dir"; public static final String OUTPUT_KEY_CLASS = "mapreduce.job.output.key.class"; public static final String OUTPUT_VALUE_CLASS = "mapreduce.job.output.value.class"; public static final String KEY_COMPARATOR = "mapreduce.job.output.key.comparator.class"; public static final String GROUP_COMPARATOR_CLASS = "mapreduce.job.output.group.comparator.class"; public static final String WORKING_DIR = "mapreduce.job.working.dir"; public static final String CLASSPATH_ARCHIVES = "mapreduce.job.classpath.archives"; public static final String CLASSPATH_FILES = "mapreduce.job.classpath.files"; public static final String CACHE_FILES = "mapreduce.job.cache.files"; public static final String CACHE_ARCHIVES = "mapreduce.job.cache.archives"; public static final String CACHE_FILES_SIZES = "mapreduce.job.cache.files.filesizes"; // internal use only public static final String CACHE_ARCHIVES_SIZES = "mapreduce.job.cache.archives.filesizes"; // ditto public static final String CACHE_LOCALFILES = "mapreduce.job.cache.local.files"; public static final String CACHE_LOCALARCHIVES = "mapreduce.job.cache.local.archives"; public static final String CACHE_FILE_TIMESTAMPS = "mapreduce.job.cache.files.timestamps"; public static final String CACHE_ARCHIVES_TIMESTAMPS = "mapreduce.job.cache.archives.timestamps"; public static final String CACHE_FILE_VISIBILITIES = "mapreduce.job.cache.files.visibilities"; public static final String CACHE_ARCHIVES_VISIBILITIES = "mapreduce.job.cache.archives.visibilities"; public static final String USER_LOG_RETAIN_HOURS = "mapreduce.job.userlog.retain.hours"; public static final String MAPREDUCE_JOB_USER_CLASSPATH_FIRST = "mapreduce.job.user.classpath.first"; public static final String MAPREDUCE_JOB_CLASSLOADER = "mapreduce.job.classloader"; /** * A comma-separated list of services that function as ShuffleProvider aux-services * (in addition to the built-in ShuffleHandler). * These services can serve shuffle requests from reducetasks. */ public static final String MAPREDUCE_JOB_SHUFFLE_PROVIDER_SERVICES = "mapreduce.job.shuffle.provider.services"; public static final String MAPREDUCE_JOB_CLASSLOADER_SYSTEM_CLASSES = "mapreduce.job.classloader.system.classes"; public static final String MAPREDUCE_JVM_SYSTEM_PROPERTIES_TO_LOG = "mapreduce.jvm.system-properties-to-log"; public static final String DEFAULT_MAPREDUCE_JVM_SYSTEM_PROPERTIES_TO_LOG = "os.name,os.version,java.home,java.runtime.version,java.vendor," + "java.version,java.vm.name,java.class.path,java.io.tmpdir,user.dir,user.name"; public static final String IO_SORT_FACTOR = "mapreduce.task.io.sort.factor"; public static final String IO_SORT_MB = "mapreduce.task.io.sort.mb"; public static final String INDEX_CACHE_MEMORY_LIMIT = "mapreduce.task.index.cache.limit.bytes"; public static final String PRESERVE_FAILED_TASK_FILES = "mapreduce.task.files.preserve.failedtasks"; public static final String PRESERVE_FILES_PATTERN = "mapreduce.task.files.preserve.filepattern"; public static final String TASK_TEMP_DIR = "mapreduce.task.tmp.dir"; public static final String TASK_DEBUGOUT_LINES = "mapreduce.task.debugout.lines"; public static final String RECORDS_BEFORE_PROGRESS = "mapreduce.task.merge.progress.records"; public static final String SKIP_START_ATTEMPTS = "mapreduce.task.skip.start.attempts"; public static final String TASK_ATTEMPT_ID = "mapreduce.task.attempt.id"; public static final String TASK_ISMAP = "mapreduce.task.ismap"; public static final String TASK_PARTITION = "mapreduce.task.partition"; public static final String TASK_PROFILE = "mapreduce.task.profile"; public static final String TASK_PROFILE_PARAMS = "mapreduce.task.profile.params"; public static final String NUM_MAP_PROFILES = "mapreduce.task.profile.maps"; public static final String NUM_REDUCE_PROFILES = "mapreduce.task.profile.reduces"; public static final String TASK_MAP_PROFILE_PARAMS = "mapreduce.task.profile.map.params"; public static final String TASK_REDUCE_PROFILE_PARAMS = "mapreduce.task.profile.reduce.params"; public static final String TASK_TIMEOUT = "mapreduce.task.timeout"; public static final String TASK_TIMEOUT_CHECK_INTERVAL_MS = "mapreduce.task.timeout.check-interval-ms"; public static final String TASK_ID = "mapreduce.task.id"; public static final String TASK_OUTPUT_DIR = "mapreduce.task.output.dir"; public static final String TASK_USERLOG_LIMIT = "mapreduce.task.userlog.limit.kb"; public static final String MAP_SORT_SPILL_PERCENT = "mapreduce.map.sort.spill.percent"; public static final String MAP_INPUT_FILE = "mapreduce.map.input.file"; public static final String MAP_INPUT_PATH = "mapreduce.map.input.length"; public static final String MAP_INPUT_START = "mapreduce.map.input.start"; public static final String MAP_MEMORY_MB = "mapreduce.map.memory.mb"; public static final int DEFAULT_MAP_MEMORY_MB = 1024; public static final String MAP_CPU_VCORES = "mapreduce.map.cpu.vcores"; public static final int DEFAULT_MAP_CPU_VCORES = 1; public static final String MAP_ENV = "mapreduce.map.env"; public static final String MAP_JAVA_OPTS = "mapreduce.map.java.opts"; public static final String MAP_MAX_ATTEMPTS = "mapreduce.map.maxattempts"; public static final String MAP_DEBUG_SCRIPT = "mapreduce.map.debug.script"; public static final String MAP_SPECULATIVE = "mapreduce.map.speculative"; public static final String MAP_FAILURES_MAX_PERCENT = "mapreduce.map.failures.maxpercent"; public static final String MAP_SKIP_INCR_PROC_COUNT = "mapreduce.map.skip.proc-count.auto-incr"; public static final String MAP_SKIP_MAX_RECORDS = "mapreduce.map.skip.maxrecords"; public static final String MAP_COMBINE_MIN_SPILLS = "mapreduce.map.combine.minspills"; public static final String MAP_OUTPUT_COMPRESS = "mapreduce.map.output.compress"; public static final String MAP_OUTPUT_COMPRESS_CODEC = "mapreduce.map.output.compress.codec"; public static final String MAP_OUTPUT_KEY_CLASS = "mapreduce.map.output.key.class"; public static final String MAP_OUTPUT_VALUE_CLASS = "mapreduce.map.output.value.class"; public static final String MAP_OUTPUT_KEY_FIELD_SEPERATOR = "mapreduce.map.output.key.field.separator"; public static final String MAP_LOG_LEVEL = "mapreduce.map.log.level"; public static final String REDUCE_LOG_LEVEL = "mapreduce.reduce.log.level"; public static final String DEFAULT_LOG_LEVEL = "INFO"; public static final String REDUCE_MERGE_INMEM_THRESHOLD = "mapreduce.reduce.merge.inmem.threshold"; public static final String REDUCE_INPUT_BUFFER_PERCENT = "mapreduce.reduce.input.buffer.percent"; public static final String REDUCE_MARKRESET_BUFFER_PERCENT = "mapreduce.reduce.markreset.buffer.percent"; public static final String REDUCE_MARKRESET_BUFFER_SIZE = "mapreduce.reduce.markreset.buffer.size"; public static final String REDUCE_MEMORY_MB = "mapreduce.reduce.memory.mb"; public static final int DEFAULT_REDUCE_MEMORY_MB = 1024; public static final String REDUCE_CPU_VCORES = "mapreduce.reduce.cpu.vcores"; public static final int DEFAULT_REDUCE_CPU_VCORES = 1; public static final String REDUCE_MEMORY_TOTAL_BYTES = "mapreduce.reduce.memory.totalbytes"; public static final String SHUFFLE_INPUT_BUFFER_PERCENT = "mapreduce.reduce.shuffle.input.buffer.percent"; public static final String SHUFFLE_MEMORY_LIMIT_PERCENT = "mapreduce.reduce.shuffle.memory.limit.percent"; public static final String SHUFFLE_MERGE_PERCENT = "mapreduce.reduce.shuffle.merge.percent"; public static final String REDUCE_FAILURES_MAXPERCENT = "mapreduce.reduce.failures.maxpercent"; public static final String REDUCE_ENV = "mapreduce.reduce.env"; public static final String REDUCE_JAVA_OPTS = "mapreduce.reduce.java.opts"; public static final String MAPREDUCE_JOB_DIR = "mapreduce.job.dir"; public static final String REDUCE_MAX_ATTEMPTS = "mapreduce.reduce.maxattempts"; public static final String SHUFFLE_PARALLEL_COPIES = "mapreduce.reduce.shuffle.parallelcopies"; public static final String REDUCE_DEBUG_SCRIPT = "mapreduce.reduce.debug.script"; public static final String REDUCE_SPECULATIVE = "mapreduce.reduce.speculative"; public static final String SHUFFLE_CONNECT_TIMEOUT = "mapreduce.reduce.shuffle.connect.timeout"; public static final String SHUFFLE_READ_TIMEOUT = "mapreduce.reduce.shuffle.read.timeout"; public static final String SHUFFLE_FETCH_FAILURES = "mapreduce.reduce.shuffle.maxfetchfailures"; public static final String SHUFFLE_NOTIFY_READERROR = "mapreduce.reduce.shuffle.notify.readerror"; public static final String MAX_SHUFFLE_FETCH_RETRY_DELAY = "mapreduce.reduce.shuffle.retry-delay.max.ms"; public static final long DEFAULT_MAX_SHUFFLE_FETCH_RETRY_DELAY = 60000; public static final String REDUCE_SKIP_INCR_PROC_COUNT = "mapreduce.reduce.skip.proc-count.auto-incr"; public static final String REDUCE_SKIP_MAXGROUPS = "mapreduce.reduce.skip.maxgroups"; public static final String REDUCE_MEMTOMEM_THRESHOLD = "mapreduce.reduce.merge.memtomem.threshold"; public static final String REDUCE_MEMTOMEM_ENABLED = "mapreduce.reduce.merge.memtomem.enabled"; public static final String COMBINE_RECORDS_BEFORE_PROGRESS = "mapreduce.task.combine.progress.records"; public static final String JOB_NAMENODES = "mapreduce.job.hdfs-servers"; public static final String JOB_JOBTRACKER_ID = "mapreduce.job.kerberos.jtprinicipal"; public static final String JOB_CANCEL_DELEGATION_TOKEN = "mapreduce.job.complete.cancel.delegation.tokens"; public static final String JOB_ACL_VIEW_JOB = "mapreduce.job.acl-view-job"; public static final String DEFAULT_JOB_ACL_VIEW_JOB = " "; public static final String JOB_ACL_MODIFY_JOB = "mapreduce.job.acl-modify-job"; public static final String DEFAULT_JOB_ACL_MODIFY_JOB = " "; /* config for tracking the local file where all the credentials for the job * credentials. */ public static final String MAPREDUCE_JOB_CREDENTIALS_BINARY = "mapreduce.job.credentials.binary"; /* Configs for tracking ids of tokens used by a job */ public static final String JOB_TOKEN_TRACKING_IDS_ENABLED = "mapreduce.job.token.tracking.ids.enabled"; public static final boolean DEFAULT_JOB_TOKEN_TRACKING_IDS_ENABLED = false; public static final String JOB_TOKEN_TRACKING_IDS = "mapreduce.job.token.tracking.ids"; public static final String JOB_SUBMITHOST = "mapreduce.job.submithostname"; public static final String JOB_SUBMITHOSTADDR = "mapreduce.job.submithostaddress"; public static final String COUNTERS_MAX_KEY = "mapreduce.job.counters.max"; public static final int COUNTERS_MAX_DEFAULT = 120; public static final String COUNTER_GROUP_NAME_MAX_KEY = "mapreduce.job.counters.group.name.max"; public static final int COUNTER_GROUP_NAME_MAX_DEFAULT = 128; public static final String COUNTER_NAME_MAX_KEY = "mapreduce.job.counters.counter.name.max"; public static final int COUNTER_NAME_MAX_DEFAULT = 64; public static final String COUNTER_GROUPS_MAX_KEY = "mapreduce.job.counters.groups.max"; public static final int COUNTER_GROUPS_MAX_DEFAULT = 50; public static final String JOB_UBERTASK_ENABLE = "mapreduce.job.ubertask.enable"; public static final String JOB_UBERTASK_MAXMAPS = "mapreduce.job.ubertask.maxmaps"; public static final String JOB_UBERTASK_MAXREDUCES = "mapreduce.job.ubertask.maxreduces"; public static final String JOB_UBERTASK_MAXBYTES = "mapreduce.job.ubertask.maxbytes"; public static final String MR_PREFIX = "yarn.app.mapreduce."; public static final String MR_AM_PREFIX = MR_PREFIX + "am."; /** The number of client retries to the AM - before reconnecting to the RM * to fetch Application State. */ public static final String MR_CLIENT_TO_AM_IPC_MAX_RETRIES = MR_PREFIX + "client-am.ipc.max-retries"; public static final int DEFAULT_MR_CLIENT_TO_AM_IPC_MAX_RETRIES = 3; /** The number of client retries on socket timeouts to the AM - before * reconnecting to the RM to fetch Application Status. */ public static final String MR_CLIENT_TO_AM_IPC_MAX_RETRIES_ON_TIMEOUTS = MR_PREFIX + "yarn.app.mapreduce.client-am.ipc.max-retries-on-timeouts"; public static final int DEFAULT_MR_CLIENT_TO_AM_IPC_MAX_RETRIES_ON_TIMEOUTS = 3; /** * The number of client retries to the RM/HS before throwing exception. */ public static final String MR_CLIENT_MAX_RETRIES = MR_PREFIX + "client.max-retries"; public static final int DEFAULT_MR_CLIENT_MAX_RETRIES = 3; /** The staging directory for map reduce.*/ public static final String MR_AM_STAGING_DIR = MR_AM_PREFIX+"staging-dir"; public static final String DEFAULT_MR_AM_STAGING_DIR = "/tmp/hadoop-yarn/staging"; /** The amount of memory the MR app master needs.*/ public static final String MR_AM_VMEM_MB = MR_AM_PREFIX+"resource.mb"; public static final int DEFAULT_MR_AM_VMEM_MB = 1536; /** The number of virtual cores the MR app master needs.*/ public static final String MR_AM_CPU_VCORES = MR_AM_PREFIX+"resource.cpu-vcores"; public static final int DEFAULT_MR_AM_CPU_VCORES = 1; /** Command line arguments passed to the MR app master.*/ public static final String MR_AM_COMMAND_OPTS = MR_AM_PREFIX+"command-opts"; public static final String DEFAULT_MR_AM_COMMAND_OPTS = "-Xmx1024m"; /** Admin command opts passed to the MR app master.*/ public static final String MR_AM_ADMIN_COMMAND_OPTS = MR_AM_PREFIX+"admin-command-opts"; public static final String DEFAULT_MR_AM_ADMIN_COMMAND_OPTS = ""; /** Root Logging level passed to the MR app master.*/ public static final String MR_AM_LOG_LEVEL = MR_AM_PREFIX+"log.level"; public static final String DEFAULT_MR_AM_LOG_LEVEL = "INFO"; /**The number of splits when reporting progress in MR*/ public static final String MR_AM_NUM_PROGRESS_SPLITS = MR_AM_PREFIX+"num-progress-splits"; public static final int DEFAULT_MR_AM_NUM_PROGRESS_SPLITS = 12; /** * Upper limit on the number of threads user to launch containers in the app * master. Expect level config, you shouldn't be needing it in most cases. */ public static final String MR_AM_CONTAINERLAUNCHER_THREAD_COUNT_LIMIT = MR_AM_PREFIX+"containerlauncher.thread-count-limit"; public static final int DEFAULT_MR_AM_CONTAINERLAUNCHER_THREAD_COUNT_LIMIT = 500; /** Number of threads to handle job client RPC requests.*/ public static final String MR_AM_JOB_CLIENT_THREAD_COUNT = MR_AM_PREFIX + "job.client.thread-count"; public static final int DEFAULT_MR_AM_JOB_CLIENT_THREAD_COUNT = 1; /** * Range of ports that the MapReduce AM can use when binding. Leave blank * if you want all possible ports. */ public static final String MR_AM_JOB_CLIENT_PORT_RANGE = MR_AM_PREFIX + "job.client.port-range"; /** Enable blacklisting of nodes in the job.*/ public static final String MR_AM_JOB_NODE_BLACKLISTING_ENABLE = MR_AM_PREFIX + "job.node-blacklisting.enable"; /** Ignore blacklisting if a certain percentage of nodes have been blacklisted */ public static final String MR_AM_IGNORE_BLACKLISTING_BLACKLISTED_NODE_PERECENT = MR_AM_PREFIX + "job.node-blacklisting.ignore-threshold-node-percent"; public static final int DEFAULT_MR_AM_IGNORE_BLACKLISTING_BLACKLISTED_NODE_PERCENT = 33; /** Enable job recovery.*/ public static final String MR_AM_JOB_RECOVERY_ENABLE = MR_AM_PREFIX + "job.recovery.enable"; public static final boolean MR_AM_JOB_RECOVERY_ENABLE_DEFAULT = true; /** * Limit on the number of reducers that can be preempted to ensure that at * least one map task can run if it needs to. Percentage between 0.0 and 1.0 */ public static final String MR_AM_JOB_REDUCE_PREEMPTION_LIMIT = MR_AM_PREFIX + "job.reduce.preemption.limit"; public static final float DEFAULT_MR_AM_JOB_REDUCE_PREEMPTION_LIMIT = 0.5f; /** AM ACL disabled. **/ public static final String JOB_AM_ACCESS_DISABLED = "mapreduce.job.am-access-disabled"; public static final boolean DEFAULT_JOB_AM_ACCESS_DISABLED = false; /** * Limit reduces starting until a certain percentage of maps have finished. * Percentage between 0.0 and 1.0 */ public static final String MR_AM_JOB_REDUCE_RAMPUP_UP_LIMIT = MR_AM_PREFIX + "job.reduce.rampup.limit"; public static final float DEFAULT_MR_AM_JOB_REDUCE_RAMP_UP_LIMIT = 0.5f; /** The class that should be used for speculative execution calculations.*/ public static final String MR_AM_JOB_SPECULATOR = MR_AM_PREFIX + "job.speculator.class"; /** Class used to estimate task resource needs.*/ public static final String MR_AM_TASK_ESTIMATOR = MR_AM_PREFIX + "job.task.estimator.class"; /** The lambda value in the smoothing function of the task estimator.*/ public static final String MR_AM_TASK_ESTIMATOR_SMOOTH_LAMBDA_MS = MR_AM_PREFIX + "job.task.estimator.exponential.smooth.lambda-ms"; public static final long DEFAULT_MR_AM_TASK_ESTIMATOR_SMOOTH_LAMBDA_MS = 1000L * 60; /** true if the smoothing rate should be exponential.*/ public static final String MR_AM_TASK_ESTIMATOR_EXPONENTIAL_RATE_ENABLE = MR_AM_PREFIX + "job.task.estimator.exponential.smooth.rate"; /** The number of threads used to handle task RPC calls.*/ public static final String MR_AM_TASK_LISTENER_THREAD_COUNT = MR_AM_PREFIX + "job.task.listener.thread-count"; public static final int DEFAULT_MR_AM_TASK_LISTENER_THREAD_COUNT = 30; /** How often the AM should send heartbeats to the RM.*/ public static final String MR_AM_TO_RM_HEARTBEAT_INTERVAL_MS = MR_AM_PREFIX + "scheduler.heartbeat.interval-ms"; public static final int DEFAULT_MR_AM_TO_RM_HEARTBEAT_INTERVAL_MS = 1000; /** * If contact with RM is lost, the AM will wait MR_AM_TO_RM_WAIT_INTERVAL_MS * milliseconds before aborting. During this interval, AM will still try * to contact the RM. */ public static final String MR_AM_TO_RM_WAIT_INTERVAL_MS = MR_AM_PREFIX + "scheduler.connection.wait.interval-ms"; public static final int DEFAULT_MR_AM_TO_RM_WAIT_INTERVAL_MS = 360000; /** * How long to wait in milliseconds for the output committer to cancel * an operation when the job is being killed */ public static final String MR_AM_COMMITTER_CANCEL_TIMEOUT_MS = MR_AM_PREFIX + "job.committer.cancel-timeout"; public static final int DEFAULT_MR_AM_COMMITTER_CANCEL_TIMEOUT_MS = 60 * 1000; /** * Defines a time window in milliseconds for output committer operations. * If contact with the RM has occurred within this window then commit * operations are allowed, otherwise the AM will not allow output committer * operations until contact with the RM has been re-established. */ public static final String MR_AM_COMMIT_WINDOW_MS = MR_AM_PREFIX + "job.committer.commit-window"; public static final int DEFAULT_MR_AM_COMMIT_WINDOW_MS = 10 * 1000; /** * Boolean. Create the base dirs in the JobHistoryEventHandler * Set to false for multi-user clusters. This is an internal config that * is set by the MR framework and read by it too. */ public static final String MR_AM_CREATE_JH_INTERMEDIATE_BASE_DIR = MR_AM_PREFIX + "create-intermediate-jh-base-dir"; public static final String MR_AM_HISTORY_MAX_UNFLUSHED_COMPLETE_EVENTS = MR_AM_PREFIX + "history.max-unflushed-events"; public static final int DEFAULT_MR_AM_HISTORY_MAX_UNFLUSHED_COMPLETE_EVENTS = 200; public static final String MR_AM_HISTORY_JOB_COMPLETE_UNFLUSHED_MULTIPLIER = MR_AM_PREFIX + "history.job-complete-unflushed-multiplier"; public static final int DEFAULT_MR_AM_HISTORY_JOB_COMPLETE_UNFLUSHED_MULTIPLIER = 30; public static final String MR_AM_HISTORY_COMPLETE_EVENT_FLUSH_TIMEOUT_MS = MR_AM_PREFIX + "history.complete-event-flush-timeout"; public static final long DEFAULT_MR_AM_HISTORY_COMPLETE_EVENT_FLUSH_TIMEOUT_MS = 30 * 1000l; public static final String MR_AM_HISTORY_USE_BATCHED_FLUSH_QUEUE_SIZE_THRESHOLD = MR_AM_PREFIX + "history.use-batched-flush.queue-size.threshold"; public static final int DEFAULT_MR_AM_HISTORY_USE_BATCHED_FLUSH_QUEUE_SIZE_THRESHOLD = 50; public static final String MR_AM_ENV = MR_AM_PREFIX + "env"; public static final String MR_AM_ADMIN_USER_ENV = MR_AM_PREFIX + "admin.user.env"; public static final String MAPRED_MAP_ADMIN_JAVA_OPTS = "mapreduce.admin.map.child.java.opts"; public static final String MAPRED_REDUCE_ADMIN_JAVA_OPTS = "mapreduce.admin.reduce.child.java.opts"; public static final String DEFAULT_MAPRED_ADMIN_JAVA_OPTS = "-Djava.net.preferIPv4Stack=true " + "-Dhadoop.metrics.log.level=WARN "; public static final String MAPRED_ADMIN_USER_SHELL = "mapreduce.admin.user.shell"; public static final String DEFAULT_SHELL = "/bin/bash"; public static final String MAPRED_ADMIN_USER_ENV = "mapreduce.admin.user.env"; public final String DEFAULT_MAPRED_ADMIN_USER_ENV = Shell.WINDOWS ? "PATH=%PATH%;%HADOOP_COMMON_HOME%\\bin": "LD_LIBRARY_PATH=$HADOOP_COMMON_HOME/lib/native"; public static final String WORKDIR = "work"; public static final String OUTPUT = "output"; public static final String HADOOP_WORK_DIR = "HADOOP_WORK_DIR"; // Environment variables used by Pipes. (TODO: these // do not appear to be used by current pipes source code!) public static final String STDOUT_LOGFILE_ENV = "STDOUT_LOGFILE_ENV"; public static final String STDERR_LOGFILE_ENV = "STDERR_LOGFILE_ENV"; // This should be the directory where splits file gets localized on the node // running ApplicationMaster. public static final String JOB_SUBMIT_DIR = "jobSubmitDir"; // This should be the name of the localized job-configuration file on the node // running ApplicationMaster and Task public static final String JOB_CONF_FILE = "job.xml"; // This should be the name of the localized job-jar file on the node running // individual containers/tasks. public static final String JOB_JAR = "job.jar"; public static final String JOB_SPLIT = "job.split"; public static final String JOB_SPLIT_METAINFO = "job.splitmetainfo"; public static final String APPLICATION_MASTER_CLASS = "org.apache.hadoop.mapreduce.v2.app.MRAppMaster"; public static final String MAPREDUCE_V2_CHILD_CLASS = "org.apache.hadoop.mapred.YarnChild"; public static final String APPLICATION_ATTEMPT_ID = "mapreduce.job.application.attempt.id"; /** * Job end notification. */ public static final String MR_JOB_END_NOTIFICATION_URL = "mapreduce.job.end-notification.url"; public static final String MR_JOB_END_NOTIFICATION_PROXY = "mapreduce.job.end-notification.proxy"; public static final String MR_JOB_END_NOTIFICATION_TIMEOUT = "mapreduce.job.end-notification.timeout"; public static final String MR_JOB_END_RETRY_ATTEMPTS = "mapreduce.job.end-notification.retry.attempts"; public static final String MR_JOB_END_RETRY_INTERVAL = "mapreduce.job.end-notification.retry.interval"; public static final String MR_JOB_END_NOTIFICATION_MAX_ATTEMPTS = "mapreduce.job.end-notification.max.attempts"; public static final String MR_JOB_END_NOTIFICATION_MAX_RETRY_INTERVAL = "mapreduce.job.end-notification.max.retry.interval"; public static final int DEFAULT_MR_JOB_END_NOTIFICATION_TIMEOUT = 5000; /* * MR AM Service Authorization */ public static final String MR_AM_SECURITY_SERVICE_AUTHORIZATION_TASK_UMBILICAL = "security.job.task.protocol.acl"; public static final String MR_AM_SECURITY_SERVICE_AUTHORIZATION_CLIENT = "security.job.client.protocol.acl"; /** * CLASSPATH for all YARN MapReduce applications. */ public static final String MAPREDUCE_APPLICATION_CLASSPATH = "mapreduce.application.classpath"; /** * Path to MapReduce framework archive */ public static final String MAPREDUCE_APPLICATION_FRAMEWORK_PATH = "mapreduce.application.framework.path"; /** * Default CLASSPATH for all YARN MapReduce applications. */ public final String DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH = Shell.WINDOWS ? "%HADOOP_MAPRED_HOME%\\share\\hadoop\\mapreduce\\*," + "%HADOOP_MAPRED_HOME%\\share\\hadoop\\mapreduce\\lib\\*" : "$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*," + "$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*"; public static final String WORKFLOW_ID = "mapreduce.workflow.id"; public static final String WORKFLOW_NAME = "mapreduce.workflow.name"; public static final String WORKFLOW_NODE_NAME = "mapreduce.workflow.node.name"; public static final String WORKFLOW_ADJACENCY_PREFIX_STRING = "mapreduce.workflow.adjacency."; public static final String WORKFLOW_ADJACENCY_PREFIX_PATTERN = "^mapreduce\\.workflow\\.adjacency\\..+"; public static final String WORKFLOW_TAGS = "mapreduce.workflow.tags"; /** * The maximum number of application attempts. * It is a application-specific setting. */ public static final String MR_AM_MAX_ATTEMPTS = "mapreduce.am.max-attempts"; public static final int DEFAULT_MR_AM_MAX_ATTEMPTS = 2; public static final String MR_APPLICATION_TYPE = "MAPREDUCE"; /* * configurable */ public static final String MR_COMBINE_SPLIT_MAXSIZE = "mapreduce.input.fileinputformat.split.maxsize"; public static final String MR_COMBINE_SPLIT_MINSIZE_PERNODE = "mapreduce.input.fileinputformat.split.minsize.per.node"; public static final String MR_COMBINE_SPLIT_MINSIZE_PERRACK = "mapreduce.input.fileinputformat.split.minsize.per.rack"; public static final String MR_RECORD_DELIMITER = "record.delimiter"; public static final String MR_KEY_VALUE_SEPARATOR = "keyvalue.separator"; }
1dbcbb1de3c50aff70474cc8e2c1eaf68ad3589d
b4e33d0d667cc39c91d062120d746fd86c8a5c9e
/tags/ark-0.1.3-SNAPSHOT/ark-container/src/test/java/au/org/theark/TestHomePage.java
3b8a8bd56fd61b9f69cf1d17304f0c4c9a4e06a8
[]
no_license
SBIMB/The-Ark-Informatics-2
4ad1e47a36ffc7470a685b21c6241150394d9c02
29de6e008158006f542cd17b44141cb5d9e9c80c
refs/heads/master
2021-09-07T00:29:51.339456
2018-02-14T06:54:49
2018-02-14T06:54:49
113,970,086
0
1
null
null
null
null
UTF-8
Java
false
false
687
java
package au.org.theark; import junit.framework.TestCase; import org.apache.wicket.util.tester.WicketTester; /** * Simple test using the WicketTester */ @SuppressWarnings("unused") public class TestHomePage extends TestCase { private WicketTester tester; @Override public void setUp() { //tester = new WicketTester(new WicketApplication()); } public void testRenderMyPage() { //start and render the test page //tester.startPage(HomePage.class); //assert rendered page class //tester.assertRenderedPage(HomePage.class); //assert rendered label component //tester.assertLabel("message", "If you see this message wicket is properly configured and running"); } }
ced1cec52e337e17b18d1406ccc0019069532248
53e9ffc8e7c75710fae7c25af1da75447f1c4cef
/example-security-core/src/main/java/example/security/core/validator/code/ValidateCodeException.java
cbde5e50ca11556ba3b3d840555630ef3145ec51
[]
no_license
JamalyYao/example-security
7dd0aaea1b8b48622fd8343faae453bb005ae604
6bfc9693b1ab81bf45fc03829019ef4d6c923eb9
refs/heads/master
2020-04-24T13:28:57.067223
2018-12-07T10:02:33
2018-12-07T10:02:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package example.security.core.validator.code; import org.springframework.security.core.AuthenticationException; public class ValidateCodeException extends AuthenticationException { private static final long serialVersionUID = 4614132326770579526L; public ValidateCodeException(String msg) { super(msg); } }
56e917df36625226e26186d823e9b09d7ffb85a2
ea54e6066ddffb5e559347312669425bf6498151
/src/main/java/com/sirtrack/construct/lib/BitStream.java
cc808fbcfe289bff8131d996434b91dc7fc75576
[ "MIT" ]
permissive
kimhSirtrack/construct
188f078d4b45fb8d99f55cf4de91703353e7a071
f77d2461860fc3a0d64616e6738994b8b293f38d
refs/heads/master
2021-04-26T13:07:38.729851
2017-05-02T07:32:02
2017-05-02T07:32:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,404
java
package com.sirtrack.construct.lib; import static com.sirtrack.construct.Core._read_stream; import static com.sirtrack.construct.lib.Binary.encode_bin; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import com.sirtrack.construct.Core.ValueError; public class BitStream { public static class BitStreamReader extends ByteBufferWrapper{ ByteBufferWrapper substream; int total_size = 0; public BitStreamReader(){ super(); } public ByteBufferWrapper init( ByteBufferWrapper substream ){ this.substream = substream; this.total_size = 0; return this; } public void close(){ if( total_size % 8 != 0 ){ throw new ValueError( "total size of read data must be a multiple of 8: " + total_size ); } } @Override public int remaining() { int r = substream.remaining() * 8; if( bb != null && bb.remaining()>0 ) r += bb.remaining(); return r; } @Override public int position() { return substream.position(); } @Override public void position(int pos) { // self.buffer = "" total_size = 0; // self.substream.seek(pos, whence) substream.position(pos); } @Override public byte get(){ byte[] d = new byte[1]; get( d, 0, 1); return d[0]; } @Override public ByteBufferWrapper get( byte[] dst, int offset, int length ) { if( length < 0 ) throw new ValueError("length cannot be negative"); if( length == 0 ) return this; if( bb == null ){ int bytes = length / 8; if(( length & 7 ) != 0 ){ bytes += 1; } bb = ByteBuffer.wrap(encode_bin(_read_stream( substream, bytes ))); bb.get( dst, 0, length ); total_size += length; } else { int l = bb.remaining(); if( length <= l ){ bb.get( dst, 0, length ); total_size += length; } else { bb.get( dst, 0, l ); total_size += l; length -= l; int bytes = length / 8; if(( length & 7 ) != 0 ){ bytes += 1; } bb = ByteBuffer.wrap(encode_bin(_read_stream( substream, bytes ))); bb.get( dst, l, length ); total_size += length; } } if( bb.remaining() == 0 ) bb = null; return this; } } public static class BitStreamWriter{ public ByteArrayOutputStream init(ByteArrayOutputStream stream) { // TODO Auto-generated method stub return null; } public void close() { // TODO Auto-generated method stub } } /* class BitStreamReader(object): class BitStreamWriter(object): __slots__ = ["substream", "buffer", "pos"] def __init__(self, substream): self.substream = substream self.buffer = [] self.pos = 0 def close(self): self.flush() def flush(self): bytes = decode_bin("".join(self.buffer)) self.substream.write(bytes) self.buffer = [] self.pos = 0 def tell(self): return self.substream.tell() + self.pos // 8 def seek(self, pos, whence = 0): self.flush() self.substream.seek(pos, whence) def write(self, data): if not data: return if type(data) is not str: raise TypeError("data must be a string, not %r" % (type(data),)) self.buffer.append(data) */ }
ffbe20fc7418566f267c4dd95d77e878991748f8
d8e4532132161365cd44d2d9840596a1b5807a05
/src/main/java/commons/BasePage.java
6238f0f39b7e6ab21c1ef2376d4e474bf7f1966a
[]
no_license
tuanlase61315/maven-hybrid-bankguru
e0f10c229e6a342830319f9e1d07b6e8b86cb113
3b8ad4be96c1dc18a7804849d4286e968e11af7a
refs/heads/master
2023-04-08T09:25:59.857521
2021-04-14T08:30:20
2021-04-14T08:30:20
356,104,684
0
0
null
null
null
null
UTF-8
Java
false
false
27,014
java
package commons; import java.io.File; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Random; import java.util.Set; import org.apache.commons.logging.Log; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import pageObjects.PageGeneratorManager; import pageUIs.BasePageUI; public class BasePage { private WebDriver driver; private Actions action; private Select select; private WebDriverWait explicitWait; private JavascriptExecutor jsExecutor; private Alert alert; private long longTimeout = 10; private Log log; final String OLD_FORMAT = "MM/dd/yyyy"; final String NEW_FORMAT = "yyyy-MM-dd"; public String newFormatDate(String oldDateString) { SimpleDateFormat sdf = new SimpleDateFormat(OLD_FORMAT); Date d = null; try { d = sdf.parse(oldDateString); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } sdf.applyPattern(NEW_FORMAT); return sdf.format(d); } public static BasePage getBasePage() { return new BasePage(); } public void sleepInSecond(long timeout) { try { Thread.sleep(timeout * 1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void sleepInMiliSecond(long timeout) { try { Thread.sleep(timeout); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static String generateEmail() { Random rand = new Random(); return "test" + rand.nextInt(99999) + "@gmail.com"; } public String getDirectorySlash(String folderName) { String separator = File.separator; return separator + "src" + separator + "main" + separator + "resources" + separator + folderName + separator; } public String getDynamicLocator(String locator, String... values) { return String.format(locator, (Object[]) values); } public void openPageUrl(WebDriver driver, String url) { driver.get(url); } public String getTitle(WebDriver driver) { return driver.getTitle(); } public String getCurrentUrl(WebDriver driver) { return driver.getCurrentUrl(); } public String getPageSource(WebDriver driver) { return driver.getPageSource(); } public void backToPage(WebDriver driver) { driver.navigate().back(); } public void forwardToPage(WebDriver driver) { driver.navigate().forward(); } public void refreshPage(WebDriver driver) { driver.navigate().refresh(); } public Alert waitAlertPresence(WebDriver driver) { explicitWait = new WebDriverWait(driver, longTimeout); return explicitWait.until(ExpectedConditions.alertIsPresent()); } public void acceptAlert(WebDriver driver) { alert = waitAlertPresence(driver); driver.switchTo().alert(); alert.accept(); } public void cancelAlert(WebDriver driver) { alert = waitAlertPresence(driver); driver.switchTo().alert(); alert.dismiss(); } public String getTextAlert(WebDriver driver) { alert = waitAlertPresence(driver); driver.switchTo().alert(); return alert.getText(); } public void sendkeyToAlert(WebDriver driver, String value) { alert = waitAlertPresence(driver); driver.switchTo().alert(); alert.sendKeys(value); } public void switchWindowByID(WebDriver dirver, String parentID) { Set<String> allWindowID = driver.getWindowHandles(); for (String windowID : allWindowID) { if (!windowID.equals(parentID)) { driver.switchTo().window(windowID); } } } public void switchWindowByTitle(WebDriver driver, String expectedTitle) { Set<String> allWindowID = driver.getWindowHandles(); for (String windowID : allWindowID) { driver.switchTo().window(windowID); String actualTilte = driver.getTitle(); if (actualTilte.equals(expectedTitle)) { break; } } } public void closeAllWindowsWithoutParent(WebDriver driver, String parentID) { Set<String> allWindowID = driver.getWindowHandles(); for (String windowID : allWindowID) { if (!windowID.equals(parentID)) { driver.switchTo().window(windowID); driver.close(); } if (driver.getWindowHandles().size() == 1) { driver.switchTo().window(parentID); break; } } } public By getByXpath(String locator) { return By.xpath(locator); } public WebElement getElement(WebDriver driver, String locator) { return driver.findElement(getByXpath(locator)); } public WebElement getElement(WebDriver driver, String locator, String... values) { return driver.findElement(getByXpath(getDynamicLocator(locator, values))); } public List<WebElement> getElements(WebDriver driver, String locator) { return driver.findElements(getByXpath(locator)); } public void clickToElement(WebDriver driver, String locator) { getElement(driver, locator).click(); } public void clickToElement(WebDriver driver, String locator, String... values) { getElement(driver, getDynamicLocator(locator, values)).click(); } public void sendkeyToElement(WebDriver driver, String locator, String value) { getElement(driver, locator).clear(); getElement(driver, locator).sendKeys(value); } public void sendkeyToElement(WebDriver driver, String locator, String value, String... values) { getElement(driver, getDynamicLocator(locator, values)).clear(); getElement(driver, getDynamicLocator(locator, values)).sendKeys(value); } public void selectItemInDropdownByText(WebDriver driver, String locator, String itemText) { select = new Select(getElement(driver, locator)); select.selectByVisibleText(itemText); } public String getSelectItemInDropdown(WebDriver driver, String locator) { select = new Select(getElement(driver, locator)); return select.getFirstSelectedOption().getText(); } public void selectItemInCustomDropbox(WebDriver driver, String parentLocator, String childLocator, String expectedItem) { getElement(driver, parentLocator).click(); explicitWait = new WebDriverWait(driver, longTimeout); List<WebElement> allItem = explicitWait .until(ExpectedConditions.presenceOfAllElementsLocatedBy(getByXpath(childLocator))); for (WebElement item : allItem) { if (item.getText().trim().equals(expectedItem)) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].scrollIntoView(true);", item); sleepInSecond(1); item.click(); sleepInSecond(1); break; } } } public boolean isDropdownMultiple(WebDriver driver, String locator) { select = new Select(getElement(driver, locator)); return select.isMultiple(); } public String getAttributeValue(WebDriver driver, String locator) { return getElement(driver, locator).getAttribute("value"); } public String getTextElement(WebDriver driver, String locator) { return getElement(driver, locator).getText(); } public String getElementText(WebDriver driver, String locator, String... values) { return getElement(driver, getDynamicLocator(locator, values)).getText(); } public int getElementSize(WebDriver driver, String locator) { return getElements(driver, locator).size(); } public int getElementSize(WebDriver driver, String locator, String... values) { return getElements(driver, getDynamicLocator(locator, values)).size(); } public boolean isElementSelected(WebDriver driver, String locator) { return getElement(driver, locator).isSelected(); } public boolean isElementSelected(WebDriver driver, String locator, String... values) { return getElement(driver, getDynamicLocator(locator, values)).isSelected(); } public boolean isElementDisplay(WebDriver driver, String locator) { return getElement(driver, locator).isDisplayed(); } public boolean isElementEnable(WebDriver driver, String locator) { return getElement(driver, locator).isEnabled(); } public boolean isElementEnable(WebDriver driver, String locator, String... values) { return getElement(driver, getDynamicLocator(locator, values)).isEnabled(); } public void checkTheCheckboxOrRadio(WebDriver driver, String locator) { if (!isElementSelected(driver, locator)) { getElement(driver, locator).click(); } } public void UncheckTheCheckbox(WebDriver driver, String locator) { if (isElementSelected(driver, locator)) { getElement(driver, locator).click(); } } public WebDriver switchToFrame(WebDriver driver, String locator) { return driver.switchTo().frame(getElement(driver, locator)); } public WebDriver switchToDefaultContent(WebDriver driver) { return driver.switchTo().defaultContent(); } public void doubleClickToElement(WebDriver driver, String locator) { action = new Actions(driver); action.doubleClick(getElement(driver, locator)).perform(); } public void hoverMouseToElement(WebDriver driver, String locator) { action = new Actions(driver); action.moveToElement(getElement(driver, locator)).perform(); } public void rightClick(WebDriver driver, String locator) { action = new Actions(driver); action.contextClick(getElement(driver, locator)).perform(); } public void sendKeyboardToElement(WebDriver driver, String locator, Keys key) { action = new Actions(driver); action.sendKeys(getElement(driver, locator), key).perform(); } public void sendKeyboardToElement(WebDriver driver, String locator, Keys key, String... values) { action = new Actions(driver); action.sendKeys(getElement(driver, getDynamicLocator(locator, values)), key).perform(); } public void dragAndDrop(WebDriver driver, String sourceLocator, String targetLocator) { action = new Actions(driver); action.dragAndDrop(getElement(driver, sourceLocator), getElement(driver, targetLocator)).perform(); } public Object executeForBrowser(WebDriver driver, String javaScript) { jsExecutor = (JavascriptExecutor) driver; return jsExecutor.executeScript(javaScript); } public String getInnerText(WebDriver driver) { jsExecutor = (JavascriptExecutor) driver; return (String) jsExecutor.executeScript("return document.documentElement.innerText;"); } public boolean areExpectedTextInInnerText(WebDriver driver, String textExpected) { jsExecutor = (JavascriptExecutor) driver; String textActual = (String) jsExecutor .executeScript("return document.documentElement.innerText.match('" + textExpected + "')[0]"); return textActual.equals(textExpected); } public void scrollToBottomPage(WebDriver driver) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("window.scrollBy(0,document.body.scrollHeight)"); } public void navigateToUrlByJS(WebDriver driver, String url) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("window.location = '" + url + "'"); } public void highlightElement(WebDriver driver, String locator) { jsExecutor = (JavascriptExecutor) driver; WebElement element = getElement(driver, locator); String originalStyle = element.getAttribute("style"); jsExecutor.executeScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", "border: 2px solid red; border-style: dashed;"); sleepInSecond(1); jsExecutor.executeScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, "style", originalStyle); } public void clickToElementByJS(WebDriver driver, String locator) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].click();", getElement(driver, locator)); } public void clickToElementByJS(WebDriver driver, String locator, String... values) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].click();", getElement(driver, getDynamicLocator(locator, values))); } public void scrollToElement(WebDriver driver, String locator) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].scrollIntoView(true);", getElement(driver, locator)); } public void sendkeyToElementByJS(WebDriver driver, String locator, String value) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].setAttribute('value', '" + value + "')", getElement(driver, locator)); } public void removeAttributeInDOM(WebDriver driver, String locator, String attributeRemove) { jsExecutor = (JavascriptExecutor) driver; jsExecutor.executeScript("arguments[0].removeAttribute('" + attributeRemove + "');", getElement(driver, locator)); } public boolean areJQueryAndJSLoadedSuccess(WebDriver driver) { explicitWait = new WebDriverWait(driver, longTimeout); jsExecutor = (JavascriptExecutor) driver; ExpectedCondition<Boolean> jQueryLoad = new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { try { return ((Long) jsExecutor.executeScript("return jQuery.active") == 0); } catch (Exception e) { return true; } } }; ExpectedCondition<Boolean> jsLoad = new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver driver) { return jsExecutor.executeScript("return document.readyState").toString().equals("complete"); } }; return explicitWait.until(jQueryLoad) && explicitWait.until(jsLoad); } public String getElementValidationMessage(WebDriver driver, String locator) { jsExecutor = (JavascriptExecutor) driver; return (String) jsExecutor.executeScript("return arguments[0].validationMessage;", getElement(driver, locator)); } public boolean isImageLoaded(WebDriver driver, String locator) { jsExecutor = (JavascriptExecutor) driver; boolean status = (boolean) jsExecutor.executeScript( "return arguments[0].complete && typeof arguments[0].naturalWidth != \"undefined\" && arguments[0].naturalWidth > 0", getElement(driver, locator)); if (status) { return true; } else { return false; } } public void waitForElementVisible(WebDriver driver, String locator) { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait.until(ExpectedConditions.visibilityOfElementLocated(getByXpath(locator))); } public void waitForElementVisible(WebDriver driver, String locator, String... values) { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait .until(ExpectedConditions.visibilityOfElementLocated(getByXpath(getDynamicLocator(locator, values)))); } public void waitForAllElementVisible(WebDriver driver, String locator) { try { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(getByXpath(locator))); } catch (Exception e) { log.debug("Wait for element visible with error: " + e.getMessage()); } } public void waitForAllElementVisible(WebDriver driver, String locator, String... values) { try { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait.until(ExpectedConditions .visibilityOfAllElementsLocatedBy(getByXpath(getDynamicLocator(locator, values)))); } catch (Exception e) { log.debug("Wait for element visible with error: " + e.getMessage()); } } public void waitForElementClickable(WebDriver driver, String locator) { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait.until(ExpectedConditions.elementToBeClickable(getByXpath(locator))); } public void waitForElementClickable(WebDriver driver, String locator, String... values) { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait.until(ExpectedConditions.elementToBeClickable(getByXpath(getDynamicLocator(locator, values)))); } public void waitForElementInvisble(WebDriver driver, String locator) { explicitWait = new WebDriverWait(driver, longTimeout); explicitWait.until(ExpectedConditions.invisibilityOfElementLocated(getByXpath(locator))); } // public void uploadMultipleFiles(WebDriver driver, String... fileNames) { // String filePath = System.getProperty("user.dir") + getDirectorySlash("uploadFiles"); // // String fullFileName = ""; // for (String file : fileNames) { // fullFileName = fullFileName + filePath + file + "\n"; // } // fullFileName = fullFileName.trim(); // getElement(driver, HomePageUI.UPLOAD_FILE_TYPE).sendKeys(fullFileName); //// sendkeyToElement(driver, HomePageUI.UPLOAD_FILE_TYPE, fullFileName); // // } /* Check data table */ // public boolean isInformationDisplayedAtColumnNameAndRowNumber(WebDriver driver, String tableID, String columnName, String rowIndex, String expectedValue) { // int columnNameIndex = getElementSize(driver, OrangeHRMAbstractPageUI.DYNAMIC_TABLE_COLUMN_NAME_SIBLING, tableID, columnName) + 1; // String actualValue = getElementText(driver, OrangeHRMAbstractPageUI.TEXTBOX_AT_COLUMN_AND_ROW_INDEX, rowIndex, String.valueOf(columnNameIndex)); // return actualValue.equals(expectedValue); // } // // public boolean isNoRecordFoundDisplayedAtTableName(WebDriver driver, String tableID) { // waitForElementVisible(driver, OrangeHRMAbstractPageUI.NO_RECORD_FOUND_TEXT_AT_TABLE_NAME, tableID); // return isElementDisplayed(driver, OrangeHRMAbstractPageUI.NO_RECORD_FOUND_TEXT_AT_TABLE_NAME, tableID); // } /* Sort String Ascending */ public boolean isDataStringSortedAscending(WebDriver driver, String locator) { // khai bao 1 array list ArrayList<String> arrayList = new ArrayList<>(); // tim tat ca cac element matching vs dk (Name/Price/...) List<WebElement> elementList = driver.findElements(By.xpath(locator)); // lay text cua tung element add vao array list for (WebElement element : elementList) { arrayList.add(element.getText()); } System.out.println("------Du lieu tren UI: -------------"); for (String name : arrayList) { System.out.println(name); } // copy qua 1 array list moi de SORT trong code ArrayList<String> sortedList = new ArrayList<>(); for (String child : arrayList) { sortedList.add(child); } // thuc hien sort asc Collections.sort(sortedList); System.out.println("-------Du lieu da Sort ASC trong code ---------"); for (String name : sortedList) { System.out.println(name); } // verify 2 array bang nhau - new du lieu sort tren UI ko chinh xac thi ket qua // tra ve sai return sortedList.equals(arrayList); } /* Sort String Descending */ public boolean isDataStringDSortedDescending(WebDriver driver, String locator) { ArrayList<String> arrayList = new ArrayList<>(); List<WebElement> elementList = driver.findElements(By.xpath(locator)); for (WebElement element : elementList) { arrayList.add(element.getText()); } System.out.println("----Du lieu tren UI-----"); for (String name : arrayList) { System.out.println(name); } ArrayList<String> sortedList = new ArrayList<>(); for (String child : arrayList) { sortedList.add(child); } Collections.sort(sortedList); System.out.println("---Du lieu da Sort ASC trong code-----"); for (String name : sortedList) { System.out.println(name); } Collections.reverse(sortedList); System.out.println("---Du lieu da Sort DSC trong code ---"); for (String name : sortedList) { System.out.println(name); } return sortedList.equals(arrayList); } /* Sort Float Ascending */ public boolean isDataFloatSortedAscending(WebDriver driver, String locator) { ArrayList<Float> arrayList = new ArrayList<Float>(); List<WebElement> elementList = driver.findElements(By.xpath(locator)); for (WebElement element : elementList) { arrayList.add(Float.parseFloat(element.getText().replace("$", "").trim())); } System.out.println("---Du lieu tren UI---"); for (Float name : arrayList) { System.out.println(name); } ArrayList<Float> sortedList = new ArrayList<Float>(); for (Float child : arrayList) { sortedList.add(child); } Collections.sort(sortedList); System.out.println("---Du lieu da Sort ASC trong code:---"); for (Float name : sortedList) { System.out.println(name); } return sortedList.equals(arrayList); } /* Sort Float Descending */ public boolean isDataFloatSortedDescending(WebDriver driver, String locator) { ArrayList<Float> arrayList = new ArrayList<Float>(); List<WebElement> elementList = driver.findElements(By.xpath(locator)); for (WebElement element : elementList) { arrayList.add(Float.parseFloat(element.getText().replace("$", "").trim())); } System.out.println("---Du lieu tren UI---"); for (Float name : arrayList) { System.out.println(name); } ArrayList<Float> sortedList = new ArrayList<Float>(); for (Float child : arrayList) { sortedList.add(child); } Collections.sort(sortedList); System.out.println("---Du lieu da Sort ASC trong code:---"); for (Float name : sortedList) { System.out.println(name); } Collections.reverse(sortedList); System.out.println("---Du lieu da Sort DSC trong code ---"); for (Float name : sortedList) { System.out.println(name); } return sortedList.equals(arrayList); } /* Sort Date Ascending */ public boolean isDataDateSortedAscending(WebDriver driver, String locator) { ArrayList<Date> arrayList = new ArrayList<Date>(); List<WebElement> elementList = driver.findElements(By.xpath(locator)); for (WebElement element : elementList) { arrayList.add(convertStringToDate(element.getText())); } System.out.println("---Du lieu tren UI:"); for (Date name : arrayList) { System.out.println(name); } ArrayList<Date> sortedList = new ArrayList<Date>(); for (Date child : arrayList) { sortedList.add(child); } Collections.sort(sortedList); System.out.println("---Du lieu da sort asc trong code:"); for (Date name : sortedList) { System.out.println(name); } return sortedList.equals(arrayList); } /* Sort Date Descending */ public boolean isDataDateSortedDescending(WebDriver driver, String locator) { ArrayList<Date> arrayList = new ArrayList<Date>(); List<WebElement> elementList = driver.findElements(By.xpath(locator)); for (WebElement element : elementList) { arrayList.add(convertStringToDate(element.getText())); } System.out.println("---Du lieu tren UI:"); for (Date name : arrayList) { System.out.println(name); } ArrayList<Date> sortedList = new ArrayList<Date>(); for (Date child : arrayList) { sortedList.add(child); } Collections.sort(sortedList); System.out.println("---Du lieu da sort asc trong code:"); for (Date name : sortedList) { System.out.println(name); } Collections.reverse(sortedList); System.out.println("---Du lieu da Sort DSC trong code ---"); for (Date name : sortedList) { System.out.println(name); } return sortedList.equals(arrayList); } /* format date data */ public Date convertStringToDate(String dateInString) { dateInString = dateInString.replace(",", ""); SimpleDateFormat formatter = new SimpleDateFormat("MMM dd yyyy"); Date date = null; try { date = formatter.parse(dateInString); } catch (Exception e) { // TODO: handle exception } return date; } public static long getRandomNumberByDateTime() { return Calendar.getInstance().getTimeInMillis() % 100000; } // DYNAMIC LOCATOR public BasePage clickToMenuNavByName(WebDriver driver, String pageName) { waitForElementClickable(driver, BasePageUI.DYNAMIC_MENU_NAV_BY_TEXT, pageName); clickToElement(driver, BasePageUI.DYNAMIC_MENU_NAV_BY_TEXT, pageName); if (pageName.equals("Manager")) { return PageGeneratorManager.getHomePageObject(driver); } else if (pageName.equals("New Customer") || pageName.equals("Edit Customer") || pageName.equals("Delete Customer")) { return PageGeneratorManager.getcCustomerPageObject(driver); } else if (pageName.equals("Deposit") || pageName.equals("Withdrawal") || pageName.equals("Fund Transfer")) { return PageGeneratorManager.getPaymentPageObject(driver); } else if (pageName.equals("New Account") || pageName.equals("Edit Account") || pageName.equals("Delete Account")) { return PageGeneratorManager.getAccountPageObject(driver); } else if (pageName.equals("Change Password")) { return PageGeneratorManager.getUserPageObject(driver); } else { throw new RuntimeException("Please input the correct Page Name"); } } public void inputToTextboxByName(WebDriver driver, String textboxName, String inputValue) { waitForElementVisible(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, textboxName); getElement(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, textboxName); sendkeyToElement(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, inputValue, textboxName); } public void clickToTextboxByName(WebDriver driver, String textboxName) { waitForElementClickable(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, textboxName); clickToElement(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, textboxName); } public void sendTabKeyToTextboxByName(WebDriver driver, String textboxName) { getElement(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, textboxName).clear(); ; waitForElementVisible(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, textboxName); sendKeyboardToElement(driver, BasePageUI.DYNAMIC_TEXTBOX_BY_NAME, Keys.TAB, textboxName); } public void clickToButtonByValue(WebDriver driver, String buttonValue) { waitForElementClickable(driver, BasePageUI.DYNAMIC_BUTTON_BY_VAULE, buttonValue); clickToElement(driver, BasePageUI.DYNAMIC_BUTTON_BY_VAULE, buttonValue); sleepInSecond(1); } public void clickToRadioButtonByValue(WebDriver driver, String raidoValue) { waitForElementClickable(driver, BasePageUI.DYNAMIC_RADIO_BUTTON_BY_VALUE, raidoValue); if (!isElementSelected(driver, BasePageUI.DYNAMIC_RADIO_BUTTON_BY_VALUE, raidoValue)) { clickToElement(driver, BasePageUI.DYNAMIC_RADIO_BUTTON_BY_VALUE, raidoValue); } } public String getItemErrorMessageByTextboxName(WebDriver driver, String textboxName) { waitForElementVisible(driver, BasePageUI.DYNAMIC_CUSTOMER_ERROR_MESSAGE, textboxName); return getElementText(driver, BasePageUI.DYNAMIC_CUSTOMER_ERROR_MESSAGE, textboxName); } public String getHeadingMessage(WebDriver driver) { waitForElementVisible(driver, BasePageUI.HEADING_MESSAGE); return getTextElement(driver, BasePageUI.HEADING_MESSAGE); } public boolean isInformationDisplayedAtColumnNameAndRowNumber(WebDriver driver, String tableID, String columnName, String rowIndex, String expectedValue) { int columnNameIndex = getElementSize(driver, BasePageUI.DYNAMIC_TABLE_COLUMN_NAME_SIBLING, tableID, columnName) + 1; String actualValue = getElementText(driver, BasePageUI.TEXTBOX_AT_COLUMN_AND_ROW_INDEX, rowIndex, String.valueOf(columnNameIndex)); return actualValue.equals(expectedValue); } }
b37090a88babc93619edf144dbb0ecb826ba3c32
08fe5d6c61678c5dbdd2f3f59e9424b28eddda76
/src/JZ_LC/T_56_找出数组中两个只出现一次的数字.java
07d22973ab9d85a36868c67ce7a0a2d98bea838a
[]
no_license
catlv/NewLeetCode
40a166e94b17564e0e6c0065e208e0e0072bd114
e5a3513bf8778ce5552228e5d48183e0bfe2c8b4
refs/heads/master
2022-12-05T13:15:37.321437
2020-08-27T14:35:09
2020-08-27T14:35:09
273,871,751
0
0
null
null
null
null
UTF-8
Java
false
false
1,666
java
package JZ_LC; /** * 思路:位运算,异或:相同为0,不同为1 * 任何一个数 异或 自身,等于0;任何一个数 异或 0 等于自身。 * 先将数组中所有数异或一遍,得到的是两个只出现一次的数的异或结果。 * 由于这两个数不同,所以它们的二进制中肯定有一位或几位是不同的,所以它们异或结果的二进制中肯定存在1 * 比如:两数异或结果为 res = 2,也就是0010,将它与 helper = 1 也就是 0001 进行与操作。 * 此时结果为0,将helper乘以2,也就是0001,变成了0010.再和 res 进行异或,如此反复,直到结果不为0. * 经过上面的操作后得到 helper,它的二进制中只有一个位置为1,这个位置反映的就是:这两个数在此位置的二进制值不一样 * 于是就可以用此时的helper对原数组进行区分了,区分为和helper进行与操作,结果为0和不为0两种情况 。 * 区分成两个数组后,再对这两个数组各自进行异或,结果分别保存在 res[0] 和 res[1] 中。 */ public class T_56_找出数组中两个只出现一次的数字 { public int[] singleNumbers(int[] nums) { int h = 0; //res就是两个只出现一次的数字异或的结果 for (int n : nums) { h ^= n; } int helper = 1; while ((h & helper) == 0) { helper *= 2; } int[] res = new int[2]; for (int n : nums) { if ((n & helper) == 0) { res[0] ^= n; } else { res[1] ^= n; } } return res; } }
707423c28fe8ad35c2483708317f56fa1e4b6edc
4c94486e32e4e8cdeff708e82cf8e147c3671007
/WeatherApp/app/src/main/java/tl/com/weatherapp/presenter/weatheraddress/WeatherAddressPresenter.java
dc65be192218eb2d4c119b911555be7fae547718
[]
no_license
TungLuong/weather-app
f0f579b872f1144e1cb27c13fc518d95d5142a79
7ac5e89ce0bf5cf2540d93f475c6f725d7794f35
refs/heads/master
2020-04-28T15:30:18.294529
2019-04-14T08:42:58
2019-04-14T08:42:58
175,376,543
0
0
null
null
null
null
UTF-8
Java
false
false
1,241
java
package tl.com.weatherapp.presenter.weatheraddress; import java.util.List; import tl.com.weatherapp.model.WeatherResult; import tl.com.weatherapp.model.modelnetwork.ModelNetwork; import tl.com.weatherapp.view.weatheraddress.IWeatherAddressView; public class WeatherAddressPresenter implements IWeatherAddressPresenter { private ModelNetwork modelNetwork; IWeatherAddressView iWeatherAddressView; public WeatherAddressPresenter(IWeatherAddressView iWeatherAddressView) { modelNetwork = ModelNetwork.getInstance(); modelNetwork.setiWeatherAddressPresenter(this); this.iWeatherAddressView = iWeatherAddressView; } public void getResultWeather() { modelNetwork.getResultWeatherForWeatherAddressPresenter(); } @Override public void getWeatherResult(List<WeatherResult> weatherResults) { iWeatherAddressView.getWeatherResult(weatherResults); } @Override public void notifyItemChange(int position) { iWeatherAddressView.notifyItemChange(position); } public void deleteItem(int position) { modelNetwork.deleteItem(position); } public void moveItem(int oldPo, int newPo) { modelNetwork.moveItem(oldPo,newPo); } }
5251a19a25aed0d01c3d8862976683c422fd620c
e2a1730f130066151653deb8efc5c042e6ea305d
/featurex/src/main/java/miguel/daggerpoc/featurex/XDepPublicJava.java
23422647575f2a6bfc16c8a9c19045ba3bc248b5
[]
no_license
guelo/daggertest
4d4672c1f136658bbaa4edcca48f9edafc963caf
4153e87bb2db1fb0406bbf10daf141d0543815ed
refs/heads/master
2020-03-26T15:36:24.284241
2018-08-21T21:48:34
2018-08-21T21:48:34
145,053,491
0
1
null
null
null
null
UTF-8
Java
false
false
459
java
package miguel.daggerpoc.featurex; public class XDepPublicJava { private final XDepPkgPrivateJava xDepPkgPrivateJava; XDepPublicJava(XDepPkgPrivateJava xDepPkgPrivateJava) { this.xDepPkgPrivateJava = xDepPkgPrivateJava; } public XDepPkgPrivateJava getxDepPkgPrivateJava() { return xDepPkgPrivateJava; } public String call() { return " XDepPublicJava called. calling: " + xDepPkgPrivateJava.call(); } }
83f804bf656f2fc936fd5095cbe2e237dd6ac081
3cfbcfc6f80936bd3e68b1c8ce253e9654b8c588
/app/src/main/java/com/flavio/android/megasena/util/DataUtil.java
2909cf6c8a7b4f1e94d724e789592467d1b54ad1
[]
no_license
flaviodiminuto/MegaSena
e4c26bb1160c72cc8135df56dc07ccb99f2cc276
7a36a9d44e62c526830088c70ca0236388724e34
refs/heads/master
2022-11-17T15:42:52.647754
2022-11-04T02:05:01
2022-11-04T02:05:01
162,488,840
0
0
null
2021-09-17T05:26:18
2018-12-19T20:44:56
Java
UTF-8
Java
false
false
816
java
package com.flavio.android.megasena.util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DataUtil { private static final String diaMesAnoFormat = "dd/MM/yyyy"; private static final String diaMesAnoHoraMinutoSegundoFormat = "dd/MM/yyyy HH:mm:ss"; private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); public static Date toDataBr(String data) throws ParseException { return new SimpleDateFormat(diaMesAnoFormat).parse(data); } public static Date toDataHoraBr(String data) throws ParseException { return new SimpleDateFormat(diaMesAnoHoraMinutoSegundoFormat).parse(data); } public static String toString(Date date){ return simpleDateFormat.format(date); } }
301c81e259e95924fb2d31a284a62042cdf394b5
95f489757abf1aef5b346bb4756afca5b043b01f
/src/com/design/patterns/factorymethod/factory/abstraction/AbstractFactory.java
6c3bb1df16a36361be329adf9ea17b965343a6b2
[]
no_license
longtengtian/design-patterns
8d77d1ee96cf60195eccb2fa6c7463f303c3de5c
02d82538bee9ae38dc24e631c5647bc1aab08b33
refs/heads/master
2020-06-05T04:07:02.429009
2019-07-29T02:41:02
2019-07-29T02:41:02
192,307,615
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package com.design.patterns.factorymethod.factory.abstraction; import com.design.patterns.factorymethod.product.abstraction.AbstractProduct; /** * Title: 抽象工厂<br> * Description: AbstractFactory<br> * Company:韦博英语在线教育部</br> * CreateDate:2019年07月19日 20:36 * * @author jackie.scl */ public interface AbstractFactory { // 创建产品 public AbstractProduct newProduct(); }
44e10f7ba4593e1f80633e7d7ab63a929f35b325
e8f0af4affaad277062f3dc8490f91622eea9896
/DS/Trie/Trie_01_InsertAndSearch.java
94ccdcad3f50a491a481ccd382cb5329569bb79c
[]
no_license
kmrgaurav11235/CTCI
6458aa6eeebe01422f3f38bd723d33dd450e812d
1a5f8f51f9055859e08b2be9c9882829dd3febff
refs/heads/master
2021-07-01T12:00:29.064409
2020-12-07T16:48:18
2020-12-07T16:48:18
203,094,903
0
1
null
null
null
null
UTF-8
Java
false
false
2,886
java
import java.util.HashMap; import java.util.Map; /* https://www.geeksforgeeks.org/trie-insert-and-search/ - Trie is an efficient information reTrieval data structure. Using Trie, search complexities can be brought to optimal limit (key length). If we store keys in binary search tree, a well balanced BST will need time proportional to M * log N, where M is maximum string length and N is number of keys in tree. Using Trie, we can search the key in O(M) time. However the penalty is on Trie storage requirements. */ class Trie_01_InsertAndSearch { static class TrieNode { Map<Character, TrieNode> children; boolean isEndOfWord; TrieNode() { children = new HashMap<>(); isEndOfWord = false; } } static class Trie { private final TrieNode root; Trie() { root = new TrieNode(); } public void insert(String str) { TrieNode p = root; for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); TrieNode next = p.children.get(ch); if (next == null) { next = new TrieNode(); p.children.put(ch, next); } p = next; } p.isEndOfWord = true; } public boolean search(String str) { TrieNode p = root; for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); TrieNode next = p.children.get(ch); if (next == null) { return false; } p = next; } return p.isEndOfWord; } } public static void main(String[] args) { String keys[] = { "the", "a", "there", "answer", "any", "by", "bye", "their" }; // Construct Trie Trie trie = new Trie(); // Insert in Trie for (int i = 0; i < keys.length; i++) { trie.insert(keys[i]); } // Search for different keys if (trie.search("the") == true) { System.out.println("the: is present in trie"); } else { System.out.println("the: is not present in trie"); } if (trie.search("these") == true) { System.out.println("these: is present in trie"); } else { System.out.println("these: is not present in trie"); } if (trie.search("their") == true) { System.out.println("their: is present in trie"); } else { System.out.println("their: is not present in trie"); } if (trie.search("thaw") == true) { System.out.println("thaw: is present in trie"); } else { System.out.println("thaw: is not present in trie"); } } }
6558274a7f7d16c2afd2c55d02c7db0bae8658c2
481e8fa6d37a26332a8e5f8840cf8c24f857317a
/src/main/java/com/company/project/web/EducationController.java
14b99892834ff8f7954eb211b7c4fd7da51f7125
[]
no_license
Huabuxiu/Double-selection-system
5c7b468136c0b0e2571ba23b3c5c8150d5913542
e1e49bef19bb522f0fc29bbb41fbedeb8c5a97e2
refs/heads/master
2022-06-30T15:56:44.342857
2020-04-06T08:47:35
2020-04-06T08:47:35
234,485,920
4
0
null
2022-06-17T02:51:49
2020-01-17T06:30:16
Java
UTF-8
Java
false
false
1,946
java
package com.company.project.web; import com.company.project.core.Result; import com.company.project.core.ResultGenerator; import com.company.project.model.Education; import com.company.project.model.Student; import com.company.project.service.EducationService; import com.company.project.service.StudentService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * Created by Huabuxiu on 2020/03/20. */ @RestController public class EducationController { @Resource private EducationService educationService; @Resource private StudentService studentService; @PostMapping("/add") public Result add(Education education) { educationService.save(education); return ResultGenerator.genSuccessResult(); } @PostMapping("/delete") public Result delete(@RequestParam Integer id) { educationService.deleteById(id); return ResultGenerator.genSuccessResult(); } @PostMapping("/update") public Result update(Education education) { educationService.update(education); return ResultGenerator.genSuccessResult(); } @PostMapping("/education") public Result education(@RequestBody Map<String,Integer> data) { Student student =studentService.findBy("uid",data.get("uid")); Education education = educationService.findBy("sid",student.getSid()); return ResultGenerator.genSuccessResult(education); } @PostMapping("/list") public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) { PageHelper.startPage(page, size); List<Education> list = educationService.findAll(); PageInfo pageInfo = new PageInfo(list); return ResultGenerator.genSuccessResult(pageInfo); } }
ea87d4c8a816e042d7d3281c5567c0ed1b3f7010
16ee2bc71a2d7543d550ebd9badf21ab49877cde
/src/main/java/com/hedging/user/dao/IRoleFunctionDao.java
7550afdc9b0272a6d44c46291b0fab416057dedc
[]
no_license
tiantt222/hedging
91faedb25eaefe35d6ef81fe834a4f76fed8c06d
daf64693266927d3bc7230f6b9145b77826f35f5
refs/heads/master
2022-06-22T20:59:42.424437
2019-11-06T11:41:13
2019-11-06T11:41:13
219,959,169
2
0
null
2022-06-21T02:11:18
2019-11-06T09:27:22
Java
UTF-8
Java
false
false
587
java
package com.hedging.user.dao; import java.util.List; import com.dz.platform.system.dao.IBaseDao; import com.dz.platform.system.util.Pager; import com.hedging.user.entity.RoleFunction; /** * @author tianwenlong */ public interface IRoleFunctionDao extends IBaseDao { /** * 按条件查找 */ public Pager<RoleFunction> search(Pager<RoleFunction> pager, RoleFunction roleFunction); /** * 根据ID删除角色功能 */ public void deleteByRoleCode(String roleCode); /** * 根据ID批量删除角色功能 */ public void deleteByIds(List<Long> ids); }
[ "tianwenlong@DESKTOP-53C3135" ]
tianwenlong@DESKTOP-53C3135
9e8f1bf29f5ef3fb70e89388b14f4ce28e202195
8aa184888dd6b6c4607c3c243be80b8093ec1021
/src/main/java/com/dsinpractice/spark/samples/core/BroadcastVars.java
dbd7728ff955e9a39723d695f5dc1b02a10db069
[ "MIT" ]
permissive
aminebr/spark-samples
bf94825abc90d606e8b862bece5415dbd7fcaa2e
8ac18f52a837159d2cbf855dbeb0474ad869a53e
refs/heads/master
2020-05-05T03:07:39.551726
2015-05-23T17:34:31
2015-05-23T17:34:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,875
java
package com.dsinpractice.spark.samples.core; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function; import org.apache.spark.broadcast.Broadcast; import java.io.Serializable; import java.util.Arrays; public class BroadcastVars implements Serializable { public static final String[] STOP_WORDS = new String[]{"the", "to", "a", "on", "it", "of", "for", "in", "by", "is"}; public static void main(String[] args) { if (args.length < 2) { System.out.println("Usage: " + BroadcastVars.class.getName() + " <input path> <output path>"); System.out.println("Input files to use are at resources/common-text-data."); System.exit(-1); } BroadcastVars broadcastVars = new BroadcastVars(); broadcastVars.run(args); } private void run(String[] args) { SparkConf sparkConf = new SparkConf().setAppName("broadcast vars"); JavaSparkContext context = new JavaSparkContext(sparkConf); final Broadcast<String[]> stopWords = context.broadcast(STOP_WORDS); JavaRDD<String> lines = context.textFile(args[0]); JavaRDD<String> words = lines.flatMap(new FlatMapFunction<String, String>() { @Override public Iterable<String> call(String line) throws Exception { return Arrays.asList(line.split(" ")); } }); JavaRDD<String> validWords = words.filter(new Function<String, Boolean>() { @Override public Boolean call(String word) throws Exception { return (!Arrays.asList(stopWords.value()).contains(word)); } }); validWords.saveAsTextFile(args[1]); } }
d9ddbbcf062ef966856586199a850f45d94b134e
d6d223bf29f5e810d9f0f25d599947388899e8fe
/master-slave-demo/src/main/java/com/example/master/slave/entity/User.java
2d5fb6b57c33b9455c69281c127541d887af939e
[]
no_license
joypo/morning
df10076a9a44a389bdf2ecfc13cb170adca2c7e7
b1df678ce7cb502b589d731bb0c59e03617b6028
refs/heads/master
2022-12-23T15:05:17.883382
2020-09-23T06:02:11
2020-09-23T06:02:11
205,761,997
2
0
null
2022-12-16T05:05:40
2019-09-02T02:25:43
Java
UTF-8
Java
false
false
227
java
package com.example.master.slave.entity; import lombok.Data; /** * @author sunx * @date 2019-12-18 * @description */ @Data public class User { private Long id; private String userName; private String pwd; }
527f9c0d42f4da930be3ffe570d7ff3372cedf52
ec1fac791ba9b2dfaf686390d67d153eebd1115b
/mifosng-android/src/main/java/com/mifos/objects/accounts/savings/SavingsDepositResponse.java
1324c768606e7f215cc9e3a4cc2ff50bfd64f732
[]
no_license
acarella/mifosX-Android-PGS
4b34d1ad577248b07a55c46006bee257746834d6
335849586828ef7ee7ddafb52a3b54f11c0529a7
refs/heads/master
2021-01-16T17:53:21.438679
2014-08-19T20:06:32
2014-08-19T20:06:32
19,929,744
0
2
null
null
null
null
UTF-8
Java
false
false
1,214
java
package com.mifos.objects.accounts.savings; import com.google.gson.annotations.Expose; import com.mifos.objects.Changes; /** * Created by antoniocarella on 6/1/14. */ public class SavingsDepositResponse { @Expose private Integer officeId; @Expose private Integer clientId; @Expose private Integer savingsId; @Expose private Integer resourceId; @Expose private Changes changes; public Integer getOfficeId() { return officeId; } public void setOfficeId(Integer officeId) { this.officeId = officeId; } public Integer getClientId() { return clientId; } public void setClientId(Integer clientId) { this.clientId = clientId; } public Integer getSavingsId() { return savingsId; } public void setSavingsId(Integer loanId) { this.savingsId = savingsId; } public Integer getResourceId() { return resourceId; } public void setResourceId(Integer resourceId) { this.resourceId = resourceId; } public Changes getChanges() { return changes; } public void setChanges(Changes changes) { this.changes = changes; } }
af780f48251fe7bc867d18df89862837e2251b62
9c0c95a475f538110110b8332000c47efec35b91
/src/test/java/io/vavr/jackson/datatype/tuples/TupleXTest.java
99cc0eabd6f2d5a0c49f691db232e1bfe224e225
[ "Apache-2.0" ]
permissive
nstdio/vavr-jackson
e51a8a17e41adc88c0e0c592d8154a7059672f14
7f877aebffac79ac4fc437f941dbdbd762853e9b
refs/heads/master
2020-07-15T08:48:18.890967
2019-08-05T02:09:44
2019-08-05T02:09:44
205,524,575
0
0
Apache-2.0
2019-08-31T09:34:49
2019-08-31T09:34:49
null
UTF-8
Java
false
false
2,121
java
package io.vavr.jackson.datatype.tuples; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; import io.vavr.*; import io.vavr.jackson.datatype.BaseTest; import org.junit.Assert; import org.junit.Test; import java.io.IOException; public class TupleXTest extends BaseTest { @Test public void test0() throws IOException { Tuple0 tuple0 = Tuple0.instance(); String json = mapper().writer().writeValueAsString(tuple0); Assert.assertEquals(mapper().readValue(json, Tuple0.class), tuple0); } @Test(expected = JsonMappingException.class) public void test9() throws IOException { String wrongJson = "[1, 2, 3, 4, 5, 6, 7, 8, 9]"; mapper().readValue(wrongJson, Tuple8.class); } @Test(expected = JsonMappingException.class) public void test10() throws IOException { String json = "[1, 2, 3]"; mapper().readValue(json, Tuple2.class); } @Test(expected = JsonMappingException.class) public void test11() throws IOException { String json = "[1, 2]"; mapper().readValue(json, Tuple3.class); } @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT, property = "type") @JsonTypeName("card") private static class TestSerialize { public String type = "hello"; } private static class A { public Tuple2<TestSerialize, TestSerialize> f = Tuple.of(new TestSerialize(), new TestSerialize()); } @Test public void testJsonTypeInfo1() throws IOException { String javaUtilValue = mapper().writeValueAsString(new A()); Assert.assertEquals("{\"f\":[{\"card\":{\"type\":\"hello\"}},{\"card\":{\"type\":\"hello\"}}]}", javaUtilValue); A restored = mapper().readValue(javaUtilValue, A.class); Assert.assertEquals("hello", restored.f._1.type); Assert.assertEquals("hello", restored.f._2.type); } }
ce74c31dcd844fa6f1fd22a4c7a019b5c729834d
c7efabcd98b7c0681e290eac0721b96c524039c0
/src/test/java/com/cybertek/chicagoTestNG/Alerts.java
dff983793dc23193ace73ac2d2f63726a2105ad8
[]
no_license
gulmira168/mavenprojectz
59c1cab8fc24cc11fca427d240f69004067f0e48
1484c6791d471eaed9ad0fd8860d1a8d167f32cf
refs/heads/master
2020-04-17T13:38:55.404859
2019-01-20T04:48:04
2019-01-20T04:48:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,703
java
package com.cybertek.chicagoTestNG; import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.BeforeClass; import org.testng.annotations.Ignore; import org.testng.annotations.Test; public class Alerts { WebDriver driver; @BeforeClass public void setup() { WebDriverManager.chromedriver().setup(); driver = new ChromeDriver(); driver.manage().window().fullscreen(); } @Ignore @Test public void warningAlert() throws InterruptedException { driver.get("http://the-internet.herokuapp.com/javascript_alerts"); driver.findElement(By.xpath("//button[.='Click for JS Alert']")).click(); Thread.sleep(1000); Alert firstAlert = driver.switchTo().alert(); firstAlert.accept(); } @Ignore @Test public void confirmationAlert() throws InterruptedException { driver.get("http://the-internet.herokuapp.com/javascript_alerts"); driver.findElement(By.xpath("//button[.='Click for JS Confirm']")).click(); Thread.sleep(1000); Alert secondAlert = driver.switchTo().alert(); secondAlert.dismiss(); } @Test public void promptAlert() throws InterruptedException { driver.get("http://the-internet.herokuapp.com/javascript_alerts"); driver.findElement(By.xpath("//button[.='Click for JS Prompt']")).click(); Thread.sleep(1000); Alert thirdAlert = driver.switchTo().alert(); thirdAlert.sendKeys("This is test"); thirdAlert.accept(); } }
e3a09625f2453e4575b9d144d636f4e6ce69e102
ff0e2cd24bc598f2d40a1aef179f107c0b5986aa
/src/main/java/com/geekerstar/system/entity/Menu.java
bdadf30adba1253f59acbacfa95bd4d6e52f983a
[]
no_license
geekerstar/geek-fast
8ecc7eabae4e3c35e9619d9f02876fb9d2484511
212ff294aaf5c04ac2cc2f6f0e5446db1932282a
refs/heads/master
2022-09-17T09:59:59.340773
2020-08-06T08:37:14
2020-08-06T08:37:14
226,278,168
1
0
null
2022-09-01T23:17:27
2019-12-06T08:11:18
Java
UTF-8
Java
false
false
3,481
java
package com.geekerstar.system.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.geekerstar.common.converter.TimeConverter; import com.wuwenze.poi.annotation.Excel; import com.wuwenze.poi.annotation.ExcelField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.io.Serializable; import java.time.LocalDateTime; /** * 菜单表Menu * * @author Geekerstar * @since 2020-01-31 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("sys_menu") @ApiModel(value = "Menu对象", description = "菜单表") @Excel("菜单信息表") public class Menu implements Serializable { private static final long serialVersionUID = 1L; /** * 菜单 */ public static final String TYPE_MENU = "0"; /** * 按钮 */ public static final String TYPE_BUTTON = "1"; public static final Long TOP_NODE = 0L; @ApiModelProperty(value = "菜单/按钮id") @TableId(value = "menu_id", type = IdType.AUTO) private Long menuId; @ApiModelProperty(value = "上级菜单id") @TableField("parent_id") private Long parentId; @ApiModelProperty(value = "菜单/按钮名称") @TableField("menu_name") @NotBlank(message = "{required}") @Size(max = 20, message = "{noMoreThan}") @ExcelField(value = "名称") private String menuName; @ApiModelProperty(value = "菜单url") @TableField("url") @Size(max = 50, message = "{noMoreThan}") @ExcelField(value = "URL") private String url; @ApiModelProperty(value = "权限标识") @TableField("perms") @Size(max = 50, message = "{noMoreThan}") @ExcelField(value = "权限") private String perms; @ApiModelProperty(value = "图标") @TableField("icon") @Size(max = 50, message = "{noMoreThan}") @ExcelField(value = "图标") private String icon; @ApiModelProperty(value = "类型 0菜单 1按钮") @TableField("type") @NotBlank(message = "{required}") @ExcelField(value = "类型", writeConverterExp = "0=按钮,1=菜单") private String type; @ApiModelProperty(value = "排序") @TableField("order_num") private Long orderNum; @ApiModelProperty(value = "创建时间") @TableField("create_time") @ExcelField(value = "创建时间", writeConverter = TimeConverter.class) @JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class) private LocalDateTime createTime; @ApiModelProperty(value = "修改时间") @TableField("modify_time") @ExcelField(value = "修改时间", writeConverter = TimeConverter.class) @JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class) private LocalDateTime modifyTime; }
695d09c31a4bf3be8f5dc5acb224f5bd8e311338
97acd4f5664e9d405bfe829e676a3673ed310a16
/app/src/main/java/thuglife/balasha/MainActivity.java
dfe30d8c34b1879715fb0cc88c697695cc5398b0
[]
no_license
Singularity9971/BalAsha
131c370eae0ca0115d7837165eacf418735f4481
759f6ef9afc363b3f9c80c8c9c458445b9fa0593
refs/heads/master
2021-01-10T15:45:07.299965
2016-01-20T09:42:55
2016-01-20T09:42:55
48,084,068
1
0
null
null
null
null
UTF-8
Java
false
false
11,769
java
package thuglife.balasha; import android.content.Intent; import android.content.res.Configuration; import android.content.res.TypedArray; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; import thuglife.balasha.Fragments.AboutUsFragment; import thuglife.balasha.Fragments.AdoptionFragment; import thuglife.balasha.Fragments.AwarenessTrainingFragment; import thuglife.balasha.Fragments.ChildrenHomeFragment; import thuglife.balasha.Fragments.DevelopmentCentreFragment; import thuglife.balasha.Fragments.DomesticAdoptionFragment; import thuglife.balasha.Fragments.Donate; import thuglife.balasha.Fragments.EducationSponsorshipFragment; import thuglife.balasha.Fragments.HomeFragment; import thuglife.balasha.Fragments.InCountryAdoptionFragment; import thuglife.balasha.Fragments.InterCountryAdoption; import thuglife.balasha.Fragments.TestimonialsFragment; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private Toolbar toolbar; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private String[] navMenuTitles; private TypedArray navMenuIcons; private ActionMenuView amvMenu; private TextView actionBarTitle; private boolean firstTime = true; private ArrayList<NavDrawerItem> navDrawerItems; private NavDrawerListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); actionBarTitle = (TextView)findViewById(R.id.action_bar_text); amvMenu = (ActionMenuView)findViewById(R.id.amvMenu); amvMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { return onOptionsItemSelected(menuItem); } }); setSupportActionBar(toolbar); if(getSupportActionBar()!=null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(null); } mDrawerTitle = mTitle = getTitle(); // load slide menu items, populate them properly first navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); // nav drawer icons from resources navMenuIcons = getResources() .obtainTypedArray(R.array.nav_drawer_icons); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.list_slidermenu); navDrawerItems = new ArrayList<>(); for(int i = 0; i != 9; i++) navDrawerItems.add(new NavDrawerItem(navMenuTitles[i],navMenuIcons.getResourceId(i,-1))); // Recycle the typed array navMenuIcons.recycle(); // setting the nav drawer list adapter adapter = new NavDrawerListAdapter(getApplicationContext(), navDrawerItems); mDrawerList.setAdapter(adapter); // enabling action bar app icon and behaving it as toggle button mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, //nav menu toggle icon R.string.app_name, // nav drawer open - description for accessibility R.string.app_name // nav drawer close - description for accessibility ){ public void onDrawerClosed(View view) { actionBarTitle.setText(mTitle); // calling onPrepareOptionsMenu() to show action bar icons invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { actionBarTitle.setText(mDrawerTitle); // calling onPrepareOptionsMenu() to hide action bar icons invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerList.setOnItemClickListener(new SlideMenuClickListener()); if(savedInstanceState == null) { displayView(0); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, amvMenu.getMenu()); return true; } @Override public void onBackPressed() { Fragment f = getSupportFragmentManager().findFragmentById(R.id.frame_container); if(f instanceof HomeFragment) super.onBackPressed(); else if(f instanceof DomesticAdoptionFragment || f instanceof InCountryAdoptionFragment || f instanceof InterCountryAdoption) { displayView(2); amvMenu.getMenu().getItem(0).setVisible(false); } else displayView(0); } @Override public boolean onOptionsItemSelected(MenuItem item) { // toggle nav drawer on selecting action bar app icon/title if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } // Handle action bar actions click switch (item.getItemId()) { case R.id.back_button: displayView(2); amvMenu.getMenu().getItem(0).setVisible(false); if(getSupportActionBar()!=null) actionBarTitle.setText("Adoption"); default: return super.onOptionsItemSelected(item); } } /*** * Called when invalidateOptionsMenu() is triggered */ @Override public boolean onPrepareOptionsMenu(Menu menu) { // if nav drawer is opened, hide the action items return super.onPrepareOptionsMenu(menu); } @Override public void setTitle(CharSequence title) { mTitle = title; actionBarTitle.setText(mTitle); } /** * When using the ActionBarDrawerToggle, you must call it during * onPostCreate() and onConfigurationChanged()... */ @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Pass any configuration change to the drawer toggls mDrawerToggle.onConfigurationChanged(newConfig); } //add proper string urls here @Override public void onClick(View view) { switch (view.getId()){ case R.id.facebook_image: startBrowser(null); break; case R.id.youtube_image: startBrowser(Uri.parse("http://youtube.com/balashatrust")); break; case R.id.instagram_image: startBrowser(null); break; case R.id.domestic_adoption: displayView(9); break; case R.id.in_country_adoption: displayView(10); break; case R.id.inter_country_adoption: displayView(11); break; case R.id.uk_donor_link: startBrowser(Uri.parse(((TextView)view).getText().toString())); break; case R.id.india_donor_link: startBrowser(Uri.parse(((TextView)view).getText().toString())); break; case R.id.us_donor_link: startBrowser(Uri.parse(((TextView)view).getText().toString())); break; default: break; } } private void startBrowser(Uri uri){ if(uri != null) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } } /** * Slide menu item click listener * */ private class SlideMenuClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // display view for selected nav drawer item displayView(position); } } private void displayView(int position) { // update the main content by replacing fragments Fragment fragment = null; switch (position) { case 0: fragment = new HomeFragment(); break; case 1: fragment = new ChildrenHomeFragment(); break; case 2: fragment = new AdoptionFragment(); break; case 3: fragment = new DevelopmentCentreFragment(); break; case 4: fragment = new EducationSponsorshipFragment(); break; case 5: fragment = new AwarenessTrainingFragment(); break; case 6: fragment = new Donate(); break; case 7: fragment = new TestimonialsFragment(); break; case 8: fragment = new AboutUsFragment(); break; case 9: fragment = new DomesticAdoptionFragment(); actionBarTitle.setText("Domestic Adoption"); break; case 10: fragment = new InCountryAdoptionFragment(); actionBarTitle.setText("Selection of Child"); break; case 11: fragment = new InterCountryAdoption(); actionBarTitle.setText("Inter Country Adoption"); break; default: break; } if (fragment != null && position < 9) { if(!firstTime && amvMenu.getMenu().getItem(0).isVisible()) amvMenu.getMenu().getItem(0).setVisible(false); FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container,fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); firstTime = false; } else if(fragment != null){ FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container,fragment).commit(); amvMenu.getMenu().getItem(0).setVisible(true); } else{ Log.e("Avi","Error creating fragment"); } } }
b666c7071c3add4ef450a2b36d1a41693d653fa3
ca85e129472eb1fa928f770f934bcda70192ea16
/domain/Anel.java
009622a10cc624137426d5e1f963f9659efba387
[]
no_license
mariofaeInfnet/ecommerce
80161fcd09976fc9cad3707fb87e6f35b2ed80a7
bfa5656d771cd0f66c3eec2cfaea130e494d921a
refs/heads/master
2023-07-29T01:19:35.669354
2021-09-28T02:57:34
2021-09-28T02:57:34
410,720,678
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package br.edu.infnet.ecommerce.model.domain; import br.edu.infnet.ecommerce.model.exceptions.PublicoInvalidoException; public class Anel extends Produto { private int tamanho; private String pedra; private String publico; //masculino, feminino ou unisex public Anel(String descricao, boolean freteGratis, float precoVenda) { super(descricao, freteGratis, precoVenda); } @Override public float calcularDesconto() { return (publico == "masculino" ? getPrecoVenda() * 0.95f : getPrecoVenda()); } public int getTamanho() { return tamanho; } public void setTamanho(int tamanho) { this.tamanho = tamanho; } public String getPedra() { return pedra; } public void setPedra(String pedra) { this.pedra = pedra; } public String getPublico() { return publico; } public void setPublico(String publico) throws PublicoInvalidoException { if (publico != "masculino" && publico != "feminino" && publico != "unisex") { throw new PublicoInvalidoException("Impossivel processar o publico inserido"); } this.publico = publico; } }
0d4928be3abd78f2e23bb943f9afdbbc9d80bff3
ebc2f544d42a9ed2727c8f11da24170d16eeb348
/MYSQL表搭建/src/use_prepareStatement.java
59f95bc0426cd585c199e1e4c69bd8d498d0ef85
[]
no_license
matilda-art/MySQL
8d17632db0c5796791840147c1722a934100e035
ad89791a43cd2bddcb3b5e15a67e825313e7e743
refs/heads/master
2022-11-05T02:23:20.352452
2020-06-11T06:50:13
2020-06-11T06:50:13
269,845,753
0
0
null
null
null
null
UTF-8
Java
false
false
4,189
java
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; import javax.sql.DataSource; import java.sql.*; import java.util.Scanner; /** * @program: MYSQL表搭建 * @description * @author: matilda * @create: 2020-06-07 11:56 **/ //使用PrepareStatement 替代 Statement public class use_prepareStatement { public static void main(String[] args) throws SQLException { // 初始化一次,多次使用 initDataSource(); Scanner scanner = new Scanner(System.in); // 使用 Statement 的写法 try (Connection c = getConnection()) { // 查询以下 SQL: select * from exam_result where english > 某个值 and chinese > 某个值 // 这个值需要用户输入 System.out.print("请输入英语获奖分数> "); int ei = scanner.nextInt(); System.out.print("请输入语文获奖分数> "); int ci = scanner.nextInt(); try (Statement s = c.createStatement()) { // 自己使用 String 拼接 SQL,很容易出问题 String sql = "select * from exam_result where english > " + ei + " and chinese > " + ci; System.out.println(sql); try (ResultSet resultSet = s.executeQuery(sql)) { while (resultSet.next()) { String id = resultSet.getString("id"); String name = resultSet.getString("name"); String english = resultSet.getString("english"); String chinese = resultSet.getString("chinese"); String math = resultSet.getString("math"); System.out.println(id + ", " + name + ", " + english + ", " + chinese + ", " + math); } } } } // 使用 PrepareStatement 的方式 // 使用 Statement 进行sql执行时,如果 sql 中有参数,需要动态获取,Statement 比较差 // 所以使用 PrepareStatement 代替:Statement 处理不谨慎,很容易 SQL 注入 // PrepareStatement 可以有效的防止 SQL 注入 try (Connection c = getConnection()) { // 查询以下 SQL: select * from exam_result where english > 某个值 and chinese > 某个值 // 这个值需要用户输入 System.out.print("请输入英语获奖分数> "); int ei = scanner.nextInt(); System.out.print("请输入语文获奖分数> "); int ci = scanner.nextInt(); // 提前把 sql 写好,使用 ? 作为占位符 String sql = "select * from exam_result where english > ? and chinese > ?"; try (PreparedStatement s = c.prepareStatement(sql)) { // 使用具体的值,替代占位符 s.setInt(1, ei); s.setInt(2, ci); try (ResultSet r = s.executeQuery()) { while (r.next()) { String id = r.getString("id"); String name = r.getString("name"); String english = r.getString("english"); String chinese = r.getString("chinese"); String math = r.getString("math"); System.out.println(id + ", " + name + ", " + english + ", " + chinese + ", " + math); } } } } } private static DataSource dataSource = null; private static void initDataSource() { MysqlDataSource mysqlDataSource = new MysqlDataSource(); mysqlDataSource.setServerName("127.0.0.1");//服务器名称 mysqlDataSource.setPort(3306);//端口 mysqlDataSource.setUser("root"); mysqlDataSource.setPassword("cardiac02200059"); mysqlDataSource.setDatabaseName("student"); mysqlDataSource.setUseSSL(false);//是否使用useSSL mysqlDataSource.setCharacterEncoding("utf8"); dataSource = mysqlDataSource; } public static Connection getConnection() throws SQLException { return dataSource.getConnection(); } }
0f2d6a86d3569d0af141cf56ec7d94cd6b77aeff
42784d4404164117b90f22093f631bee5326442a
/app/src/main/java/daniyal_android_jsonparsing/json_parsing/MainActivity.java
ee6c0cfc06c629147a3c36ca1edec89458cf4111
[]
no_license
dalalsunil1986/Json_Parsing
719017dc738f0af471c8378cce9bde545d2e828e
8e443f06c0a5d52cebc48d22e6e305534eb024d8
refs/heads/master
2021-09-29T02:20:42.191077
2018-11-22T18:36:05
2018-11-22T18:36:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,241
java
package daniyal_android_jsonparsing.json_parsing; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class MainActivity extends AppCompatActivity { String jsonData = "[{\n" + "\n" + "\t\"properties\": [{\n" + "\t\t\"Name\": \"Shahan\",\n" + "\t\t\"prop_name\": \"Bonneville\",\n" + "\t\t\"address\": \"122 Lakeshore\",\n" + "\t\t\"city\": \"Ripley\",\n" + "\t\t\"state\": \"OH\",\n" + "\t\t\"zip\": \"11454\",\n" + "\t\t\"lat\": \"41.123\",\n" + "\t\t\"long\": \"-85.5034\"\n" + "\t}]\n" + "}]"; TextView name; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name = (TextView) findViewById(R.id.name); JSONArray mJsonArray = null; JSONObject mJsonObject = null; try { mJsonArray = new JSONArray(jsonData); mJsonObject = mJsonArray.getJSONObject(0); } catch (JSONException e) { e.printStackTrace(); } try { JSONArray mJsonArrayProperty = mJsonObject.getJSONArray("properties"); for (int i = 0; i < mJsonArrayProperty.length(); i++) { JSONObject mJsonObjectProperty = mJsonArrayProperty.getJSONObject(i); String JName = mJsonObjectProperty.getString("Name"); name.setText(JName); // String prop_name = mJsonObjectProperty.getString("prop_name"); // String address = mJsonObjectProperty.getString("address"); // String city = mJsonObjectProperty.getString("city"); // String state = mJsonObjectProperty.getString("state"); // String zip = mJsonObjectProperty.getString("zip"); // String lat = mJsonObjectProperty.getString("lat"); // String lon = mJsonObjectProperty.getString("long"); } }catch (Exception e){} } }
d7b8fa8cb1568a9a1ce7d91ba1b107120c1654bc
ec5b3ec35adad0ca92ba068b6b0a9ac1fed4ff2d
/main/java/com/yun/phonemanager/dao/AntivirusDao.java
dd10016891a7a427f0f18f3f9f288f919c66aab4
[]
no_license
MyUsernameisCloud/PhoneManager
200791848859e6ee9fa2a47593b2a0ae1c5f026f
5afdd2484af72c59f07b413bb4e5b7b4f4f5cfa5
refs/heads/master
2020-03-15T12:42:48.118713
2018-05-05T08:28:55
2018-05-05T08:28:55
132,150,299
0
0
null
null
null
null
UTF-8
Java
false
false
1,328
java
package com.yun.phonemanager.dao; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import java.io.File; public class AntivirusDao { private static String Fullpath; SQLiteDatabase db; // 初始化 public AntivirusDao() { // 数据库的位置 String path = "data/data/com.jess.mobilesafe/files/antivirus.db"; // 打开数据库的到数据库对象 //db = SQLiteDatabase.openDatabase(path, null,SQLiteDatabase.OPEN_READONLY); } public String query(String md5, Context context){ String desc=null; File f=context.getDatabasePath("antivirus.db").getParentFile(); if(f.exists()==false) { f.mkdirs(); } Fullpath=f.getPath()+"/antivirus.db"; db = SQLiteDatabase.openDatabase(Fullpath, null,SQLiteDatabase.OPEN_READONLY); //?为占位符 Cursor cursor = db.rawQuery("select desc from datable where md5 = ?", new String[]{md5}); if (cursor.moveToNext()) { desc = cursor.getString(0); } return desc; } /** * 关闭数据库释放资源 */ public void close(){ if (db!=null) { db.close(); } } }
f5bb6d5f4d82c32e95faaa0be9998c669c70c344
1429ee4ce851eb6292c990bfa5ed10c9297c08d5
/app/src/main/java/com/cleanmaster/notificationclean/view/CMCircularProgressBar.java
684958fc118617f39ae80d263e44c3550ab22c2f
[]
no_license
bridsj/CleanMemory
37db3a8c4c2a2dda719eab3430098f2354c1ae6f
77eae57d6f5114636ecf679845b198f79de32038
refs/heads/master
2020-09-22T06:10:43.967893
2016-10-12T04:21:21
2016-10-12T04:21:21
66,561,472
0
0
null
null
null
null
UTF-8
Java
false
false
20,415
java
package com.cleanmaster.notificationclean.view; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.os.Build; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; import android.view.View; import com.really.cleanmemory.R; /** * HoloCircularProgressBar custom view. * * https://github.com/passsy/android-HoloCircularProgressBar * * @author Pascal.Welsch * @version 1.3 (03.10.2014) * @since 05.03.2013 */ public class CMCircularProgressBar extends View { /** * TAG constant for logging */ private static final String TAG = CMCircularProgressBar.class.getSimpleName(); /** * used to save the super state on configuration change */ private static final String INSTANCE_STATE_SAVEDSTATE = "saved_state"; /** * used to save the progress on configuration changes */ private static final String INSTANCE_STATE_PROGRESS = "progress"; /** * used to save the marker progress on configuration changes */ private static final String INSTANCE_STATE_MARKER_PROGRESS = "marker_progress"; /** * used to save the background color of the progress */ private static final String INSTANCE_STATE_PROGRESS_BACKGROUND_COLOR = "progress_background_color"; /** * used to save the color of the progress */ private static final String INSTANCE_STATE_PROGRESS_COLOR = "progress_color"; /** * used to save and restore the visibility of the thumb in this instance */ private static final String INSTANCE_STATE_THUMB_VISIBLE = "thumb_visible"; /** * used to save and restore the visibility of the marker in this instance */ private static final String INSTANCE_STATE_MARKER_VISIBLE = "marker_visible"; /** * The rectangle enclosing the circle. */ private final RectF mCircleBounds = new RectF(); /** * the rect for the thumb square */ private final RectF mSquareRect = new RectF(); /** * the paint for the background. */ private Paint mBackgroundColorPaint = new Paint(); /** * The stroke width used to paint the circle. */ private int mCircleStrokeWidth = 10; /** * The gravity of the view. Where should the Circle be drawn within the given bounds * * {@link #computeInsets(int, int)} */ private int mGravity = Gravity.CENTER; /** * The Horizontal inset calcualted in {@link #computeInsets(int, int)} depends on {@link * #mGravity}. */ private int mHorizontalInset = 0; /** * true if not all properties are set. then the view isn't drawn and there are no errors in the * LayoutEditor */ private boolean mIsInitializing = true; /** * flag if the marker should be visible */ private boolean mIsMarkerEnabled = false; /** * indicates if the thumb is visible */ private boolean mIsThumbEnabled = true; private boolean mIsClockwiseEnabled = true; /** * The Marker color paint. */ private Paint mMarkerColorPaint; /** * The Marker progress. */ private float mMarkerProgress = 0.0f; /** * the overdraw is true if the progress is over 1.0. */ private boolean mOverrdraw = false; /** * The current progress. */ private float mProgress = 0.3f; /** * The color of the progress background. */ private int mProgressBackgroundColor; /** * the color of the progress. */ private int mProgressColor; /** * paint for the progress. */ private Paint mProgressColorPaint; /** * Radius of the circle * * <p> Note: (Re)calculated in {@link #onMeasure(int, int)}. </p> */ private float mRadius; /** * The Thumb color paint. */ private Paint mThumbColorPaint = new Paint(); /** * The Thumb pos x. * * Care. the position is not the position of the rotated thumb. The position is only calculated * in {@link #onMeasure(int, int)} */ private float mThumbPosX; /** * The Thumb pos y. * * Care. the position is not the position of the rotated thumb. The position is only calculated * in {@link #onMeasure(int, int)} */ private float mThumbPosY; /** * The pointer width (in pixels). */ private int mThumbRadius = 20; /** * The Translation offset x which gives us the ability to use our own coordinates system. */ private float mTranslationOffsetX; /** * The Translation offset y which gives us the ability to use our own coordinates system. */ private float mTranslationOffsetY; /** * The Vertical inset calcualted in {@link #computeInsets(int, int)} depends on {@link * #mGravity}.. */ private int mVerticalInset = 0; /** * Instantiates a new holo circular progress bar. * * @param context the context */ public CMCircularProgressBar(final Context context) { this(context, null); } /** * Instantiates a new holo circular progress bar. * * @param context the context * @param attrs the attrs */ public CMCircularProgressBar(final Context context, final AttributeSet attrs) { this(context, attrs, R.attr.CMCircularProgressBarStyle); } /** * Instantiates a new holo circular progress bar. * * @param context the context * @param attrs the attrs * @param defStyle the def style */ public CMCircularProgressBar(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); // load the styled attributes and set their properties final TypedArray attributes = context .obtainStyledAttributes(attrs, R.styleable.CMCircularProgressBar, defStyle, 0); if (attributes != null) { try { setProgressColor(attributes .getColor(R.styleable.CMCircularProgressBar_cm_circular_pb_progress_color, Color.CYAN)); setProgressBackgroundColor(attributes .getColor(R.styleable.CMCircularProgressBar_cm_circular_pb_background_color, Color.GREEN)); setProgress( attributes.getFloat(R.styleable.CMCircularProgressBar_cm_circular_pb_progress, 0.0f)); setClockwiseEnabled(attributes.getBoolean(R.styleable.CMCircularProgressBar_cm_circular_pb_clockwise_enable, true)); setMarkerProgress( attributes.getFloat(R.styleable.CMCircularProgressBar_cm_circular_pb_marker_progress, 0.0f)); setWheelSize((int) attributes .getDimension(R.styleable.CMCircularProgressBar_cm_circular_pb_stroke_width, 10)); setThumbEnabled(attributes .getBoolean(R.styleable.CMCircularProgressBar_cm_circular_pb_thumb_visible, true)); setMarkerEnabled(attributes .getBoolean(R.styleable.CMCircularProgressBar_cm_circular_pb_marker_visible, true)); mGravity = attributes .getInt(R.styleable.CMCircularProgressBar_android_gravity, Gravity.CENTER); } finally { // make sure recycle is always called. attributes.recycle(); } } mThumbRadius = mCircleStrokeWidth * 2; updateBackgroundColor(); updateMarkerColor(); updateProgressColor(); // the view has now all properties and can be drawn mIsInitializing = false; } @Override protected void onDraw(final Canvas canvas) { // All of our positions are using our internal coordinate system. // Instead of translating // them we let Canvas do the work for us. canvas.translate(mTranslationOffsetX, mTranslationOffsetY); final float progressRotation = getCurrentRotation(); // draw the background if (!mOverrdraw) { canvas.drawArc(mCircleBounds, 270, -(360 - progressRotation), false, mBackgroundColorPaint); } // draw the progress or a full circle if overdraw is true canvas.drawArc(mCircleBounds, 270, mOverrdraw ? 360 : progressRotation, false, mProgressColorPaint); Log.e("","progressRotation 223222 "+(mOverrdraw ? 360 : progressRotation)+","+mCircleBounds.toString()); // draw the marker at the correct rotated position if (mIsMarkerEnabled) { final float markerRotation = getMarkerRotation(); canvas.save(); canvas.rotate(markerRotation - 90); canvas.drawLine((float) (mThumbPosX + mThumbRadius / 2 * 1.4), mThumbPosY, (float) (mThumbPosX - mThumbRadius / 2 * 1.4), mThumbPosY, mMarkerColorPaint); canvas.restore(); } if (isThumbEnabled()) { // draw the thumb square at the correct rotated position canvas.save(); canvas.rotate(progressRotation - 90); // rotate the square by 45 degrees canvas.rotate(45, mThumbPosX, mThumbPosY); mSquareRect.left = mThumbPosX - mThumbRadius / 3; mSquareRect.right = mThumbPosX + mThumbRadius / 3; mSquareRect.top = mThumbPosY - mThumbRadius / 3; mSquareRect.bottom = mThumbPosY + mThumbRadius / 3; canvas.drawRect(mSquareRect, mThumbColorPaint); canvas.restore(); } } @Override protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { final int height = getDefaultSize( getSuggestedMinimumHeight() + getPaddingTop() + getPaddingBottom(), heightMeasureSpec); final int width = getDefaultSize( getSuggestedMinimumWidth() + getPaddingLeft() + getPaddingRight(), widthMeasureSpec); final int diameter; if (heightMeasureSpec == MeasureSpec.UNSPECIFIED) { // ScrollView diameter = width; computeInsets(0, 0); } else if (widthMeasureSpec == MeasureSpec.UNSPECIFIED) { // HorizontalScrollView diameter = height; computeInsets(0, 0); } else { // Default diameter = Math.min(width, height); computeInsets(width - diameter, height - diameter); } setMeasuredDimension(diameter, diameter); final float halfWidth = diameter * 0.5f; // width of the drawed circle (+ the drawedThumb) final float drawedWith; if (isThumbEnabled()) { drawedWith = mThumbRadius * (5f / 6f); } else if (isMarkerEnabled()) { drawedWith = mCircleStrokeWidth * 1.4f; } else { drawedWith = mCircleStrokeWidth / 2f; } // -0.5f for pixel perfect fit inside the viewbounds mRadius = halfWidth - drawedWith - 0.5f; mCircleBounds.set(-mRadius, -mRadius, mRadius, mRadius); mThumbPosX = (float) (mRadius * Math.cos(0)); mThumbPosY = (float) (mRadius * Math.sin(0)); mTranslationOffsetX = halfWidth + mHorizontalInset; mTranslationOffsetY = halfWidth + mVerticalInset; } @Override protected void onRestoreInstanceState(final Parcelable state) { if (state instanceof Bundle) { final Bundle bundle = (Bundle) state; setProgress(bundle.getFloat(INSTANCE_STATE_PROGRESS)); setMarkerProgress(bundle.getFloat(INSTANCE_STATE_MARKER_PROGRESS)); final int progressColor = bundle.getInt(INSTANCE_STATE_PROGRESS_COLOR); if (progressColor != mProgressColor) { mProgressColor = progressColor; updateProgressColor(); } final int progressBackgroundColor = bundle .getInt(INSTANCE_STATE_PROGRESS_BACKGROUND_COLOR); if (progressBackgroundColor != mProgressBackgroundColor) { mProgressBackgroundColor = progressBackgroundColor; updateBackgroundColor(); } mIsThumbEnabled = bundle.getBoolean(INSTANCE_STATE_THUMB_VISIBLE); mIsMarkerEnabled = bundle.getBoolean(INSTANCE_STATE_MARKER_VISIBLE); super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE_SAVEDSTATE)); return; } super.onRestoreInstanceState(state); } @Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE_SAVEDSTATE, super.onSaveInstanceState()); bundle.putFloat(INSTANCE_STATE_PROGRESS, mProgress); bundle.putFloat(INSTANCE_STATE_MARKER_PROGRESS, mMarkerProgress); bundle.putInt(INSTANCE_STATE_PROGRESS_COLOR, mProgressColor); bundle.putInt(INSTANCE_STATE_PROGRESS_BACKGROUND_COLOR, mProgressBackgroundColor); bundle.putBoolean(INSTANCE_STATE_THUMB_VISIBLE, mIsThumbEnabled); bundle.putBoolean(INSTANCE_STATE_MARKER_VISIBLE, mIsMarkerEnabled); return bundle; } public int getCircleStrokeWidth() { return mCircleStrokeWidth; } /** * similar to {@link #getProgress} */ public float getMarkerProgress() { return mMarkerProgress; } /** * gives the current progress of the ProgressBar. Value between 0..1 if you set the progress to * >1 you'll get progress % 1 as return value * * @return the progress */ public float getProgress() { return mProgress; } /** * Gets the progress color. * * @return the progress color */ public int getProgressColor() { return mProgressColor; } /** * @return true if the marker is visible */ public boolean isMarkerEnabled() { return mIsMarkerEnabled; } /** * @return true if the marker is visible */ public boolean isThumbEnabled() { return mIsThumbEnabled; } /** * Sets the marker enabled. * * @param enabled the new marker enabled */ public void setMarkerEnabled(final boolean enabled) { mIsMarkerEnabled = enabled; } /** * Sets the marker progress. * * @param progress the new marker progress */ public void setMarkerProgress(final float progress) { mIsMarkerEnabled = true; mMarkerProgress = progress; } /** * Sets the progress. * * @param progress the new progress */ public void setProgress(final float progress) { if (progress == mProgress) { return; } if (progress == 1) { mOverrdraw = false; mProgress = 1; } else { if (progress >= 1) { mOverrdraw = true; } else { mOverrdraw = false; } mProgress = progress % 1.0f; } if (!mIsInitializing) { invalidate(); } } /** * Sets the progress background color. * * @param color the new progress background color */ public void setProgressBackgroundColor(final int color) { mProgressBackgroundColor = color; updateMarkerColor(); updateBackgroundColor(); } /** * Sets the progress color. * * @param color the new progress color */ public void setProgressColor(final int color) { mProgressColor = color; updateProgressColor(); } /** * shows or hides the thumb of the progress bar * * @param enabled true to show the thumb */ public void setThumbEnabled(final boolean enabled) { mIsThumbEnabled = enabled; } /** * Sets the wheel size. * * @param dimension the new wheel size */ public void setWheelSize(final int dimension) { mCircleStrokeWidth = dimension; // update the paints updateBackgroundColor(); updateMarkerColor(); updateProgressColor(); } /** * Compute insets. * * <pre> * ______________________ * |_________dx/2_________| * |......| /'''''\|......| * |-dx/2-|| View ||-dx/2-| * |______| \_____/|______| * |________ dx/2_________| * </pre> * * @param dx the dx the horizontal unfilled space * @param dy the dy the horizontal unfilled space */ @SuppressLint("NewApi") private void computeInsets(final int dx, final int dy) { int absoluteGravity = mGravity; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { absoluteGravity = Gravity.getAbsoluteGravity(mGravity, getLayoutDirection()); } switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.LEFT: mHorizontalInset = 0; break; case Gravity.RIGHT: mHorizontalInset = dx; break; case Gravity.CENTER_HORIZONTAL: default: mHorizontalInset = dx / 2; break; } switch (absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK) { case Gravity.TOP: mVerticalInset = 0; break; case Gravity.BOTTOM: mVerticalInset = dy; break; case Gravity.CENTER_VERTICAL: default: mVerticalInset = dy / 2; break; } } private boolean isClockwiseEnabled() { return mIsClockwiseEnabled; } private void setClockwiseEnabled(boolean isClockwiseEnabled) { mIsClockwiseEnabled = isClockwiseEnabled; } /** * Gets the current rotation. * * @return the current rotation */ private float getCurrentRotation() { if (isClockwiseEnabled()) { return 360 * mProgress; } return -360 * mProgress; } /** * Gets the marker rotation. * * @return the marker rotation */ private float getMarkerRotation() { return 360 * mMarkerProgress; } /** * updates the paint of the background */ private void updateBackgroundColor() { mBackgroundColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mBackgroundColorPaint.setColor(mProgressBackgroundColor); mBackgroundColorPaint.setStyle(Paint.Style.STROKE); mBackgroundColorPaint.setStrokeWidth(mCircleStrokeWidth); invalidate(); } /** * updates the paint of the marker */ private void updateMarkerColor() { mMarkerColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mMarkerColorPaint.setColor(mProgressBackgroundColor); mMarkerColorPaint.setStyle(Paint.Style.STROKE); mMarkerColorPaint.setStrokeWidth(mCircleStrokeWidth / 2); invalidate(); } /** * updates the paint of the progress and the thumb to give them a new visual style */ private void updateProgressColor() { mProgressColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mProgressColorPaint.setColor(mProgressColor); mProgressColorPaint.setAntiAlias(true); mProgressColorPaint.setStyle(Paint.Style.STROKE); mProgressColorPaint.setStrokeWidth(mCircleStrokeWidth); mProgressColorPaint.setStrokeCap(Paint.Cap.ROUND); mThumbColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mThumbColorPaint.setAntiAlias(true); mThumbColorPaint.setColor(mProgressColor); mThumbColorPaint.setStyle(Paint.Style.FILL_AND_STROKE); mThumbColorPaint.setStrokeWidth(mCircleStrokeWidth); invalidate(); } }
7b8f6922625aa3b7b66adb34c10d8d38e2781114
90aa8f65e417d02b12655e248d9c0e71a227e14e
/src/java/jsf/TurnoController.java
fc2edeb5877de7213384cd7d9dc81d5bd2d8483a
[]
no_license
Ildevana/Reserva
c5d89aed15929c8df1346383ed3c04e5ec47ee91
a791ca8f799b79901c80c96fe854049f86a2f06f
refs/heads/master
2016-09-09T17:17:32.588926
2014-11-22T23:56:45
2014-11-22T23:56:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,061
java
package jsf; import Jpa.entites.Turno; import jsf.util.JsfUtil; import jsf.util.PaginationHelper; import Jpa.session.TurnoFacade; import java.io.Serializable; import java.util.ResourceBundle; import javax.ejb.EJB; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.FacesConverter; import javax.faces.model.DataModel; import javax.faces.model.ListDataModel; import javax.faces.model.SelectItem; @Named("turnoController") @SessionScoped public class TurnoController implements Serializable { private Turno current; private DataModel items = null; @EJB private Jpa.session.TurnoFacade ejbFacade; private PaginationHelper pagination; private int selectedItemIndex; public TurnoController() { } public Turno getSelected() { if (current == null) { current = new Turno(); selectedItemIndex = -1; } return current; } private TurnoFacade getFacade() { return ejbFacade; } public PaginationHelper getPagination() { if (pagination == null) { pagination = new PaginationHelper(10) { @Override public int getItemsCount() { return getFacade().count(); } @Override public DataModel createPageDataModel() { return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem() + getPageSize()})); } }; } return pagination; } public String prepareList() { recreateModel(); return "List"; } public String prepareView() { current = (Turno) getItems().getRowData(); selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); return "View"; } public String prepareCreate() { current = new Turno(); selectedItemIndex = -1; return "Create"; } public String create() { try { getFacade().create(current); JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("TurnoCreated")); return prepareCreate(); } catch (Exception e) { JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); return null; } } public String prepareEdit() { current = (Turno) getItems().getRowData(); selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); return "Edit"; } public String update() { try { getFacade().edit(current); JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("TurnoUpdated")); return "View"; } catch (Exception e) { JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); return null; } } public String destroy() { current = (Turno) getItems().getRowData(); selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex(); performDestroy(); recreatePagination(); recreateModel(); return "List"; } public String destroyAndView() { performDestroy(); recreateModel(); updateCurrentItem(); if (selectedItemIndex >= 0) { return "View"; } else { // all items were removed - go back to list recreateModel(); return "List"; } } private void performDestroy() { try { getFacade().remove(current); JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("TurnoDeleted")); } catch (Exception e) { JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured")); } } private void updateCurrentItem() { int count = getFacade().count(); if (selectedItemIndex >= count) { // selected index cannot be bigger than number of items: selectedItemIndex = count - 1; // go to previous page if last page disappeared: if (pagination.getPageFirstItem() >= count) { pagination.previousPage(); } } if (selectedItemIndex >= 0) { current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex + 1}).get(0); } } public DataModel getItems() { if (items == null) { items = getPagination().createPageDataModel(); } return items; } private void recreateModel() { items = null; } private void recreatePagination() { pagination = null; } public String next() { getPagination().nextPage(); recreateModel(); return "List"; } public String previous() { getPagination().previousPage(); recreateModel(); return "List"; } public SelectItem[] getItemsAvailableSelectMany() { return JsfUtil.getSelectItems(ejbFacade.findAll(), false); } public SelectItem[] getItemsAvailableSelectOne() { return JsfUtil.getSelectItems(ejbFacade.findAll(), true); } public Turno getTurno(java.lang.Integer id) { return ejbFacade.find(id); } @FacesConverter(forClass = Turno.class) public static class TurnoControllerConverter implements Converter { @Override public Object getAsObject(FacesContext facesContext, UIComponent component, String value) { if (value == null || value.length() == 0) { return null; } TurnoController controller = (TurnoController) facesContext.getApplication().getELResolver(). getValue(facesContext.getELContext(), null, "turnoController"); return controller.getTurno(getKey(value)); } java.lang.Integer getKey(String value) { java.lang.Integer key; key = Integer.valueOf(value); return key; } String getStringKey(java.lang.Integer value) { StringBuilder sb = new StringBuilder(); sb.append(value); return sb.toString(); } @Override public String getAsString(FacesContext facesContext, UIComponent component, Object object) { if (object == null) { return null; } if (object instanceof Turno) { Turno o = (Turno) object; return getStringKey(o.getId()); } else { throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + Turno.class.getName()); } } } }
aca6dd31ca4ce6dffcd65579758edfc18dea99ac
9f686514f762553313e98b54d4638faa8558dffb
/Spring/E-shopping/order-service/src/main/java/com/order/document/Item.java
d2d243b8fd48e56be9beeca90c2d893a0e7ecb57
[]
no_license
lakshmijha19/E-Shopping
238d549534b7b07e3fca825c266e8b6cd9f25b6a
ec657e2a823b687ff7c6e705788f0eeebbd1d272
refs/heads/master
2023-08-07T06:15:18.205214
2021-10-09T15:07:39
2021-10-09T15:07:39
409,147,964
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package com.order.document; public class Item { String productName; double price; int quantity; public Item() {} public Item(String productName, double price, int quantity) { this.productName = productName; this.price = price; this.quantity = quantity; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } @Override public String toString() { return "Item [productName=" + productName + ", price=" + price + ", quantity=" + quantity + "]"; } }
266b125812a3b661af7ea251954e0e5e77fb4571
2854e0ac523175431269dd1eb9f817dd6e8ae526
/src/quiz/B13_count_letter.java
b65516e0bf9e6486d5b8f7962c8067a2db2098e5
[]
no_license
rlaalghkwkd2/Java_Class
5c6a374b2728061bb60965eb89b43b6f5a03eb10
e3cccf5bcc1997c3e4f2b9a3fa5202a215becdcc
refs/heads/main
2023-02-04T23:15:08.242309
2020-12-23T02:54:28
2020-12-23T02:54:28
315,221,944
0
1
null
null
null
null
UHC
Java
false
false
1,834
java
package quiz; public class B13_count_letter { public static void main(String[] args) { // 사용자로부터 문장을 하나 입력받고았다 치고 // 해당 문장에 어떤 알파벳이 몇번 등장했는지 세어서 출력해보시오. // 대소문자 구분 X // 해설 int[] count = new int[26]; String msg = "The Quick Brown Fox Jumps Over a Lazy Dog"; msg = msg.toLowerCase(); // 대문자로 : Upper 소문자로 : Lower for (int i = 0; i < msg.length(); i++) { char ch = msg.charAt(i); if (ch >= 'a' && ch <= 'z') count[ch - 'a'] += 1; } for (int i = 0; i < 26; i++) { if (count[i] > 0) { // 등장한 애들만 System.out.printf("%c가 등장한 횟수는 %d번입니다.\n", i + 'a', count[i]); } } // 'a' - 'a' -> 0 -> count[0] += 1 // 'b' - 'a' -> 1 -> count[1] += 1 // 'c' - 'a' -> 2 -> count[2] += 1 // // switch (ch) { // case 'a' : // count[0] += 1; // break; // String user = "Hello, world131253"; // char[] ch = user.toCharArray(); // // int[] count = new int[65536]; // // for (int i = 0; i < ch.length; i++) { // for (int j = 0; j < ch.length; j++) { // // if (ch[i] >= 'A' && ch[i] <= 'Z' // || ch[i] >= 'a' && ch[i] <= 'z') { // if (ch[i] == ch[j]) { // count[i]++; // } // } else if (ch[i] == ch[j]) { // count[i]++; // } // } // System.out.printf("%c : %d번\n", (char) (ch[i]), count[i]); // } // String user = "Helloworld"; // char[] ch = user.toCharArray(); // int[] count = new int[26]; // // for( // int i = 0;i<ch.length;i++) // { // for (int j = 0; j < ch.length; j++) { // if (ch[j] >= 'A' && ch[j] <= 'Z') // ch[j] += 32; // // } // System.out.printf("%c\n", (ch[i])); // } } }
[ "seunghwan@Park" ]
seunghwan@Park
4a0172c430b8738329c9ffba129fc1517ba4f965
86eadee8c5cb48e490b35d4f142ee731fe27f87f
/test-commons/src/main/java/com/mygeno/test/pojo/EasyUIDatagrid.java
bc4bf3bfa6b8ef219e26fe8d87a4443f71b17bb1
[]
no_license
yt348619925/test-dubbo
de337bf7805f5880f6c79ab961a9f232d25a1c1f
46208453f3dda3107b5556d852854857cc86d9ab
refs/heads/master
2020-04-17T11:14:13.766957
2019-02-23T10:58:10
2019-02-23T10:58:10
166,533,249
0
0
null
null
null
null
UTF-8
Java
false
false
553
java
package com.mygeno.test.pojo; import java.io.Serializable; import java.util.List; /** * @Auther: yt * @Date: 2019/1/22 * @Description: com.mygeno.test.pojo * @version: 1.0 */ public class EasyUIDatagrid implements Serializable { private List<?> rows; private long total; public List<?> getRows() { return rows; } public void setRows(List<?> rows) { this.rows = rows; } public long getTotal() { return total; } public void setTotal(long total) { this.total = total; } }
ef5dcedd3c73da643beb2e532614990c9d66d54a
d7c99be7b36d0ca7555485cc45da647ea66d2424
/barchart-feed-ddf-datalink/src/main/java/com/barchart/feed/ddf/datalink/provider/util/ByteAccumulator.java
8b622ab508022584ae40de1c08243f136936f931
[ "BSD-3-Clause" ]
permissive
barchart/barchart-feed-ddf
9558a2c2cf70e1e4f3ab78d81e089afd13937bcd
5d745f5a66402a40ab30cac7c087b740c54b6e65
refs/heads/master
2023-08-27T05:48:01.431376
2021-10-11T17:06:22
2021-10-11T17:06:22
3,918,537
2
2
null
2019-10-23T14:57:25
2012-04-03T14:00:41
Java
UTF-8
Java
false
false
2,435
java
// // ======================================================================== // Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 // and Apache License v2.0 which accompanies this distribution. // // The Eclipse Public License is available at // http://www.eclipse.org/legal/epl-v10.html // // The Apache License v2.0 is available at // http://www.opensource.org/licenses/apache2.0.php // // You may elect to redistribute this code under either of these licenses. // ======================================================================== // package com.barchart.feed.ddf.datalink.provider.util; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; /** * Collect up 1 or more byte arrays for later transfer to a single * {@link ByteBuffer}. * <p> * Used by decompression routines to fail if there is excessive inflation of the * decompressed data. (either maliciously or accidentally) * </p> */ public class ByteAccumulator { private final List<byte[]> chunks = new ArrayList<byte[]>(); private final int maxSize; private int length = 0; public ByteAccumulator(int maxOverallMessageSize) { this.maxSize = maxOverallMessageSize; } public void copyChunk(byte buf[], int offset, int length) throws Exception { if (this.length + length > maxSize) { throw new Exception(String.format("Decompressed Message [%,d b] is too large [max %,d b]", this.length + length, maxSize)); } byte copy[] = new byte[length - offset]; System.arraycopy(buf, offset, copy, 0, length); chunks.add(copy); this.length += length; } public int getLength() { return length; } public void transferTo(ByteBuffer buffer) { if (buffer.remaining() < length) { throw new IllegalArgumentException(String.format( "Not enough space in ByteBuffer remaining [%d] for accumulated buffers length [%d]", buffer.remaining(), length)); } int position = buffer.position(); for (byte[] chunk : chunks) { buffer.put(chunk, 0, chunk.length); } buffer.limit(position); buffer.position(position); } public ByteBuffer toByteBuffer() { final ByteBuffer b = ByteBuffer.allocate(getLength()); transferTo(b); return b; } }
ea31ad34204fa704f8332769cb10eb0eeb7e56cd
06b224fb7b28cabd1137f17cb85370d9e3b4c633
/proj.android/gen/proj/mgame/dolpha/R.java
e17feefb0445f8ac2be3fc098062ccfadf78188e
[]
no_license
beatheat/Dolpha
9713558877042c68e97344eb3401c57c4af352ba
245e19c5c0f56680ffb53f47d39d8f5bdaa15b3a
refs/heads/master
2022-07-18T06:24:00.269309
2018-06-17T21:01:06
2018-06-17T21:01:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
472
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package proj.mgame.dolpha; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; } public static final class string { public static final int app_name=0x7f030000; } }
97b606e57b45bd6753cd3a5502bc81a39c3aefea
a306f79281c4eb154fbbddedea126f333ab698da
/com/alibaba/fastjson/JSONReader.java
e863ef83312093a68a425b3b86c2c60e05f185ee
[]
no_license
pkcsecurity/decompiled-lightbulb
50828637420b9e93e9a6b2a7d500d2a9a412d193
314bb20a383b42495c04531106c48fd871115702
refs/heads/master
2022-01-26T18:38:38.489549
2019-05-11T04:27:09
2019-05-11T04:27:09
186,070,402
0
0
null
null
null
null
UTF-8
Java
false
false
7,677
java
package com.alibaba.fastjson; import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONStreamContext; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.parser.DefaultJSONParser; import com.alibaba.fastjson.parser.Feature; import com.alibaba.fastjson.parser.JSONLexer; import com.alibaba.fastjson.util.TypeUtils; import java.io.Closeable; import java.io.IOException; import java.io.Reader; import java.lang.reflect.Type; import java.util.Map; public class JSONReader implements Closeable { private JSONStreamContext context; private final DefaultJSONParser parser; private Reader reader; public JSONReader(DefaultJSONParser var1) { this.parser = var1; } public JSONReader(JSONLexer var1) { this(new DefaultJSONParser(var1)); } public JSONReader(Reader var1) { this(new JSONLexer(readAll(var1))); this.reader = var1; } private void endStructure() { this.context = this.context.parent; if(this.context != null) { short var1; switch(this.context.state) { case 1001: case 1003: var1 = 1002; break; case 1002: var1 = 1003; break; case 1004: var1 = 1005; break; default: var1 = -1; } if(var1 != -1) { this.context.state = var1; } } } private void readAfter() { int var2 = this.context.state; short var1 = 1002; switch(var2) { case 1001: case 1003: break; case 1002: var1 = 1003; break; case 1004: var1 = 1005; break; case 1005: var1 = -1; break; default: StringBuilder var3 = new StringBuilder(); var3.append("illegal state : "); var3.append(var2); throw new JSONException(var3.toString()); } if(var1 != -1) { this.context.state = var1; } } static String readAll(Reader param0) { // $FF: Couldn't be decompiled } private void readBefore() { int var1 = this.context.state; switch(var1) { case 1002: this.parser.accept(17); case 1001: case 1004: return; case 1003: case 1005: this.parser.accept(16); return; default: StringBuilder var2 = new StringBuilder(); var2.append("illegal state : "); var2.append(var1); throw new JSONException(var2.toString()); } } private void startStructure() { switch(this.context.state) { case 1002: this.parser.accept(17); case 1001: case 1004: return; case 1003: case 1005: this.parser.accept(16); return; default: StringBuilder var1 = new StringBuilder(); var1.append("illegal state : "); var1.append(this.context.state); throw new JSONException(var1.toString()); } } public void close() { this.parser.lexer.close(); if(this.reader != null) { try { this.reader.close(); } catch (IOException var2) { throw new JSONException("closed reader error", var2); } } } public void config(Feature var1, boolean var2) { this.parser.config(var1, var2); } public void endArray() { this.parser.accept(15); this.endStructure(); } public void endObject() { this.parser.accept(13); this.endStructure(); } public boolean hasNext() { if(this.context == null) { throw new JSONException("context is null"); } else { int var1 = this.parser.lexer.token(); int var2 = this.context.state; boolean var4 = false; boolean var3 = false; switch(var2) { case 1001: case 1003: var3 = var4; if(var1 != 13) { var3 = true; } return var3; case 1002: default: StringBuilder var5 = new StringBuilder(); var5.append("illegal state : "); var5.append(var2); throw new JSONException(var5.toString()); case 1004: case 1005: if(var1 != 15) { var3 = true; } return var3; } } } public int peek() { return this.parser.lexer.token(); } public Integer readInteger() { Object var1; if(this.context == null) { var1 = this.parser.parse(); } else { this.readBefore(); var1 = this.parser.parse(); this.readAfter(); } return TypeUtils.castToInt(var1); } public Long readLong() { Object var1; if(this.context == null) { var1 = this.parser.parse(); } else { this.readBefore(); var1 = this.parser.parse(); this.readAfter(); } return TypeUtils.castToLong(var1); } public Object readObject() { if(this.context == null) { return this.parser.parse(); } else { this.readBefore(); Object var1 = this.parser.parse(); this.readAfter(); return var1; } } public <T extends Object> T readObject(TypeReference<T> var1) { return this.readObject(var1.type); } public <T extends Object> T readObject(Class<T> var1) { if(this.context == null) { return this.parser.parseObject(var1); } else { this.readBefore(); Object var2 = this.parser.parseObject(var1); this.readAfter(); return var2; } } public <T extends Object> T readObject(Type var1) { if(this.context == null) { return this.parser.parseObject(var1); } else { this.readBefore(); Object var2 = this.parser.parseObject(var1); this.readAfter(); return var2; } } public Object readObject(Map var1) { if(this.context == null) { return this.parser.parseObject(var1); } else { this.readBefore(); Object var2 = this.parser.parseObject(var1); this.readAfter(); return var2; } } public void readObject(Object var1) { if(this.context == null) { this.parser.parseObject(var1); } else { this.readBefore(); this.parser.parseObject(var1); this.readAfter(); } } public String readString() { Object var1; if(this.context == null) { var1 = this.parser.parse(); } else { this.readBefore(); var1 = this.parser.parse(); this.readAfter(); } return TypeUtils.castToString(var1); } public void startArray() { if(this.context == null) { this.context = new JSONStreamContext((JSONStreamContext)null, 1004); } else { this.startStructure(); this.context = new JSONStreamContext(this.context, 1004); } this.parser.accept(14); } public void startObject() { if(this.context == null) { this.context = new JSONStreamContext((JSONStreamContext)null, 1001); } else { this.startStructure(); this.context = new JSONStreamContext(this.context, 1001); } this.parser.accept(12); } }
8e92dc31b5e6d5b1f2e23468a3691867556937b2
725e43d7f520c9f22c1670a826fdab2d9abe0996
/producers/mysql-producer/src/main/java/com/flipkart/aesop/runtime/producer/avro/exception/InvalidAvroSchemaException.java
2f983562f6715d8eedf4564a003bd43153fc5f4e
[ "Apache-2.0" ]
permissive
akshit-agarwal/aesop
149b7a895fda846a86414531206f0d1a0428a5fb
ce97be734c64375a6f7d9a168cd170d62dfed0a7
refs/heads/master
2020-12-25T23:18:52.224922
2016-05-23T13:10:29
2016-05-23T13:10:29
53,935,668
0
0
null
2016-05-03T10:12:20
2016-03-15T10:31:41
Java
UTF-8
Java
false
false
511
java
package com.flipkart.aesop.runtime.producer.avro.exception; /** * Created by akshit.agarwal on 19/04/16. */ public class InvalidAvroSchemaException extends RuntimeException { public InvalidAvroSchemaException() { } public InvalidAvroSchemaException(String message, Throwable cause) { super(message, cause); } public InvalidAvroSchemaException(String message) { super(message); } public InvalidAvroSchemaException(Throwable cause) { super(cause); } }
2197bd50ed927e7c51102d6b543edc7dd7174468
f91d19518f302b1bf8d3f551acc9777814cd2a62
/src/main/java/entity/DAO/TransactionManager.java
bc558cdeef48648edb27d095e6f6141fe39d2bf4
[]
no_license
cmaruz/is_2019
2c455c6d89dfb696c54e20eaee213ec2164558ee
209927ca0fca62a77497cfed2b1b701e247b746d
refs/heads/master
2020-05-23T06:52:22.906776
2019-05-15T05:14:18
2019-05-15T05:14:18
186,667,267
0
0
null
null
null
null
UTF-8
Java
false
false
2,371
java
package entity.DAO; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.*; public class TransactionManager { private final String DATABASE_PATH; private final String DATABASE_USERNAME; private final String DATABASE_PASSWORD; private Connection connection; private boolean inTransaction; protected TransactionManager(String databasePath, String databaseUsername, String databasePassword) { this.DATABASE_PATH = databasePath; this.DATABASE_USERNAME = databaseUsername; this.DATABASE_PASSWORD = databasePassword; } public static class TransactionStateException extends RuntimeException { public TransactionStateException(String message) { super(message); } } public void beginTransaction() throws TransactionStateException { assertNotInTransaction(); try { connection = DriverManager.getConnection(DATABASE_PATH, DATABASE_USERNAME, DATABASE_PASSWORD); connection.setAutoCommit(false); inTransaction = true; } catch (SQLException e) { throw new RuntimeException("Impossible to create a new connection!", e); } } public Connection getConnection() { return connection; } public void assertInTransaction() throws TransactionStateException { if (isInTransaction() == false) { throw new TransactionStateException("Transaction not active!"); } } public void assertNotInTransaction() throws TransactionStateException { if (isInTransaction() == true) { throw new TransactionStateException("Transaction is active!"); } } public boolean isInTransaction() { return inTransaction; } public void commitTransaction() throws TransactionStateException, DAOException { try { assertInTransaction(); connection.commit(); connection.close(); connection = null; inTransaction = false; } catch (SQLException e) { throw new DAOException("Impossible to commit the transaction!", e); } } public void rollbackTransaction() throws TransactionStateException { try { assertInTransaction(); connection.rollback(); connection.close(); connection = null; inTransaction = false; } catch (SQLException e) { throw new RuntimeException("Unexpected exception during rollback!", e); } } }
c0b4dc5856296c0fd9f5c40415058cbf618a6155
f296971ed9ef26b68d570ec50702159723c81a0f
/src/SwapStringContent.java
912501634506d2e9cc66c7b2f9e7537ce5bf6d02
[]
no_license
prathimasuvarna11/JavaTutorial
e73d4e1b5c9ecaf967f6aeb075dd550eb5bdb757
4473b1cd0c18bcd207a2e38b1fe496c54d084d4b
refs/heads/master
2022-11-27T19:42:25.586543
2020-07-26T06:40:51
2020-07-26T06:40:51
282,592,381
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
import java.util.Scanner; public class SwapStringContent { public void swap(String s) { System.out.println(s); String[] ref=s.split(" "); System.out.println(ref[2]+" "+ref[1]+" "+ref[0]); } public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter a string"); String s=sc.nextLine(); SwapStringContent ss=new SwapStringContent(); ss.swap(s); } }
cbb4b3748559fdd1ac44b092064126b92d651543
3c93431c01c50af1a866bdfed31abcdc6fefae0a
/webStudy01/src/kr/or/ddit/web/IndexType.java
bc7da597dc05af39eacc3c8e114e029fb14dc9bf
[]
no_license
kimgwanhee/sturdy-potato
e6a256ad2d47c6c7ccfc0271fa17eb6b03d8635c
bc7e5070d27aa9ee2d42899efd6f0e973f2ca6ad
refs/heads/master
2020-04-06T13:57:38.571565
2018-12-12T11:28:41
2018-12-12T11:28:41
157,521,656
0
0
null
null
null
null
UTF-8
Java
false
false
806
java
package kr.or.ddit.web; public enum IndexType { //2번 GUGUDAN("/01/gugudanForm.html"), CALENDER("/04/calendar.jsp"), MUSIC("02/musicForm.jsp"), IMAGE("/imageForm"); private String iName;//4번 //이제 이 안에 서비스 페이지를 파라미터로 받을 수 있는 생성자를 하나 만들기 private IndexType(String iName) {//생성자에서 셋팅 //3번 this.iName = iName; } //활용하려면 //1번 public static IndexType getIndexType(String select) {//선택한메뉴 IndexType result = null; IndexType[] value = values(); for(IndexType tmp : value) { if(select.toUpperCase().contains(tmp.name())){ result = tmp; break; } } return result; } public String getIndexName() { return iName; } }
0cc13d2f13375bd95e498582970b52872a0892bf
028cbe18b4e5c347f664c592cbc7f56729b74060
/external/modules/derby/10.10.2.0/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DeadlockDetectionTest.java
63b4c6eae68b40578458d1217155b12695847a03
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-generic-export-compliance" ]
permissive
dmatej/Glassfish-SVN-Patched
8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e
269e29ba90db6d9c38271f7acd2affcacf2416f1
refs/heads/master
2021-05-28T12:55:06.267463
2014-11-11T04:21:44
2014-11-11T04:21:44
23,610,469
1
0
null
null
null
null
UTF-8
Java
false
false
10,594
java
/* * Derby - Class org.apache.derbyTesting.functionTests.tests.lang.DeadlockDetectionTest * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the License. */ package org.apache.derbyTesting.functionTests.tests.lang; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import junit.framework.Test; import org.apache.derbyTesting.functionTests.util.Barrier; import org.apache.derbyTesting.junit.BaseJDBCTestCase; import org.apache.derbyTesting.junit.CleanDatabaseTestSetup; import org.apache.derbyTesting.junit.DatabasePropertyTestSetup; import org.apache.derbyTesting.junit.JDBC; import org.apache.derbyTesting.junit.TestConfiguration; /** * This test verifies that the deadlock detection algorithm is able to * recognize certain cycles in the wait graph as deadlocks. */ public class DeadlockDetectionTest extends BaseJDBCTestCase { /** SQLState for deadlock exceptions. */ private final static String DEADLOCK = "40001"; public static Test suite() { // Deadlock detection is engine functionality, so only test embedded. Test test = TestConfiguration.embeddedSuite(DeadlockDetectionTest.class); // Reduce the deadlock timeout since this test expects deadlocks, and // we want to detect them quickly in order to reduce the test time. // We don't expect any wait timeouts, so set the wait timeout // sufficiently high to prevent that queries time out before we have // set up the deadlock on slow machines. test = DatabasePropertyTestSetup.setLockTimeouts(test, 1, 30); return new CleanDatabaseTestSetup(test); } public DeadlockDetectionTest(String name) { super(name); } /** * Test case to verify the fix for DERBY-3980. A simple deadlock was not * detected, and was reported as a lock timeout. */ public void testDerby3980_repeatable_read() throws Exception { Statement s = createStatement(); s.executeUpdate("create table derby3980 (i int)"); s.executeUpdate("insert into derby3980 values 1956, 180, 456, 3"); // Set up two threads. Thread[] threads = new Thread[2]; Connection[] conns = new Connection[threads.length]; // This barrier lets the two threads wait for each other so that both // can obtain a read lock before going on trying to obtain the write // lock. If one thread goes ahead and obtains the write lock before the // other thread has obtained the read lock, we won't see a deadlock. final Barrier readLockBarrier = new Barrier(threads.length); // Exceptions seen by the threads. final List exceptions = Collections.synchronizedList(new ArrayList()); // Start the two threads. Both should first obtain a read lock, and // when both have the read lock, they should try to lock the same row // exclusively. They'll be blocking each other, and we have a deadlock. for (int i = 0; i < threads.length; i++) { final Connection c = openDefaultConnection(); c.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); c.setAutoCommit(false); final PreparedStatement select = c.prepareStatement( "select * from derby3980 where i = 456"); final PreparedStatement update = c.prepareStatement( "update derby3980 set i = 456 where i = 456"); threads[i] = new Thread() { public void run() { try { JDBC.assertSingleValueResultSet( select.executeQuery(), "456"); // Now we've got the read lock. Wait until all threads // have it before attempting to get the write lock. readLockBarrier.await(); // All threads have the read lock. Now all should try // to update the row and thereby create a deadlock. assertUpdateCount(update, 1); // We got the write lock too. End the transaction. c.rollback(); } catch (Exception e) { exceptions.add(e); } } }; conns[i] = c; threads[i].start(); } // Threads have started, wait for them to complete. for (int i = 0; i < threads.length; i++) { threads[i].join(); conns[i].rollback(); conns[i].close(); } // Verify that we only got deadlock exceptions. for (Iterator it = exceptions.iterator(); it.hasNext(); ) { Exception e = (Exception) it.next(); if (e instanceof SQLException) { assertSQLState(DEADLOCK, (SQLException) e); } else { // What's this? Report it. throw e; } } // And we should only get one exception. (One transaction should be // picked as victim, the other one should be able to complete.) assertEquals("Number of victims", 1, exceptions.size()); } /** * Test case for DERBY-5073. A deadlock involving three transactions was * not reported when there were other transactions waiting for the same * locks. The deadlock was detected, and a victim chosen. But the victim * would recheck the deadlock and conclude that it wasn't part of it, and * it would pick a new victim that would also recheck and come to the same * conclusion. This would go on until the wait timeout had expired, and * an exception would be throws, although not a deadlock. */ public void testDerby5073_dodgy_victims() throws Exception { Statement s = createStatement(); s.executeUpdate("create table derby5073(x int primary key, y int)"); s.executeUpdate("insert into derby5073(x) values 0, 1, 2"); // We want six connections. Three that are involved in the deadlock, // and three that try to obtain locks on the same rows without // actually being part of the deadlock. Connection[] conns = new Connection[6]; Thread[] threads = new Thread[conns.length]; for (int i = 0; i < conns.length; i++) { conns[i] = openDefaultConnection(); conns[i].setAutoCommit(false); } // Three transactions take an exclusive lock on one row each. for (int i = 3; i < 6; i++) { PreparedStatement ps = conns[i].prepareStatement( "update derby5073 set y = x where x = ?"); ps.setInt(1, i % 3); assertUpdateCount(ps, 1); } // Then try to lock the rows in three other transactions and in the // three transactions that already have locked the rows exclusively. // The transactions that have exclusive locks should attempt to lock // another row than the one they already have locked, otherwise there // will be no deadlock. final List exceptions = Collections.synchronizedList(new ArrayList()); for (int i = 0; i < threads.length; i++) { final PreparedStatement ps = conns[i].prepareStatement( "select x from derby5073 where x = ?"); // Which row to lock. Add one to the thread number to make sure // that the threads don't attempt to lock the same row that they // already have locked above. final int row = (i + 1) % 3; ps.setInt(1, row); // The query will have to wait, so execute it in a separate thread. threads[i] = new Thread() { public void run() { try { JDBC.assertSingleValueResultSet( ps.executeQuery(), Integer.toString(row)); ps.getConnection().commit(); } catch (Exception e) { exceptions.add(e); } } }; threads[i].start(); // The bug is only seen if the first three threads are already // waiting for the locks when the last three threads (those // involved in the deadlock) start waiting. So take a little nap // here after we've started the third thread (index 2) to allow // the first three threads to enter the waiting state. if (i == 2) Thread.sleep(100L); } // Wait for all threads to finish. for (int i = 0; i < threads.length; i++) { threads[i].join(); conns[i].rollback(); conns[i].close(); } // Verify that we only got deadlock exceptions. for (Iterator it = exceptions.iterator(); it.hasNext(); ) { Exception e = (Exception) it.next(); if (e instanceof SQLException) { assertSQLState(DEADLOCK, (SQLException) e); } else { // What's this? Report it. throw e; } } // And we should only get one exception. (One transaction should be // picked as victim, the other ones should be able to complete.) assertEquals("Number of victims", 1, exceptions.size()); } }
[ "snjezana@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5" ]
snjezana@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5
c4fab4b370c9c3e649da8749cd7469cbd9395870
20a856c0840a2b4bc5f8045f5c6d5852927597c4
/myCollections/src/test/java/com/epam/myCollections/AppTest.java
b74b0e2ce7a965d9a618c8308daaf0853c8ac2b8
[]
no_license
saimanideepika210/SaiManideepika_collections_task
6d0f8c25ca013d5093ad02a686fecc1a630d219a
17e4268c8763268d99b15521f27d0f9ca6abbebd
refs/heads/master
2021-02-15T22:36:17.276825
2020-03-04T16:04:35
2020-03-04T16:04:35
244,939,429
0
0
null
2020-10-13T20:03:35
2020-03-04T15:45:45
Java
UTF-8
Java
false
false
294
java
package com.epam.myCollections; import static org.junit.Assert.assertTrue; import org.junit.Test; /** * Unit test for simple App. */ public class AppTest { /** * Rigorous Test :-) */ @Test public void shouldAnswerWithTrue() { assertTrue( true ); } }
8e703ad63b3b5a370ed9b76c6f7f83f6d52e44e9
5b08ffce417ba04e027b01dcd4ee27f9682d9cea
/Printing numbers in inverse right angle triangle/Main.java
ceb230cac11c9e6590d818182ec9cf244cf3a1b9
[]
no_license
sweety1115/Playground
249d6187c8cfd21b4ae157aaf0c252e0ef133042
dc4d78ece82d0c2ecbdf05afd558473bc9b26aea
refs/heads/master
2020-04-23T21:25:45.571556
2019-03-23T06:26:36
2019-03-23T06:26:36
171,470,362
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
#include <stdio.h> int main() { // Type your code here int n; scanf("%d",&n); int val=n; for(int row=1;row<=n;row++) { for(int col=val;col>=1;col--) { printf("%d",col); } val--; printf("\n"); } return 0; }
73339f8a6d2500778a49937ff4505b41f0513042
9d73929e6536a2dc1d32f513feef127c4af6b627
/Interpreter.java
63c653ecc1a56ca17cba64affaf2c402db1b80e5
[]
no_license
XuanLiNYC/Leetcode
3511fec74cbee4ce5056c25e3565420117af67c1
a2ab7b34a3a3a9f350a0c0c0c2dfe6a9d8cfb256
refs/heads/master
2021-01-23T07:03:16.651911
2013-08-19T22:51:50
2013-08-19T22:51:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,327
java
// Type your Java code and click the "Run Code" button! // Your code output will be shown on the left. // Click on the "Show input" button to enter input data to be read (from stdin). import java.util.Hashtable; import java.util.ArrayList; public class Interpreter { public static void main(String[] args) { // Start typing your code here... System.out.println("Hello world!"); String S="aa"; String T="aa"; System.out.println(minWindow(S,T)); } public static String minWindow(String S, String T) { // Start typing your Java solution below // DO NOT write main() function if ((T.length() == 0) || (T.length()> S.length ())) { return (new String()); } int min = -1; int start = -1; int end = -1; Hashtable<Character, Integer> table = new Hashtable<Character, Integer>() ; ArrayList<Character> list = new ArrayList<Character>(); for(int i = 0 ; i < T.length(); i ++){ table.put(T.charAt(i), -1); } for(int i = 0 ; i < S.length(); i ++) { if(table.containsKey(S.charAt(i))){ table.put(S.charAt(i), i); if(start == -1) { start = i; } if (list.size() == table.size()) { list.remove(S.charAt(i)); list.add(S.charAt(i)); int temp = i-table.get(list.get(0)); if(min == -1) { min = temp; end = i; } else if(min > temp ){ min = temp; start = table.get(list.get(0)); end = i; } } else { if(list.contains(S.charAt(i))){ list.remove(S.charAt(i)); list.add(S.charAt(i)); } else { list.add(S.charAt(i)); } } } } if((start == -1) || (end == -1) ) { return(new String()); } return(S.substring(start, end+1)); } }
1f2f770bccaa7573417cc142c54c3dd04e16762e
93b603bb492606a29f8791834e670fb5bddffd9e
/General-Insurance/src/main/java/com/lti/entity1/Customer.java
789d23e807e31a95aef4d179202de2bdf1bd4e50
[]
no_license
RiturajG08/general-ins-spring
755ddbddc23c5deae15d56e3b2a62b795f259302
0fe1a5ccd475c335ad4abb1a5c94d75772c801fa
refs/heads/master
2023-04-10T19:28:19.938334
2021-04-26T13:27:07
2021-04-26T13:27:07
358,795,281
1
0
null
null
null
null
UTF-8
Java
false
false
2,636
java
package com.lti.entity1; import java.time.LocalDate; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; @Entity @Table(name="customer_tbl") public class Customer { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="my_sequence") @SequenceGenerator(sequenceName="customer_seq", allocationSize=1, name="my_sequence") private int id; private String name; private String email; private String password; @Column(name="date_of_birth") private LocalDate dateOfBirth; private String address; private String city; private String state; private int pincode; @Column(name="mobile_number") private double mobileNumber; @OneToMany(cascade= CascadeType.ALL , mappedBy= "customer") private List<Vehicle> vehicles; @OneToMany(cascade= CascadeType.ALL , mappedBy= "customer") private List<Policy> policies; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public LocalDate getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(LocalDate dateOfBirth) { this.dateOfBirth = dateOfBirth; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public int getPincode() { return pincode; } public void setPincode(int pincode) { this.pincode = pincode; } public double getMobileNumber() { return mobileNumber; } public void setMobileNumber(double mobileNumber) { this.mobileNumber = mobileNumber; } public List<Vehicle> getVehicles() { return vehicles; } public void setVehicles(List<Vehicle> vehicles) { this.vehicles = vehicles; } public List<Policy> getPolicies() { return policies; } public void setPolicies(List<Policy> policies) { this.policies = policies; } }
4565b04bddceb83aa2a424400070d438c4ab0c7d
d11e6542a76b042e3bfe883d2762f73f1d630fe5
/app/src/androidTest/java/com/example/cyberbear/ejemplo_constraint/ExampleInstrumentedTest.java
d54dff9e808a2829be85c34ae9d0ce910edcf1a1
[]
no_license
EduardoAntunez/Ejemplo_Constraint
f159d370c36522966a096177049644a4ac95ad20
a66acb563ad4272d9a87724f2a948230419e984b
refs/heads/master
2020-03-11T18:49:54.799494
2018-04-19T09:10:19
2018-04-19T09:10:19
130,189,372
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.example.cyberbear.ejemplo_constraint; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.cyberbear.ejemplo_constraint", appContext.getPackageName()); } }
2f0bdd68469fb732514854eece69249d34086ba8
06ef12912a506d23854988904eb6f686abd98dd0
/benchmarks/src/Plural/src/edu/cmu/cs/crystal/tac/DotClassInstruction.java
4db0011c487a493a8f0a587210df9fdb171007ef
[]
no_license
autolock-anonymous/autolock-benchmark
bac4fd2981e42a334fd0b102e91390be2f449c7a
b3ecb1c7f0cf9eb87eed977617fb4e83cd0a9a69
refs/heads/master
2022-12-21T03:17:30.380261
2020-06-08T12:28:06
2020-06-08T12:28:06
297,629,037
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package edu.cmu.cs.crystal.tac; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.Type; /** * x = T.class. * @author Kevin Bierhoff * @see org.eclipse.jdt.core.dom.TypeLiteral */ public interface DotClassInstruction extends LoadInstruction { /** * Returns the node this instruction is for. Should be of type {@link org.eclipse.jdt.core.dom.TypeLiteral}. Usually, one instruction exists per AST node, but can be more when AST nodes are desugared, such as for post-increment. * @return the node this instruction is for. * @see TACInstruction#getNode() */ public ASTNode getNode(); /** * Returns the type of the class object being loaded. * @return the type of the class object being loaded. */ public Type getTypeNode(); }
37925b055b22c72edd2198cfc3e4b452bf6cbc86
1409f7fbb822754a339579afd987b5843e9177b0
/app/src/main/java/com/example/peacock/imagestoreapplication/SaveImageSDActivity.java
4c3353af99c3e473a88e83340599a2bf07d2cd78
[]
no_license
Mayur-vaghasiya/ImageStoreApplication
550e8ec0d98913ab1e158c685c33c3286d9134f5
6a1bda5ea30d4e58bda63d15d6d642b75af9f849
refs/heads/master
2021-01-21T20:59:37.340834
2017-06-19T10:47:31
2017-06-19T10:47:31
94,766,610
1
0
null
null
null
null
UTF-8
Java
false
false
8,954
java
package com.example.peacock.imagestoreapplication; import android.Manifest; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Camera; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.MediaStore; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.example.peacock.imagestoreapplication.DataBaseHelper.MyHelper; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.Date; public class SaveImageSDActivity extends AppCompatActivity { byte img[]; EditText ed1, ed2; ImageView imageView; String str1, str2, str3 = null; Bitmap bitmap = null; int REQUEST_CAMERA = 0, SELECT_FILE = 1; String fileManagerString, imagePath; private String selectedImagePath = ""; public static int count = 0; private String file; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_save_image_sd); ed1 = (EditText) findViewById(R.id.et1); ed2 = (EditText) findViewById(R.id.et2); imageView = (ImageView) findViewById(R.id.iv1); // for cemara permission if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1); } } } public void selectimg(View v) { final CharSequence[] items = {"Take from Camera", "Select from Gallery", "Cancel"}; //final CharSequence[] items = {getResources().getResourceName(R.string.Takephoto),getResources().getResourceName(R.string.TakefromGalllery) , getResources().getResourceName(R.string.Cancel)}; final AlertDialog.Builder builder = new AlertDialog.Builder(SaveImageSDActivity.this); builder.setTitle("Add Photo!"); builder.setIcon(R.drawable.pk); builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (items[item].equals("Take from Camera")) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, REQUEST_CAMERA); } else if (items[item].equals("Select from Gallery")) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE); } else if (items[item].equals("Cancel")) { dialog.dismiss(); } } }); builder.show(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { { if (resultCode == Activity.RESULT_OK) { if (requestCode == SELECT_FILE) onSelectFromGalleryResult(data); else if (requestCode == REQUEST_CAMERA) onCaptureImageResult(data); } } } private void onSelectFromGalleryResult(Intent data) { Uri selectedImage = data.getData(); try { bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), selectedImage); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 80, bos); img = bos.toByteArray(); imageView.setImageBitmap(bitmap); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } private void onCaptureImageResult(Intent data) { bitmap = (Bitmap) data.getExtras().get("data"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 80, bos); File file = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpeg"); FileOutputStream fo; try { file.createNewFile(); fo = new FileOutputStream(file); img = bos.toByteArray(); fo.write(bos.toByteArray()); fo.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } imageView.setImageBitmap(bitmap); } public void save(View v) { /*OutputStream fOut = null; String strDirectory = Environment.getExternalStorageDirectory().toString(); File f = new File(strDirectory, "myimg.JPEG"); try { fOut = new FileOutputStream(f); *//**Compress image**//* bitmap.compress(Bitmap.CompressFormat.JPEG, 85, fOut); fOut.flush(); fOut.close(); *//*Update image to gallery*//* MediaStore.Images.Media.insertImage(getContentResolver(), f.getAbsolutePath(), f.getName(), f.getName()); Toast.makeText(this, "Record Saved", Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); }*/ //Chech sdcard is plugin or not /* Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); if (isSDPresent) { // yes SD-card is present } else { // Sorry }*/ OutputStream fOut = null; final String dir = Environment.getExternalStorageDirectory().toString() + "/pic1Folder/"; File newdir = new File(dir); newdir.mkdirs(); // count++; //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HH_mm_ss"); //String currentTimeStamp = dateFormat.format(new Date()); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); //String file = "Myimage" + count + ".jpg"; file = dir + "IMG" + timeStamp + ".jpg"; Log.e("Imagepath", file); File newfile = new File(file); try { newfile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { fOut = new FileOutputStream(newfile); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, fOut); fOut.flush(); fOut.close(); MediaStore.Images.Media.insertImage(getContentResolver(), newfile.getAbsolutePath(), newfile.getName(), newfile.getName()); Toast.makeText(this, "Record Saved", Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } /* File filepath = Environment.getExternalStorageDirectory(); // Create a new folder in SD Card File dir = new File(filepath.getAbsolutePath() + "/SaveImage/"); dir.mkdirs(); count++; // Create a name for the saved image File file = new File(dir, "Myimage" + count + ".jpg"); // Show a toast message on successful save Toast.makeText(SaveImageSDActivity.this, "Image Saved to SD Card", Toast.LENGTH_SHORT).show(); try { OutputStream output = new FileOutputStream(file); // Compress into png format image from 0% - 100% bitmap.compress(Bitmap.CompressFormat.JPEG, 80, output); output.flush(); output.close(); MediaStore.Images.Media.insertImage(getContentResolver(), file.getAbsolutePath(), file.getName(), file.getName()); Toast.makeText(this, "Record Saved", Toast.LENGTH_SHORT).show(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ str1 = ed1.getText().toString(); str2 = ed2.getText().toString(); MyHelper myhlp = new MyHelper(this); myhlp.addInf(str1, str2, file); Toast.makeText(this, "Record Saved", Toast.LENGTH_SHORT).show(); } }
e8048aa14e59b46b7432e9eb31fd3dd9b7b53532
69b73dba0a4e95e05731e652a20ddf7a7d8d96e0
/src/main/java/com/abc/shop/controller/OrdersController.java
b934551184d36e7559be95fea0f36e9dda74238c
[]
no_license
amnesiacDog/shop
69530355b791111968e58850add16d30bb98eb95
21cba219d369064d26c360727475458f5512bd36
refs/heads/master
2020-07-06T09:33:30.685756
2019-08-20T00:02:30
2019-08-20T00:02:30
202,972,893
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.abc.shop.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p> * 前端控制器 * </p> * * @author mjk * @since 2019-08-19 */ @RestController @RequestMapping("/orders") public class OrdersController { }
caa7759b435aa0b4a62ea439e3bb7c4b22549822
027bdc161f37360306b21246d8354a9e0c834637
/SumsAndProducts.java
93272f977effbeebecc9c26a1e67fcef12e4d162
[]
no_license
jaymzee/category-theory
cc14c020aafd962c467636edd5fee985586167cd
74f57845c9c85c7730706a049d2d139536278997
refs/heads/master
2023-01-24T15:27:00.111811
2020-12-03T07:14:43
2020-12-03T07:14:43
159,524,411
0
0
null
null
null
null
UTF-8
Java
false
false
861
java
import java.util.List; import java.util.ArrayList; import io.github.jaymzee.categorytheory.*; public class SumsAndProducts { public static void main(String[] args) { Product<Double, String> prod = new Product<>(5.0, "hello"); System.out.printf("Product:\n"); System.out.printf(" fst: %s\n", prod.getFst()); System.out.printf(" snd: %s\n", prod.getSnd()); List<Sum<Double,Boolean>> sums = new ArrayList<Sum<Double,Boolean>>(); sums.add(new Inl<>(3.14)); sums.add(new Inr<>(false)); System.out.printf("\nSum:\n"); sums.forEach(v -> { System.out.printf(" caseExpr: %s\n", v.caseExpr( (Double y) -> "inl: " + y.toString(), (Boolean b) -> "inr: " + b.toString() )); }); System.out.printf("new version!!\n"); } }
99a1fc7ad8985a53457d552574492aca6174bf18
ee47a06e353878750659a13f7319205e9e992e5d
/src/main/java/com/viching/generate/source/GeneratedKey.java
aec4f0f60cd089076756e94bfb2e8c5baced127d
[]
no_license
viching/viching-generate
7ca891ec69c058bc218c2d0533a86abdffe3f5ad
d6135bb0d5b5bfc6d210b20823b958f1a155ada7
refs/heads/master
2020-04-01T04:23:57.570971
2018-10-13T23:07:59
2018-10-13T23:07:59
152,861,833
0
0
null
null
null
null
UTF-8
Java
false
false
1,029
java
package com.viching.generate.source; public class GeneratedKey { private String column; private String runtimeSqlStatement; private boolean isIdentity; private DBColumnJavaBean dbColumn; private String type; public GeneratedKey(DBColumnJavaBean dbColumn, String column, boolean isIdentity, String type) { super(); this.dbColumn = dbColumn; this.column = column; this.type = type; this.isIdentity = isIdentity; this.runtimeSqlStatement = "JDBC"; } public String getColumn() { return column; } public boolean isIdentity() { return isIdentity; } public String getRuntimeSqlStatement() { return runtimeSqlStatement; } public String getType() { return type; } public String getOrder() { return isIdentity ? "AFTER" : "BEFORE"; //$NON-NLS-1$ //$NON-NLS-2$ } public boolean isJdbcStandard() { return "JDBC".equals(runtimeSqlStatement); //$NON-NLS-1$ } public DBColumnJavaBean getDbColumn() { return dbColumn; } }
31ab5e6b906215ddd17d5d4dc401f5717ef27630
831b6e0531a76474b66cdf1b3e1842062c64af27
/mybatis03/src/main/java/org/javaboy/mybatis03/plugin/PageInterceptor.java
aa1b26c43fd3e047141b4bcb1970d97c32c384f4
[]
no_license
wushangshikongyonghengdazizai/mybatis-samples-3.5.6
476d821b43a8254ea357c1f17bcfb3a44a86fe37
275c664d466640bebc45a08eaaf295d6b73203a8
refs/heads/main
2023-03-08T09:25:12.982797
2021-02-24T13:31:05
2021-02-24T13:31:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,519
java
package org.javaboy.mybatis03.plugin; import org.apache.ibatis.cache.CacheKey; import org.apache.ibatis.executor.Executor; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.ResultMap; import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.plugin.Intercepts; import org.apache.ibatis.plugin.Invocation; import org.apache.ibatis.plugin.Signature; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; import java.lang.reflect.Field; import java.util.*; /** * @author 江南一点雨 * @微信公众号 江南一点雨 mybatis-gen * @网站 http://www.itboyhub.com * @国际站 http://www.javaboy.org * @微信 a_java_boy * @GitHub https://github.com/lenve * @Gitee https://gitee.com/lenve */ @Intercepts(@Signature( type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class} )) public class PageInterceptor implements Interceptor { @Override public Object intercept(Invocation invocation) throws Throwable { Object[] args = invocation.getArgs(); MappedStatement ms = (MappedStatement) args[0]; Object parameterObject = args[1]; RowBounds rowBounds = (RowBounds) args[2]; //需要分页 if (rowBounds != RowBounds.DEFAULT) { Executor executor = (Executor) invocation.getTarget(); BoundSql boundSql = ms.getBoundSql(parameterObject); Field additionalParametersField = BoundSql.class.getDeclaredField("additionalParameters"); additionalParametersField.setAccessible(true); Map<String, Object> additionalParameters = (Map<String, Object>) additionalParametersField.get(boundSql); if (rowBounds instanceof PageRowBounds) { MappedStatement countMs = newMappedStatement(ms, Long.class); CacheKey countKey = executor.createCacheKey(countMs, parameterObject, RowBounds.DEFAULT, boundSql); String countSql = "select count(*) from ("+boundSql.getSql()+") temp"; BoundSql countBoundSql = new BoundSql(ms.getConfiguration(), countSql, boundSql.getParameterMappings(), parameterObject); Set<String> keySet = additionalParameters.keySet(); for (String key : keySet) { countBoundSql.setAdditionalParameter(key, additionalParameters.get(key)); } List<Object> countQueryResult = executor.query(countMs, parameterObject, RowBounds.DEFAULT, ((ResultHandler) args[3]), countKey, countBoundSql); Long total = (Long) countQueryResult.get(0); ((PageRowBounds) rowBounds).setTotal(total); } CacheKey pageKey = executor.createCacheKey(ms, parameterObject, rowBounds, boundSql); pageKey.update("RowBounds"); String pageSql = boundSql.getSql() + " limit " + rowBounds.getOffset() + "," + rowBounds.getLimit(); BoundSql pageBoundSql = new BoundSql(ms.getConfiguration(), pageSql, boundSql.getParameterMappings(), parameterObject); Set<String> keySet = additionalParameters.keySet(); for (String key : keySet) { pageBoundSql.setAdditionalParameter(key, additionalParameters.get(key)); } List list = executor.query(ms, parameterObject, RowBounds.DEFAULT, (ResultHandler) args[3], pageKey, pageBoundSql); return list; } return invocation.proceed(); } private MappedStatement newMappedStatement(MappedStatement ms, Class<Long> typeClazz) { MappedStatement.Builder builder = new MappedStatement.Builder(ms.getConfiguration(), ms.getId() + "_count", ms.getSqlSource(), ms.getSqlCommandType()); ResultMap resultMap = new ResultMap.Builder(ms.getConfiguration(),ms.getId(),typeClazz,new ArrayList<>(0)).build(); builder.resource(ms.getResource()) .fetchSize(ms.getFetchSize()) .statementType(ms.getStatementType()) .timeout(ms.getTimeout()) .parameterMap(ms.getParameterMap()) .resultSetType(ms.getResultSetType()) .cache(ms.getCache()) .flushCacheRequired(ms.isFlushCacheRequired()) .useCache(ms.isUseCache()) .resultMaps(Arrays.asList(resultMap)); return builder.build(); } }
d5e02c4a8f500541188e7fb37f8408acfebc574a
4892393e28b0280adfc0b0353ef8774e6d77897c
/coupon-gateway/src/main/java/com/imooc/coupon/filter/AbsSecurityFilter.java
dfb761e1087dbd6365ca52c929d85091db921bda
[]
no_license
Boneshade/imooc-coupon
eeae5b8d26e2125bb1958493bd4640fdf93bc7d7
c3d20e8f2ad18bf3bca95035423512fff64bc76e
refs/heads/master
2023-03-18T00:47:58.820003
2021-03-12T05:47:04
2021-03-12T05:47:04
321,247,967
0
0
null
null
null
null
UTF-8
Java
false
false
4,229
java
package com.imooc.coupon.filter; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpStatus; import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * @author xubr * @title: AbsSecurityFilter * @projectName imooc-coupon * @description: <h1>抽象权限过滤器,可以有多种实现</h1> * @date 2021/3/1210:18 */ @Slf4j public abstract class AbsSecurityFilter extends ZuulFilter { /** * 在Zuul按照规则路由到下级服务之前执行。如果需要对请求进行预处理,比如鉴权,限流等,都应该考虑在此类Filter实现 * 也就是前置过滤器 * @return */ @Override public String filterType() { return FilterConstants.PRE_TYPE; } @Override public int filterOrder() { //优先级,数字越大,优先级越低 return 1; } @Override public boolean shouldFilter() { //是否执行该过滤器,true代表需要过滤 //获取当前的上下文 RequestContext context = RequestContext.getCurrentContext(); //获取上下文中的响应 HttpServletResponse response = context.getResponse(); //如果前一个filter 执行失败,不会调用后面的filter return response.getStatus() == 0 || response.getStatus() == HttpStatus.SC_OK; } @Override public Object run() throws ZuulException { RequestContext context = RequestContext.getCurrentContext(); HttpServletRequest request = context.getRequest(); HttpServletResponse response = context.getResponse(); log.info("filter {} begin check request {}.", this.getClass().getSimpleName(), request.getRequestURI()); Boolean result = null; try { result = interceptCheck(request, response); } catch (Exception ex) { log.error("filter {} check request {}, throws exception {}.", this.getClass().getSimpleName(), request.getRequestURI(), ex.getMessage()); } log.debug("filter {} finish check,result is null.", this.getClass().getSimpleName()); if (result == null) { log.debug("filter {} finish check,result is null.", this.getClass().getSimpleName()); //对当前的请求不进行路由 context.setSendZuulResponse(false); context.setResponseStatusCode(getHttpStatus()); return null; } if (!result) { try { //对当前的请求不进行路由 context.setSendZuulResponse(false); context.setResponseStatusCode(getHttpStatus()); response.setHeader("Content-type", "application/json;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(getErrorMsg()); context.setResponse(response); } catch (IOException e) { log.error("filter {} check request {}, result is false," + "setResponse throws Exception {}", this.getClass().getSimpleName(), request.getRequestURI(), e.getMessage()); } } return null; } /** * <h2>子Filter 实现该方法,填充校验逻辑<h2/> * @param request * @param response * @return true:通过校验;false:校验未通过 * @throws Exception */ protected abstract Boolean interceptCheck(HttpServletRequest request, HttpServletResponse response) throws Exception; /** * <h2>获得http响应状态<h2/> * @return */ protected abstract int getHttpStatus(); /** * <h2>获得错误消息<h2/> * @return */ protected abstract String getErrorMsg(); }
818cef239fa7362ce8dd0a241a0eaf231e081647
23033344f9aa7b8b28ad37c3dcdaab5c56ed4f5b
/CSE 337/hangman/src/gui/GUIMain.java
7966c963ce0c0e9184ba1bb8914094150a119866
[ "MIT" ]
permissive
Gocnak/ou-schoolwork
ff05a43f4dd0837f259f91888cbd329333c3fe7b
0fe3441b664d304d2de7d2fd8e9e5ff9758da13a
refs/heads/master
2021-03-27T16:25:21.399695
2018-04-04T19:52:13
2018-04-04T19:52:13
78,162,696
0
0
null
null
null
null
UTF-8
Java
false
false
32,933
java
package gui; import sound.Sound; import sound.SoundEngine; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.Collections; import java.util.Deque; import java.util.stream.Collectors; /* * Created by JFormDesigner on Thu Jan 05 20:38:14 EST 2017 */ /** * @author Nick K */ public class GUIMain extends JFrame { public static void log(Object mess){System.out.println(mess.toString());} public static GUIMain instance; public static boolean isPulsing, shutDown, bPlaying; private static int iTries; private String currentWord; private Deque<String> wordPool; private Sound trySuccess, tryFail, tryInvalid, gameWin; public GUIMain() { initComponents(); setVisible(true); bPlaying = isPulsing = shutDown = false; iTries = 0; // Load words currentWord = ""; wordPool = new ArrayDeque<>(1000); loadWords(); // Load sounds SoundEngine.init(); trySuccess = new Sound("/resource/success.wav"); tryFail = new Sound("/resource/error.wav"); tryInvalid = new Sound("/resource/pluck.wav"); gameWin = new Sound("/resource/win.wav"); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { SoundEngine.getEngine().close(); } }); instance = this; } private void loadWords() { try (InputStreamReader ir = new InputStreamReader(getClass().getResourceAsStream("/resource/words.txt")); BufferedReader br = new BufferedReader(ir)) { java.util.List<String> words = br.lines().collect(Collectors.toList()); Collections.shuffle(words); // Randomize the order for some more fun wordPool.addAll(words); } catch (Exception e) { e.printStackTrace(); } } private boolean checkDone() { return !bPlaying || wordLabel.getText().equalsIgnoreCase(currentWord); } public boolean shouldPulse() { return !shutDown && bPlaying && checkDone(); } private void guess(char guessChar) { if (checkDone()) return; String currentDisplay = wordLabel.getText().toLowerCase(); GameButton.BUTTON_STATE guessState = getButtonState(guessChar); if (currentDisplay.contains("" + guessChar) || guessState == GameButton.BUTTON_STATE.TRIED_FAIL || guessState == GameButton.BUTTON_STATE.TRIED_SUCCESS) { SoundEngine.getEngine().playSound(tryInvalid); return; } boolean successfulGuess = false; // Look at the string char[] beforeGuess = currentDisplay.toCharArray(); for (int i = 0; i < currentWord.length(); i++) { if (currentWord.charAt(i) == guessChar && beforeGuess[i] == '-') { // Success! They hit a character in the word beforeGuess[i] = guessChar; successfulGuess = true; } } iTries++; setTries(); setGameButtonState(guessChar, successfulGuess ? GameButton.BUTTON_STATE.TRIED_SUCCESS : GameButton.BUTTON_STATE.TRIED_FAIL); // Show the updated guess wordLabel.setText(new String(beforeGuess).toUpperCase()); if (checkDone()) { // Congrats! You won! SoundEngine.getEngine().playSound(gameWin); // Update the text gameStateToggle.setText("End Game"); // Start the button pulse TabPulse buttonPulse = new TabPulse(gameStateToggle); buttonPulse.start(); } else { SoundEngine.getEngine().playSound(successfulGuess ? trySuccess : tryFail); } } private void guess(JButton guess) { if (checkDone()) return; guess(guess.getText().toLowerCase().charAt(0)); // Guess this button's text } // Loads a random word into the current word, and generates the label string private void loadNewGame() { // Get our word from our word pool currentWord = wordPool.pop(); // Set our label wordLabel.setText("----------------".substring(0, currentWord.length())); } private void setTries() { triesLabel.setText(String.format("%d tries", iTries)); } private void gameStateToggle() { // Toggle text, determined before playing bool toggle gameStateToggle.setText(bPlaying ? "Start Game" : "Stop Game"); // Toggle game state bPlaying = !bPlaying; triesLabel.setVisible(bPlaying); // Toggle tries label visibility iTries = 0; // Reset our tries counter setTries(); // Reset the tries label setGameButtonState(bPlaying ? GameButton.BUTTON_STATE.ENABLED : GameButton.BUTTON_STATE.DISABLED); // Toggle game buttons wordLabel.setText("XXXXXXXXXXXXXXXX"); // Back to default, gets overridden if a new game // Load a new game if we went from not playing to playing if (bPlaying) loadNewGame(); } private void setGameButtonState(GameButton.BUTTON_STATE state) { setGameButtonState('\0', state); } private void setGameButtonState(char buttonChar, GameButton.BUTTON_STATE state) { boolean hasLimiter = Character.isAlphabetic(buttonChar); for (Component c : getContentPane().getComponents()) { if (c instanceof GameButton && !((GameButton) c).getText().contains("Game")) { boolean isTheButton = ((GameButton) c).getText().equalsIgnoreCase("" + buttonChar); if (hasLimiter && !isTheButton) continue; ((GameButton)c).setButtonState(state); if (hasLimiter) return; } } } private GameButton.BUTTON_STATE getButtonState(char toCheck) { for (Component comp : getContentPane().getComponents()) { if (comp instanceof GameButton) { GameButton c = (GameButton)comp; if (!c.getText().contains("Game") && c.getText().equalsIgnoreCase("" + toCheck)) { return c.getButtonState(); } } } return GameButton.BUTTON_STATE.DISABLED; } private void thisKeyReleased(KeyEvent e) { if (bPlaying) { if (e.getKeyCode() >= KeyEvent.VK_A && e.getKeyCode() <= KeyEvent.VK_Z) { // Get the typed key char guess = e.getKeyChar(); // Guess that key guess(guess); } } // Space toggles game state if (e.getKeyCode() == KeyEvent.VK_SPACE) gameStateToggle(); } private void gameButtonClicked(MouseEvent e) { guess((JButton)e.getSource()); } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Nick K. button1 = new GameButton(); button2 = new GameButton(); button3 = new GameButton(); button4 = new GameButton(); button5 = new GameButton(); button6 = new GameButton(); button7 = new GameButton(); button8 = new GameButton(); button9 = new GameButton(); button10 = new GameButton(); button11 = new GameButton(); button12 = new GameButton(); button13 = new GameButton(); button14 = new GameButton(); button15 = new GameButton(); button16 = new GameButton(); button17 = new GameButton(); button18 = new GameButton(); button19 = new GameButton(); button20 = new GameButton(); button21 = new GameButton(); button22 = new GameButton(); button23 = new GameButton(); button24 = new GameButton(); button25 = new GameButton(); button26 = new GameButton(); gameStateToggle = new JButton(); label3 = new JLabel(); wordLabel = new JLabel(); triesLabel = new JLabel(); //======== this ======== setTitle("Hangman"); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setResizable(false); setIconImage(new ImageIcon(getClass().getResource("/resource/icon.png")).getImage()); addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { thisKeyReleased(e); } }); Container contentPane = getContentPane(); //---- button1 ---- button1.setText("A"); button1.setFont(new Font("Arial", Font.BOLD, 20)); button1.setHorizontalTextPosition(SwingConstants.CENTER); button1.setEnabled(false); button1.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button2 ---- button2.setText("B"); button2.setFont(new Font("Arial", Font.BOLD, 20)); button2.setHorizontalTextPosition(SwingConstants.CENTER); button2.setEnabled(false); button2.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button3 ---- button3.setText("C"); button3.setFont(new Font("Arial", Font.BOLD, 20)); button3.setHorizontalTextPosition(SwingConstants.CENTER); button3.setEnabled(false); button3.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button4 ---- button4.setText("D"); button4.setFont(new Font("Arial", Font.BOLD, 20)); button4.setHorizontalTextPosition(SwingConstants.CENTER); button4.setEnabled(false); button4.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button5 ---- button5.setText("E"); button5.setFont(new Font("Arial", Font.BOLD, 20)); button5.setHorizontalTextPosition(SwingConstants.CENTER); button5.setEnabled(false); button5.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button6 ---- button6.setText("F"); button6.setFont(new Font("Arial", Font.BOLD, 20)); button6.setHorizontalTextPosition(SwingConstants.CENTER); button6.setEnabled(false); button6.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button7 ---- button7.setText("G"); button7.setFont(new Font("Arial", Font.BOLD, 20)); button7.setHorizontalTextPosition(SwingConstants.CENTER); button7.setEnabled(false); button7.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button8 ---- button8.setText("H"); button8.setFont(new Font("Arial", Font.BOLD, 20)); button8.setHorizontalTextPosition(SwingConstants.CENTER); button8.setEnabled(false); button8.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button9 ---- button9.setText("I"); button9.setFont(new Font("Arial", Font.BOLD, 20)); button9.setHorizontalTextPosition(SwingConstants.CENTER); button9.setEnabled(false); button9.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button10 ---- button10.setText("J"); button10.setFont(new Font("Arial", Font.BOLD, 20)); button10.setHorizontalTextPosition(SwingConstants.CENTER); button10.setEnabled(false); button10.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button11 ---- button11.setText("K"); button11.setFont(new Font("Arial", Font.BOLD, 20)); button11.setHorizontalTextPosition(SwingConstants.CENTER); button11.setEnabled(false); button11.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button12 ---- button12.setText("L"); button12.setFont(new Font("Arial", Font.BOLD, 20)); button12.setHorizontalTextPosition(SwingConstants.CENTER); button12.setEnabled(false); button12.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button13 ---- button13.setText("M"); button13.setFont(new Font("Arial", Font.BOLD, 20)); button13.setHorizontalTextPosition(SwingConstants.CENTER); button13.setEnabled(false); button13.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button14 ---- button14.setText("N"); button14.setFont(new Font("Arial", Font.BOLD, 20)); button14.setHorizontalTextPosition(SwingConstants.CENTER); button14.setEnabled(false); button14.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button15 ---- button15.setText("O"); button15.setFont(new Font("Arial", Font.BOLD, 20)); button15.setHorizontalTextPosition(SwingConstants.CENTER); button15.setEnabled(false); button15.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button16 ---- button16.setText("P"); button16.setFont(new Font("Arial", Font.BOLD, 20)); button16.setHorizontalTextPosition(SwingConstants.CENTER); button16.setEnabled(false); button16.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button17 ---- button17.setText("Q"); button17.setFont(new Font("Arial", Font.BOLD, 20)); button17.setHorizontalTextPosition(SwingConstants.CENTER); button17.setEnabled(false); button17.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button18 ---- button18.setText("R"); button18.setFont(new Font("Arial", Font.BOLD, 20)); button18.setHorizontalTextPosition(SwingConstants.CENTER); button18.setEnabled(false); button18.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button19 ---- button19.setText("S"); button19.setFont(new Font("Arial", Font.BOLD, 20)); button19.setHorizontalTextPosition(SwingConstants.CENTER); button19.setEnabled(false); button19.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button20 ---- button20.setText("T"); button20.setFont(new Font("Arial", Font.BOLD, 20)); button20.setHorizontalTextPosition(SwingConstants.CENTER); button20.setEnabled(false); button20.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button21 ---- button21.setText("U"); button21.setFont(new Font("Arial", Font.BOLD, 20)); button21.setHorizontalTextPosition(SwingConstants.CENTER); button21.setEnabled(false); button21.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button22 ---- button22.setText("V"); button22.setFont(new Font("Arial", Font.BOLD, 20)); button22.setHorizontalTextPosition(SwingConstants.CENTER); button22.setEnabled(false); button22.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button23 ---- button23.setText("W"); button23.setFont(new Font("Arial", Font.BOLD, 20)); button23.setHorizontalTextPosition(SwingConstants.CENTER); button23.setEnabled(false); button23.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button24 ---- button24.setText("X"); button24.setFont(new Font("Arial", Font.BOLD, 20)); button24.setHorizontalTextPosition(SwingConstants.CENTER); button24.setEnabled(false); button24.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button25 ---- button25.setText("Y"); button25.setFont(new Font("Arial", Font.BOLD, 20)); button25.setHorizontalTextPosition(SwingConstants.CENTER); button25.setEnabled(false); button25.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- button26 ---- button26.setText("Z"); button26.setFont(new Font("Arial", Font.BOLD, 20)); button26.setHorizontalTextPosition(SwingConstants.CENTER); button26.setEnabled(false); button26.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameButtonClicked(e); } }); //---- gameStateToggle ---- gameStateToggle.setText("Start Game"); gameStateToggle.setFont(new Font("Arial", Font.BOLD, 18)); gameStateToggle.setFocusPainted(false); gameStateToggle.setFocusable(false); gameStateToggle.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { gameStateToggle(); } }); //---- label3 ---- label3.setText("Welcome to Hangman"); label3.setHorizontalAlignment(SwingConstants.CENTER); label3.setFont(new Font("Arial", Font.BOLD, 26)); //---- wordLabel ---- wordLabel.setText("XXXXXXXXXXXXXXXX"); wordLabel.setFont(new Font("Arial", Font.BOLD, 36)); wordLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- triesLabel ---- triesLabel.setText("X tries"); triesLabel.setFont(new Font("Arial", Font.BOLD, 30)); triesLabel.setHorizontalAlignment(SwingConstants.RIGHT); triesLabel.setVisible(false); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup( contentPaneLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup() .addGap(0, 30, Short.MAX_VALUE) .addGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup() .addComponent(button10, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button11, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button12, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button13, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button14, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button15, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button16, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button17, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button18, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)) .addGroup(contentPaneLayout.createSequentialGroup() .addComponent(button1, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button2, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button3, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button4, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button5, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button6, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button7, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button8, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button9, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)) .addGroup(contentPaneLayout.createSequentialGroup() .addGap(30, 30, 30) .addComponent(button19, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button20, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button21, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button22, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button23, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button24, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button25, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(button26, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))) .addGap(26, 26, 26)) .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(wordLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE) .addComponent(label3, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)) .addContainerGap()) .addGroup(contentPaneLayout.createSequentialGroup() .addContainerGap() .addComponent(gameStateToggle) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 364, Short.MAX_VALUE) .addComponent(triesLabel, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); contentPaneLayout.setVerticalGroup( contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup() .addComponent(label3, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(wordLabel) .addGap(24, 24, 24) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(button1, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button2, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button3, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button4, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button5, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button6, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button7, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button8, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button9, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(button10, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button11, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button12, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button13, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button14, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button15, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button16, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button17, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button18, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(button19, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button20, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button21, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button22, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button23, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button24, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button25, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(button26, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(gameStateToggle, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addComponent(triesLabel, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // Generated using JFormDesigner Evaluation license - Nick K. private GameButton button1; private GameButton button2; private GameButton button3; private GameButton button4; private GameButton button5; private GameButton button6; private GameButton button7; private GameButton button8; private GameButton button9; private GameButton button10; private GameButton button11; private GameButton button12; private GameButton button13; private GameButton button14; private GameButton button15; private GameButton button16; private GameButton button17; private GameButton button18; private GameButton button19; private GameButton button20; private GameButton button21; private GameButton button22; private GameButton button23; private GameButton button24; private GameButton button25; private GameButton button26; private JButton gameStateToggle; private JLabel label3; private JLabel wordLabel; private JLabel triesLabel; // JFormDesigner - End of variables declaration //GEN-END:variables }
4740f22c6b5e39989895a31a4c8ab06d76a8abe2
6d0b97c6cd23f99db508c08f99b651d08a3ac7ef
/src/test/java/org/assertj/core/internal/paths/Paths_assertIsRelative_Test.java
02e57cccd36f4cd38d92e86b9fe00d18a844436a
[ "Apache-2.0" ]
permissive
lpandzic/assertj-core
14054dd2e42019fc173168e4e6e494ce3528a8f1
165a4b4f54e2c78cfca652ae6324a49d6d20243b
refs/heads/master
2021-01-21T05:32:10.144265
2016-01-04T07:43:56
2016-01-04T07:43:56
31,382,191
1
0
null
2015-02-26T18:33:50
2015-02-26T18:33:50
null
UTF-8
Java
false
false
1,685
java
/** * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * Copyright 2012-2015 the original author or authors. */ package org.assertj.core.internal.paths; import static org.assertj.core.error.ShouldBeRelativePath.shouldBeRelativePath; import static org.assertj.core.test.TestFailures.wasExpectingAssertionError; import static org.assertj.core.util.FailureMessages.actualIsNull; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.Test; public class Paths_assertIsRelative_Test extends MockPathsBaseTest { @Test public void should_fail_if_actual_is_null() { thrown.expectAssertionError(actualIsNull()); paths.assertIsRelative(info, null); } @Test public void should_fail_if_actual_is_not_relative() { // This is the default, but make it explicit when(actual.isAbsolute()).thenReturn(true); try { paths.assertIsRelative(info, actual); wasExpectingAssertionError(); } catch (AssertionError e) { verify(failures).failure(info, shouldBeRelativePath(actual)); } } @Test public void should_pass_if_actual_is_relative() { when(actual.isAbsolute()).thenReturn(false); paths.assertIsRelative(info, actual); } }
1edb48b3a3f62551b90d240f052f0f029d454451
aa7e7e464a34ca2118c2aa6fbfaf4388a8f34b2d
/src/main/java/com/github/elkurilina/game/player/smartplayer/MoveCost.java
832e69ecb978ae484f17900ca861e30a917c72a2
[]
no_license
ElenaPhilipenko/tic-tac-toe
d464e81df28244e35531dc9d84c252f2baeeae6e
d887a161c1e2f34487908850d61ad41b3f66fe38
refs/heads/master
2020-12-25T17:34:41.522002
2016-08-16T12:09:24
2016-08-16T12:09:24
22,099,642
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
package com.github.elkurilina.game.player.smartplayer; /** * @author Elena Kurilina */ public class MoveCost { private final int cost; private final int steps; public MoveCost(int cost, int steps) { this.cost = cost; this.steps = steps; } public boolean isBetterThan(MoveCost moveCost) { if (cost == moveCost.cost) { return steps < moveCost.steps; } else { return cost > moveCost.cost; } } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MoveCost that = (MoveCost) o; if (cost != that.cost) return false; if (steps != that.steps) return false; return true; } @Override public int hashCode() { int result = cost; result = 31 * result + steps; return result; } }
6f183291982a9759e180530870ec7bc68ebc6059
2d493c523922589b97afc0398d3e454f1dd2f63a
/src/main/java/com/iau/projeto/dto/CategoriaDTO.java
e0c3790abe9342cab2820d3bfff9eb4bdffda902
[]
no_license
AdemirDeSousa/Projeto-Spring-Boot
2dcf0d54f1b8aa8899c0e78958cc5278d5bcc6a8
026720e36adc6eae1db8526a1c4b7609cb06c8db
refs/heads/master
2020-09-21T06:42:17.973060
2019-12-04T14:18:35
2019-12-04T14:18:35
224,713,042
0
0
null
null
null
null
UTF-8
Java
false
false
900
java
package com.iau.projeto.dto; import java.io.Serializable; import javax.validation.constraints.NotEmpty; import org.hibernate.validator.constraints.Length; import com.iau.projeto.domain.Categoria; public class CategoriaDTO implements Serializable{ private static final long serialVersionUID = 1L; //Atributos private Integer id; @NotEmpty(message = "Preenchimento obrigatorio") @Length(min = 5, max = 80, message = "O tamanho deve ser entre 5 e 80 caracteres") private String nome; //Construtor vazio public CategoriaDTO() { } //Construtor recebendo Categoria public CategoriaDTO(Categoria obj) { id = obj.getId(); nome = obj.getNome(); } //Getters e Setters public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
a4e51c3a30d4198beb4d1f4ec6d3925206e89513
3282867ce65b5a24e43af0530ad81cb5cf676ec9
/acme-money/src/main/java/com/github/marschall/acme/money/IsoCurrencyCompressor.java
4d2c9c011ce0d28e80e75cbdcc7bb5cb857cff5b
[]
no_license
marschall/acme-money
31a27f7caa58c5206e1c7b981d34dd9cc83212fc
93c6a4a7ec585e5ca5881ab7e74955cf601c39a5
refs/heads/master
2023-05-01T05:03:51.737740
2023-04-06T14:25:05
2023-04-06T14:25:05
26,048,266
0
0
null
null
null
null
UTF-8
Java
false
false
2,238
java
package com.github.marschall.acme.money; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import javax.money.CurrencyUnit; import javax.xml.stream.XMLStreamException; import com.github.marschall.acme.money.IsoCurrencyParser.ParsedCurrrency; final class IsoCurrencyCompressor { private static final int LETTERS_IN_ALPHABET = 26; private IsoCurrencyCompressor() { throw new AssertionError("not instantiable"); } static Map<Short, CurrencyUnit> parse() { Map<String, ParsedCurrrency> parsedMap; try { parsedMap = IsoCurrencyParser.parseToMap(); } catch (IOException | XMLStreamException e) { throw new RuntimeException("could not load currencies", e); } Map<Short, CurrencyUnit> currencyMap = new HashMap<>(parsedMap.size()); for (Entry<String, ParsedCurrrency> entry : parsedMap.entrySet()) { String currencyCode = entry.getKey(); short key = compressCurrencyCode(currencyCode); IsoCurrencyUnit currency = new IsoCurrencyUnit(currencyCode, key, entry.getValue().currencyNumber, entry.getValue().minorUnits); currencyMap.put(key, currency); } return currencyMap; } static short compressCurrencyCode(String currencyCode) { if (currencyCode.length() != 3) { throw invalidFormat(); } int index = toFactor(currencyCode.charAt(0)) + toFactor(currencyCode.charAt(1)) * LETTERS_IN_ALPHABET + toFactor(currencyCode.charAt(2)) * LETTERS_IN_ALPHABET * LETTERS_IN_ALPHABET; return (short) index; } private static int toFactor(char c) { if (c < 'A' || c > 'Z') { throw invalidFormat(); } return (short) (c - 'A'); } private static IllegalArgumentException invalidFormat() { return new IllegalArgumentException("currency code must be 3 letters A-Z"); } static String decompressCurrencyCode(short compressed) { int char1 = compressed % LETTERS_IN_ALPHABET; int char2 = (compressed / LETTERS_IN_ALPHABET) % LETTERS_IN_ALPHABET; int char3 = (compressed / LETTERS_IN_ALPHABET / LETTERS_IN_ALPHABET); return new String(new char[] {(char) (char1 + 'A'), (char) (char2 + 'A'), (char) (char3 + 'A')}); } }
64075400af9e4311361019092edba4d5664068ef
fd7ee1e7fd53a26b96eef35a94272cd1be8185cf
/src/main/java/app/laboat/repository/TypeRepository.java
1eb0cc6130beb9c71cf08e4d72a5f7f3e3cad9b9
[]
no_license
TiinaSeppala/laBoat
ffa69b51401614ffa952ffae75779d67e66263bc
ff4d916cedb8bf8650e1061336f4a7b28c511d44
refs/heads/master
2020-04-03T23:40:11.333286
2018-11-21T15:39:49
2018-11-21T15:39:49
155,627,887
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package app.laboat.repository; import java.util.List; import org.springframework.data.repository.CrudRepository; import app.laboat.domain.Type; public interface TypeRepository extends CrudRepository<Type, Long>{ List<Type> findByTypeName(String typeName); }
67c8ccd844c390107d4cca07b42f7afcec6d9127
e4c17ca877f744da3938afb4356161493de0af52
/src/module11/webinar/FileReaderJava7Example.java
152e0c803c2794821d19f7ed128efc6fe850712d
[]
no_license
PBaranovskyi/JavaCourse
d03ed16ad998bcbafa4f32cb21b4a78dc53964fe
38c74ea8bffe5e1c8f59d62170cc8fcff27bbc32
refs/heads/master
2020-12-24T12:05:10.625066
2016-11-02T20:54:54
2016-11-02T20:54:54
73,078,217
1
0
null
2016-11-07T12:54:51
2016-11-07T12:54:51
null
UTF-8
Java
false
false
861
java
package module11.webinar; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class FileReaderJava7Example { public static void main(String[] args) { try { //this is try with resourses, and readed will be cloed automatically try (BufferedReader br = new BufferedReader(new FileReader("/Users/Andrey/Desktop/file.txt"))) { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); } String everything = sb.toString(); System.out.println(everything); } } catch (IOException e) { } } }
c38ad5dd5399975a07ddeb66ee4e7ff19974880a
eaa4bd2746bc69619a7d3deabe087d84d6139379
/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java
7a37351c4fc47dc98d1eb0c0f9ad81e06323f72f
[ "Apache-2.0" ]
permissive
jgfoster/sarl
766cc5930ed5bcadf9e485128945e379e0050657
829eb7d6c191881b7af75aaa43de5f7935a4c80c
refs/heads/master
2020-08-01T07:41:45.523134
2017-05-30T10:32:21
2017-05-30T10:34:36
73,583,113
0
0
null
2016-11-12T22:52:44
2016-11-12T22:52:44
null
UTF-8
Java
false
false
3,251
java
/* * $Id$ * * File is automatically generated by the Xtext language generator. * Do not change it. * * SARL is an general-purpose agent programming language. * More details on http://www.sarl.io * * Copyright (C) 2014-2017 the original authors or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.sarl.lang.codebuilder.builders; import javax.inject.Inject; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.common.types.JvmLowerBound; import org.eclipse.xtext.common.types.JvmTypeParameter; import org.eclipse.xtext.common.types.JvmUpperBound; import org.eclipse.xtext.common.types.TypesFactory; import org.eclipse.xtext.common.types.access.IJvmTypeProvider; import org.eclipse.xtext.util.EmfFormatter; import org.eclipse.xtext.xbase.lib.Pure; /** Builder of a Sarl type parameter. */ @SuppressWarnings("all") public class TypeParameterBuilderImpl extends AbstractBuilder implements ITypeParameterBuilder { private EObject context; private JvmTypeParameter parameter; @Inject private TypesFactory jvmTypesFactory; /** Initialize the type parameter. * <p>Caution: This initialization function does not add the type parameter in its container. * The container is responsible of adding the type parameter in its internal object. * @param name - the name of the type parameter. * @param typeContext - the provider of types or null. */ public void eInit(EObject context, String name, IJvmTypeProvider typeContext) { setTypeResolutionContext(typeContext); this.context = context; this.parameter = this.jvmTypesFactory.createJvmTypeParameter(); this.parameter.setName(name); } /** Replies the created parameter. * * @return the parameter. */ @Pure public JvmTypeParameter getJvmTypeParameter() { return this.parameter; } /** Replies the resource to which the type parameter is attached. */ @Pure public Resource eResource() { return getJvmTypeParameter().eResource(); } @Override @Pure public String toString() { return EmfFormatter.objToStr(getJvmTypeParameter()); } /** Add upper type bounds. * @param type the type. */ public void addUpperConstraint(String type) { final JvmUpperBound constraint = this.jvmTypesFactory.createJvmUpperBound(); constraint.setTypeReference(newTypeRef(this.context, type)); getJvmTypeParameter().getConstraints().add(constraint); } /** Add lower type bounds. * @param type the type. */ public void addLowerConstraint(String type) { final JvmLowerBound constraint = this.jvmTypesFactory.createJvmLowerBound(); constraint.setTypeReference(newTypeRef(this.context, type)); getJvmTypeParameter().getConstraints().add(constraint); } }
b04ef90b39d01f16116b8f0bca4007356a80e375
3b84ee2fa50146859154b336147ccb6b7b0d8641
/FlipdogSpellChecker/com/flipdog/speller/r.java
7dfd4a60d0944775a1b1e9143e7f318df56d7d03
[]
no_license
DarthYogurt/Dragonbreath
5ac8883b75480a9a778f6b30d98c518b3544375d
72f3e53cde17aacff812dce67f89b87d0b427a0e
refs/heads/master
2016-08-03T16:43:36.614188
2013-11-12T00:11:29
2013-11-12T00:11:29
14,119,806
0
1
null
null
null
null
UTF-8
Java
false
false
5,807
java
package com.flipdog.speller; import android.app.Activity; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.text.Editable; import android.text.Layout; import android.text.Spannable; import android.text.TextPaint; import android.view.Display; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.TextView; import com.flipdog.activity.MyActivity; import com.flipdog.m; public class r { private EditText a; private LayoutInflater b; private PopupWindow c; private MyActivity d; private WindowManager e; private View f; private com.flipdog.commons.s.b g; private com.b.b.h h = new com.b.b.h(); private n i; public r(MyActivity paramMyActivity, EditText paramEditText, n paramn) { this.d = paramMyActivity; this.a = paramEditText; this.i = paramn; this.b = ((LayoutInflater)paramMyActivity.getSystemService("layout_inflater")); this.e = ((WindowManager)a().getSystemService("window")); this.f = this.b.inflate(com.flipdog.p.speller_suggestions_list_item, null); this.f.measure(-2, -2); this.g = ((com.flipdog.commons.s.b)com.flipdog.commons.i.b.a(com.flipdog.commons.s.b.class)); c(); d(); } private int a(int paramInt1, Drawable paramDrawable, int paramInt2) { return paramInt1 * (paramInt2 + this.f.getMeasuredHeight()) + paramDrawable.getMinimumHeight(); } private int a(String[] paramArrayOfString, Drawable paramDrawable, TextPaint paramTextPaint) { return a(paramArrayOfString, paramTextPaint) + paramDrawable.getMinimumWidth(); } private int a(String[] paramArrayOfString, TextPaint paramTextPaint) { int j = -1; int k = paramArrayOfString.length; int m = 0; if (m >= k) return j; int n = (int)paramTextPaint.measureText(paramArrayOfString[m]); if (n > j); while (true) { m++; j = n; break; n = j; } } private void a(View paramView, int paramInt) { FrameLayout localFrameLayout = (FrameLayout)paramView.getParent(); WindowManager.LayoutParams localLayoutParams = (WindowManager.LayoutParams)localFrameLayout.getLayoutParams(); localLayoutParams.width = paramInt; localLayoutParams.flags = (0x20 | localLayoutParams.flags); this.e.updateViewLayout(localFrameLayout, localLayoutParams); } private void a(o paramo, MotionEvent paramMotionEvent) { a(paramo, paramo.a(), paramMotionEvent); } private void a(o paramo, s params, MotionEvent paramMotionEvent) { if (this.c != null) this.c.dismiss(); View localView = this.b.inflate(com.flipdog.p.speller_suggestions, null); this.c = new PopupWindow(localView, 50, 50); this.c.setWidth(-2); this.c.setHeight(-2); this.c.setFocusable(true); this.c.setTouchable(true); this.c.setOutsideTouchable(true); this.c.setInputMethodMode(1); Drawable localDrawable = a().getResources().getDrawable(17301505); this.c.setBackgroundDrawable(localDrawable); ListView localListView = (ListView)localView.findViewById(m.list); localListView.setAdapter(new p(a(), params.d)); localListView.setOnItemClickListener(new f(this, paramo, params)); this.a.setOnKeyListener(new e(this)); this.c.setOnDismissListener(new g(this)); float f1 = paramMotionEvent.getY(); float f2 = paramMotionEvent.getX(); float f3 = paramMotionEvent.getRawY(); int j = (int)f2; int k = -1 * (this.a.getHeight() - (int)f1); if (f3 > e() / 2); for (int m = k - a(params.d.length, localDrawable, 2); ; m = k + 10) { this.c.showAsDropDown(this.a, j, m); TextPaint localTextPaint = ((TextView)this.f.findViewById(m.text)).getPaint(); a(localView, a(params.d, localDrawable, localTextPaint)); return; } } private void c() { this.a.setOnTouchListener(new i(this)); } private void d() { this.g.a(this.h, new h(this)); } private int e() { return this.e.getDefaultDisplay().getHeight(); } protected Activity a() { return this.d; } protected void a(TextView paramTextView, MotionEvent paramMotionEvent) { Editable localEditable = paramTextView.getEditableText(); int j = paramMotionEvent.getAction(); int i5; if ((j == 1) || (j == 0)) { int k = (int)paramMotionEvent.getX(); int m = (int)paramMotionEvent.getY(); int n = k - paramTextView.getTotalPaddingLeft(); int i1 = m - paramTextView.getTotalPaddingTop(); int i2 = n + paramTextView.getScrollX(); int i3 = i1 + paramTextView.getScrollY(); Layout localLayout = paramTextView.getLayout(); int i4 = localLayout.getLineForVertical(i3); i5 = localLayout.getOffsetForHorizontal(i4, i2); if (localLayout.getLineBottom(i4) >= i3) break label112; } label112: o[] arrayOfo; do { return; arrayOfo = (o[])localEditable.getSpans(i5, i5, o.class); } while ((arrayOfo.length == 0) || (j != 1)); arrayOfo[0].a(paramTextView, paramMotionEvent); } protected void a(o paramo, s params, int paramInt) { Editable localEditable = this.a.getText(); localEditable.replace(localEditable.getSpanStart(paramo), localEditable.getSpanEnd(paramo), params.d[paramInt]); localEditable.removeSpan(paramo); this.c.dismiss(); } public void b() { this.i.a(); } } /* Location: C:\Programming\Android2Java\FlipdogSpellchecker_dex2jar.jar * Qualified Name: com.flipdog.speller.r * JD-Core Version: 0.6.2 */
77a1007d137612f1674eab1734448a452516165f
368164a48b73d31c8b1e1f74f906f60b64c71e4b
/web/src/main/java/com/jason/web/test/spring/annotation/AsyncConfig.java
260b0755b39ab1903ce677e41fc7eac050b7dfdd
[]
no_license
Jasyl0519/change-the-world
f5be2e0870c1ed62a3e6c3e9e1c13b4cbdba8c59
6c93eca7e3532e13c2ada1dfd82771589870f09e
refs/heads/master
2022-07-03T16:40:48.515380
2020-06-24T07:50:13
2020-06-24T07:50:13
214,458,408
0
0
null
2022-06-17T03:15:34
2019-10-11T14:34:54
HTML
UTF-8
Java
false
false
732
java
package com.jason.web.test.spring.annotation; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; /** * @author zhengcheng * @Description: * @date 2020/6/12 */ @Configuration @EnableAsync public class AsyncConfig { @Bean("event-async") public Executor getAsyncExecutor() { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setThreadNamePrefix("async-thread-"); taskExecutor.initialize(); return taskExecutor; } }
bf045a602f387308d1db6f33e9e11a7cc19946f2
21c2f55b571a4a43da0bb56396fce4202bce3306
/src/generated/java/Murmur/AMD_Server_addCallback.java
f937913d5af0d0500e69700383d17a13cb3eb571
[]
no_license
Tiim/telegram_mumble_bot
33c4729158db89aadf98dfbcc4bf6a14c9141ee3
fb4d373595fbdafd7eda2668ab703a70157fa6b7
refs/heads/master
2021-01-10T19:50:51.597343
2016-01-04T06:48:43
2016-01-04T06:48:43
39,690,708
1
0
null
null
null
null
UTF-8
Java
false
false
826
java
// ********************************************************************** // // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** // // Ice version 3.4.2 // // <auto-generated> // // Generated from file `AMD_Server_addCallback.java' // // Warning: do not edit this file. // // </auto-generated> // package Murmur; /** * Add a callback. The callback will receive notifications about changes to users and channels. * **/ public interface AMD_Server_addCallback extends Ice.AMDCallback { /** * ice_response indicates that * the operation completed successfully. **/ void ice_response(); }
6206f0fbda49d2c46ea7814ee1cc33949735eaf6
2d2463318ffb154f572194fd6201ce8b515bccb7
/JYQ/system-center/src/main/java/com/hengyu/system/web/FeedbackController.java
d2a5412274706258472b9ddf19f1a129006c74ca
[]
no_license
AWeekGlass/workspace
2746a04e589f6e0cb2bb6b558c1de97ea810e10f
67d32c20342b8c0d183e78a112beeec3ef6fcd2a
refs/heads/master
2022-12-11T08:43:01.327388
2019-10-31T02:06:08
2019-10-31T02:06:08
218,499,474
0
0
null
2022-09-01T23:14:47
2019-10-30T10:17:38
Java
UTF-8
Java
false
false
5,030
java
package com.hengyu.system.web; import static com.hengyu.common.constant.CommonConstants.ADD_FAILURE; import static com.hengyu.common.constant.CommonConstants.ADD_SUCCESS; import static com.hengyu.common.constant.CommonConstants.PAGE_SIZE; import static com.hengyu.common.constant.CommonConstants.TOKEN; import static com.hengyu.common.constant.CommonConstants.UPDATE_FAILURE; import static com.hengyu.common.constant.CommonConstants.UPDATE_SUCCESS; import static com.hengyu.common.constant.CommonConstants.DELETE_FAILURE; import static com.hengyu.common.constant.CommonConstants.DELETE_SUCCESS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.baomidou.mybatisplus.plugins.Page; import com.hengyu.common.jwt.IJWTInfo; import com.hengyu.common.msg.RestResponse; import com.hengyu.common.util.JWTUtils; import com.hengyu.system.entity.Feedback; import com.hengyu.system.service.FeedbackService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; /** * <p> * 中介反馈表 前端控制器 * </p> * * @author allnas * @since 2018-08-22 */ @Api(value = "FeedbackController", tags = "意见反馈Controller") @RestController @RequestMapping("/feedback") public class FeedbackController { @Autowired private FeedbackService feedbackService; @Autowired private JWTUtils jwtUtils; /** * 新增意见反馈 * * @throws Exception * */ @ApiOperation(value = "新增意见反馈", notes = "新增意见反馈(请求头添加token)") @ApiImplicitParam(name = "feedback", value = "中介反馈", dataTypeClass = Feedback.class) @PostMapping("add") public RestResponse<String> add(@RequestHeader(TOKEN) String token, Feedback feedback) throws Exception { IJWTInfo info = jwtUtils.getInfoFromToken(token); feedback.setCompanyId(info.getCompanyId()); feedback.setAdminId(info.getUserId()); feedback.setStatus(2); boolean flag = feedbackService.insert(feedback); RestResponse<String> response = new RestResponse<String>().rel(flag); if (flag) { return response.data(ADD_SUCCESS); } else { return response.message(ADD_FAILURE); } } /** * 查询列表 * @param token * @param current * @param size * @param feedback * @return * @throws Exception */ @ApiOperation(value = "查询意见反馈列表", notes = "查询意见反馈列表") @ApiImplicitParams({ @ApiImplicitParam(name = "current", value = "当前页", defaultValue = "1", dataType = "Integer"), @ApiImplicitParam(name = "size", value = "每页行数", defaultValue = PAGE_SIZE, dataType = "Integer"), @ApiImplicitParam(name = "feedback", value = "查询条件", dataTypeClass = Feedback.class) }) @GetMapping("getList") public RestResponse<Page<Feedback>> getList(@RequestHeader("token") String token,@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = PAGE_SIZE) Integer size, Feedback feedback) throws Exception { IJWTInfo info = jwtUtils.getInfoFromToken(token); feedback.setCompanyId(info.getCompanyId()); Page<Feedback> page = new Page<>(current,size); page = feedbackService.getList(page, feedback); return new RestResponse<Page<Feedback>>().rel(true).data(page); } @ApiOperation(value = "查询反馈详情", notes = "查询反馈详情") @ApiImplicitParam(name = "id", value = "反馈id", dataTypeClass = Integer.class) @GetMapping("queryById") public RestResponse<Feedback> queryById(Integer id){ Feedback feedback = feedbackService.queryById(id); return new RestResponse<Feedback>().rel(true).data(feedback); } @ApiOperation(value = "修改反馈", notes = "修改反馈") @ApiImplicitParam(name = "feedback", value = "反馈对象", dataTypeClass = Feedback.class) @GetMapping("update") public RestResponse<String> update(Feedback feedback){ boolean flag = feedbackService.updateById(feedback); RestResponse<String> response = new RestResponse<>(); response.rel(flag); if(flag){ return response.data(UPDATE_SUCCESS); } return response.message(UPDATE_FAILURE); } @ApiOperation(value = "删除反馈", notes = "删除反馈") @ApiImplicitParam(name = "id", value = "反馈id", dataTypeClass = String.class) @GetMapping("delete/{id}") public RestResponse<String> delete(@PathVariable String id){ boolean flag = feedbackService.delete(id); RestResponse<String> response = new RestResponse<>(); response.rel(flag); if(flag){ return response.data(DELETE_SUCCESS); } return response.message(DELETE_FAILURE); } }