blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
1e8fba8b3321ec65da8f1accad65de2e2b2ae4dc
5,884,105,256,059
bcb5a7b4f41ecc951a5abf6962fa5d6ed907993c
/piqle/agents/ElementaryCooperativeAgent.java
ff7630641311020c26cca5f6e59c07d2b54dfd6c
[]
no_license
mchadaj1/machinelearning
https://github.com/mchadaj1/machinelearning
5a7b1e32de8c037954157c3f88bd14f624954ff6
9438ed4857e4bc7f938f5f660f870c73fb15250e
refs/heads/master
2021-01-20T20:10:47.779000
2017-04-27T16:46:16
2017-04-27T16:46:16
60,925,785
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * * Copyright (C) 2006 Francesco De Comité * ElementaryCooperativeAgent_OLD.java * 21 nov. 06 * */ package agents; import java.util.ArrayList; import java.util.Iterator; //import maabacVersion2.MuscleNullableAction; import algorithms.ISelector; import environment.ElementaryStateWithActions; import environment.IAction; import environment.NullableAction; import environment.Filter; import environment.IEnvironment; import environment.IState; /** * We want to have agents (in a multi-agent frame) that are able to know * what was the last action of their neighbours. * Each such agent maintains a (stationary) list of its neighbours, * and builds its state (its perception of the universe) using the global * environment's state (through a filter), and the last actions of its * neighbours. * As we must also define the initial state, we need the notion of null action * (when no agent has yet moved). * * * @author decomite * */ abstract public class ElementaryCooperativeAgent<F extends ElementaryStateWithActions> extends ElementaryAgent { /** * */ private static final long serialVersionUID = 1L; protected ArrayList<ElementaryCooperativeAgent> neighbours =new ArrayList<ElementaryCooperativeAgent>(); protected ArrayList<NullableAction> oldActions=new ArrayList<NullableAction>(); /** True if all neighbours are entered and the initial state build */ protected boolean completed=false; /** * @param s the local environment (which defines possible actions) * @param al the selector * @param f the filter */ public ElementaryCooperativeAgent(IEnvironment s, ISelector al, Filter f) { super(s, al, f); // Next line : the type is not yet instantiated // lastAction=E.getNullAction(); // Initial state can only be build when all neighbours are entered } protected F buildState(IEnvironment universe,IState s,ArrayList<NullableAction> old){ System.out.println("ElementaryCooperativeAgent.buildState() :"); System.out.println("You MUST override this method : exiting"); System.exit(0); return null;} /** By calling this method, the user indicates that all neighbours * have been entered : we can build the initial composed state * */ public void buildInitialComposedState(IState st){ this.completed=true; F f = buildState(this.universe, this.fil.filterState(st,this.universe), this.oldActions); this.currentState=f; this.oldState=this.currentState.copy(); } public void setInitialState(IState s){ setCurrentState(s); } public void setCurrentState(IState s){ if(this.completed){ this.oldState=this.currentState.copy(); this.oldActions=new ArrayList<NullableAction>(); Iterator<ElementaryCooperativeAgent>cursor=this.neighbours.iterator(); while(cursor.hasNext()){ ElementaryCooperativeAgent ag=cursor.next(); this.oldActions.add((NullableAction)ag.getLastAction()); } F f = (F) buildState(this.universe, this.fil.filterState(s,this.universe), this.oldActions); this.currentState=f; } else{ System.err.println("Can't set state before list of neighbours completed\n" + "Must call buidInitialComposedState"); System.exit(0); return; } } public NullableAction getNullAction() { return NullableAction.getNullAction(); } public void newEpisode() { super.newEpisode(); this.lastAction=NullableAction.getNullAction(); } public void addNeighbour(ElementaryCooperativeAgent n) { this.neighbours.add(n); oldActions.add((NullableAction)n.getLastAction()); } // TODO For debug and setting : to be erased when verification completed public String neighboursActions(){ String s=""; int i=0; Iterator<ElementaryCooperativeAgent>cursor=this.neighbours.iterator(); while(cursor.hasNext()){ ElementaryCooperativeAgent ag=cursor.next(); IAction ac=ag.getLastAction(); s+="Action neighbour number "+i+":"+ac+"\n"; } return s; } }
WINDOWS-1250
Java
4,747
java
ElementaryCooperativeAgent.java
Java
[ { "context": "n, MA 02110-1301 USA.\n*\n*\n* Copyright (C) 2006 Francesco De Comité\n* ElementaryCooperativeAgent_OLD.java\n* 21 ", "end": 806, "score": 0.9998348355293274, "start": 787, "tag": "NAME", "value": "Francesco De Comité" }, { "context": " (when no agent has yet moved). \n* \n* \n* @author decomite\n*\n*/\n\n\nabstract public class ElementaryCooperativ", "end": 1706, "score": 0.9996733665466309, "start": 1698, "tag": "USERNAME", "value": "decomite" } ]
null
[]
/** * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * * Copyright (C) 2006 <NAME> * ElementaryCooperativeAgent_OLD.java * 21 nov. 06 * */ package agents; import java.util.ArrayList; import java.util.Iterator; //import maabacVersion2.MuscleNullableAction; import algorithms.ISelector; import environment.ElementaryStateWithActions; import environment.IAction; import environment.NullableAction; import environment.Filter; import environment.IEnvironment; import environment.IState; /** * We want to have agents (in a multi-agent frame) that are able to know * what was the last action of their neighbours. * Each such agent maintains a (stationary) list of its neighbours, * and builds its state (its perception of the universe) using the global * environment's state (through a filter), and the last actions of its * neighbours. * As we must also define the initial state, we need the notion of null action * (when no agent has yet moved). * * * @author decomite * */ abstract public class ElementaryCooperativeAgent<F extends ElementaryStateWithActions> extends ElementaryAgent { /** * */ private static final long serialVersionUID = 1L; protected ArrayList<ElementaryCooperativeAgent> neighbours =new ArrayList<ElementaryCooperativeAgent>(); protected ArrayList<NullableAction> oldActions=new ArrayList<NullableAction>(); /** True if all neighbours are entered and the initial state build */ protected boolean completed=false; /** * @param s the local environment (which defines possible actions) * @param al the selector * @param f the filter */ public ElementaryCooperativeAgent(IEnvironment s, ISelector al, Filter f) { super(s, al, f); // Next line : the type is not yet instantiated // lastAction=E.getNullAction(); // Initial state can only be build when all neighbours are entered } protected F buildState(IEnvironment universe,IState s,ArrayList<NullableAction> old){ System.out.println("ElementaryCooperativeAgent.buildState() :"); System.out.println("You MUST override this method : exiting"); System.exit(0); return null;} /** By calling this method, the user indicates that all neighbours * have been entered : we can build the initial composed state * */ public void buildInitialComposedState(IState st){ this.completed=true; F f = buildState(this.universe, this.fil.filterState(st,this.universe), this.oldActions); this.currentState=f; this.oldState=this.currentState.copy(); } public void setInitialState(IState s){ setCurrentState(s); } public void setCurrentState(IState s){ if(this.completed){ this.oldState=this.currentState.copy(); this.oldActions=new ArrayList<NullableAction>(); Iterator<ElementaryCooperativeAgent>cursor=this.neighbours.iterator(); while(cursor.hasNext()){ ElementaryCooperativeAgent ag=cursor.next(); this.oldActions.add((NullableAction)ag.getLastAction()); } F f = (F) buildState(this.universe, this.fil.filterState(s,this.universe), this.oldActions); this.currentState=f; } else{ System.err.println("Can't set state before list of neighbours completed\n" + "Must call buidInitialComposedState"); System.exit(0); return; } } public NullableAction getNullAction() { return NullableAction.getNullAction(); } public void newEpisode() { super.newEpisode(); this.lastAction=NullableAction.getNullAction(); } public void addNeighbour(ElementaryCooperativeAgent n) { this.neighbours.add(n); oldActions.add((NullableAction)n.getLastAction()); } // TODO For debug and setting : to be erased when verification completed public String neighboursActions(){ String s=""; int i=0; Iterator<ElementaryCooperativeAgent>cursor=this.neighbours.iterator(); while(cursor.hasNext()){ ElementaryCooperativeAgent ag=cursor.next(); IAction ac=ag.getLastAction(); s+="Action neighbour number "+i+":"+ac+"\n"; } return s; } }
4,733
0.729456
0.723978
159
28.842768
26.525064
86
false
false
0
0
0
0
0
0
1.641509
false
false
8
e3997abeb54d743c280dcb7594ba5fac2069505b
34,668,976,018,291
304b01d0e52986a2810391427589fc8a4355063d
/handleinlibrary/src/main/java/com/guyuan/handlein/base/ui/customizeview/autoscrollrecyclerview/MessageBean.java
53ced927362b82e5491bdd219b13a2f6dfa1ee55
[]
no_license
hughsheng/WidgetDemo
https://github.com/hughsheng/WidgetDemo
ac88d8075cedc0c25db9f375aab40b3a1c773631
5e31db60328a82f04870200550f3692057366940
refs/heads/master
2021-12-25T11:26:06.080000
2021-08-05T05:18:42
2021-08-05T05:18:42
160,315,015
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.guyuan.handlein.base.ui.customizeview.autoscrollrecyclerview; import java.util.List; /** * created by tl * created at 2020/4/25 */ public class MessageBean { /** * id : 2 * msgType : 1 * sendType : 1 * businessId : 1 * msgTitle : [是谁呢下]我都钉钉 * msgContent : 其实有时候我完不成任务或者工作,也不是因为懒什么的,我就是能力不行 * createBy : 24 * sendTime : 2019-12-17 02:48:12 * createTime : 2019-12-17 02:48:16 * lastUpdateBy : null * lastUpdateTime : 2019-12-17 02:48:21 * myMsgStatus : null * messageInfos : null */ private int id; //编号 private int msgType; //消息类型 private int sendType; //推送类型 private int businessId; //业务id private String msgTitle; //消息标题 private String msgContent; //消息内容 private int createBy; //创建人 private String sendTime; //发送时间 private String createTime; //创建时间 private Object lastUpdateBy; //更新人 private String lastUpdateTime; //更新时间 private Object myMsgStatus; //自己的消息状态 private int label; //0:绿色 1:黄色 2:红色 private int isClose; //是否已处理该条智能管控消息 1:已处理 private int isCloseAll; //是否已处理该类型所有异常消息 1:已处理 private String url; //消息跳转的地址 private String urlWarnContent; //出现预警警告,智能管控模块菜单提示语 private String urlName; //页面标题 private List<MessageInfosBean> messageInfos; public MessageBean() { } public MessageBean(int label, String url) { this.label = label; this.url = url; } public String getUrlWarnContent() { return urlWarnContent; } public void setUrlWarnContent(String urlWarnContent) { this.urlWarnContent = urlWarnContent; } public int getIsCloseAll() { return isCloseAll; } public void setIsCloseAll(int isCloseAll) { this.isCloseAll = isCloseAll; } public int getIsClose() { return isClose; } public void setIsClose(int isClose) { this.isClose = isClose; } public String getUrlName() { return urlName; } public void setUrlName(String urlName) { this.urlName = urlName; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getMsgType() { return msgType; } public void setMsgType(int msgType) { this.msgType = msgType; } public int getSendType() { return sendType; } public void setSendType(int sendType) { this.sendType = sendType; } public int getBusinessId() { return businessId; } public void setBusinessId(int businessId) { this.businessId = businessId; } public String getMsgTitle() { return msgTitle; } public void setMsgTitle(String msgTitle) { this.msgTitle = msgTitle; } public String getMsgContent() { return msgContent; } public void setMsgContent(String msgContent) { this.msgContent = msgContent; } public int getCreateBy() { return createBy; } public void setCreateBy(int createBy) { this.createBy = createBy; } public String getSendTime() { return sendTime; } public void setSendTime(String sendTime) { this.sendTime = sendTime; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public Object getLastUpdateBy() { return lastUpdateBy; } public void setLastUpdateBy(Object lastUpdateBy) { this.lastUpdateBy = lastUpdateBy; } public String getLastUpdateTime() { return lastUpdateTime; } public void setLastUpdateTime(String lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; } public Object getMyMsgStatus() { return myMsgStatus; } public void setMyMsgStatus(Object myMsgStatus) { this.myMsgStatus = myMsgStatus; } public List<MessageInfosBean> getMessageInfos() { return messageInfos; } public void setMessageInfos(List<MessageInfosBean> messageInfos) { this.messageInfos = messageInfos; } public int getLabel() { return label; } public void setLabel(int label) { this.label = label; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } @Override public String toString() { return "MessageBean{" + "id=" + id + ", msgType=" + msgType + ", sendType=" + sendType + ", businessId=" + businessId + ", msgTitle='" + msgTitle + '\'' + ", msgContent='" + msgContent + '\'' + ", createBy=" + createBy + ", sendTime='" + sendTime + '\'' + ", createTime='" + createTime + '\'' + ", lastUpdateBy=" + lastUpdateBy + ", lastUpdateTime='" + lastUpdateTime + '\'' + ", myMsgStatus=" + myMsgStatus + ", messageInfos=" + messageInfos + ", label=" + label + ", url='" + url + '\'' + ", urlName='" + urlName + '\'' + '}'; } }
UTF-8
Java
6,104
java
MessageBean.java
Java
[ { "context": "erview;\n\nimport java.util.List;\n\n/**\n * created by tl\n * created at 2020/4/25\n */\npublic class MessageB", "end": 119, "score": 0.9823680520057678, "start": 117, "tag": "USERNAME", "value": "tl" } ]
null
[]
package com.guyuan.handlein.base.ui.customizeview.autoscrollrecyclerview; import java.util.List; /** * created by tl * created at 2020/4/25 */ public class MessageBean { /** * id : 2 * msgType : 1 * sendType : 1 * businessId : 1 * msgTitle : [是谁呢下]我都钉钉 * msgContent : 其实有时候我完不成任务或者工作,也不是因为懒什么的,我就是能力不行 * createBy : 24 * sendTime : 2019-12-17 02:48:12 * createTime : 2019-12-17 02:48:16 * lastUpdateBy : null * lastUpdateTime : 2019-12-17 02:48:21 * myMsgStatus : null * messageInfos : null */ private int id; //编号 private int msgType; //消息类型 private int sendType; //推送类型 private int businessId; //业务id private String msgTitle; //消息标题 private String msgContent; //消息内容 private int createBy; //创建人 private String sendTime; //发送时间 private String createTime; //创建时间 private Object lastUpdateBy; //更新人 private String lastUpdateTime; //更新时间 private Object myMsgStatus; //自己的消息状态 private int label; //0:绿色 1:黄色 2:红色 private int isClose; //是否已处理该条智能管控消息 1:已处理 private int isCloseAll; //是否已处理该类型所有异常消息 1:已处理 private String url; //消息跳转的地址 private String urlWarnContent; //出现预警警告,智能管控模块菜单提示语 private String urlName; //页面标题 private List<MessageInfosBean> messageInfos; public MessageBean() { } public MessageBean(int label, String url) { this.label = label; this.url = url; } public String getUrlWarnContent() { return urlWarnContent; } public void setUrlWarnContent(String urlWarnContent) { this.urlWarnContent = urlWarnContent; } public int getIsCloseAll() { return isCloseAll; } public void setIsCloseAll(int isCloseAll) { this.isCloseAll = isCloseAll; } public int getIsClose() { return isClose; } public void setIsClose(int isClose) { this.isClose = isClose; } public String getUrlName() { return urlName; } public void setUrlName(String urlName) { this.urlName = urlName; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getMsgType() { return msgType; } public void setMsgType(int msgType) { this.msgType = msgType; } public int getSendType() { return sendType; } public void setSendType(int sendType) { this.sendType = sendType; } public int getBusinessId() { return businessId; } public void setBusinessId(int businessId) { this.businessId = businessId; } public String getMsgTitle() { return msgTitle; } public void setMsgTitle(String msgTitle) { this.msgTitle = msgTitle; } public String getMsgContent() { return msgContent; } public void setMsgContent(String msgContent) { this.msgContent = msgContent; } public int getCreateBy() { return createBy; } public void setCreateBy(int createBy) { this.createBy = createBy; } public String getSendTime() { return sendTime; } public void setSendTime(String sendTime) { this.sendTime = sendTime; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public Object getLastUpdateBy() { return lastUpdateBy; } public void setLastUpdateBy(Object lastUpdateBy) { this.lastUpdateBy = lastUpdateBy; } public String getLastUpdateTime() { return lastUpdateTime; } public void setLastUpdateTime(String lastUpdateTime) { this.lastUpdateTime = lastUpdateTime; } public Object getMyMsgStatus() { return myMsgStatus; } public void setMyMsgStatus(Object myMsgStatus) { this.myMsgStatus = myMsgStatus; } public List<MessageInfosBean> getMessageInfos() { return messageInfos; } public void setMessageInfos(List<MessageInfosBean> messageInfos) { this.messageInfos = messageInfos; } public int getLabel() { return label; } public void setLabel(int label) { this.label = label; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } @Override public String toString() { return "MessageBean{" + "id=" + id + ", msgType=" + msgType + ", sendType=" + sendType + ", businessId=" + businessId + ", msgTitle='" + msgTitle + '\'' + ", msgContent='" + msgContent + '\'' + ", createBy=" + createBy + ", sendTime='" + sendTime + '\'' + ", createTime='" + createTime + '\'' + ", lastUpdateBy=" + lastUpdateBy + ", lastUpdateTime='" + lastUpdateTime + '\'' + ", myMsgStatus=" + myMsgStatus + ", messageInfos=" + messageInfos + ", label=" + label + ", url='" + url + '\'' + ", urlName='" + urlName + '\'' + '}'; } }
6,104
0.530538
0.520186
229
24.310043
21.363867
77
false
false
0
0
0
0
0
0
0.340611
false
false
8
e5023e1d7cec84ebf05befaca63cc3a0bdd33567
16,183,436,817,677
270c7a6e153051cdd0f5f61483ebed00a8795386
/src/Interfaces/Accessories/ColourComboBox.java
e089999a14aa1931d094809d1a461bda810f7aee
[]
no_license
NicoGoux/TP-INTEGRADOR-DIED
https://github.com/NicoGoux/TP-INTEGRADOR-DIED
f7d84d97e4118d8b5ca70ff3c3f353c4c3d60eb6
49c56847f9e4452145e7dcc0f581e883b42fc126
refs/heads/main
2023-07-19T10:40:29.372000
2021-09-10T12:41:41
2021-09-10T12:41:41
392,516,860
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Interfaces.Accessories; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JComboBox; import DataBase.DBConnection; public class ColourComboBox extends JComboBox<String> { public ColourComboBox() { super(); this.addItem("Seleccione un color"); Runnable colourT = () -> { ResultSet rs =null; DBConnection.establishConnection(); PreparedStatement pstm = null; try { pstm = DBConnection.getConnection().prepareStatement("SELECT * FROM COLOUR"); rs = pstm.executeQuery(); while (rs.next()) { this.addItem(rs.getString(1)); } } catch (SQLException exception) { exception.printStackTrace(); } finally { DBConnection.closeConnection(pstm, rs); } }; new Thread(colourT,"colourComboBox").start(); this.setRenderer(new ColourSelectorRender(this)); } }
UTF-8
Java
1,070
java
ColourComboBox.java
Java
[]
null
[]
package Interfaces.Accessories; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JComboBox; import DataBase.DBConnection; public class ColourComboBox extends JComboBox<String> { public ColourComboBox() { super(); this.addItem("Seleccione un color"); Runnable colourT = () -> { ResultSet rs =null; DBConnection.establishConnection(); PreparedStatement pstm = null; try { pstm = DBConnection.getConnection().prepareStatement("SELECT * FROM COLOUR"); rs = pstm.executeQuery(); while (rs.next()) { this.addItem(rs.getString(1)); } } catch (SQLException exception) { exception.printStackTrace(); } finally { DBConnection.closeConnection(pstm, rs); } }; new Thread(colourT,"colourComboBox").start(); this.setRenderer(new ColourSelectorRender(this)); } }
1,070
0.584112
0.583178
33
31.424242
20.255983
93
false
false
0
0
0
0
0
0
0.636364
false
false
8
6513b85670cf2cd87707d859808f6b3fac43434b
1,116,691,543,753
9b56d6e6fa2f854e9e9274d16607d5ba3f056ca2
/presegundoprevionomina/src/co/nomina/entities/Liquidacion.java
649cdc0c4a635185f4c8b45c85a0138e7fd1ab86
[]
no_license
RaphaelFernandezG/presegundoprevionomina
https://github.com/RaphaelFernandezG/presegundoprevionomina
6746e28701d298e582ee556d2e4e9985fa049608
9ef37f7bee45188c8e577ff80cdf9e596e5cd957
refs/heads/gh-pages
2023-08-03T12:07:34.246000
2019-11-12T17:22:12
2019-11-12T17:22:12
221,207,737
1
0
null
false
2023-07-22T21:23:09
2019-11-12T12:00:40
2022-06-23T20:16:57
2023-07-22T21:23:08
35
1
0
7
Java
false
false
package co.nomina.entities; import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; /** * The persistent class for the liquidacion database table. * */ @Entity @NamedQuery(name="Liquidacion.findAll", query="SELECT l FROM Liquidacion l") public class Liquidacion implements Serializable { private static final long serialVersionUID = 1L; @Id private int id; private int codmodelo; @Temporal(TemporalType.DATE) private Date fecha; private BigDecimal valor; //bi-directional many-to-one association to Proceso @ManyToOne @JoinColumn(name="numproceso") private Proceso proceso; //bi-directional many-to-one association to Empleado @ManyToOne @JoinColumn(name="codempleado") private Empleado empleado; //bi-directional many-to-one association to Concepto @ManyToOne @JoinColumn(name="codconcepto") private Concepto concepto; public Liquidacion() { } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public int getCodmodelo() { return this.codmodelo; } public void setCodmodelo(int codmodelo) { this.codmodelo = codmodelo; } public Date getFecha() { return this.fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public BigDecimal getValor() { return this.valor; } public void setValor(BigDecimal valor) { this.valor = valor; } public Proceso getProceso() { return this.proceso; } public void setProceso(Proceso proceso) { this.proceso = proceso; } public Empleado getEmpleado() { return this.empleado; } public void setEmpleado(Empleado empleado) { this.empleado = empleado; } public Concepto getConcepto() { return this.concepto; } public void setConcepto(Concepto concepto) { this.concepto = concepto; } }
UTF-8
Java
1,912
java
Liquidacion.java
Java
[]
null
[]
package co.nomina.entities; import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; /** * The persistent class for the liquidacion database table. * */ @Entity @NamedQuery(name="Liquidacion.findAll", query="SELECT l FROM Liquidacion l") public class Liquidacion implements Serializable { private static final long serialVersionUID = 1L; @Id private int id; private int codmodelo; @Temporal(TemporalType.DATE) private Date fecha; private BigDecimal valor; //bi-directional many-to-one association to Proceso @ManyToOne @JoinColumn(name="numproceso") private Proceso proceso; //bi-directional many-to-one association to Empleado @ManyToOne @JoinColumn(name="codempleado") private Empleado empleado; //bi-directional many-to-one association to Concepto @ManyToOne @JoinColumn(name="codconcepto") private Concepto concepto; public Liquidacion() { } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public int getCodmodelo() { return this.codmodelo; } public void setCodmodelo(int codmodelo) { this.codmodelo = codmodelo; } public Date getFecha() { return this.fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public BigDecimal getValor() { return this.valor; } public void setValor(BigDecimal valor) { this.valor = valor; } public Proceso getProceso() { return this.proceso; } public void setProceso(Proceso proceso) { this.proceso = proceso; } public Empleado getEmpleado() { return this.empleado; } public void setEmpleado(Empleado empleado) { this.empleado = empleado; } public Concepto getConcepto() { return this.concepto; } public void setConcepto(Concepto concepto) { this.concepto = concepto; } }
1,912
0.689854
0.689331
102
16.764706
17.271294
76
false
false
0
0
0
0
0
0
1.029412
false
false
8
4d9335f2f3dbf4e4346f39b4c14e0ecc813941d0
1,116,691,543,330
0d36e62fe1b6439dd805309618025bcbe0eecaf4
/app/src/main/java/com/example/wechat/Model/UserManagerModel.java
a3ab4d7eb3523bead684345d446522b45ea6855f
[]
no_license
stevecandroid/Wechat
https://github.com/stevecandroid/Wechat
1ce28c74dccd2efa254b97283326224463696458
e93731e20ed3db7ac41d6b9e8bdde9383c408ce9
refs/heads/master
2021-01-20T00:20:31.492000
2017-04-26T04:27:51
2017-04-26T04:27:51
89,112,612
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.wechat.Model; import android.content.Intent; import com.example.wechat.Uitls.LogHelper; import com.example.wechat.WeChatApplication; import cn.bmob.v3.BmobUser; import cn.bmob.v3.listener.SaveListener; /** * Created by 铖哥 on 2017/4/24. */ public class UserManagerModel extends Model { public static final int SUCCESS = 001; public static final int ACCOUNT_ERROR = 202; public static final int EMAIL_ERROR = 203; public static final int P_A_NULL = 304; private int mStatus = SUCCESS; Intent intent; public int register(String account,String email,String password){ BmobUser bu = new BmobUser(); bu.setUsername(account); bu.setPassword(password); bu.setEmail(email); bu.signUp(WeChatApplication.getContext(),new SaveListener(){ @Override public void onSuccess() { intent = new Intent("register_done"); intent.putExtra("status",SUCCESS); WeChatApplication.getContext().sendBroadcast(intent); LogHelper.e("success"); mStatus = SUCCESS; } @Override public void onFailure(int i, String s) { intent = new Intent("register_done"); intent.putExtra("status",i); WeChatApplication.getContext().sendBroadcast(intent); LogHelper.e(i); LogHelper.e(s); mStatus = i; } }); return mStatus; } }
UTF-8
Java
1,551
java
UserManagerModel.java
Java
[ { "context": "bmob.v3.listener.SaveListener;\n\n/**\n * Created by 铖哥 on 2017/4/24.\n */\n\npublic class UserManagerModel ", "end": 246, "score": 0.9476044178009033, "start": 244, "tag": "USERNAME", "value": "铖哥" }, { "context": "bUser bu = new BmobUser();\n bu.setUsername(account);\n bu.setPassword(password);\n bu.se", "end": 689, "score": 0.8742392063140869, "start": 682, "tag": "USERNAME", "value": "account" }, { "context": " bu.setUsername(account);\n bu.setPassword(password);\n bu.setEmail(email);\n\n bu.signUp(", "end": 723, "score": 0.9991951584815979, "start": 715, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.example.wechat.Model; import android.content.Intent; import com.example.wechat.Uitls.LogHelper; import com.example.wechat.WeChatApplication; import cn.bmob.v3.BmobUser; import cn.bmob.v3.listener.SaveListener; /** * Created by 铖哥 on 2017/4/24. */ public class UserManagerModel extends Model { public static final int SUCCESS = 001; public static final int ACCOUNT_ERROR = 202; public static final int EMAIL_ERROR = 203; public static final int P_A_NULL = 304; private int mStatus = SUCCESS; Intent intent; public int register(String account,String email,String password){ BmobUser bu = new BmobUser(); bu.setUsername(account); bu.setPassword(<PASSWORD>); bu.setEmail(email); bu.signUp(WeChatApplication.getContext(),new SaveListener(){ @Override public void onSuccess() { intent = new Intent("register_done"); intent.putExtra("status",SUCCESS); WeChatApplication.getContext().sendBroadcast(intent); LogHelper.e("success"); mStatus = SUCCESS; } @Override public void onFailure(int i, String s) { intent = new Intent("register_done"); intent.putExtra("status",i); WeChatApplication.getContext().sendBroadcast(intent); LogHelper.e(i); LogHelper.e(s); mStatus = i; } }); return mStatus; } }
1,553
0.595992
0.582418
53
28.188679
20.810064
69
false
false
0
0
0
0
0
0
0.660377
false
false
8
fd993cfb2d4a07422cae4afdffcb86b91a1a08d8
1,116,691,546,544
47143a96caa14237aa7206f129f614e7bb5be757
/com/google/android/gms/tasks/zze.java
534cf7b9e486930815ca269a44280af41ac6f30e
[]
no_license
AhmadBayati/Golden-Telegram
https://github.com/AhmadBayati/Golden-Telegram
3b198edabe0a9d59a58d1fb09ec849aedc080df4
9c7be8636a0fd13e4c16a718e2a3766f66ed01f5
refs/heads/master
2020-05-19T12:19:21.071000
2019-05-05T09:26:55
2019-05-05T09:26:55
185,007,924
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.tasks; import android.support.annotation.NonNull; import java.util.concurrent.Executor; class zze<TResult> implements zzf<TResult> { private final Executor aBG; private OnSuccessListener<? super TResult> aJD; private final Object zzakd; /* renamed from: com.google.android.gms.tasks.zze.1 */ class C02541 implements Runnable { final /* synthetic */ zze aJE; final /* synthetic */ Task aJw; C02541(zze com_google_android_gms_tasks_zze, Task task) { this.aJE = com_google_android_gms_tasks_zze; this.aJw = task; } public void run() { synchronized (this.aJE.zzakd) { if (this.aJE.aJD != null) { this.aJE.aJD.onSuccess(this.aJw.getResult()); } } } } public zze(@NonNull Executor executor, @NonNull OnSuccessListener<? super TResult> onSuccessListener) { this.zzakd = new Object(); this.aBG = executor; this.aJD = onSuccessListener; } public void cancel() { synchronized (this.zzakd) { this.aJD = null; } } public void onComplete(@NonNull Task<TResult> task) { if (task.isSuccessful()) { synchronized (this.zzakd) { if (this.aJD == null) { return; } this.aBG.execute(new C02541(this, task)); } } } }
UTF-8
Java
1,490
java
zze.java
Java
[]
null
[]
package com.google.android.gms.tasks; import android.support.annotation.NonNull; import java.util.concurrent.Executor; class zze<TResult> implements zzf<TResult> { private final Executor aBG; private OnSuccessListener<? super TResult> aJD; private final Object zzakd; /* renamed from: com.google.android.gms.tasks.zze.1 */ class C02541 implements Runnable { final /* synthetic */ zze aJE; final /* synthetic */ Task aJw; C02541(zze com_google_android_gms_tasks_zze, Task task) { this.aJE = com_google_android_gms_tasks_zze; this.aJw = task; } public void run() { synchronized (this.aJE.zzakd) { if (this.aJE.aJD != null) { this.aJE.aJD.onSuccess(this.aJw.getResult()); } } } } public zze(@NonNull Executor executor, @NonNull OnSuccessListener<? super TResult> onSuccessListener) { this.zzakd = new Object(); this.aBG = executor; this.aJD = onSuccessListener; } public void cancel() { synchronized (this.zzakd) { this.aJD = null; } } public void onComplete(@NonNull Task<TResult> task) { if (task.isSuccessful()) { synchronized (this.zzakd) { if (this.aJD == null) { return; } this.aBG.execute(new C02541(this, task)); } } } }
1,490
0.555034
0.544295
52
27.653847
22.349398
107
false
false
0
0
0
0
0
0
0.384615
false
false
8
d11ca7ab6b2bf9047ece3f8a60c72ad95df72110
34,471,407,519,768
258532a96d1d99dcd511ebf6fe8fb6599376631d
/actions/com/liveguru/objects/AdminInvoicePageObjects.java
864bc07a3f1645a2eaf7cd6a16821702760ddac8
[]
no_license
nmtri5/LIVEGURU
https://github.com/nmtri5/LIVEGURU
858125f1271ffd1442ea6281ead10bf3d0462569
7f54c88390f5c98d330e64c4924e04971dc3e611
refs/heads/master
2021-07-04T11:05:38.176000
2019-07-17T17:47:49
2019-07-17T17:47:49
194,452,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.liveguru.objects; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import org.joda.time.DateTime; import org.openqa.selenium.WebDriver; import com.liveguru.commons.AbstractPage; import com.liveguru.commons.AbstractPageUI; import liveguru.AdminInvoicesPageUI; public class AdminInvoicePageObjects extends AbstractPage { WebDriver driver; public AdminInvoicePageObjects(WebDriver driver) { this.driver = driver; } public List<String> getInvoicesList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.INVOICES_LIST); return invoiceList; } public List<String> getInvoiceDateList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.INVOICE_DATE_LIST); return invoiceList; } public List<String> getOrderList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.ORDER_LIST); return invoiceList; } public List<String> getBillToNameList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.BILL_TO_NAME_LIST); return invoiceList; } public void clickToAnyHeadings(String heading) { waitForElementVisible(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, heading); clickToElement(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, heading); } public boolean isSortingCorrectly(String heading, List<String> actualList) { List<String> expectedList = new ArrayList<String>(); List<Date> dateList = new ArrayList<Date>(); expectedList.addAll(actualList); SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy h:mm:ss a"); switch (heading) { case "Invoice Date": case "Order Date": for (String date : expectedList) { Date d1; try { d1 = formatter.parse(date); dateList.add(d1); } catch (ParseException e) { e.printStackTrace(); } } if (getAttributeValue(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, "title", heading).equals("desc")) { Collections.sort(dateList); expectedList.clear(); for (Date dat : dateList) { expectedList.add(dat.toString()); } return actualList.equals(expectedList); } else { Collections.sort(dateList, Collections.reverseOrder()); expectedList.clear(); for (Date dat : dateList) { expectedList.add(dat.toString()); } return actualList.equals(expectedList); } case "Bill to Name": if (getAttributeValue(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, "title", heading).equals("desc")) { Collections.sort(expectedList, String.CASE_INSENSITIVE_ORDER); return actualList.equals(expectedList); } else { Collections.sort(expectedList, String.CASE_INSENSITIVE_ORDER); Collections.reverse(expectedList); return actualList.equals(expectedList); } default: if (getAttributeValue(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, "title", heading).equals("desc")) { Collections.sort(expectedList); return actualList.equals(expectedList); } else { Collections.sort(expectedList, Collections.reverseOrder()); return actualList.equals(expectedList); } } } }
UTF-8
Java
3,799
java
AdminInvoicePageObjects.java
Java
[ { "context": "n actualList.equals(expectedList);\r\n\t\t\t}\r\n\t\tcase \"Bill to Name\":\r\n\t\t\tif (getAttributeValue(driver, AdminInvoices", "end": 3055, "score": 0.9615652561187744, "start": 3043, "tag": "NAME", "value": "Bill to Name" } ]
null
[]
package com.liveguru.objects; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import org.joda.time.DateTime; import org.openqa.selenium.WebDriver; import com.liveguru.commons.AbstractPage; import com.liveguru.commons.AbstractPageUI; import liveguru.AdminInvoicesPageUI; public class AdminInvoicePageObjects extends AbstractPage { WebDriver driver; public AdminInvoicePageObjects(WebDriver driver) { this.driver = driver; } public List<String> getInvoicesList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.INVOICES_LIST); return invoiceList; } public List<String> getInvoiceDateList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.INVOICE_DATE_LIST); return invoiceList; } public List<String> getOrderList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.ORDER_LIST); return invoiceList; } public List<String> getBillToNameList() { waitForElementInvisible(driver, AbstractPageUI.ADMIN_LOADING_ICON); List<String> invoiceList = new ArrayList<String>(); invoiceList = getTextInListOfElement(driver, AdminInvoicesPageUI.BILL_TO_NAME_LIST); return invoiceList; } public void clickToAnyHeadings(String heading) { waitForElementVisible(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, heading); clickToElement(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, heading); } public boolean isSortingCorrectly(String heading, List<String> actualList) { List<String> expectedList = new ArrayList<String>(); List<Date> dateList = new ArrayList<Date>(); expectedList.addAll(actualList); SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy h:mm:ss a"); switch (heading) { case "Invoice Date": case "Order Date": for (String date : expectedList) { Date d1; try { d1 = formatter.parse(date); dateList.add(d1); } catch (ParseException e) { e.printStackTrace(); } } if (getAttributeValue(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, "title", heading).equals("desc")) { Collections.sort(dateList); expectedList.clear(); for (Date dat : dateList) { expectedList.add(dat.toString()); } return actualList.equals(expectedList); } else { Collections.sort(dateList, Collections.reverseOrder()); expectedList.clear(); for (Date dat : dateList) { expectedList.add(dat.toString()); } return actualList.equals(expectedList); } case "<NAME>": if (getAttributeValue(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, "title", heading).equals("desc")) { Collections.sort(expectedList, String.CASE_INSENSITIVE_ORDER); return actualList.equals(expectedList); } else { Collections.sort(expectedList, String.CASE_INSENSITIVE_ORDER); Collections.reverse(expectedList); return actualList.equals(expectedList); } default: if (getAttributeValue(driver, AdminInvoicesPageUI.DYNAMIC_HEADINGS, "title", heading).equals("desc")) { Collections.sort(expectedList); return actualList.equals(expectedList); } else { Collections.sort(expectedList, Collections.reverseOrder()); return actualList.equals(expectedList); } } } }
3,793
0.723348
0.722559
117
30.470085
27.300346
106
false
false
0
0
0
0
0
0
2.700855
false
false
8
4e4457df9e26947d7612a38715b87522c3014402
3,547,643,030,293
6d9a0c9d7c81e48abf866d49c35d5799f7a7db7d
/src/main/java/com/jvn/resume/section/ProjectSection.java
8b651dc2ea9c4203eafe692ca6b28cc60eb4e088
[ "MIT" ]
permissive
JohnVanNote/resume
https://github.com/JohnVanNote/resume
0b405678262b4ce38eac2e878ffaad33f7472564
7225bf8f6222f9dd579b9401d551a147bb93e4ca
refs/heads/master
2023-04-04T14:46:29.860000
2023-04-03T03:51:03
2023-04-03T03:51:03
66,990,028
0
1
MIT
false
2023-04-03T03:51:05
2016-08-31T01:09:48
2022-10-23T14:05:20
2023-04-03T03:51:03
2,983
0
1
1
TeX
false
false
package com.jvn.resume.section; import java.util.List; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Getter @NoArgsConstructor @Setter public class ProjectSection extends AbstractTitledSection { private List<String> projects; public static final String TITLE = "Personal Projects"; public String getTitle() { return TITLE; } }
UTF-8
Java
376
java
ProjectSection.java
Java
[]
null
[]
package com.jvn.resume.section; import java.util.List; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Getter @NoArgsConstructor @Setter public class ProjectSection extends AbstractTitledSection { private List<String> projects; public static final String TITLE = "Personal Projects"; public String getTitle() { return TITLE; } }
376
0.773936
0.773936
20
17.799999
17.710449
59
false
false
0
0
0
0
0
0
0.4
false
false
8
dde1f978571c9330994d25b0bb14305cb522847c
5,566,277,628,909
68016decf1e884753dd45e8211e873464fd56479
/src/broadcast_room/ClientHandler.java
e23fbb368d1d8959a34e7b3a41d29598176ad182
[]
no_license
morpheus9631/JavaSocket
https://github.com/morpheus9631/JavaSocket
57dc8657b2c29b41b06c6527151209c3ae5f968b
5a7f25a035d27d5aa8d609ce676358953f330cd4
refs/heads/master
2023-04-15T15:44:10.904000
2019-10-22T12:55:58
2019-10-22T12:55:58
202,486,154
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package broadcast_room; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.net.Socket; import java.net.SocketException; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import org.apache.commons.io.IOUtils; public class ClientHandler extends Thread { private String _Name; private Socket _ClientSocket; private DataInputStream _dis; private DataOutputStream _dos; private Map<String, DataOutputStream> _OutPool; private Map<String, Socket> _SocketPool; private volatile boolean isRunning = true; public ClientHandler( String name, Socket socket, DataOutputStream dos, Map<String, DataOutputStream> outPool, Map<String, Socket> socketPool ) { this._Name = name; this._ClientSocket = socket; this._dos = dos; this._OutPool = outPool; this._SocketPool = socketPool; try { this._dis = new DataInputStream(this._ClientSocket.getInputStream()); } catch (IOException e) { e.printStackTrace(); } } public String Name() { return this._Name; } @Override public void run() { try { while(isRunning) { String inStr = this._dis.readUTF(); System.out.format("\r\nRead (%s): '%s'\r\n", this._Name, inStr); ParseRequest pr = new ParseRequest(inStr); String type = pr.Type(); String strPayload = new String(pr.Payload()); // System.out.format("\r\n'%s', '%s'\r\n", type, new String(payload)); switch (type) { case "MSG": // System.out.format("MSG: '%s'\r\n", strPayload); this.broadCast(this._Name, strPayload); break; case "CMD": System.out.format("CMD: '%s'\r\n", strPayload); this.shutdown(this._Name); this.isRunning = false; break; case "CSV": System.out.format("CSV filename: '%s'\r\n", strPayload); System.out.println(); this.dealwithCSV(strPayload, this._dis, this._Name); break; default: } } this._dis.close(); this._dos.close(); this._ClientSocket.close(); } catch (EOFException ex) { this._SocketPool.remove(this._Name); this._OutPool.remove(this._Name); myPrinter.printException(this.getClass().getName(), ex); } catch (SocketException ex) { this._SocketPool.remove(this._Name); this._OutPool.remove(this._Name); myPrinter.printException(this.getClass().getName(), ex); } catch(IOException ex) { ex.printStackTrace(); } finally { IOUtils.closeQuietly(this._dis); IOUtils.closeQuietly(this._dos); IOUtils.closeQuietly(this._ClientSocket); } } public void broadCast(String srcName, String mesg) { for (Iterator<Entry<String, DataOutputStream>> it = this._OutPool.entrySet().iterator(); it.hasNext();) { Entry<String, DataOutputStream> entry = it.next(); String dstName = entry.getKey(); DataOutputStream dos = entry.getValue(); if (this._SocketPool.get(dstName).isClosed()) { this._SocketPool.remove(dstName); it.remove(); continue; } try { String outStr = String.format("%s: %s", srcName, mesg); dos.writeUTF(outStr); dos.flush(); System.out.format("Boradcast to %s: %s\r\n", dstName, outStr); } catch (SocketException ex) { System.out.format("%s: %s\r\n", ex.getMessage(), dstName); this._OutPool.remove(dstName); ex.printStackTrace(); } catch (IOException e) { System.out.println("\r\nException: "+ e.toString()); System.out.println("Location: ClientHandler -> broadCast()"); } } } private void shutdown(String srcName) throws IOException { // Sending number of connections message to command client int num_clients = 0; for (Iterator<Entry<String, Socket>> it = this._SocketPool.entrySet().iterator(); it.hasNext();) { Entry<String, Socket> entry = it.next(); Socket s = entry.getValue(); if (s.isConnected()) { num_clients++; } else { this._SocketPool.remove(entry.getKey()); } } String format = "Server: Number of connections is %d."; String payStr = String.format(format, num_clients); Request req = new Request("MSG", payStr.getBytes()); String outStr = new String(req.toWireFormat()); this._dos.writeUTF(outStr); this._dos.flush(); System.out.format("Send (%s): '%s'\r\n", srcName, outStr); // Send shutdown command to all clients for (Iterator<Entry<String, DataOutputStream>> it = this._OutPool.entrySet().iterator(); it.hasNext();) { Entry<String, DataOutputStream> entry = it.next(); String dstName = entry.getKey(); DataOutputStream dos = entry.getValue(); if (this._SocketPool.get(dstName).isClosed()) { this._SocketPool.remove(dstName); it.remove(); continue; } // Command Client must be the last shutdown if (dstName.equals(srcName)) { continue; } // Other clients shutdown req = new Request("CMD", "SHUTDOWN".getBytes()); outStr = new String(req.toWireFormat()); dos.writeUTF(outStr); dos.flush(); System.out.format("Send (%s): '%s'\r\n", dstName, outStr); this._SocketPool.get(dstName).close(); } // Last Shutdown req = new Request("CMD", "LAST SHUTDOWN".getBytes()); outStr = new String(req.toWireFormat()); DataOutputStream dos = this._OutPool.get(srcName); dos.writeUTF(outStr); dos.flush(); System.out.format("Send (%s): '%s'\r\n", srcName, outStr); this._SocketPool.get(srcName).close(); } private void dealwithCSV(String filename, DataInputStream dis, String srcName) { StringBuffer sb = new StringBuffer(); String new_filename = filename.replace(".csv", "_copy.csv"); String currpath = System.getProperty("user.dir"); String pathfile = String.format("%s\\%s", currpath, new_filename); File file = new File(pathfile); if (file.exists() & file.isFile()) { file.delete(); } FileOutputStream fos; BufferedOutputStream bos; System.out.println("\r\nCSV content:"); String split_line = new String(new char[80]).replace("\0", "-"); System.out.println(split_line); int size = 0; try { fos = new FileOutputStream(pathfile); bos = new BufferedOutputStream(fos); byte[] buffer = new byte[1024]; int bytesRead = 0; while ((bytesRead = dis.read(buffer)) > 0) { size += bytesRead; bos.write(buffer, 0, bytesRead); bos.flush(); String readStr = new String(buffer, 0, bytesRead); System.out.println(readStr); } bos.close(); fos.flush(); fos.close(); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(split_line); System.out.println("File size: " + size); // Calculates the unique username count Map<String, Integer> userMap = new HashMap<String, Integer>(); BufferedReader br; try { br = new BufferedReader(new FileReader(pathfile)); String lineStr = br.readLine(); String[] fields = lineStr.split(","); int fields_len = fields.length; int idx_username = -1; for (int i=0; i<fields.length; i++) { if ("preferredUsername".equals(fields[i].trim())) { idx_username = i; break; } } // System.out.println("username idx: " + idx_username); // Deal with content int num_line = 0; while ((lineStr = br.readLine()) != null) { num_line++; fields = lineStr.split(","); if (fields.length < fields_len) { System.out.format("%d: %s\r\n", num_line, lineStr); } String username = fields[idx_username]; userMap.putIfAbsent(username, 0); userMap.put(username, userMap.get(username)+1); } // System.out.println(userMap.toString()); br.close(); // Convert calculate result Object[] keys = userMap.keySet().toArray(); Arrays.sort(keys); for (Object key : keys) { int val = userMap.get(key); if (sb.length() > 0) sb.append(", "); sb.append(key+"="+val); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // System.out.println(sb.toString()); // Send calculate result to client String strPayload = sb.toString(); Request req = new Request("UAC", strPayload.getBytes()); String outStr = new String(req.toWireFormat()); DataOutputStream dos = this._OutPool.get(srcName); try { dos.writeUTF(outStr); dos.flush(); System.out.format("Send (%s): '%s'\r\n", srcName, outStr); } catch (IOException e) { e.printStackTrace(); } } @SuppressWarnings("unused") private void showSocketState(Socket socket) { System.out.println("Socket is Connected: "+socket.isConnected()); System.out.println("Socket is Bound: "+socket.isBound()); System.out.println("Socket is Closed: "+socket.isClosed()); } }
UTF-8
Java
10,128
java
ClientHandler.java
Java
[]
null
[]
package broadcast_room; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.net.Socket; import java.net.SocketException; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import org.apache.commons.io.IOUtils; public class ClientHandler extends Thread { private String _Name; private Socket _ClientSocket; private DataInputStream _dis; private DataOutputStream _dos; private Map<String, DataOutputStream> _OutPool; private Map<String, Socket> _SocketPool; private volatile boolean isRunning = true; public ClientHandler( String name, Socket socket, DataOutputStream dos, Map<String, DataOutputStream> outPool, Map<String, Socket> socketPool ) { this._Name = name; this._ClientSocket = socket; this._dos = dos; this._OutPool = outPool; this._SocketPool = socketPool; try { this._dis = new DataInputStream(this._ClientSocket.getInputStream()); } catch (IOException e) { e.printStackTrace(); } } public String Name() { return this._Name; } @Override public void run() { try { while(isRunning) { String inStr = this._dis.readUTF(); System.out.format("\r\nRead (%s): '%s'\r\n", this._Name, inStr); ParseRequest pr = new ParseRequest(inStr); String type = pr.Type(); String strPayload = new String(pr.Payload()); // System.out.format("\r\n'%s', '%s'\r\n", type, new String(payload)); switch (type) { case "MSG": // System.out.format("MSG: '%s'\r\n", strPayload); this.broadCast(this._Name, strPayload); break; case "CMD": System.out.format("CMD: '%s'\r\n", strPayload); this.shutdown(this._Name); this.isRunning = false; break; case "CSV": System.out.format("CSV filename: '%s'\r\n", strPayload); System.out.println(); this.dealwithCSV(strPayload, this._dis, this._Name); break; default: } } this._dis.close(); this._dos.close(); this._ClientSocket.close(); } catch (EOFException ex) { this._SocketPool.remove(this._Name); this._OutPool.remove(this._Name); myPrinter.printException(this.getClass().getName(), ex); } catch (SocketException ex) { this._SocketPool.remove(this._Name); this._OutPool.remove(this._Name); myPrinter.printException(this.getClass().getName(), ex); } catch(IOException ex) { ex.printStackTrace(); } finally { IOUtils.closeQuietly(this._dis); IOUtils.closeQuietly(this._dos); IOUtils.closeQuietly(this._ClientSocket); } } public void broadCast(String srcName, String mesg) { for (Iterator<Entry<String, DataOutputStream>> it = this._OutPool.entrySet().iterator(); it.hasNext();) { Entry<String, DataOutputStream> entry = it.next(); String dstName = entry.getKey(); DataOutputStream dos = entry.getValue(); if (this._SocketPool.get(dstName).isClosed()) { this._SocketPool.remove(dstName); it.remove(); continue; } try { String outStr = String.format("%s: %s", srcName, mesg); dos.writeUTF(outStr); dos.flush(); System.out.format("Boradcast to %s: %s\r\n", dstName, outStr); } catch (SocketException ex) { System.out.format("%s: %s\r\n", ex.getMessage(), dstName); this._OutPool.remove(dstName); ex.printStackTrace(); } catch (IOException e) { System.out.println("\r\nException: "+ e.toString()); System.out.println("Location: ClientHandler -> broadCast()"); } } } private void shutdown(String srcName) throws IOException { // Sending number of connections message to command client int num_clients = 0; for (Iterator<Entry<String, Socket>> it = this._SocketPool.entrySet().iterator(); it.hasNext();) { Entry<String, Socket> entry = it.next(); Socket s = entry.getValue(); if (s.isConnected()) { num_clients++; } else { this._SocketPool.remove(entry.getKey()); } } String format = "Server: Number of connections is %d."; String payStr = String.format(format, num_clients); Request req = new Request("MSG", payStr.getBytes()); String outStr = new String(req.toWireFormat()); this._dos.writeUTF(outStr); this._dos.flush(); System.out.format("Send (%s): '%s'\r\n", srcName, outStr); // Send shutdown command to all clients for (Iterator<Entry<String, DataOutputStream>> it = this._OutPool.entrySet().iterator(); it.hasNext();) { Entry<String, DataOutputStream> entry = it.next(); String dstName = entry.getKey(); DataOutputStream dos = entry.getValue(); if (this._SocketPool.get(dstName).isClosed()) { this._SocketPool.remove(dstName); it.remove(); continue; } // Command Client must be the last shutdown if (dstName.equals(srcName)) { continue; } // Other clients shutdown req = new Request("CMD", "SHUTDOWN".getBytes()); outStr = new String(req.toWireFormat()); dos.writeUTF(outStr); dos.flush(); System.out.format("Send (%s): '%s'\r\n", dstName, outStr); this._SocketPool.get(dstName).close(); } // Last Shutdown req = new Request("CMD", "LAST SHUTDOWN".getBytes()); outStr = new String(req.toWireFormat()); DataOutputStream dos = this._OutPool.get(srcName); dos.writeUTF(outStr); dos.flush(); System.out.format("Send (%s): '%s'\r\n", srcName, outStr); this._SocketPool.get(srcName).close(); } private void dealwithCSV(String filename, DataInputStream dis, String srcName) { StringBuffer sb = new StringBuffer(); String new_filename = filename.replace(".csv", "_copy.csv"); String currpath = System.getProperty("user.dir"); String pathfile = String.format("%s\\%s", currpath, new_filename); File file = new File(pathfile); if (file.exists() & file.isFile()) { file.delete(); } FileOutputStream fos; BufferedOutputStream bos; System.out.println("\r\nCSV content:"); String split_line = new String(new char[80]).replace("\0", "-"); System.out.println(split_line); int size = 0; try { fos = new FileOutputStream(pathfile); bos = new BufferedOutputStream(fos); byte[] buffer = new byte[1024]; int bytesRead = 0; while ((bytesRead = dis.read(buffer)) > 0) { size += bytesRead; bos.write(buffer, 0, bytesRead); bos.flush(); String readStr = new String(buffer, 0, bytesRead); System.out.println(readStr); } bos.close(); fos.flush(); fos.close(); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(split_line); System.out.println("File size: " + size); // Calculates the unique username count Map<String, Integer> userMap = new HashMap<String, Integer>(); BufferedReader br; try { br = new BufferedReader(new FileReader(pathfile)); String lineStr = br.readLine(); String[] fields = lineStr.split(","); int fields_len = fields.length; int idx_username = -1; for (int i=0; i<fields.length; i++) { if ("preferredUsername".equals(fields[i].trim())) { idx_username = i; break; } } // System.out.println("username idx: " + idx_username); // Deal with content int num_line = 0; while ((lineStr = br.readLine()) != null) { num_line++; fields = lineStr.split(","); if (fields.length < fields_len) { System.out.format("%d: %s\r\n", num_line, lineStr); } String username = fields[idx_username]; userMap.putIfAbsent(username, 0); userMap.put(username, userMap.get(username)+1); } // System.out.println(userMap.toString()); br.close(); // Convert calculate result Object[] keys = userMap.keySet().toArray(); Arrays.sort(keys); for (Object key : keys) { int val = userMap.get(key); if (sb.length() > 0) sb.append(", "); sb.append(key+"="+val); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // System.out.println(sb.toString()); // Send calculate result to client String strPayload = sb.toString(); Request req = new Request("UAC", strPayload.getBytes()); String outStr = new String(req.toWireFormat()); DataOutputStream dos = this._OutPool.get(srcName); try { dos.writeUTF(outStr); dos.flush(); System.out.format("Send (%s): '%s'\r\n", srcName, outStr); } catch (IOException e) { e.printStackTrace(); } } @SuppressWarnings("unused") private void showSocketState(Socket socket) { System.out.println("Socket is Connected: "+socket.isConnected()); System.out.println("Socket is Bound: "+socket.isBound()); System.out.println("Socket is Closed: "+socket.isClosed()); } }
10,128
0.579483
0.577409
324
29.25926
20.326366
80
false
false
0
0
0
0
0
0
0.774691
false
false
8
1bde96f3ead17f05faa80b6d9328c1f7d67edc00
19,490,561,619,424
b1d9c8c10e5fbe82a8e5aeca0706e9bb9156252c
/Java/_1_TwoSum.java
d39f7401fe3c0761557193f325533e78b5f6520f
[]
no_license
Anderbone/leetcode
https://github.com/Anderbone/leetcode
0ab6808f4ce640477abf9686e959930d309086ef
7e6d4f6677688fe96001bde88a4cab4ac342d4a8
refs/heads/master
2021-12-10T05:23:28.055000
2021-12-07T21:36:42
2021-12-07T21:36:42
187,881,087
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package leetcode; import java.util.HashMap; /* * #easy #array #hash table * Given an array of integers, return indices of the two numbers * such that they add up to a specific target. * You may assume that each input would have exactly one solution, * and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. */ public class _1_TwoSum { public static int[] twoSum1(int[] nums, int target) { int[] ans = new int[2]; for(int i=0; i<nums.length; i++){ for(int j =0; j<nums.length; j++){ while(i!=j){ if(target - nums[i] == nums[j]){ ans[0] = i; ans[1] = j; return ans; } } } } return ans; } public static int[] twoSum2(int[] nums, int target){ int[] ans = new int[2]; HashMap<Integer, Integer> ha = new HashMap<Integer,Integer>(); for(int i = 0; i<nums.length; i++){ if(ha.containsKey(target - nums[i])){ ans[0] = i; ans[1] = ha.get(target - nums[i]); return ans; }else{ ha.put(nums[i],i); } } return null; } public static int[] twoSum3(int[] nums, int target){ HashMap<Integer, Integer> map1=new HashMap<Integer, Integer>(); int[] arr=new int[2]; for(int i=0; i<nums.length; i++){ int ss=target-nums[i]; if (map1.get(ss) != null) { arr[0]=map1.get(ss); arr[1]=i; return arr; } else{ map1.put(nums[i], i); } } return null; } public static void main(String[] args) { int[] nums = {2,7,11,15}; int t = 9; int a[] = twoSum3(nums,t); System.out.println(a[0]); System.out.println(a[1]); } }
UTF-8
Java
1,792
java
_1_TwoSum.java
Java
[]
null
[]
package leetcode; import java.util.HashMap; /* * #easy #array #hash table * Given an array of integers, return indices of the two numbers * such that they add up to a specific target. * You may assume that each input would have exactly one solution, * and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. */ public class _1_TwoSum { public static int[] twoSum1(int[] nums, int target) { int[] ans = new int[2]; for(int i=0; i<nums.length; i++){ for(int j =0; j<nums.length; j++){ while(i!=j){ if(target - nums[i] == nums[j]){ ans[0] = i; ans[1] = j; return ans; } } } } return ans; } public static int[] twoSum2(int[] nums, int target){ int[] ans = new int[2]; HashMap<Integer, Integer> ha = new HashMap<Integer,Integer>(); for(int i = 0; i<nums.length; i++){ if(ha.containsKey(target - nums[i])){ ans[0] = i; ans[1] = ha.get(target - nums[i]); return ans; }else{ ha.put(nums[i],i); } } return null; } public static int[] twoSum3(int[] nums, int target){ HashMap<Integer, Integer> map1=new HashMap<Integer, Integer>(); int[] arr=new int[2]; for(int i=0; i<nums.length; i++){ int ss=target-nums[i]; if (map1.get(ss) != null) { arr[0]=map1.get(ss); arr[1]=i; return arr; } else{ map1.put(nums[i], i); } } return null; } public static void main(String[] args) { int[] nums = {2,7,11,15}; int t = 9; int a[] = twoSum3(nums,t); System.out.println(a[0]); System.out.println(a[1]); } }
1,792
0.532475
0.507279
79
21.607595
18.273878
68
false
false
0
0
0
0
0
0
2.443038
false
false
8
f02efcc6dc1100cc8b5c88d093ece27ff8a4bb2e
1,778,116,465,544
491ee5e6ea71314fc4b6e28903d0965c910dbbd8
/app/src/main/java/com/yardspoon/androidarchtest/screens/ScreensDIModule.java
af523ff1b8a3a753a8f75657d6582c460c213789
[]
no_license
benjaminplee/AndroidArchTest
https://github.com/benjaminplee/AndroidArchTest
6b2b5a205f9130fb7e876f2ea551667e267e002d
808ddfd1c6b6235395800c954a5dfd1efbd3a5ed
refs/heads/master
2021-01-20T21:32:03.425000
2017-08-22T20:32:09
2017-08-22T20:32:09
101,766,318
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yardspoon.androidarchtest.screens; import com.yardspoon.androidarchtest.screens.main.MainActivity; import dagger.Module; import dagger.android.ContributesAndroidInjector; @Module public abstract class ScreensDIModule { @ContributesAndroidInjector() abstract MainActivity contributeYourActivityInjector(); }
UTF-8
Java
331
java
ScreensDIModule.java
Java
[]
null
[]
package com.yardspoon.androidarchtest.screens; import com.yardspoon.androidarchtest.screens.main.MainActivity; import dagger.Module; import dagger.android.ContributesAndroidInjector; @Module public abstract class ScreensDIModule { @ContributesAndroidInjector() abstract MainActivity contributeYourActivityInjector(); }
331
0.833837
0.833837
13
24.461538
23.679317
63
false
false
0
0
0
0
0
0
0.384615
false
false
8
502b1356e69b37b05c333d06c5b1cfd933b2439d
22,625,887,745,910
6a99c57e9bf376009c81dcd0df7315c4c2c963e5
/TeamCode/src/main/java/org/firstinspires/ftc/team7316/modes/test_opmodes/SimultaneousKeyTest.java
d12b734e85247ff983b4b20c53556afbaf3570b3
[ "BSD-3-Clause" ]
permissive
Iron-Panthers/FTC-2017
https://github.com/Iron-Panthers/FTC-2017
e032dea0a3fe595a682fe31796b1f98a656e4a44
9abdf82c718d33b32febd39f96d26e5c071bc384
refs/heads/master
2018-12-07T20:39:25.096000
2018-09-12T02:01:42
2018-09-12T02:01:42
103,326,283
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.firstinspires.ftc.team7316.modes.test_opmodes; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import org.firstinspires.ftc.team7316.modes.AutoBaseOpMode; import org.firstinspires.ftc.team7316.util.Hardware; import org.firstinspires.ftc.team7316.util.Scheduler; import org.firstinspires.ftc.team7316.util.commands.AutoCodes; import org.firstinspires.ftc.team7316.util.commands.drive.DriveForTime; import org.firstinspires.ftc.team7316.util.commands.drive.distance.DriveDistance; import org.firstinspires.ftc.team7316.util.commands.drive.turn.TurnGyroPID; import org.firstinspires.ftc.team7316.util.commands.flow.SequentialCommand; import org.firstinspires.ftc.team7316.util.commands.flow.SimultaneousKeyCommand; import org.firstinspires.ftc.team7316.util.commands.intake.MoveIntakeArm; import org.firstinspires.ftc.team7316.util.commands.intake.RunIntake; /** * Created by jerry on 2/8/18. */ public class SimultaneousKeyTest extends AutoBaseOpMode { @Override public void onInit() { // Scheduler.instance.add( // new SequentialCommand( // new TurnGyroPID(90), // new SequentialCommand( // new DriveForTime(0.4, 0, 1), // new SimultaneousKeyCommand( // new DriveDistance(10), // new RunIntake(-0.7) // ), // new SimultaneousKeyCommand( // new DriveDistance(-10), // new RunIntake(-0.7) // ), // new TurnGyroPID(180) // ), // new SimultaneousKeyCommand( // new TurnGyroPID(0), // new RunIntake(0.44) // ), // new DriveDistance(-10) // ) // ); Scheduler.instance.add(AutoCodes.closeMultiglyph(false)); } @Override public void onLoop() { Hardware.log("fatty", "fatty"); } }
UTF-8
Java
2,035
java
SimultaneousKeyTest.java
Java
[ { "context": "util.commands.intake.RunIntake;\n\n/**\n * Created by jerry on 2/8/18.\n */\n\npublic class SimultaneousKeyT", "end": 901, "score": 0.6318396925926208, "start": 900, "tag": "NAME", "value": "j" }, { "context": "il.commands.intake.RunIntake;\n\n/**\n * Created by jerry on 2/8/18.\n */\n\npublic class SimultaneousKeyTest ", "end": 905, "score": 0.5993351936340332, "start": 901, "tag": "USERNAME", "value": "erry" } ]
null
[]
package org.firstinspires.ftc.team7316.modes.test_opmodes; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import org.firstinspires.ftc.team7316.modes.AutoBaseOpMode; import org.firstinspires.ftc.team7316.util.Hardware; import org.firstinspires.ftc.team7316.util.Scheduler; import org.firstinspires.ftc.team7316.util.commands.AutoCodes; import org.firstinspires.ftc.team7316.util.commands.drive.DriveForTime; import org.firstinspires.ftc.team7316.util.commands.drive.distance.DriveDistance; import org.firstinspires.ftc.team7316.util.commands.drive.turn.TurnGyroPID; import org.firstinspires.ftc.team7316.util.commands.flow.SequentialCommand; import org.firstinspires.ftc.team7316.util.commands.flow.SimultaneousKeyCommand; import org.firstinspires.ftc.team7316.util.commands.intake.MoveIntakeArm; import org.firstinspires.ftc.team7316.util.commands.intake.RunIntake; /** * Created by jerry on 2/8/18. */ public class SimultaneousKeyTest extends AutoBaseOpMode { @Override public void onInit() { // Scheduler.instance.add( // new SequentialCommand( // new TurnGyroPID(90), // new SequentialCommand( // new DriveForTime(0.4, 0, 1), // new SimultaneousKeyCommand( // new DriveDistance(10), // new RunIntake(-0.7) // ), // new SimultaneousKeyCommand( // new DriveDistance(-10), // new RunIntake(-0.7) // ), // new TurnGyroPID(180) // ), // new SimultaneousKeyCommand( // new TurnGyroPID(0), // new RunIntake(0.44) // ), // new DriveDistance(-10) // ) // ); Scheduler.instance.add(AutoCodes.closeMultiglyph(false)); } @Override public void onLoop() { Hardware.log("fatty", "fatty"); } }
2,035
0.611794
0.574939
53
37.396225
24.281633
81
false
false
0
0
0
0
0
0
0.528302
false
false
8
f175b54ff94b2093bf1c919af774e57a9ab5c312
30,537,217,478,445
ee8019c726dc17e3e930ad6f92cfc2520e99b833
/facade-gateway/src/main/java/ru/otus/example/facadegateway/model/AuthInfo.java
58a0a323b4ac9ae6fc21bf8b5b1dd9d2e9ee1bcc
[]
no_license
audiz/FitStore
https://github.com/audiz/FitStore
f69602db233cac32940a17d8089f505870ddedbf
d07a88c182935eb1331934fc6a23674704c12ea8
refs/heads/main
2023-06-03T00:47:17.336000
2021-06-21T13:56:22
2021-06-21T13:56:22
368,632,322
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.otus.example.facadegateway.model; import lombok.Data; @Data public class AuthInfo { private boolean authenticated; private String username; }
UTF-8
Java
163
java
AuthInfo.java
Java
[]
null
[]
package ru.otus.example.facadegateway.model; import lombok.Data; @Data public class AuthInfo { private boolean authenticated; private String username; }
163
0.766871
0.766871
9
17.111111
15.480773
44
false
false
0
0
0
0
0
0
0.444444
false
false
8
17b9d81a241f016442bca8ff464c3aaf2c2f0b57
11,905,649,359,590
de82e5bea50f2fc664b8ed165ffa2043af26de9c
/cultraview/NewSettings/security/src/main/java/com/ctv/settings/security/adapter/PermissionsListAadpter.java
c07a792baf08625ad63522241661192a2c85b48a
[]
no_license
xuzemin/xuzemin
https://github.com/xuzemin/xuzemin
4ed8a68e34c9847dbbddc7844319cccb70c34902
56d50e4ca060993b352a00edf8abbd03726afbb1
refs/heads/master
2021-07-02T17:50:14.423000
2020-11-23T09:49:49
2020-11-23T09:49:49
32,496,595
0
6
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ctv.settings.security.adapter; import android.content.Context; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.ctv.settings.security.bean.ApkInfo; import com.ctv.settings.security.R; import java.util.List; public class PermissionsListAadpter extends BaseAdapter { private PackageManager packageManager; private LayoutInflater inflater; private Context context; private List<ApkInfo> packages; private int selectedId = -1; public void setAppData(List<ApkInfo> packages) { this.packages = packages; notifyDataSetChanged(); } public PermissionsListAadpter(Context context, List<ApkInfo> packages) { this.context = context; this.packages = packages; inflater = LayoutInflater.from(context); packageManager = context.getPackageManager(); } @Override public int getCount() { return packages == null ? 0 : packages.size(); } @Override public Object getItem(int i) { return packages.get(i); } @Override public long getItemId(int i) { return 0; } public void setSelectedId(int selectedId) { this.selectedId = selectedId; notifyDataSetChanged(); } @Override public View getView(int i, View convertView, ViewGroup parent) { ViewHolder holder = null; ApkInfo appInfo = packages.get(i); String appName = appInfo.getLabel(); Drawable icon = appInfo.getApk_icon(); if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.permission_item_adapter, null); // convertView.setAlpha(0.5f); holder.tv = (TextView) convertView.findViewById(R.id.app_item_tv); holder.iv = (ImageView) convertView.findViewById(R.id.app_item_iv); holder.iv.setImageDrawable(icon); holder.tv.setText(appName); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); holder.iv.setImageDrawable(icon); holder.tv.setText(appName); } return convertView; } class ViewHolder { ImageView iv; TextView tv; } }
UTF-8
Java
2,288
java
PermissionsListAadpter.java
Java
[]
null
[]
package com.ctv.settings.security.adapter; import android.content.Context; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.ctv.settings.security.bean.ApkInfo; import com.ctv.settings.security.R; import java.util.List; public class PermissionsListAadpter extends BaseAdapter { private PackageManager packageManager; private LayoutInflater inflater; private Context context; private List<ApkInfo> packages; private int selectedId = -1; public void setAppData(List<ApkInfo> packages) { this.packages = packages; notifyDataSetChanged(); } public PermissionsListAadpter(Context context, List<ApkInfo> packages) { this.context = context; this.packages = packages; inflater = LayoutInflater.from(context); packageManager = context.getPackageManager(); } @Override public int getCount() { return packages == null ? 0 : packages.size(); } @Override public Object getItem(int i) { return packages.get(i); } @Override public long getItemId(int i) { return 0; } public void setSelectedId(int selectedId) { this.selectedId = selectedId; notifyDataSetChanged(); } @Override public View getView(int i, View convertView, ViewGroup parent) { ViewHolder holder = null; ApkInfo appInfo = packages.get(i); String appName = appInfo.getLabel(); Drawable icon = appInfo.getApk_icon(); if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.permission_item_adapter, null); // convertView.setAlpha(0.5f); holder.tv = (TextView) convertView.findViewById(R.id.app_item_tv); holder.iv = (ImageView) convertView.findViewById(R.id.app_item_iv); holder.iv.setImageDrawable(icon); holder.tv.setText(appName); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); holder.iv.setImageDrawable(icon); holder.tv.setText(appName); } return convertView; } class ViewHolder { ImageView iv; TextView tv; } }
2,288
0.714161
0.711976
91
23.142857
19.451021
73
false
false
0
0
0
0
0
0
1.714286
false
false
8
06b3696ea4a276af8684cbb97557afd46287834f
11,467,562,746,276
ae9d428ef0386d449736dd2a8f4563493d8e0db5
/src/main/java/org/apereo/portlet/soffit/mvc/SoffitController.java
066930f1c09436ed1bab08821be3f2af04f18280
[ "Apache-2.0" ]
permissive
cousquer/Soffit
https://github.com/cousquer/Soffit
445a4aa6ecc0d85d5de63c7031ece52d755e88f5
a87fc44807d7d992cf949950c6eda98632ecffd1
refs/heads/master
2020-12-31T06:31:35.491000
2016-05-10T18:20:53
2016-05-10T18:20:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Licensed to Apereo under one or more contributor license * agreements. See the NOTICE file distributed with this work * for additional information regarding copyright ownership. * Apereo 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 the following location: * * 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.apereo.portlet.soffit.mvc; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.PostConstruct; import javax.portlet.PortletConfig; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequest; import javax.servlet.ServletContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.ServletContextAware; import org.springframework.web.portlet.bind.annotation.RenderMapping; import org.springframework.web.portlet.context.PortletConfigAware; @Controller @RequestMapping(value={"VIEW","EDIT","HELP"}) public class SoffitController implements ServletContextAware, PortletConfigAware { public static final String VIEWS_LOCATION_INIT_PARAM = "viewsLocation"; public static final String VIEWS_LOCATION_DEFAULT = "/WEB-INF/soffit/"; private static final String VIEW_NOT_PROVIDED = SoffitController.class.getName() + ".VIEW_NOT_PROVIDED"; private ServletContext servletContext; private PortletConfig portletConfig; private String viewsLocation = null; // default; indicates we're not running in a portlet container private final Map<String,Map<String,String>> availableViews = new HashMap<>(); protected final Logger logger = LoggerFactory.getLogger(getClass()); @Override public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } @Override public void setPortletConfig(PortletConfig portletConfig) { this.portletConfig = portletConfig; } @PostConstruct public void init() { if (portletConfig != null) { /* * We are running in a portlet container and will therefore provide * portlet-based services. (Anything special we should do if we * aren't?) */ viewsLocation = portletConfig.getInitParameter(VIEWS_LOCATION_INIT_PARAM); if (viewsLocation == null) { /* * This circumstance means the viewsLocation portlet init * parameter was not set; use VIEWS_LOCATION_DEFAULT. */ viewsLocation = VIEWS_LOCATION_DEFAULT; } } } @RenderMapping public String render(final PortletRequest req) { if (viewsLocation == null) { /* * We're NOT running in a portlet container (as far as we know). */ throw new IllegalStateException("Portlet not initialized; the PortletConfig was not provided."); } return selectView(req); } @ModelAttribute("preferences") public Map<String,List<String>> getPreferences(final PortletPreferences portletPreferences) { final Map<String,List<String>> rslt = new HashMap<>(); for (Map.Entry<String,String[]> y : portletPreferences.getMap().entrySet()) { rslt.put(y.getKey(), Arrays.asList(y.getValue())); } return rslt; } /* * Implementation */ private String selectView(final PortletRequest req) { // Narrow the choices based on PortletMode final String portletModeLowercase = req.getPortletMode().toString().toLowerCase(); Map<String,String> viewsForMode = availableViews.get(portletModeLowercase); if (viewsForMode == null) { // First time for this PortletMode; seed the Map viewsForMode = new HashMap<>(); availableViews.put(portletModeLowercase, viewsForMode); } // Narrow the choices further based on WindowState final String windowStateLowercase = req.getWindowState().toString().toLowerCase(); String rslt = viewsForMode.get(windowStateLowercase); if (rslt == null) { /* * This circumstance means that we haven't looked (yet); * check for a file named to match this pattern. */ final String pathBasedOnModeAndState = getCompletePathforParts(req, portletModeLowercase, windowStateLowercase); final File fileBasedOnModeAndState = new File(servletContext.getRealPath(pathBasedOnModeAndState)); if (fileBasedOnModeAndState.exists()) { // We have a winner! viewsForMode.put(windowStateLowercase, pathBasedOnModeAndState); rslt = pathBasedOnModeAndState; } else { // Trigger the next resolution step viewsForMode.put(windowStateLowercase, VIEW_NOT_PROVIDED); rslt = VIEW_NOT_PROVIDED; } } if (rslt.equals(VIEW_NOT_PROVIDED)) { /* * This circumstance means that there isn't a specific view for this * PortletMode *and* WindowState; widen the search to PortletMode only. */ final String pathBasedOnModeOnly = getCompletePathforParts(req, portletModeLowercase); final File fileBasedOnModeOnly = new File(servletContext.getRealPath(pathBasedOnModeOnly)); if (fileBasedOnModeOnly.exists()) { // We still need to store the choice so we're not constantly looking viewsForMode.put(windowStateLowercase, pathBasedOnModeOnly); rslt = pathBasedOnModeOnly; } else { // TODO: Maybe insert some helpful instructions from the classpath? throw new IllegalStateException("Unable to select a view for PortletMode=" + req.getPortletMode() + " and WindowState=" + req.getWindowState()); } } logger.info("Selected viewName='{}' for PortletMode='{}' and WindowState='{}'", rslt, req.getPortletMode(), req.getWindowState()); return rslt; } private String getCompletePathforParts(final PortletRequest req, final String... parts) { StringBuilder path = new StringBuilder().append(viewsLocation); if (!viewsLocation.endsWith("/")) { // Final slash in the init param is optional path.append("/"); } for (String part : parts) { path.append(part).append("."); } path.append("jsp"); logger.debug("Calculated path '{}' for parts={}", path, parts); return path.toString(); } }
UTF-8
Java
7,427
java
SoffitController.java
Java
[]
null
[]
/** * Licensed to Apereo under one or more contributor license * agreements. See the NOTICE file distributed with this work * for additional information regarding copyright ownership. * Apereo 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 the following location: * * 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.apereo.portlet.soffit.mvc; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.PostConstruct; import javax.portlet.PortletConfig; import javax.portlet.PortletPreferences; import javax.portlet.PortletRequest; import javax.servlet.ServletContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.ServletContextAware; import org.springframework.web.portlet.bind.annotation.RenderMapping; import org.springframework.web.portlet.context.PortletConfigAware; @Controller @RequestMapping(value={"VIEW","EDIT","HELP"}) public class SoffitController implements ServletContextAware, PortletConfigAware { public static final String VIEWS_LOCATION_INIT_PARAM = "viewsLocation"; public static final String VIEWS_LOCATION_DEFAULT = "/WEB-INF/soffit/"; private static final String VIEW_NOT_PROVIDED = SoffitController.class.getName() + ".VIEW_NOT_PROVIDED"; private ServletContext servletContext; private PortletConfig portletConfig; private String viewsLocation = null; // default; indicates we're not running in a portlet container private final Map<String,Map<String,String>> availableViews = new HashMap<>(); protected final Logger logger = LoggerFactory.getLogger(getClass()); @Override public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } @Override public void setPortletConfig(PortletConfig portletConfig) { this.portletConfig = portletConfig; } @PostConstruct public void init() { if (portletConfig != null) { /* * We are running in a portlet container and will therefore provide * portlet-based services. (Anything special we should do if we * aren't?) */ viewsLocation = portletConfig.getInitParameter(VIEWS_LOCATION_INIT_PARAM); if (viewsLocation == null) { /* * This circumstance means the viewsLocation portlet init * parameter was not set; use VIEWS_LOCATION_DEFAULT. */ viewsLocation = VIEWS_LOCATION_DEFAULT; } } } @RenderMapping public String render(final PortletRequest req) { if (viewsLocation == null) { /* * We're NOT running in a portlet container (as far as we know). */ throw new IllegalStateException("Portlet not initialized; the PortletConfig was not provided."); } return selectView(req); } @ModelAttribute("preferences") public Map<String,List<String>> getPreferences(final PortletPreferences portletPreferences) { final Map<String,List<String>> rslt = new HashMap<>(); for (Map.Entry<String,String[]> y : portletPreferences.getMap().entrySet()) { rslt.put(y.getKey(), Arrays.asList(y.getValue())); } return rslt; } /* * Implementation */ private String selectView(final PortletRequest req) { // Narrow the choices based on PortletMode final String portletModeLowercase = req.getPortletMode().toString().toLowerCase(); Map<String,String> viewsForMode = availableViews.get(portletModeLowercase); if (viewsForMode == null) { // First time for this PortletMode; seed the Map viewsForMode = new HashMap<>(); availableViews.put(portletModeLowercase, viewsForMode); } // Narrow the choices further based on WindowState final String windowStateLowercase = req.getWindowState().toString().toLowerCase(); String rslt = viewsForMode.get(windowStateLowercase); if (rslt == null) { /* * This circumstance means that we haven't looked (yet); * check for a file named to match this pattern. */ final String pathBasedOnModeAndState = getCompletePathforParts(req, portletModeLowercase, windowStateLowercase); final File fileBasedOnModeAndState = new File(servletContext.getRealPath(pathBasedOnModeAndState)); if (fileBasedOnModeAndState.exists()) { // We have a winner! viewsForMode.put(windowStateLowercase, pathBasedOnModeAndState); rslt = pathBasedOnModeAndState; } else { // Trigger the next resolution step viewsForMode.put(windowStateLowercase, VIEW_NOT_PROVIDED); rslt = VIEW_NOT_PROVIDED; } } if (rslt.equals(VIEW_NOT_PROVIDED)) { /* * This circumstance means that there isn't a specific view for this * PortletMode *and* WindowState; widen the search to PortletMode only. */ final String pathBasedOnModeOnly = getCompletePathforParts(req, portletModeLowercase); final File fileBasedOnModeOnly = new File(servletContext.getRealPath(pathBasedOnModeOnly)); if (fileBasedOnModeOnly.exists()) { // We still need to store the choice so we're not constantly looking viewsForMode.put(windowStateLowercase, pathBasedOnModeOnly); rslt = pathBasedOnModeOnly; } else { // TODO: Maybe insert some helpful instructions from the classpath? throw new IllegalStateException("Unable to select a view for PortletMode=" + req.getPortletMode() + " and WindowState=" + req.getWindowState()); } } logger.info("Selected viewName='{}' for PortletMode='{}' and WindowState='{}'", rslt, req.getPortletMode(), req.getWindowState()); return rslt; } private String getCompletePathforParts(final PortletRequest req, final String... parts) { StringBuilder path = new StringBuilder().append(viewsLocation); if (!viewsLocation.endsWith("/")) { // Final slash in the init param is optional path.append("/"); } for (String part : parts) { path.append(part).append("."); } path.append("jsp"); logger.debug("Calculated path '{}' for parts={}", path, parts); return path.toString(); } }
7,427
0.656389
0.655581
193
37.481865
31.843708
124
false
false
0
0
0
0
0
0
0.492228
false
false
8
cd189fa070f58d759a42247c6f146c596b35f26a
8,452,495,651,725
6f5665e3ad1fe4d9461e088b0b3e4dfba8a5d5e0
/by/epam/training/dao/impl/DbDAO.java
243bd5e6b6d6b73533001e2de4fc9fb8e5429591
[]
no_license
OSmol/CheckPointProject
https://github.com/OSmol/CheckPointProject
f91bdb25d07765c2bf76d0985af254aeb2b4021c
afe4c1d42e00dba67771478f654856cfb9f9bc4f
refs/heads/master
2017-12-25T22:43:10.196000
2016-10-31T19:38:36
2016-10-31T19:38:36
72,470,654
0
0
null
true
2016-10-31T19:26:25
2016-10-31T19:26:25
2016-10-19T20:38:17
2016-10-20T13:38:41
16
0
0
0
null
null
null
package by.epam.training.dao.impl; import by.epam.training.bean.entity.Goods; import by.epam.training.dao.BCDao; import by.epam.training.dao.exception.DAOException; import java.sql.*;// не импортим со * import java.util.ArrayList; import java.util.List; /** * Created by Алексей on 19.10.2016. */ public class DbDAO implements BCDao { private static final String url = "jdbc:mysql://localhost:3306/bicycle_goods?autoReconnect=true&useSSL=false"; private static final String addStatement = "INSERT INTO features (idfeatures, category, name, cost) VALUES (?,?,?,?)"; private static final String deleteStatement = "DELETE FROM features WHERE idfeatures = (?)"; private static final String selectStatement = "SELECT * FROM `bicycle_goods`.`features`;"; @Override public void addGoods(int id, String category, String name, double cost) throws DAOException { Connection connection = null; PreparedStatement st = null; try { connection = DriverManager.getConnection(url,"root","root");// что делаем с константными строками? try {// try в try в одной области видимости - что за бред? st = connection.prepareStatement(addStatement); st.setInt(1, id); st.setString(2, category); st.setString(3, name); st.setDouble(4, cost); st.executeUpdate(); } catch (SQLException e1) { throw new DAOException();// о, потерял исходное исключение, растаряша } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close();// ты уже соединение закрыл, зачем же со statement-от мучаешься? } catch (SQLException e) { throw new DAOException();// ну и зачет здесь в блоке finelly выбрасывать исключение? } } } @Override public void deleteGoods(int id) throws DAOException { Connection connection = null; PreparedStatement st = null; try { connection = DriverManager.getConnection(url,"root","root"); try { st = connection.prepareStatement(deleteStatement); st.setInt(1, id); st.executeUpdate(); } catch (SQLException e1) { throw new DAOException(); } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close(); } catch (SQLException e) { throw new DAOException(); } } } @Override public List<Goods> findGoods(String category)throws DAOException { List<Goods> list = new ArrayList<>(); StringBuilder str = new StringBuilder("SELECT * FROM `bicycle_goods`.`features` WHERE `category` =" ); str.append("'"); str.append(category); str.append("'"); Connection connection = null; Statement st = null; try { connection = DriverManager.getConnection(url,"root","root"); st = connection.createStatement(); try { ResultSet rs = st.executeQuery(str.toString()); while (rs.next()) { list.add(new Goods(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getDouble(4))); } } catch (SQLException e1) { throw new DAOException(); } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close(); } catch (SQLException e) { throw new DAOException(); } } return list; } @Override public List<Goods> findGoods() throws DAOException { List<Goods> list = new ArrayList<>(); Connection connection = null; PreparedStatement st = null; try { connection = DriverManager.getConnection(url,"root","root"); try { st = connection.prepareStatement(selectStatement); ResultSet resultSet = st.executeQuery(); while (resultSet.next()) { list.add(new Goods(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3), resultSet.getDouble(4))); // а вот вспомнишь ли ты, что возвращает getString(3), не лазя по другому коду? } } catch (SQLException e1) { throw new DAOException(); } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close(); } catch (SQLException e) { throw new DAOException(); } } return list; } }
UTF-8
Java
6,004
java
DbDAO.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Алексей on 19.10.2016.\n */\npublic class DbDAO implements ", "end": 282, "score": 0.9997180104255676, "start": 275, "tag": "NAME", "value": "Алексей" } ]
null
[]
package by.epam.training.dao.impl; import by.epam.training.bean.entity.Goods; import by.epam.training.dao.BCDao; import by.epam.training.dao.exception.DAOException; import java.sql.*;// не импортим со * import java.util.ArrayList; import java.util.List; /** * Created by Алексей on 19.10.2016. */ public class DbDAO implements BCDao { private static final String url = "jdbc:mysql://localhost:3306/bicycle_goods?autoReconnect=true&useSSL=false"; private static final String addStatement = "INSERT INTO features (idfeatures, category, name, cost) VALUES (?,?,?,?)"; private static final String deleteStatement = "DELETE FROM features WHERE idfeatures = (?)"; private static final String selectStatement = "SELECT * FROM `bicycle_goods`.`features`;"; @Override public void addGoods(int id, String category, String name, double cost) throws DAOException { Connection connection = null; PreparedStatement st = null; try { connection = DriverManager.getConnection(url,"root","root");// что делаем с константными строками? try {// try в try в одной области видимости - что за бред? st = connection.prepareStatement(addStatement); st.setInt(1, id); st.setString(2, category); st.setString(3, name); st.setDouble(4, cost); st.executeUpdate(); } catch (SQLException e1) { throw new DAOException();// о, потерял исходное исключение, растаряша } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close();// ты уже соединение закрыл, зачем же со statement-от мучаешься? } catch (SQLException e) { throw new DAOException();// ну и зачет здесь в блоке finelly выбрасывать исключение? } } } @Override public void deleteGoods(int id) throws DAOException { Connection connection = null; PreparedStatement st = null; try { connection = DriverManager.getConnection(url,"root","root"); try { st = connection.prepareStatement(deleteStatement); st.setInt(1, id); st.executeUpdate(); } catch (SQLException e1) { throw new DAOException(); } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close(); } catch (SQLException e) { throw new DAOException(); } } } @Override public List<Goods> findGoods(String category)throws DAOException { List<Goods> list = new ArrayList<>(); StringBuilder str = new StringBuilder("SELECT * FROM `bicycle_goods`.`features` WHERE `category` =" ); str.append("'"); str.append(category); str.append("'"); Connection connection = null; Statement st = null; try { connection = DriverManager.getConnection(url,"root","root"); st = connection.createStatement(); try { ResultSet rs = st.executeQuery(str.toString()); while (rs.next()) { list.add(new Goods(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getDouble(4))); } } catch (SQLException e1) { throw new DAOException(); } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close(); } catch (SQLException e) { throw new DAOException(); } } return list; } @Override public List<Goods> findGoods() throws DAOException { List<Goods> list = new ArrayList<>(); Connection connection = null; PreparedStatement st = null; try { connection = DriverManager.getConnection(url,"root","root"); try { st = connection.prepareStatement(selectStatement); ResultSet resultSet = st.executeQuery(); while (resultSet.next()) { list.add(new Goods(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3), resultSet.getDouble(4))); // а вот вспомнишь ли ты, что возвращает getString(3), не лазя по другому коду? } } catch (SQLException e1) { throw new DAOException(); } } catch (SQLException e) { throw new DAOException(); } finally { if (connection!= null) try { connection.close(); } catch (SQLException e) { throw new DAOException(); } try { st.close(); } catch (SQLException e) { throw new DAOException(); } } return list; } }
6,004
0.516151
0.510941
182
30.631868
27.431467
133
false
false
0
0
0
0
0
0
0.571429
false
false
8
e21fb3d4e5c682d59db7f8b32061079df993a158
24,824,910,984,578
0322119e2257195a9353d973fb4dbb58ecdd35c2
/backend/src/br/unesp/rc/curriculumGenerator/controller/command/NewCurriculum.java
511f10d7367006a6f26c315eaaf19670090ca563
[]
no_license
bleandro/curriculum-generator
https://github.com/bleandro/curriculum-generator
58403b85a4e1b7f99a6b52971c7d7eee3a3e7880
4cd1f645eda0eed4fbc24620337c6a79d7bbbf06
refs/heads/master
2020-03-22T08:32:57.322000
2018-06-28T03:18:54
2018-06-28T03:18:54
132,539,956
1
0
null
true
2018-05-08T02:03:44
2018-05-08T02:03:44
2018-05-08T02:03:43
2018-05-08T02:03:16
12,047
0
0
0
null
false
null
package br.unesp.rc.curriculumGenerator.controller.command; import br.unesp.rc.curriculumGenerator.controller.helper.Helper; import br.unesp.rc.curriculumGenerator.model.Curriculum; import br.unesp.rc.curriculumGenerator.service.CurriculumService; import br.unesp.rc.curriculumGenerator.service.FactoryService; import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.net.httpserver.HttpExchange; import java.io.IOException; import java.io.OutputStream; /** * This class is used as a command to the frontend application to insert a new curriculum to database. */ public class NewCurriculum implements ICommand { /** * Receives a POST Request with a Curriculum JSON and inserts the Curriculum to database. * * @param httpExchange httpExchange * @throws IOException IOException */ @Override public void handle(HttpExchange httpExchange) throws IOException { if (Helper.isRequestMethodOptions(httpExchange)) return; String JSONRequest = Helper.getJSONfromHttpExchange(httpExchange); ObjectMapper objectMapper = new ObjectMapper(); Curriculum curriculum = objectMapper.readValue(JSONRequest, Curriculum.class); int userId = curriculum.getUser().getIdUser(); CurriculumService curriculumService = FactoryService.getCurriculumService(); int curriculumId = curriculumService.insertCurriculum(curriculum, userId); //Set the "curriculumId" as response to the frontend String response = Integer.toString(curriculumId); httpExchange.sendResponseHeaders(200, response.getBytes().length); OutputStream outputStream = httpExchange.getResponseBody(); outputStream.write(response.getBytes()); outputStream.close(); } }
UTF-8
Java
1,782
java
NewCurriculum.java
Java
[]
null
[]
package br.unesp.rc.curriculumGenerator.controller.command; import br.unesp.rc.curriculumGenerator.controller.helper.Helper; import br.unesp.rc.curriculumGenerator.model.Curriculum; import br.unesp.rc.curriculumGenerator.service.CurriculumService; import br.unesp.rc.curriculumGenerator.service.FactoryService; import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.net.httpserver.HttpExchange; import java.io.IOException; import java.io.OutputStream; /** * This class is used as a command to the frontend application to insert a new curriculum to database. */ public class NewCurriculum implements ICommand { /** * Receives a POST Request with a Curriculum JSON and inserts the Curriculum to database. * * @param httpExchange httpExchange * @throws IOException IOException */ @Override public void handle(HttpExchange httpExchange) throws IOException { if (Helper.isRequestMethodOptions(httpExchange)) return; String JSONRequest = Helper.getJSONfromHttpExchange(httpExchange); ObjectMapper objectMapper = new ObjectMapper(); Curriculum curriculum = objectMapper.readValue(JSONRequest, Curriculum.class); int userId = curriculum.getUser().getIdUser(); CurriculumService curriculumService = FactoryService.getCurriculumService(); int curriculumId = curriculumService.insertCurriculum(curriculum, userId); //Set the "curriculumId" as response to the frontend String response = Integer.toString(curriculumId); httpExchange.sendResponseHeaders(200, response.getBytes().length); OutputStream outputStream = httpExchange.getResponseBody(); outputStream.write(response.getBytes()); outputStream.close(); } }
1,782
0.748597
0.746914
47
36.914894
31.391712
102
false
false
0
0
0
0
0
0
0.510638
false
false
8
6c077bdeef5a887f77af7744ca22a68bfa530c05
5,557,687,697,271
6f483be8adb42c25c4072837aa9eacbb2bcc22b6
/src/core/util/LogMaker.java
701bd36dd5fbb4691ca9eef7781f5e08a115238d
[]
no_license
eLVas/Elbo
https://github.com/eLVas/Elbo
e85c5b8461849979a8ddc8371c2343c95cb98adf
52b8779a8e5d184499a0aa1eb9fb6c747637f25f
refs/heads/master
2015-08-13T21:58:15
2014-10-22T19:37:05
2014-10-22T19:37:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package core.util; import java.io.*; import java.text.SimpleDateFormat; import java.util.Date; /** * Created by el on 17.10.14. */ public class LogMaker { private String logName; private final String ext = ".txt"; static private final SimpleDateFormat longDateFormat = new SimpleDateFormat("dd.MM HH:mm:ss"); static private final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); static private final SimpleDateFormat shortDateFormat = new SimpleDateFormat("dd.MM"); public LogMaker() { logName = "log"; } public LogMaker(String logname) { this.logName = logname; } // public void writeToLog(String s) { try (PrintWriter printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logName + "_" + shortDateFormat.format(new Date()) + ext, true)))) { printWriter.println(timeFormat.format(new Date()) + " " + s); } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
1,008
java
LogMaker.java
Java
[ { "context": "eFormat;\nimport java.util.Date;\n\n/**\n * Created by el on 17.10.14.\n */\npublic class LogMaker {\n priv", "end": 117, "score": 0.9881199598312378, "start": 115, "tag": "USERNAME", "value": "el" } ]
null
[]
package core.util; import java.io.*; import java.text.SimpleDateFormat; import java.util.Date; /** * Created by el on 17.10.14. */ public class LogMaker { private String logName; private final String ext = ".txt"; static private final SimpleDateFormat longDateFormat = new SimpleDateFormat("dd.MM HH:mm:ss"); static private final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); static private final SimpleDateFormat shortDateFormat = new SimpleDateFormat("dd.MM"); public LogMaker() { logName = "log"; } public LogMaker(String logname) { this.logName = logname; } // public void writeToLog(String s) { try (PrintWriter printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logName + "_" + shortDateFormat.format(new Date()) + ext, true)))) { printWriter.println(timeFormat.format(new Date()) + " " + s); } catch (IOException e) { e.printStackTrace(); } } }
1,008
0.651786
0.645833
38
25.526316
33.954876
157
false
false
0
0
0
0
0
0
0.368421
false
false
8
1c33af07889a7f316028b31349e0f1d10b07ab4a
6,743,098,669,305
6dd47751df4eb9a46812e68e2be4a38a6a8404c8
/src/tp4/Te.java
42e4af770f16d9b14500756b676d833a0dd3c2a1
[]
no_license
SofiaAguirre/CoffeeStoreTP
https://github.com/SofiaAguirre/CoffeeStoreTP
e56e632bbfda1c31dc1209bfc8353b1d5149ac37
9bacf7b1a57f230a37fcd6e76c3d7ddf4e63e4e8
refs/heads/master
2021-01-07T16:35:12.126000
2020-02-20T00:20:05
2020-02-20T00:20:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tp4; public abstract class Te extends Bebida { public Te(String tipo, int cantidadAzucar, int cantidadLeche) { super(tipo, cantidadAzucar, cantidadLeche); } @Override public String getTipo() { return " Té "+ super.getTipo(); } }
UTF-8
Java
277
java
Te.java
Java
[]
null
[]
package tp4; public abstract class Te extends Bebida { public Te(String tipo, int cantidadAzucar, int cantidadLeche) { super(tipo, cantidadAzucar, cantidadLeche); } @Override public String getTipo() { return " Té "+ super.getTipo(); } }
277
0.644928
0.641304
13
20.23077
21.796803
67
false
false
0
0
0
0
0
0
0.538462
false
false
8
6797fa7413efbe80fc91927efd2ff06ebd4842c9
22,728,966,966,896
57c33e774aa82ea9faaf78733777e8606fa3b874
/app/src/main/java/com/kalestenika/android/model/Place.java
82470ec8c1977bf5b38c413b5a353b5271e28870
[]
no_license
ThiasTux/kalestenika
https://github.com/ThiasTux/kalestenika
a4c99cdcd11022d4611dd9fc9ef2c5d361e4d8f1
e0fb9cbb9fd34f8787d2c8568fd6b1ef4414a93a
refs/heads/master
2020-05-28T08:53:34.639000
2015-09-14T17:26:32
2015-09-14T17:26:32
40,197,706
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kalestenika.android.model; import lombok.Data; import lombok.NoArgsConstructor; /** * Entity representing a training place signaled by a user */ @Data @NoArgsConstructor public class Place { Long _id; String creator; String address; double latitude; double longitude; String name; String webId; /** Available structures */ //List<String> structures; public Place(com.appspot.kalestenika.kalestenika.model.Place place) { this._id = place.getId(); this.address = place.getAddress(); this.latitude = place.getPosition().getLatitude(); this.longitude = place.getPosition().getLongitude(); this.name = place.getName(); this.webId = place.getId().toString(); } }
UTF-8
Java
767
java
Place.java
Java
[]
null
[]
package com.kalestenika.android.model; import lombok.Data; import lombok.NoArgsConstructor; /** * Entity representing a training place signaled by a user */ @Data @NoArgsConstructor public class Place { Long _id; String creator; String address; double latitude; double longitude; String name; String webId; /** Available structures */ //List<String> structures; public Place(com.appspot.kalestenika.kalestenika.model.Place place) { this._id = place.getId(); this.address = place.getAddress(); this.latitude = place.getPosition().getLatitude(); this.longitude = place.getPosition().getLongitude(); this.name = place.getName(); this.webId = place.getId().toString(); } }
767
0.664928
0.664928
31
23.741936
19.844505
73
false
false
0
0
0
0
0
0
0.548387
false
false
8
48d965fb5484a219d6e57bd58bcea01fb076be40
1,202,590,853,966
a7d5fc032b5d1d7e265499971191daae36acfa64
/core/src/tech/tokin/game/potatokergeto/BetoltoScreen.java
c4f9563c7be6b02a92aa32550882ab8c9b501060
[]
no_license
TokinGame/potatokergeto
https://github.com/TokinGame/potatokergeto
219940143f8279d3435184268701eb21accd1d9d
5b49aa1b118efcc10a92cfd9567e49a2ca94436a
refs/heads/master
2021-07-05T04:03:50.846000
2017-09-28T13:59:16
2017-09-28T13:59:16
105,148,113
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tech.tokin.game.potatokergeto; import com.badlogic.gdx.Game; import com.badlogic.gdx.scenes.scene2d.Stage; /** * Created by M on 10/7/2016. */ public class BetoltoScreen extends MyScreen { Stage stage; private float elapsedTime = 0; private OneSpriteStaticActor backGround; public BetoltoScreen(Game game) { super(game); setBackGroundColor(0f, 0f, 0f); stage = new Stage(viewport, spriteBatch); //stage.addActor(backGround= new OneSpriteStaticActor("wood.png")); //backGround.setSize(MyScreen.WORLD_WIDTH,MyScreen.WORLD_HEIGHT); //backGround.setPosition(0,0); /*stage.addActor(new OneSpriteAnimatedActor("load.txt") { @Override protected void init() { super.init(); setFps(10); //setWidth(WORLD_WIDTH); //setHeight(WORLD_HEIGHT); setSize(MyScreen.WORLD_WIDTH,MyScreen.WORLD_HEIGHT); } });*/ } @Override public void show() { Assets.manager.finishLoading(); Assets.load(); } @Override public void render(float delta) { super.render(delta); //if (elapsedTime > 2.0 && Assets.manager.update()) { if (Assets.manager.update()) { Assets.afterLoaded(); game.setScreen(new MenuScreen(game)); } //spriteBatch.begin(); elapsedTime += delta; stage.act(delta); stage.draw(); //Globals.FONT_HOBO_STD.draw(spriteBatch,"Betöltés: " + Assets.manager.getLoadedAssets() + "/" + (Assets.manager.getQueuedAssets()+Assets.manager.getLoadedAssets()) + " (" + ((int)(Assets.manager.getProgress()*100f)) + "%)",0,50); //spriteBatch.end(); } @Override public void hide() { } }
UTF-8
Java
1,838
java
BetoltoScreen.java
Java
[ { "context": "logic.gdx.scenes.scene2d.Stage;\n\n/**\n * Created by M on 10/7/2016.\n */\n\npublic class BetoltoScreen ext", "end": 136, "score": 0.9741621613502502, "start": 135, "tag": "USERNAME", "value": "M" } ]
null
[]
package tech.tokin.game.potatokergeto; import com.badlogic.gdx.Game; import com.badlogic.gdx.scenes.scene2d.Stage; /** * Created by M on 10/7/2016. */ public class BetoltoScreen extends MyScreen { Stage stage; private float elapsedTime = 0; private OneSpriteStaticActor backGround; public BetoltoScreen(Game game) { super(game); setBackGroundColor(0f, 0f, 0f); stage = new Stage(viewport, spriteBatch); //stage.addActor(backGround= new OneSpriteStaticActor("wood.png")); //backGround.setSize(MyScreen.WORLD_WIDTH,MyScreen.WORLD_HEIGHT); //backGround.setPosition(0,0); /*stage.addActor(new OneSpriteAnimatedActor("load.txt") { @Override protected void init() { super.init(); setFps(10); //setWidth(WORLD_WIDTH); //setHeight(WORLD_HEIGHT); setSize(MyScreen.WORLD_WIDTH,MyScreen.WORLD_HEIGHT); } });*/ } @Override public void show() { Assets.manager.finishLoading(); Assets.load(); } @Override public void render(float delta) { super.render(delta); //if (elapsedTime > 2.0 && Assets.manager.update()) { if (Assets.manager.update()) { Assets.afterLoaded(); game.setScreen(new MenuScreen(game)); } //spriteBatch.begin(); elapsedTime += delta; stage.act(delta); stage.draw(); //Globals.FONT_HOBO_STD.draw(spriteBatch,"Betöltés: " + Assets.manager.getLoadedAssets() + "/" + (Assets.manager.getQueuedAssets()+Assets.manager.getLoadedAssets()) + " (" + ((int)(Assets.manager.getProgress()*100f)) + "%)",0,50); //spriteBatch.end(); } @Override public void hide() { } }
1,838
0.584967
0.571895
64
27.6875
33.088364
238
false
false
0
0
0
0
0
0
0.59375
false
false
8
1e631dc3fb238e08ddc66c609c30da4c6360a38e
33,509,334,876,513
c5482e2e90273ea0342fa082eb08e0962c07f4fe
/api/src/main/java/org/ednovo/gooru/domain/service/eventlogs/UserEventLog.java
d7d5a5cfc5b054aa14665e52f1034155ace33bcb
[ "MIT" ]
permissive
Gooru/Gooru-Core-API
https://github.com/Gooru/Gooru-Core-API
1ef44aba0b050c04ddfa44ce6ee3ac6fb3760260
fc13e712f8cb0b1257ba383c6bd4d0e3bd6676c1
refs/heads/master
2015-08-10T06:47:44.605000
2015-08-06T06:05:55
2015-08-06T06:05:55
16,409,491
2
18
null
false
2016-03-10T09:38:38
2014-01-31T14:03:14
2015-07-20T12:11:05
2016-03-10T09:38:38
19,596
1
32
2
Java
null
null
///////////////////////////////////////////////////////////// // UserEventlog.java // gooru-api // Created by Gooru on 2015 // Copyright (c) 2015 Gooru. All rights reserved. // http://www.goorulearning.org/ // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ///////////////////////////////////////////////////////////// package org.ednovo.gooru.domain.service.eventlogs; import java.util.Iterator; import org.ednovo.gooru.core.api.model.Identity; import org.ednovo.gooru.core.api.model.SessionContextSupport; import org.ednovo.gooru.core.api.model.User; import org.ednovo.gooru.core.constant.ConstantProperties; import org.ednovo.gooru.core.constant.ParameterProperties; import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class UserEventLog implements ParameterProperties, ConstantProperties{ private static final Logger LOGGER = LoggerFactory.getLogger(UserEventLog.class); public void getEventLogs(boolean updateProfile, boolean visitProfile, User profileVisitor, JSONObject itemData, boolean isFollow, boolean isUnfollow) { try { SessionContextSupport.putLogParameter(EVENT_NAME, PROFILE_ACTION); JSONObject session = SessionContextSupport.getLog().get(SESSION) != null ? new JSONObject(SessionContextSupport.getLog().get(SESSION).toString()) : new JSONObject(); SessionContextSupport.putLogParameter(SESSION, session.toString()); JSONObject user = SessionContextSupport.getLog().get(USER) != null ? new JSONObject(SessionContextSupport.getLog().get(USER).toString()) : new JSONObject(); SessionContextSupport.putLogParameter(USER, user.toString()); JSONObject context = SessionContextSupport.getLog().get(CONTEXT) != null ? new JSONObject(SessionContextSupport.getLog().get(CONTEXT).toString()) : new JSONObject(); if (updateProfile) { context.put("url", "/profile/edit"); } else if (visitProfile) { context.put("url", "/profile/visit"); } SessionContextSupport.putLogParameter(CONTEXT, context.toString()); JSONObject payLoadObject = SessionContextSupport.getLog().get(PAY_LOAD_OBJECT) != null ? new JSONObject(SessionContextSupport.getLog().get(PAY_LOAD_OBJECT).toString()) : new JSONObject(); if (updateProfile) { payLoadObject.put(ACTION_TYPE, EDIT); } else if (visitProfile) { payLoadObject.put(ACTION_TYPE, VISIT); payLoadObject.put(VISIT_UID, profileVisitor != null ? profileVisitor.getPartyUid() : null); } else if (isFollow) { payLoadObject.put(ACTION_TYPE, FOLLOW); } else if (isUnfollow) { payLoadObject.put(ACTION_TYPE, UN_FOLLOW); } if (itemData != null) { payLoadObject.put("itemData", itemData.toString()); } SessionContextSupport.putLogParameter(PAY_LOAD_OBJECT, payLoadObject.toString()); } catch (Exception e) { LOGGER.error(_ERROR , e); } } public void getEventLogs(User newUser, String source, Identity newIdentity) throws JSONException { SessionContextSupport.putLogParameter(EVENT_NAME, USER_REG); JSONObject context = SessionContextSupport.getLog().get(CONTEXT) != null ? new JSONObject(SessionContextSupport.getLog().get(CONTEXT).toString()) : new JSONObject(); if (source != null) { context.put(REGISTER_TYPE, source); } else { context.put(REGISTER_TYPE, GOORU); } SessionContextSupport.putLogParameter(CONTEXT, context.toString()); JSONObject payLoadObject = SessionContextSupport.getLog().get(PAY_LOAD_OBJECT) != null ? new JSONObject(SessionContextSupport.getLog().get(PAY_LOAD_OBJECT).toString()) : new JSONObject(); if (newIdentity != null && newIdentity.getIdp() != null) { payLoadObject.put(IDP_NAME, newIdentity.getIdp().getName()); } else { payLoadObject.put(IDP_NAME, GOORU_API); } Iterator<Identity> iter = newUser.getIdentities().iterator(); if (iter != null && iter.hasNext()) { Identity identity = iter.next(); payLoadObject.put(CREATED_TYPE, identity != null ? identity.getAccountCreatedType() : null); } SessionContextSupport.putLogParameter(PAY_LOAD_OBJECT, payLoadObject.toString()); JSONObject session = SessionContextSupport.getLog().get(SESSION) != null ? new JSONObject(SessionContextSupport.getLog().get(SESSION).toString()) : new JSONObject(); session.put(ORGANIZATION_UID, newUser != null && newUser.getOrganization() != null ? newUser.getOrganization().getPartyUid() : null); SessionContextSupport.putLogParameter(SESSION, session.toString()); JSONObject user = SessionContextSupport.getLog().get(USER) != null ? new JSONObject(SessionContextSupport.getLog().get(USER).toString()) : new JSONObject(); user.put(GOORU_UID, newUser != null ? newUser.getPartyUid() : null); SessionContextSupport.putLogParameter(USER, user.toString()); } }
UTF-8
Java
5,816
java
UserEventLog.java
Java
[ { "context": "//\n// UserEventlog.java\n// gooru-api\n// Created by Gooru on 2015\n// Copyright (c) 2015 Gooru. All rights r", "end": 115, "score": 0.888033390045166, "start": 110, "tag": "NAME", "value": "Gooru" }, { "context": "\n// Created by Gooru on 2015\n// Copyright (c) 2015 Gooru. All rights reserved.\n// http://www.goorulearn", "end": 148, "score": 0.5364813804626465, "start": 146, "tag": "NAME", "value": "Go" } ]
null
[]
///////////////////////////////////////////////////////////// // UserEventlog.java // gooru-api // Created by Gooru on 2015 // Copyright (c) 2015 Gooru. All rights reserved. // http://www.goorulearning.org/ // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ///////////////////////////////////////////////////////////// package org.ednovo.gooru.domain.service.eventlogs; import java.util.Iterator; import org.ednovo.gooru.core.api.model.Identity; import org.ednovo.gooru.core.api.model.SessionContextSupport; import org.ednovo.gooru.core.api.model.User; import org.ednovo.gooru.core.constant.ConstantProperties; import org.ednovo.gooru.core.constant.ParameterProperties; import org.json.JSONException; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class UserEventLog implements ParameterProperties, ConstantProperties{ private static final Logger LOGGER = LoggerFactory.getLogger(UserEventLog.class); public void getEventLogs(boolean updateProfile, boolean visitProfile, User profileVisitor, JSONObject itemData, boolean isFollow, boolean isUnfollow) { try { SessionContextSupport.putLogParameter(EVENT_NAME, PROFILE_ACTION); JSONObject session = SessionContextSupport.getLog().get(SESSION) != null ? new JSONObject(SessionContextSupport.getLog().get(SESSION).toString()) : new JSONObject(); SessionContextSupport.putLogParameter(SESSION, session.toString()); JSONObject user = SessionContextSupport.getLog().get(USER) != null ? new JSONObject(SessionContextSupport.getLog().get(USER).toString()) : new JSONObject(); SessionContextSupport.putLogParameter(USER, user.toString()); JSONObject context = SessionContextSupport.getLog().get(CONTEXT) != null ? new JSONObject(SessionContextSupport.getLog().get(CONTEXT).toString()) : new JSONObject(); if (updateProfile) { context.put("url", "/profile/edit"); } else if (visitProfile) { context.put("url", "/profile/visit"); } SessionContextSupport.putLogParameter(CONTEXT, context.toString()); JSONObject payLoadObject = SessionContextSupport.getLog().get(PAY_LOAD_OBJECT) != null ? new JSONObject(SessionContextSupport.getLog().get(PAY_LOAD_OBJECT).toString()) : new JSONObject(); if (updateProfile) { payLoadObject.put(ACTION_TYPE, EDIT); } else if (visitProfile) { payLoadObject.put(ACTION_TYPE, VISIT); payLoadObject.put(VISIT_UID, profileVisitor != null ? profileVisitor.getPartyUid() : null); } else if (isFollow) { payLoadObject.put(ACTION_TYPE, FOLLOW); } else if (isUnfollow) { payLoadObject.put(ACTION_TYPE, UN_FOLLOW); } if (itemData != null) { payLoadObject.put("itemData", itemData.toString()); } SessionContextSupport.putLogParameter(PAY_LOAD_OBJECT, payLoadObject.toString()); } catch (Exception e) { LOGGER.error(_ERROR , e); } } public void getEventLogs(User newUser, String source, Identity newIdentity) throws JSONException { SessionContextSupport.putLogParameter(EVENT_NAME, USER_REG); JSONObject context = SessionContextSupport.getLog().get(CONTEXT) != null ? new JSONObject(SessionContextSupport.getLog().get(CONTEXT).toString()) : new JSONObject(); if (source != null) { context.put(REGISTER_TYPE, source); } else { context.put(REGISTER_TYPE, GOORU); } SessionContextSupport.putLogParameter(CONTEXT, context.toString()); JSONObject payLoadObject = SessionContextSupport.getLog().get(PAY_LOAD_OBJECT) != null ? new JSONObject(SessionContextSupport.getLog().get(PAY_LOAD_OBJECT).toString()) : new JSONObject(); if (newIdentity != null && newIdentity.getIdp() != null) { payLoadObject.put(IDP_NAME, newIdentity.getIdp().getName()); } else { payLoadObject.put(IDP_NAME, GOORU_API); } Iterator<Identity> iter = newUser.getIdentities().iterator(); if (iter != null && iter.hasNext()) { Identity identity = iter.next(); payLoadObject.put(CREATED_TYPE, identity != null ? identity.getAccountCreatedType() : null); } SessionContextSupport.putLogParameter(PAY_LOAD_OBJECT, payLoadObject.toString()); JSONObject session = SessionContextSupport.getLog().get(SESSION) != null ? new JSONObject(SessionContextSupport.getLog().get(SESSION).toString()) : new JSONObject(); session.put(ORGANIZATION_UID, newUser != null && newUser.getOrganization() != null ? newUser.getOrganization().getPartyUid() : null); SessionContextSupport.putLogParameter(SESSION, session.toString()); JSONObject user = SessionContextSupport.getLog().get(USER) != null ? new JSONObject(SessionContextSupport.getLog().get(USER).toString()) : new JSONObject(); user.put(GOORU_UID, newUser != null ? newUser.getPartyUid() : null); SessionContextSupport.putLogParameter(USER, user.toString()); } }
5,816
0.738308
0.736589
117
48.692307
45.182529
189
false
false
0
0
0
0
71
0.023212
2.094017
false
false
8
feda24438e1befc832772c71bda45dd759131366
5,282,809,803,688
719bbc27e3d6207fcaac9332ddb1b2c026fd4e9e
/src/main/java/by/eugenepetsevich/todolist/model/beans/User.java
3a69ad15a11f201d403a4f15d15bfff83ca5bf06
[]
no_license
EugenePetsevich/ToDoList
https://github.com/EugenePetsevich/ToDoList
664683b0da3cffac19122d496392228eb18ac245
3f2331f57483f90f0920c12abac7dce9bd360575
refs/heads/master
2019-12-06T14:27:29.962000
2016-07-25T17:44:39
2016-07-25T17:44:39
60,478,421
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.eugenepetsevich.todolist.model.beans; import org.apache.commons.lang3.builder.ToStringBuilder; /** * Main user's bean class. */ public class User { /** * Main user fields. */ private int id; private String firstName; private String lastName; private String login; private String[] password; /** * Empty Constructor */ public User() { this.password = new String[1]; } /** * Constructor without ID parameter * * @param firstName The {@link String} object with user's first name. * @param lastName The {@link String} object with user's last name. * @param login The {@link String} object with user's login. * @param password The {@link String} object with user's password. */ public User(String firstName, String lastName, String login, String password) { this.firstName = firstName; this.lastName = lastName; this.login = login; this.password = new String[]{password}; } /** * Constructor with all parameters * * @param id The {@code int} value with user's identifier. * @param firstName The {@link String} object with user's first name. * @param lastName The {@link String} object with user's last name. * @param login The {@link String} object with user's login. * @param password The {@link String} object with user's password. */ public User(int id, String firstName, String lastName, String login, String password) { this(firstName, lastName, login, password); this.id = id; } /** * @return Current user's identifier. */ public int getId() { return id; } /** * @param id Current user's identifier. */ public void setId(int id) { this.id = id; } /** * @return Current user's first name. */ public String getFirstName() { return firstName; } /** * @param firstName Current user's first name. */ public void setFirstName(String firstName) { this.firstName = firstName; } /** * @return Current user's last name. */ public String getLastName() { return lastName; } /** * @param lastName Current user's last name. */ public void setLastName(String lastName) { this.lastName = lastName; } /** * @return Current user's login. */ public String getLogin() { return login; } /** * @param login Current user's login. */ public void setLogin(String login) { this.login = login; } /** * @return Current user's password. */ public String getPassword() { return password[0]; } /** * @param password Current user's password. */ public void setPassword(String password) { this.password[0] = password; } /** * <p>Get {@code String} object which include class name and all fields values.</p> * * @return Text string with class name and all fields values. */ @Override public String toString() { return new ToStringBuilder(this). append("id", id). append("firstName" + firstName). append("lastName" + lastName). append("login" + login). append("password" + getPassword()). toString(); } }
UTF-8
Java
3,487
java
User.java
Java
[ { "context": "nd(\"id\", id).\n append(\"firstName\" + firstName).\n append(\"lastName\" + lastName).\n", "end": 3308, "score": 0.9770629405975342, "start": 3299, "tag": "NAME", "value": "firstName" }, { "context": " + firstName).\n append(\"lastName\" + lastName).\n append(\"login\" + login).\n ", "end": 3355, "score": 0.9738448262214661, "start": 3347, "tag": "NAME", "value": "lastName" } ]
null
[]
package by.eugenepetsevich.todolist.model.beans; import org.apache.commons.lang3.builder.ToStringBuilder; /** * Main user's bean class. */ public class User { /** * Main user fields. */ private int id; private String firstName; private String lastName; private String login; private String[] password; /** * Empty Constructor */ public User() { this.password = new String[1]; } /** * Constructor without ID parameter * * @param firstName The {@link String} object with user's first name. * @param lastName The {@link String} object with user's last name. * @param login The {@link String} object with user's login. * @param password The {@link String} object with user's password. */ public User(String firstName, String lastName, String login, String password) { this.firstName = firstName; this.lastName = lastName; this.login = login; this.password = new String[]{password}; } /** * Constructor with all parameters * * @param id The {@code int} value with user's identifier. * @param firstName The {@link String} object with user's first name. * @param lastName The {@link String} object with user's last name. * @param login The {@link String} object with user's login. * @param password The {@link String} object with user's password. */ public User(int id, String firstName, String lastName, String login, String password) { this(firstName, lastName, login, password); this.id = id; } /** * @return Current user's identifier. */ public int getId() { return id; } /** * @param id Current user's identifier. */ public void setId(int id) { this.id = id; } /** * @return Current user's first name. */ public String getFirstName() { return firstName; } /** * @param firstName Current user's first name. */ public void setFirstName(String firstName) { this.firstName = firstName; } /** * @return Current user's last name. */ public String getLastName() { return lastName; } /** * @param lastName Current user's last name. */ public void setLastName(String lastName) { this.lastName = lastName; } /** * @return Current user's login. */ public String getLogin() { return login; } /** * @param login Current user's login. */ public void setLogin(String login) { this.login = login; } /** * @return Current user's password. */ public String getPassword() { return password[0]; } /** * @param password Current user's password. */ public void setPassword(String password) { this.password[0] = password; } /** * <p>Get {@code String} object which include class name and all fields values.</p> * * @return Text string with class name and all fields values. */ @Override public String toString() { return new ToStringBuilder(this). append("id", id). append("firstName" + firstName). append("lastName" + lastName). append("login" + login). append("password" + getPassword()). toString(); } }
3,487
0.569257
0.56811
141
23.730497
22.246485
87
false
false
0
0
0
0
0
0
0.255319
false
false
8
53679126367eafc7a6118f9bba24745010c7d360
20,237,885,919,469
3d9771a5551ea723f4e9169333f558c99eaba8f7
/src/main/java/iot/lviv/ua/service/TicketPassageService.java
867c8389ff9455d84a4e40102e5bfe00b25472b0
[]
no_license
c0nf1g/java_mvc_lab
https://github.com/c0nf1g/java_mvc_lab
d06501e3ec4fdb6ff564af0e5141715795214c78
e2d23c50d60404b5eb65832024131dceca34bcd9
refs/heads/master
2022-07-03T15:47:13.181000
2020-02-01T17:42:56
2020-02-01T17:42:56
237,651,849
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package iot.lviv.ua.service; import iot.lviv.ua.DAO.implementation.TicketPassageDAOImpl; import iot.lviv.ua.model.TicketPassageEntity; import java.sql.SQLException; import java.util.List; public class TicketPassageService { public List<TicketPassageEntity> findAll() throws SQLException { return new TicketPassageDAOImpl().findAll(); } public TicketPassageEntity findById(Integer id) throws SQLException { return new TicketPassageDAOImpl().findById(id); } public int create(TicketPassageEntity entity) throws SQLException { return new TicketPassageDAOImpl().create(entity); } public int update(TicketPassageEntity entity) throws SQLException { return new TicketPassageDAOImpl().update(entity); } public int delete(Integer id) throws SQLException { return new TicketPassageDAOImpl().delete(id); } }
UTF-8
Java
885
java
TicketPassageService.java
Java
[]
null
[]
package iot.lviv.ua.service; import iot.lviv.ua.DAO.implementation.TicketPassageDAOImpl; import iot.lviv.ua.model.TicketPassageEntity; import java.sql.SQLException; import java.util.List; public class TicketPassageService { public List<TicketPassageEntity> findAll() throws SQLException { return new TicketPassageDAOImpl().findAll(); } public TicketPassageEntity findById(Integer id) throws SQLException { return new TicketPassageDAOImpl().findById(id); } public int create(TicketPassageEntity entity) throws SQLException { return new TicketPassageDAOImpl().create(entity); } public int update(TicketPassageEntity entity) throws SQLException { return new TicketPassageDAOImpl().update(entity); } public int delete(Integer id) throws SQLException { return new TicketPassageDAOImpl().delete(id); } }
885
0.738983
0.738983
29
29.517241
27.414595
73
false
false
0
0
0
0
0
0
0.344828
false
false
8
6e9793fbbf6b1ee9ce21316a0f9515ede31d40db
32,650,341,429,063
918741f9c2814a674a4d45b49295d8191e502fe8
/src/main/java/com/example/demo/service/GroupChatService.java
b918fdff10c53a88c41231a3707dbbcd902101df
[]
no_license
YYYYYHHHHHH/dddcz-game-system
https://github.com/YYYYYHHHHHH/dddcz-game-system
a48a30abf612e9da405d13be55aa8f34590c5a84
1d804e140643ad6cfe0d007fc75a97b164e81e50
refs/heads/master
2023-08-24T11:18:25.071000
2021-10-26T12:44:30
2021-10-26T12:44:30
416,629,982
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.service; import java.util.List; import com.example.demo.entity.GroupChat.Chat; import com.example.demo.entity.GroupChat.ChatUserInfo; import com.example.demo.entity.GroupChat.SocketData; public interface GroupChatService { /* 获取聊天室人员信息 */ List<ChatUserInfo> getChatUsers(); /* 获取聊天记录 */ List<Chat> getChatByLimit(int start, int num); /* 客户端发送消息 */ void sendChat(int userId, String mes); /* 服务端返回消息 */ void returnChat(SocketData chat); }
UTF-8
Java
560
java
GroupChatService.java
Java
[]
null
[]
package com.example.demo.service; import java.util.List; import com.example.demo.entity.GroupChat.Chat; import com.example.demo.entity.GroupChat.ChatUserInfo; import com.example.demo.entity.GroupChat.SocketData; public interface GroupChatService { /* 获取聊天室人员信息 */ List<ChatUserInfo> getChatUsers(); /* 获取聊天记录 */ List<Chat> getChatByLimit(int start, int num); /* 客户端发送消息 */ void sendChat(int userId, String mes); /* 服务端返回消息 */ void returnChat(SocketData chat); }
560
0.715139
0.715139
19
25.421053
18.559481
54
false
false
0
0
0
0
0
0
0.578947
false
false
8
13cf7ec9ceeae61850732e3806ba387f2bff1af2
31,190,052,528,403
895debaffbcbc2c8dbba69ea9282ab04cecc8c42
/src/server/network/ServerSocketHandler.java
f42efa938014939230451dc47609aa92cf26b56c
[]
no_license
michaelbui99/sdjassignment2
https://github.com/michaelbui99/sdjassignment2
962cd1fae101315e3692b59968e664d790d6e7a6
55347a119ff6cb5eb1284af9efa8ac85ed1557a2
refs/heads/main
2023-03-17T08:23:36.355000
2021-03-11T12:02:42
2021-03-11T12:02:42
345,642,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package server.network; import server.model.ChatModel; import shared.Message; import shared.Request; import java.beans.PropertyChangeEvent; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; public class ServerSocketHandler implements Runnable { private Socket socket; private ObjectInputStream in; private ObjectOutputStream out; private ChatModel model; public ServerSocketHandler(Socket socket, ChatModel model) throws IOException { this.model = model; this.socket = socket; in = new ObjectInputStream(socket.getInputStream()); out = new ObjectOutputStream(socket.getOutputStream()); } @Override public void run() { System.out.println("Client connected from: " + socket.getInetAddress().getHostAddress() + " " +socket.getPort()); while (true) { try { Request requestFromClient = (Request) in.readObject(); System.out.println("Request from client received: " + requestFromClient.getType()); if (requestFromClient.getType().equals("Listener")) { model.addPropertyChangeListener("SendMessage", this::onSendMessage); } else if (requestFromClient.getType().equals("SendMessage")) { model.sendMessage((Message) requestFromClient.getObj()); out.writeObject(new Request("response", "Message has been sent")); } else if (requestFromClient.getType().equals("addUser")) { model.addConnectedUser((String) requestFromClient.getObj()); out.writeObject(new Request("response", "I got it")); } else if (requestFromClient.getType().equals("getConnectedUsers")) { out.writeObject(new Request("getConnectedUsers", model.getConnectedUsers())); } } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } } } public void onSendMessage(PropertyChangeEvent evt) { try { out.writeObject(new Request(evt.getPropertyName(), evt.getNewValue())); } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
2,181
java
ServerSocketHandler.java
Java
[]
null
[]
package server.network; import server.model.ChatModel; import shared.Message; import shared.Request; import java.beans.PropertyChangeEvent; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; public class ServerSocketHandler implements Runnable { private Socket socket; private ObjectInputStream in; private ObjectOutputStream out; private ChatModel model; public ServerSocketHandler(Socket socket, ChatModel model) throws IOException { this.model = model; this.socket = socket; in = new ObjectInputStream(socket.getInputStream()); out = new ObjectOutputStream(socket.getOutputStream()); } @Override public void run() { System.out.println("Client connected from: " + socket.getInetAddress().getHostAddress() + " " +socket.getPort()); while (true) { try { Request requestFromClient = (Request) in.readObject(); System.out.println("Request from client received: " + requestFromClient.getType()); if (requestFromClient.getType().equals("Listener")) { model.addPropertyChangeListener("SendMessage", this::onSendMessage); } else if (requestFromClient.getType().equals("SendMessage")) { model.sendMessage((Message) requestFromClient.getObj()); out.writeObject(new Request("response", "Message has been sent")); } else if (requestFromClient.getType().equals("addUser")) { model.addConnectedUser((String) requestFromClient.getObj()); out.writeObject(new Request("response", "I got it")); } else if (requestFromClient.getType().equals("getConnectedUsers")) { out.writeObject(new Request("getConnectedUsers", model.getConnectedUsers())); } } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } } } public void onSendMessage(PropertyChangeEvent evt) { try { out.writeObject(new Request(evt.getPropertyName(), evt.getNewValue())); } catch (IOException e) { e.printStackTrace(); } } }
2,181
0.664374
0.664374
78
26.961538
28.21549
117
false
false
0
0
0
0
0
0
0.461538
false
false
8
3d90cd22fc5f08ada99c5802977278b95091f1f4
20,650,202,764,728
37a10d59d6866e421d6ca6f56fc69480e23a8f70
/PrismaMod/src/main/java/PrismaMod/actions/CardActions/Illya/Normal/AOECommonAction.java
a162bf1c524c36748dc79d5a78f77b2da96dfc57
[ "MIT" ]
permissive
Beastly418/PrismaMod
https://github.com/Beastly418/PrismaMod
feaad32e6665ab6d7555ffa3526e383c9e950072
6fb33d4ae7aa275fc767fe43407af66e98cd6467
refs/heads/main
2023-09-01T07:25:59.729000
2021-10-13T15:15:35
2021-10-13T15:15:35
416,802,606
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package PrismaMod.actions.CardActions.Illya.Normal; import PrismaMod.actions.CardActions.Illya.AbstractCardAction; import PrismaMod.actions.sfx.IllyaSFX.CardSFX.NormalSFX.BigAttackSFX; import com.badlogic.gdx.Gdx; import com.megacrit.cardcrawl.cards.DamageInfo; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.monsters.MonsterGroup; import static PrismaMod.characters.AbstractPrismaPlayer.PlayerAnimationEnums.ATTACK_TWO; public class AOECommonAction extends AbstractCardAction { public int damage; public float delay; public DamageInfo.DamageType damageType; public boolean hit; public AOECommonAction(AbstractPlayer p, int damage, DamageInfo.DamageType damageType){ this.p = p; this.handler = getHandler(p); this.sfx = new BigAttackSFX(p, target); AbstractDungeon.effectsQueue.add(sfx); this.damage = damage; this.damageType = damageType; this.duration = this.sfx.duration; this.delay = this.sfx.getStallTimer();// - this.sfx.getEndStall()/4F; this.hit = false; //handler.setAnimtion(SWIPE_ATTACK); handler.setAnimation(ATTACK_TWO); } @Override public void update() { this.delay -= Gdx.graphics.getDeltaTime(); if(this.delay <= 0 && !hit){ MonsterGroup enemies = AbstractDungeon.getMonsters(); for (AbstractMonster mon : enemies.monsters) { mon.damage(new DamageInfo(p, damage, damageType)); } this.hit = true; } //logger.info("TICK"); this.tickDuration(); } }
UTF-8
Java
1,747
java
AOECommonAction.java
Java
[]
null
[]
package PrismaMod.actions.CardActions.Illya.Normal; import PrismaMod.actions.CardActions.Illya.AbstractCardAction; import PrismaMod.actions.sfx.IllyaSFX.CardSFX.NormalSFX.BigAttackSFX; import com.badlogic.gdx.Gdx; import com.megacrit.cardcrawl.cards.DamageInfo; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.monsters.MonsterGroup; import static PrismaMod.characters.AbstractPrismaPlayer.PlayerAnimationEnums.ATTACK_TWO; public class AOECommonAction extends AbstractCardAction { public int damage; public float delay; public DamageInfo.DamageType damageType; public boolean hit; public AOECommonAction(AbstractPlayer p, int damage, DamageInfo.DamageType damageType){ this.p = p; this.handler = getHandler(p); this.sfx = new BigAttackSFX(p, target); AbstractDungeon.effectsQueue.add(sfx); this.damage = damage; this.damageType = damageType; this.duration = this.sfx.duration; this.delay = this.sfx.getStallTimer();// - this.sfx.getEndStall()/4F; this.hit = false; //handler.setAnimtion(SWIPE_ATTACK); handler.setAnimation(ATTACK_TWO); } @Override public void update() { this.delay -= Gdx.graphics.getDeltaTime(); if(this.delay <= 0 && !hit){ MonsterGroup enemies = AbstractDungeon.getMonsters(); for (AbstractMonster mon : enemies.monsters) { mon.damage(new DamageInfo(p, damage, damageType)); } this.hit = true; } //logger.info("TICK"); this.tickDuration(); } }
1,747
0.69605
0.694906
47
36.170212
23.92659
91
false
false
0
0
0
0
0
0
0.787234
false
false
8
8741ae5ce482a42bc55cf3ad54325f20d821038c
23,063,974,429,564
329f5a1582c140c5e5ecf75c3f33fc3ceb0b5860
/mongodbDao/src/test/java/com/livegoods/dao/MongodbApplicationTest.java
1bc73fcdb52d28e3ae2069c77d1ab097f8c52781
[]
no_license
Elton-Ge/livegoods
https://github.com/Elton-Ge/livegoods
574f510f5866e88d43ba486cf577df7599cb7e44
1430c63dc362388e5d2d557390875b4cf38dd810
refs/heads/master
2023-01-02T23:33:58.965000
2020-10-30T02:08:32
2020-10-30T02:08:32
297,828,204
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.livegoods.dao; import com.livegoods.pojo.Banner; import com.livegoods.pojo.Item; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.test.context.junit4.SpringRunner; import java.util.*; /** * @Auther: Elton Ge * @Date: 16/9/20 * @Description: com.livegoods.dao * @version: 1.0 */ @SpringBootTest(classes = {MongodbApplication.class}) @RunWith(SpringRunner.class) public class MongodbApplicationTest { @Autowired private MongoTemplate mongoTemplate; @Test public void insertItems(){ List<Item> items = new ArrayList<>(); Item item = new Item(); item.setCity("北京"); item.setHouseType("150 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(12000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(100L); item.setTitle("北京高档公寓"); Map<String, String> info = new HashMap<>(); info.put("years", "2010"); info.put("type", "3室2厅"); info.put("level", "10/18层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); items.add(item); item = new Item(); item.setCity("北京"); item.setHouseType("230 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(21000L); item.setRecommendation(true); item.setRecoSort((byte)12); item.setRentType("整租"); item.setSales(30L); info = new HashMap<>(); info.put("years", "2007"); info.put("type", "5室3厅"); info.put("level", "2/2层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); item.setTitle("北京联排别墅"); items.add(item); item = new Item(); item.setCity("北京"); item.setHouseType("310 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(30000L); item.setRecommendation(true); item.setRecoSort((byte)6); item.setRentType("整租"); item.setSales(10L); info = new HashMap<>(); info.put("years", "2013"); info.put("type", "6室4厅"); info.put("level", "3/3层"); info.put("style", "豪华装修"); info.put("orientation", "四面环海"); item.setInfo(info); item.setTitle("北京独栋别墅"); items.add(item); item = new Item(); item.setCity("北京"); item.setHouseType("60 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(3000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(300L); info = new HashMap<>(); info.put("years", "2000"); info.put("type", "2室1厅"); info.put("level", "6/6层"); info.put("style", "简单装修"); info.put("orientation", "朝南"); item.setInfo(info); item.setTitle("北京老小区"); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("150 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(12000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(100L); item.setTitle("上海高档公寓"); info = new HashMap<>(); info.put("years", "2010"); info.put("type", "3室2厅"); info.put("level", "10/18层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("230 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(21000L); item.setRecommendation(true); item.setRecoSort((byte)12); item.setRentType("整租"); item.setSales(30L); info = new HashMap<>(); info.put("years", "2007"); info.put("type", "5室3厅"); info.put("level", "2/2层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); item.setTitle("上海联排别墅"); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("310 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(30000L); item.setRecommendation(true); item.setRecoSort((byte)6); item.setRentType("整租"); item.setSales(10L); info = new HashMap<>(); info.put("years", "2013"); info.put("type", "6室4厅"); info.put("level", "3/3层"); info.put("style", "豪华装修"); info.put("orientation", "四面环海"); item.setInfo(info); item.setTitle("上海独栋别墅"); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("60 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(3000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(300L); info = new HashMap<>(); info.put("years", "2000"); info.put("type", "2室1厅"); info.put("level", "6/6层"); info.put("style", "简单装修"); info.put("orientation", "朝南"); item.setInfo(info); item.setTitle("上海老小区"); items.add(item); mongoTemplate.insert(items, Item.class); } @Test public void insert(){ ArrayList<Banner> list = new ArrayList<>(); Date date = new Date(); Banner banner1 = new Banner(); banner1.setUrl("group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png"); banner1.setCreateTime(date); Banner banner2 = new Banner(); banner2.setUrl("group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png"); banner2.setCreateTime(date); Banner banner3 = new Banner(); banner3.setUrl("group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png"); banner3.setCreateTime(date); Banner banner4 = new Banner(); banner4.setUrl("group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png"); banner4.setCreateTime(date); Banner banner5 = new Banner(); banner5.setUrl("group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png"); banner5.setCreateTime(date); Banner banner6 = new Banner(); banner6.setUrl("group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png"); banner6.setCreateTime(date); list.add(banner1); list.add(banner2); list.add(banner3); list.add(banner4); list.add(banner5); list.add(banner6); mongoTemplate.insert(list,Banner.class); } }
UTF-8
Java
9,512
java
MongodbApplicationTest.java
Java
[ { "context": "pringRunner;\n\nimport java.util.*;\n\n/**\n * @Auther: Elton Ge\n * @Date: 16/9/20\n * @Description: com.livegoods.", "end": 504, "score": 0.999562680721283, "start": 496, "tag": "NAME", "value": "Elton Ge" } ]
null
[]
package com.livegoods.dao; import com.livegoods.pojo.Banner; import com.livegoods.pojo.Item; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.test.context.junit4.SpringRunner; import java.util.*; /** * @Auther: <NAME> * @Date: 16/9/20 * @Description: com.livegoods.dao * @version: 1.0 */ @SpringBootTest(classes = {MongodbApplication.class}) @RunWith(SpringRunner.class) public class MongodbApplicationTest { @Autowired private MongoTemplate mongoTemplate; @Test public void insertItems(){ List<Item> items = new ArrayList<>(); Item item = new Item(); item.setCity("北京"); item.setHouseType("150 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(12000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(100L); item.setTitle("北京高档公寓"); Map<String, String> info = new HashMap<>(); info.put("years", "2010"); info.put("type", "3室2厅"); info.put("level", "10/18层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); items.add(item); item = new Item(); item.setCity("北京"); item.setHouseType("230 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(21000L); item.setRecommendation(true); item.setRecoSort((byte)12); item.setRentType("整租"); item.setSales(30L); info = new HashMap<>(); info.put("years", "2007"); info.put("type", "5室3厅"); info.put("level", "2/2层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); item.setTitle("北京联排别墅"); items.add(item); item = new Item(); item.setCity("北京"); item.setHouseType("310 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(30000L); item.setRecommendation(true); item.setRecoSort((byte)6); item.setRentType("整租"); item.setSales(10L); info = new HashMap<>(); info.put("years", "2013"); info.put("type", "6室4厅"); info.put("level", "3/3层"); info.put("style", "豪华装修"); info.put("orientation", "四面环海"); item.setInfo(info); item.setTitle("北京独栋别墅"); items.add(item); item = new Item(); item.setCity("北京"); item.setHouseType("60 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(3000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(300L); info = new HashMap<>(); info.put("years", "2000"); info.put("type", "2室1厅"); info.put("level", "6/6层"); info.put("style", "简单装修"); info.put("orientation", "朝南"); item.setInfo(info); item.setTitle("北京老小区"); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("150 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(12000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(100L); item.setTitle("上海高档公寓"); info = new HashMap<>(); info.put("years", "2010"); info.put("type", "3室2厅"); info.put("level", "10/18层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("230 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(21000L); item.setRecommendation(true); item.setRecoSort((byte)12); item.setRentType("整租"); item.setSales(30L); info = new HashMap<>(); info.put("years", "2007"); info.put("type", "5室3厅"); info.put("level", "2/2层"); info.put("style", "精装修"); info.put("orientation", "南北通透"); item.setInfo(info); item.setTitle("上海联排别墅"); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("310 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png", "group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png", "group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png" ) ); item.setPrice(30000L); item.setRecommendation(true); item.setRecoSort((byte)6); item.setRentType("整租"); item.setSales(10L); info = new HashMap<>(); info.put("years", "2013"); info.put("type", "6室4厅"); info.put("level", "3/3层"); info.put("style", "豪华装修"); info.put("orientation", "四面环海"); item.setInfo(info); item.setTitle("上海独栋别墅"); items.add(item); item = new Item(); item.setCity("上海"); item.setHouseType("60 ㎡"); item.setImgs( Arrays.asList( "group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png", "group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png", "group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png" ) ); item.setPrice(3000L); item.setRecommendation(true); item.setRecoSort((byte)9); item.setRentType("整租"); item.setSales(300L); info = new HashMap<>(); info.put("years", "2000"); info.put("type", "2室1厅"); info.put("level", "6/6层"); info.put("style", "简单装修"); info.put("orientation", "朝南"); item.setInfo(info); item.setTitle("上海老小区"); items.add(item); mongoTemplate.insert(items, Item.class); } @Test public void insert(){ ArrayList<Banner> list = new ArrayList<>(); Date date = new Date(); Banner banner1 = new Banner(); banner1.setUrl("group1/M00/00/00/CtM3BV9h38yASwjzABLGy04UWBI722.png"); banner1.setCreateTime(date); Banner banner2 = new Banner(); banner2.setUrl("group1/M00/00/00/CtM3BV9h4BmAQkL1AAjIoXS-cuE085.png"); banner2.setCreateTime(date); Banner banner3 = new Banner(); banner3.setUrl("group1/M00/00/00/CtM3BV9h4B2AXvLBAAro96E3Lio828.png"); banner3.setCreateTime(date); Banner banner4 = new Banner(); banner4.setUrl("group1/M00/00/00/CtM3BV9h4CCAaSTAAAuC40wnByU864.png"); banner4.setCreateTime(date); Banner banner5 = new Banner(); banner5.setUrl("group1/M00/00/00/CtM3BV9h4CSADcQxABS0LiTh-88659.png"); banner5.setCreateTime(date); Banner banner6 = new Banner(); banner6.setUrl("group1/M00/00/00/CtM3BV9h4CeAOucVABHVEPBnO7M969.png"); banner6.setCreateTime(date); list.add(banner1); list.add(banner2); list.add(banner3); list.add(banner4); list.add(banner5); list.add(banner6); mongoTemplate.insert(list,Banner.class); } }
9,510
0.54902
0.478214
273
32.626373
19.877638
78
false
false
0
0
0
0
0
0
0.893773
false
false
8
8937777df53ec5fa6e78e5daa05d3123669ba2eb
30,614,526,934,706
22066a0b6db1f86688016d7b0285dc5c46eeff5f
/node/common/src/main/java/at/ac/tuwien/aic/ws14/group2/onion/node/common/node/TargetWorker.java
6af21fe1cede2e36f8a39fe4fb790452c8c7d266
[]
no_license
philatelist05/aic_2015
https://github.com/philatelist05/aic_2015
18cacfe6d4488123346eb0f9d00e1e65daf9c823
99349eba54f1275b0442baf85744c80fbaa4c591
refs/heads/master
2023-06-09T19:40:43.576000
2015-01-28T08:40:45
2015-01-28T08:40:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.ac.tuwien.aic.ws14.group2.onion.node.common.node; import at.ac.tuwien.aic.ws14.group2.onion.node.common.cells.Cell; import at.ac.tuwien.aic.ws14.group2.onion.shared.Configuration; import at.ac.tuwien.aic.ws14.group2.onion.shared.ConfigurationFactory; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.BufferOverflowException; import java.util.*; /** * Created by Stefan on 02.12.2014. */ public class TargetWorker implements AutoCloseable { static final Logger logger = LogManager.getLogger(TargetWorker.class.getName()); private final ConnectionWorker worker; private final TargetForwarder forwarder; private final NoGapBuffer<Bucket> buffer; private final Timer bufferChecker; private final ClearBufferTask clearBufferTask; public TargetWorker(ConnectionWorker worker, TargetForwarder forwarder) { this.worker = worker; this.forwarder = forwarder; forwarder.setTargetWorkerCallback(this); this.buffer = new NoGapBuffer<>((b1, b2) -> Long.compare(b1.getNr(), b2.getNr()), this::allItemsInRange, Integer.toUnsignedLong(-1) /*0xFFFFFFFF*/); bufferChecker = new Timer("PeriodicBufferChecker"); clearBufferTask = new ClearBufferTask(); } public void sendData(byte[] data, long sequenceNumber) { Bucket bucket = new Bucket(Arrays.copyOf(data, data.length), sequenceNumber); try { buffer.add(bucket); } catch (BufferOverflowException e) { clearBufferTask.run(); buffer.add(bucket); } } private Set<Bucket> allItemsInRange(Bucket b1, Bucket b2) { Set<Bucket> buckets = new HashSet<>(); if (b1.getNr() <= b2.getNr()) { for (long i = b1.getNr() + 1; i < b2.getNr(); i++) { buckets.add(new Bucket(new byte[]{}, i)); } } else { for (long i = b1.getNr() - 1; i > b2.getNr(); i--) { buckets.add(new Bucket(new byte[]{}, i)); } } return buckets; } @Override public void close() throws IOException { bufferChecker.cancel(); } public void sendCell(Cell cell) { try { worker.sendCell(cell); } catch (IOException e) { logger.debug("Unable to send cell " + cell); logger.catching(Level.DEBUG, e); } } public TargetForwarder getForwarder() { return forwarder; } public void startForwarding() { Configuration configuration = ConfigurationFactory.getConfiguration(); long targetWorkerTimeout = configuration.getTargetWorkerTimeout(); bufferChecker.schedule(clearBufferTask, targetWorkerTimeout, targetWorkerTimeout); } private class ClearBufferTask extends TimerTask { @Override public void run() { Set<Bucket> missingElements = buffer.getMissingElements(); if (missingElements.size() > 0) { logger.fatal("There are some gaps in the input: "); logger.fatal("Missing Sequences: " + missingElements.toString()); //TODO: What should we do here? return; } ByteArrayOutputStream bos = new ByteArrayOutputStream(); buffer.getContents().stream() .forEach(bucket -> { try { bos.write(bucket.getData()); } catch (IOException e) { logger.catching(Level.DEBUG, e); } }); buffer.clear(); try { forwarder.forward(bos.toByteArray()); } catch (IOException e) { logger.catching(Level.DEBUG, e); } } } }
UTF-8
Java
3,972
java
TargetWorker.java
Java
[ { "context": "wException;\nimport java.util.*;\n\n/**\n * Created by Stefan on 02.12.2014.\n */\npublic class TargetWorker impl", "end": 539, "score": 0.999629020690918, "start": 533, "tag": "NAME", "value": "Stefan" } ]
null
[]
package at.ac.tuwien.aic.ws14.group2.onion.node.common.node; import at.ac.tuwien.aic.ws14.group2.onion.node.common.cells.Cell; import at.ac.tuwien.aic.ws14.group2.onion.shared.Configuration; import at.ac.tuwien.aic.ws14.group2.onion.shared.ConfigurationFactory; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.BufferOverflowException; import java.util.*; /** * Created by Stefan on 02.12.2014. */ public class TargetWorker implements AutoCloseable { static final Logger logger = LogManager.getLogger(TargetWorker.class.getName()); private final ConnectionWorker worker; private final TargetForwarder forwarder; private final NoGapBuffer<Bucket> buffer; private final Timer bufferChecker; private final ClearBufferTask clearBufferTask; public TargetWorker(ConnectionWorker worker, TargetForwarder forwarder) { this.worker = worker; this.forwarder = forwarder; forwarder.setTargetWorkerCallback(this); this.buffer = new NoGapBuffer<>((b1, b2) -> Long.compare(b1.getNr(), b2.getNr()), this::allItemsInRange, Integer.toUnsignedLong(-1) /*0xFFFFFFFF*/); bufferChecker = new Timer("PeriodicBufferChecker"); clearBufferTask = new ClearBufferTask(); } public void sendData(byte[] data, long sequenceNumber) { Bucket bucket = new Bucket(Arrays.copyOf(data, data.length), sequenceNumber); try { buffer.add(bucket); } catch (BufferOverflowException e) { clearBufferTask.run(); buffer.add(bucket); } } private Set<Bucket> allItemsInRange(Bucket b1, Bucket b2) { Set<Bucket> buckets = new HashSet<>(); if (b1.getNr() <= b2.getNr()) { for (long i = b1.getNr() + 1; i < b2.getNr(); i++) { buckets.add(new Bucket(new byte[]{}, i)); } } else { for (long i = b1.getNr() - 1; i > b2.getNr(); i--) { buckets.add(new Bucket(new byte[]{}, i)); } } return buckets; } @Override public void close() throws IOException { bufferChecker.cancel(); } public void sendCell(Cell cell) { try { worker.sendCell(cell); } catch (IOException e) { logger.debug("Unable to send cell " + cell); logger.catching(Level.DEBUG, e); } } public TargetForwarder getForwarder() { return forwarder; } public void startForwarding() { Configuration configuration = ConfigurationFactory.getConfiguration(); long targetWorkerTimeout = configuration.getTargetWorkerTimeout(); bufferChecker.schedule(clearBufferTask, targetWorkerTimeout, targetWorkerTimeout); } private class ClearBufferTask extends TimerTask { @Override public void run() { Set<Bucket> missingElements = buffer.getMissingElements(); if (missingElements.size() > 0) { logger.fatal("There are some gaps in the input: "); logger.fatal("Missing Sequences: " + missingElements.toString()); //TODO: What should we do here? return; } ByteArrayOutputStream bos = new ByteArrayOutputStream(); buffer.getContents().stream() .forEach(bucket -> { try { bos.write(bucket.getData()); } catch (IOException e) { logger.catching(Level.DEBUG, e); } }); buffer.clear(); try { forwarder.forward(bos.toByteArray()); } catch (IOException e) { logger.catching(Level.DEBUG, e); } } } }
3,972
0.599194
0.589124
113
34.150444
26.873753
156
false
false
0
0
0
0
0
0
0.619469
false
false
8
87d50c001822689d2216bca1918f6c1618448e63
8,435,315,798,154
cd45114c19dabc1ab36f2695cee7eb0b2cf45cca
/DataStructures/src/functions/True.java
cd1ba81e4dcb63e4184aa63b6d294d24a72bd558
[ "MIT" ]
permissive
anandimous/UB-CSE_115
https://github.com/anandimous/UB-CSE_115
6cbf98aefd96b6f2f9655046e8bb471873650ee9
606a969e93ac59f3e92f4803b385ecb15c36baeb
refs/heads/master
2020-06-17T04:27:31.396000
2017-02-28T00:54:14
2017-02-28T00:54:14
75,041,518
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package functions; public class True<E> implements Predicate<E> { @Override public Boolean apply(E arg) { return true; } }
UTF-8
Java
131
java
True.java
Java
[]
null
[]
package functions; public class True<E> implements Predicate<E> { @Override public Boolean apply(E arg) { return true; } }
131
0.70229
0.70229
10
12.1
14.754321
46
false
false
0
0
0
0
0
0
0.7
false
false
8
9781bb785d7e83e0513237c6d4516e405eb00471
8,469,675,527,815
91b52e3b499d6c8f84a350be1f3d9671be4bf1b7
/src/model/collections/MyList.java
4921602d3302bc71a1386122787c3e3017c281b7
[]
no_license
iuliarevnic/APM
https://github.com/iuliarevnic/APM
98b25d0628f1e124030973f6ccae2195bf2431e7
3b8858a6690fa7aff9671758ca88952673d97337
refs/heads/main
2023-03-24T14:57:51.034000
2021-03-12T14:52:52
2021-03-12T14:52:52
346,782,366
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.collections; import java.util.ArrayList; public class MyList<T> implements InterfaceList<T> { private ArrayList<T> list; public MyList() { list=new ArrayList<T>(); } @Override public int size() { return list.size(); } @Override public boolean add(T element) { return list.add(element); } @Override public ArrayList<T> getAll() { return list; } @Override public boolean isDefined(Integer key) { return list.contains(key); } @Override public T getElement(int index) { return list.get(index); } @Override public String toString() { return list.toString(); } }
UTF-8
Java
722
java
MyList.java
Java
[]
null
[]
package model.collections; import java.util.ArrayList; public class MyList<T> implements InterfaceList<T> { private ArrayList<T> list; public MyList() { list=new ArrayList<T>(); } @Override public int size() { return list.size(); } @Override public boolean add(T element) { return list.add(element); } @Override public ArrayList<T> getAll() { return list; } @Override public boolean isDefined(Integer key) { return list.contains(key); } @Override public T getElement(int index) { return list.get(index); } @Override public String toString() { return list.toString(); } }
722
0.585873
0.585873
40
17.049999
14.345644
52
false
false
0
0
0
0
0
0
0.25
false
false
8
bf489c0f35b7fd2908685b59ca3a8f123b3ecd7d
31,387,621,041,913
11b48951cb8389e1834a077b03083de5d09191c8
/src/main/java/com/nera/nms/dto/InventoryUploadDTO.java
1150df27a57d189a4ccb0020d19e89be7a28ef6c
[]
no_license
vohoangptit/mng-web
https://github.com/vohoangptit/mng-web
21a61441f5d958175777542efca15b6f6f62b86a
79bdc978987cf36edb00d5b9560fe69d165d909f
refs/heads/master
2023-05-31T01:53:51.499000
2020-04-30T13:20:02
2020-04-30T13:20:02
260,216,295
0
0
null
false
2021-06-15T16:04:52
2020-04-30T13:16:42
2020-04-30T13:20:36
2021-06-15T16:04:52
5,155
0
0
3
JavaScript
false
false
package com.nera.nms.dto; import com.nera.nms.models.InventoryHost; import lombok.Data; import java.util.Date; @Data public class InventoryUploadDTO { private String hostName; private String description; private String ipAddress; private String port; private String ipAndPort; private String groupName; private String importStatus; private String createdBy; private String username; private String password; public InventoryHost dtoToEntity(InventoryHost entityHost) { if (entityHost != null) { entityHost.setName(getHostName()); entityHost.setDescription(getDescription()); entityHost.setIpAddress(getIpAddress()); entityHost.setPort(Integer.parseInt(getPort())); entityHost.setActive(true); entityHost.setCreatedDate(new Date()); entityHost.setCreatedBy(getCreatedBy()); entityHost.setDeleted(false); entityHost.setUsername(getUsername()); entityHost.setPassword(getPassword()); } return entityHost; } }
UTF-8
Java
1,103
java
InventoryUploadDTO.java
Java
[ { "context": "eleted(false);\n entityHost.setUsername(getUsername());\n entityHost.setPassword(getPasswor", "end": 1002, "score": 0.9795041680335999, "start": 991, "tag": "USERNAME", "value": "getUsername" }, { "context": "etUsername());\n entityHost.setPassword(getPassword());\n }\n return entityHost;\n }\n}\n", "end": 1053, "score": 0.9987810254096985, "start": 1042, "tag": "PASSWORD", "value": "getPassword" } ]
null
[]
package com.nera.nms.dto; import com.nera.nms.models.InventoryHost; import lombok.Data; import java.util.Date; @Data public class InventoryUploadDTO { private String hostName; private String description; private String ipAddress; private String port; private String ipAndPort; private String groupName; private String importStatus; private String createdBy; private String username; private String password; public InventoryHost dtoToEntity(InventoryHost entityHost) { if (entityHost != null) { entityHost.setName(getHostName()); entityHost.setDescription(getDescription()); entityHost.setIpAddress(getIpAddress()); entityHost.setPort(Integer.parseInt(getPort())); entityHost.setActive(true); entityHost.setCreatedDate(new Date()); entityHost.setCreatedBy(getCreatedBy()); entityHost.setDeleted(false); entityHost.setUsername(getUsername()); entityHost.setPassword(<PASSWORD>()); } return entityHost; } }
1,102
0.670898
0.670898
37
28.81081
18.570301
64
false
false
0
0
0
0
0
0
0.675676
false
false
8
051d7cf7996e8077d0e31ec396a4860e5f6b2774
37,031,208,034,159
8cc7379eb3742c06d32222363d638b211acaae12
/BlogPessoal/BlogPessoal/src/main/java/org/generation/BlogPessoal/Repository/Postagem.java
c2ac16b242f7baf6ad5a32a0a83f0685de63dfb1
[]
no_license
devzinha/Spring-Boot
https://github.com/devzinha/Spring-Boot
3c3a4f4119320b01cd993bcd29931c2c53c3a0ca
cc1c6881b6ac74d549b9c338f99b83d11c0ba821
refs/heads/main
2023-07-08T12:00:15.019000
2021-07-30T14:32:30
2021-07-30T14:32:30
382,091,946
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.generation.BlogPessoal.Repository; public class Postagem { }
UTF-8
Java
75
java
Postagem.java
Java
[]
null
[]
package org.generation.BlogPessoal.Repository; public class Postagem { }
75
0.8
0.8
5
14
18.253767
46
false
false
0
0
0
0
0
0
0.2
false
false
8
016075417e2476421bdf028bc96a39b99e61a766
36,876,589,213,318
7239cbc7c499a71e0e2c55e48113b90eae016c7d
/app/src/main/java/com/example/harshgupta/fire/insert.java
78735d7db1cd4164ebf131e165c04025973b1c2b
[]
no_license
harshguptaiiita/fire
https://github.com/harshguptaiiita/fire
f225ed413d84584b03641b62748df98a08ff06d7
c5b0cef3e9ea77f51e9a1d694f55f97a65b9c7d3
refs/heads/master
2021-01-22T22:16:27.950000
2017-05-29T19:53:21
2017-05-29T19:53:21
92,767,167
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.harshgupta.fire; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.firebase.client.Firebase; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; /** * Created by Harsh Gupta on 5/29/2017. */ public class insert extends AppCompatActivity { // @Override private FirebaseDatabase mFirebaseDatabase; protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.insert); mFirebaseDatabase = FirebaseDatabase.getInstance(); final EditText nam,ph; Button inse; final DatabaseReference mReference; Firebase.setAndroidContext(this); mReference=mFirebaseDatabase.getReference().child("data"); //final Firebase ref = new Firebase(url.FIREBASE_URL); nam=(EditText)findViewById(R.id.name); ph=(EditText)findViewById(R.id.phone); inse=(Button)findViewById(R.id.enter); inse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Creating firebase object //Getting values to store String name = nam.getText().toString().trim(); String phone = ph.getText().toString().trim(); fire p=new fire(); p.setName(name); p.setPhone(phone); mReference.push().setValue(p); } }); }}
UTF-8
Java
1,688
java
insert.java
Java
[ { "context": "base.database.FirebaseDatabase;\n\n/**\n * Created by Harsh Gupta on 5/29/2017.\n */\n\npublic class insert extends Ap", "end": 422, "score": 0.9998529553413391, "start": 411, "tag": "NAME", "value": "Harsh Gupta" } ]
null
[]
package com.example.harshgupta.fire; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.firebase.client.Firebase; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; /** * Created by <NAME> on 5/29/2017. */ public class insert extends AppCompatActivity { // @Override private FirebaseDatabase mFirebaseDatabase; protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.insert); mFirebaseDatabase = FirebaseDatabase.getInstance(); final EditText nam,ph; Button inse; final DatabaseReference mReference; Firebase.setAndroidContext(this); mReference=mFirebaseDatabase.getReference().child("data"); //final Firebase ref = new Firebase(url.FIREBASE_URL); nam=(EditText)findViewById(R.id.name); ph=(EditText)findViewById(R.id.phone); inse=(Button)findViewById(R.id.enter); inse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Creating firebase object //Getting values to store String name = nam.getText().toString().trim(); String phone = ph.getText().toString().trim(); fire p=new fire(); p.setName(name); p.setPhone(phone); mReference.push().setValue(p); } }); }}
1,683
0.654028
0.649289
54
30.277779
21.133102
66
false
false
0
0
0
0
0
0
0.574074
false
false
8
437d9c522813ed6682302f85f2325e3360f4b80b
35,098,472,767,213
bae0d93bbb9a6f35dcd25c8e2379df3fd9792933
/src/main/java/moe/kayla/okxparser/Snitch.java
b86eb53694958fe12c8831294dfc956192a69783
[]
no_license
KaloHG/OkxSnitchParser
https://github.com/KaloHG/OkxSnitchParser
82b2ece3a734299ae4bee78ca8f1cadba018c5d8
beda1ab85ff98c300a8eec0b1d2e49325aad0eb2
refs/heads/main
2023-08-14T15:45:12.681000
2021-10-18T05:41:36
2021-10-18T05:41:36
418,358,664
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package moe.kayla.okxparser; public class Snitch { int x; int y; int z; String name; String group; public Snitch(int x,int y,int z,String name,String group) { this.x = x; this.y = y; this.z = z; this.name = name; this.group = group; } public String getName() { return name; } public String getGroup() { return group; } public int getX() { return x; } public int getY() { return y; } public int getZ() { return z; } }
UTF-8
Java
574
java
Snitch.java
Java
[]
null
[]
package moe.kayla.okxparser; public class Snitch { int x; int y; int z; String name; String group; public Snitch(int x,int y,int z,String name,String group) { this.x = x; this.y = y; this.z = z; this.name = name; this.group = group; } public String getName() { return name; } public String getGroup() { return group; } public int getX() { return x; } public int getY() { return y; } public int getZ() { return z; } }
574
0.493031
0.493031
39
13.717949
12.733861
63
false
false
0
0
0
0
0
0
0.512821
false
false
8
1e71965fccbc6b5687001546a76edcf3fe39f269
27,925,877,415,515
a860f013c0febe4304fd899c99c44a0b0345456b
/collegeServer/BarberSync.java
e545faeb2711adeebef8887050bbe2e6d796e549
[]
no_license
dbroeder/randomJavaProjects
https://github.com/dbroeder/randomJavaProjects
ea34a566ff8053eb99ef089a83e28c39e69e458d
661695aebb7eb284125eff97ff31d6fcd8212177
refs/heads/master
2020-03-15T13:16:36.300000
2018-05-09T12:59:41
2018-05-09T12:59:41
132,162,778
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collegeServer; import java.util.*; public class BarberSync { public final int CHAIRS=7; public final int HAIR_CUT_TIME=10; public static int currentCustomers=0; public static int randomTime() { int randomTime=(int)(Math.random()*15); return randomTime; } public static int hairCutTime() { int randomHairTime=(int)(Math.random()*5+5); return randomHairTime; } public static synchronized void newCustomer() { if(currentCustomers<7&&currentCustomers>=0) currentCustomers++; } public static synchronized void customerLeft() { currentCustomers--; } public static boolean checkForCustomer() { if(currentCustomers==0) return false; else return true; } public static void main(String[] args) { Thread customers=new Thread(){ public void run(){ while(true) { try{sleep(randomTime());}catch(Exception e){}; newCustomer(); } } }; Thread barber=new Thread(){ public void run(){ int totalCustomers=0; int sleepTime=0; long start=System.currentTimeMillis(); while(System.currentTimeMillis()-start<540) { if(checkForCustomer()==false) { long start1=System.currentTimeMillis(); while(currentCustomers==0) { System.out.println("Waiting"); } sleepTime+=(System.currentTimeMillis()-start1); } try{sleep(hairCutTime());}catch(Exception e){}; System.out.println(currentCustomers); totalCustomers++; customerLeft(); } System.out.println("The barber cut "+totalCustomers+" people's hair in one day and slept "+sleepTime+" minutes during the day."); } }; customers.start(); barber.start(); while(barber.isAlive()) { } customers.stop(); } }
UTF-8
Java
1,815
java
BarberSync.java
Java
[]
null
[]
package collegeServer; import java.util.*; public class BarberSync { public final int CHAIRS=7; public final int HAIR_CUT_TIME=10; public static int currentCustomers=0; public static int randomTime() { int randomTime=(int)(Math.random()*15); return randomTime; } public static int hairCutTime() { int randomHairTime=(int)(Math.random()*5+5); return randomHairTime; } public static synchronized void newCustomer() { if(currentCustomers<7&&currentCustomers>=0) currentCustomers++; } public static synchronized void customerLeft() { currentCustomers--; } public static boolean checkForCustomer() { if(currentCustomers==0) return false; else return true; } public static void main(String[] args) { Thread customers=new Thread(){ public void run(){ while(true) { try{sleep(randomTime());}catch(Exception e){}; newCustomer(); } } }; Thread barber=new Thread(){ public void run(){ int totalCustomers=0; int sleepTime=0; long start=System.currentTimeMillis(); while(System.currentTimeMillis()-start<540) { if(checkForCustomer()==false) { long start1=System.currentTimeMillis(); while(currentCustomers==0) { System.out.println("Waiting"); } sleepTime+=(System.currentTimeMillis()-start1); } try{sleep(hairCutTime());}catch(Exception e){}; System.out.println(currentCustomers); totalCustomers++; customerLeft(); } System.out.println("The barber cut "+totalCustomers+" people's hair in one day and slept "+sleepTime+" minutes during the day."); } }; customers.start(); barber.start(); while(barber.isAlive()) { } customers.stop(); } }
1,815
0.630854
0.620386
79
20.974684
20.47473
133
false
false
0
0
0
0
0
0
3.025316
false
false
8
349d6b24c7ce7762cfe033b33a3bfaf886e4e3a7
38,697,655,339,835
2302d50d681aaa9e255f00275ffa4301c71dfe6a
/Palindrom.java
3207086fc5c98269ca296ab42bcf4d24de16ea58
[]
no_license
MWO2017/RoChPalindrom
https://github.com/MWO2017/RoChPalindrom
db1b4b074731660a0041bde1cf8826b0d7bd6574
ae5c10fe45471659dd25e8655795a794663e76e0
refs/heads/master
2021-09-07T09:10:52.754000
2018-02-20T21:56:09
2018-02-20T21:56:09
118,029,116
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Palindrom { private static String text; public String getText() { return text; } public void setText(String text) { this.text = text; } public Palindrom(String text) { this.text = text; } public static boolean check(String text) { boolean isPalindrom = false; String textToCheck = text.replaceAll("[\\s,./\"\':;?! \\-]", "").toLowerCase(); int textLen = textToCheck.length(); List<String> letters = new ArrayList<String>(); for (int i = 0; i < textLen; i++) { letters.add(Character.toString(textToCheck.charAt(i))); } List<String> toRevLetter = new ArrayList<String>(letters); Collections.reverse(toRevLetter); if (letters.equals(toRevLetter)) { isPalindrom = true; } return isPalindrom; } }
UTF-8
Java
845
java
Palindrom.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Palindrom { private static String text; public String getText() { return text; } public void setText(String text) { this.text = text; } public Palindrom(String text) { this.text = text; } public static boolean check(String text) { boolean isPalindrom = false; String textToCheck = text.replaceAll("[\\s,./\"\':;?! \\-]", "").toLowerCase(); int textLen = textToCheck.length(); List<String> letters = new ArrayList<String>(); for (int i = 0; i < textLen; i++) { letters.add(Character.toString(textToCheck.charAt(i))); } List<String> toRevLetter = new ArrayList<String>(letters); Collections.reverse(toRevLetter); if (letters.equals(toRevLetter)) { isPalindrom = true; } return isPalindrom; } }
845
0.67574
0.674556
45
17.777779
19.47065
81
false
false
0
0
0
0
0
0
1.6
false
false
8
b6da39426b2220f51e9c6279b0eb90b925375ec7
28,690,381,585,598
3be1c92046ff0b54a9708d69cb646dc406f6b47c
/src/main/java/configuration/EventConfiguration.java
fdf979fe84ea177d4bc4e36039cbd5b61ca9a585
[]
no_license
mizkuzy/myspring
https://github.com/mizkuzy/myspring
3b64cf9ca1e4b93c264ae6b1a7810e7bbbf9d6f1
260375465adf66c288b0ff7e2917570698da14e5
refs/heads/master
2020-12-24T20:00:45.723000
2017-03-26T12:31:26
2017-03-26T12:31:26
86,228,277
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package configuration; import events.MyBlackListEvent; import listeners.BlackListNotifier; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import services.EmailService; @Configuration @ComponentScan(basePackageClasses = {MyBlackListEvent.class, BlackListNotifier.class, EmailService.class}) public class EventConfiguration { }
UTF-8
Java
403
java
EventConfiguration.java
Java
[]
null
[]
package configuration; import events.MyBlackListEvent; import listeners.BlackListNotifier; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import services.EmailService; @Configuration @ComponentScan(basePackageClasses = {MyBlackListEvent.class, BlackListNotifier.class, EmailService.class}) public class EventConfiguration { }
403
0.861042
0.861042
12
32.583332
29.570419
106
false
false
0
0
0
0
0
0
0.666667
false
false
8
a145f110b0dc7fbba24ff8fe26af9a3a72147a47
28,690,381,585,242
1bd4dc6275d091ad8e2f78d3294742c7dd250f93
/Reto 5/src/main/java/org/example/Challenge5/models/Team.java
9f2ab3d317f9d9979fc1a73f2c240893d253910a
[]
no_license
TheB3rX/Reto-5
https://github.com/TheB3rX/Reto-5
cac4c75bbe08401e86474a9c72faebe55519ff0e
ef38b81862522f2e40d9711930b3a0e9db444d56
refs/heads/main
2023-08-11T08:26:36.001000
2021-09-13T04:08:47
2021-09-13T04:08:47
405,828,032
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.example.Challenge5.models; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Team { private int id; private String name; private String sponsor; private int wonRace; private LocalDate date; public Team(int id, String name, String sponsor, int wonRace, String date) { this.id = id; this.name = name; this.sponsor = sponsor; this.wonRace = wonRace; this.date = LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } 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 getSponsor() { return sponsor; } public void setSponsor(String sponsor) { this.sponsor = sponsor; } public int getWonRace() { return wonRace; } public void setWonRace(int wonRace) { this.wonRace = wonRace; } public LocalDate getDate() { return date; } public void setDate(LocalDate date) { this.date = date; } @Override public String toString() { return id+ "-" +name; } }
UTF-8
Java
1,361
java
Team.java
Java
[]
null
[]
package org.example.Challenge5.models; import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Team { private int id; private String name; private String sponsor; private int wonRace; private LocalDate date; public Team(int id, String name, String sponsor, int wonRace, String date) { this.id = id; this.name = name; this.sponsor = sponsor; this.wonRace = wonRace; this.date = LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } 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 getSponsor() { return sponsor; } public void setSponsor(String sponsor) { this.sponsor = sponsor; } public int getWonRace() { return wonRace; } public void setWonRace(int wonRace) { this.wonRace = wonRace; } public LocalDate getDate() { return date; } public void setDate(LocalDate date) { this.date = date; } @Override public String toString() { return id+ "-" +name; } }
1,361
0.562821
0.562087
65
18.938461
17.795313
85
false
false
0
0
0
0
0
0
0.446154
false
false
8
e112d7e165c7ac4fec708bb5cab1b4b18ef344d0
19,825,569,066,359
e049c452c76a8c3f69a6ad4bd746a3d116397539
/src/com/nus/adqs/delegate/task/TaskSchedulerDelegate.java
b667bd3a7e3f2891bab709e69eaec9e30d3adb17
[]
no_license
windieccf/common
https://github.com/windieccf/common
a387e2f4168adb3b2b01687c252866957da2d5e2
806389d25680370e00d427333492f5bb4e6a5694
refs/heads/master
2021-01-20T07:10:25.647000
2015-07-19T04:04:47
2015-07-19T04:04:47
39,321,797
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nus.adqs.delegate.task; import java.util.Date; import com.nus.adqs.dataaccess.model.taskmanagement.template.TaskTemplate; import com.nus.adqs.delegate.BaseDelegate; import com.nus.adqs.service.task.TaskTemplateService; public class TaskSchedulerDelegate extends BaseDelegate<TaskTemplate>{ public Class<TaskTemplateService> getServiceClass(){return TaskTemplateService.class;} private static TaskSchedulerDelegate instance; private TaskSchedulerDelegate(){ /*SINGLETON*/} public static TaskSchedulerDelegate getInstance(){ if( TaskSchedulerDelegate.instance == null) TaskSchedulerDelegate.instance = new TaskSchedulerDelegate(); return TaskSchedulerDelegate.instance; } /********************************************* EXTRAS *********************************************************/ public void generateTaskFromTemplate(Date callTime) throws Exception{ super.getService(this.getServiceClass()).generateTaskFromTemplate(callTime); } }
UTF-8
Java
978
java
TaskSchedulerDelegate.java
Java
[]
null
[]
package com.nus.adqs.delegate.task; import java.util.Date; import com.nus.adqs.dataaccess.model.taskmanagement.template.TaskTemplate; import com.nus.adqs.delegate.BaseDelegate; import com.nus.adqs.service.task.TaskTemplateService; public class TaskSchedulerDelegate extends BaseDelegate<TaskTemplate>{ public Class<TaskTemplateService> getServiceClass(){return TaskTemplateService.class;} private static TaskSchedulerDelegate instance; private TaskSchedulerDelegate(){ /*SINGLETON*/} public static TaskSchedulerDelegate getInstance(){ if( TaskSchedulerDelegate.instance == null) TaskSchedulerDelegate.instance = new TaskSchedulerDelegate(); return TaskSchedulerDelegate.instance; } /********************************************* EXTRAS *********************************************************/ public void generateTaskFromTemplate(Date callTime) throws Exception{ super.getService(this.getServiceClass()).generateTaskFromTemplate(callTime); } }
978
0.726994
0.726994
28
33.92857
33.058311
113
false
false
0
0
0
0
0
0
1.214286
false
false
8
67f2a2500d56308c32e0f326f8a274988c8efb4c
34,746,285,444,908
e9059f5615e249ef42f1f6e72e2ebdc3388051a3
/src/main/java/com/groupoffive/listapp/exceptions/IncorrectEmailOrPasswordException.java
52d7cf293d8e04f4bf6a95cd6607ff939e3729e0
[]
no_license
lsmacedo/ListAppBackEnd
https://github.com/lsmacedo/ListAppBackEnd
2e089f8ca00d87271fa15c336ed7167b955b8644
c8337a48d5bb1972d8999d90b22d909998a8abad
refs/heads/heroku
2020-04-24T23:39:49.937000
2019-06-16T20:30:38
2019-06-16T20:30:38
172,352,097
1
7
null
false
2020-07-01T22:36:45
2019-02-24T15:06:36
2019-06-16T20:30:45
2020-07-01T22:36:43
13,647
0
1
1
Java
false
false
package com.groupoffive.listapp.exceptions; public class IncorrectEmailOrPasswordException extends Exception { public IncorrectEmailOrPasswordException() { super("O e-mail e/ou senha informados estão incorretos."); } }
UTF-8
Java
239
java
IncorrectEmailOrPasswordException.java
Java
[]
null
[]
package com.groupoffive.listapp.exceptions; public class IncorrectEmailOrPasswordException extends Exception { public IncorrectEmailOrPasswordException() { super("O e-mail e/ou senha informados estão incorretos."); } }
239
0.760504
0.760504
9
25.444445
28.01631
66
false
false
0
0
0
0
0
0
0.222222
false
false
8
81567eb60b8a6fa4c31bbb693fb4edb3f0848eb7
34,746,285,445,325
e5431a10d8a82b382fa586724be9f804041fa0fe
/gaia-bigdata/gbd-document-service-impl/src/main/java/gaia/bigdata/api/document/DocumentAPI.java
2b6b30e873070984e8fdc86c473b63faa1cded1d
[]
no_license
whlee21/gaia
https://github.com/whlee21/gaia
65ca1a45e3c85ac0a368a94827e53cf73834d48b
9abcb86b7c2ffc33c39ec1cf66a25e9d2144aae0
refs/heads/master
2022-12-26T14:06:44.067000
2014-05-19T16:15:47
2014-05-19T16:15:47
14,943,649
2
0
null
false
2022-12-14T20:22:44
2013-12-05T04:16:26
2019-01-22T17:14:17
2022-12-14T20:22:41
12,178
3
0
25
Java
false
false
package gaia.bigdata.api.document; import com.google.inject.Inject; import com.google.inject.Singleton; import gaia.commons.api.API; import gaia.commons.api.ResourceFinder; import gaia.bigdata.services.ServiceType; @Singleton public class DocumentAPI extends API { @Inject public DocumentAPI(ResourceFinder finder) { super(finder); } protected void initAttachments() { attach("/{collection}", DocumentsServerResource.class); attach("/{collection}/retrieval", DocumentsRetrievalServerResource.class); attach("/{collection}/deletion", DocumentsDeletionSR.class); attach("/{collection}/doc/{id}", DocumentServerResource.class); } public String getAPIRoot() { return "/documents"; } public String getAPIName() { return ServiceType.DOCUMENT.name(); } }
UTF-8
Java
777
java
DocumentAPI.java
Java
[]
null
[]
package gaia.bigdata.api.document; import com.google.inject.Inject; import com.google.inject.Singleton; import gaia.commons.api.API; import gaia.commons.api.ResourceFinder; import gaia.bigdata.services.ServiceType; @Singleton public class DocumentAPI extends API { @Inject public DocumentAPI(ResourceFinder finder) { super(finder); } protected void initAttachments() { attach("/{collection}", DocumentsServerResource.class); attach("/{collection}/retrieval", DocumentsRetrievalServerResource.class); attach("/{collection}/deletion", DocumentsDeletionSR.class); attach("/{collection}/doc/{id}", DocumentServerResource.class); } public String getAPIRoot() { return "/documents"; } public String getAPIName() { return ServiceType.DOCUMENT.name(); } }
777
0.761905
0.761905
31
24.064516
22.077482
76
false
false
0
0
0
0
0
0
1.290323
false
false
8
6dafac29d9d4b26cff100a568d985157ec735196
30,442,728,245,996
c7f3dca0f47b544a21d29a91c25b417ddc5925e1
/AgendaSamuelArandav0.9/src/clases/Contacto.java
6b8939d49a09fa88a89da300b2772b72737daa4a
[]
no_license
SamuelAranda/AgendaJava
https://github.com/SamuelAranda/AgendaJava
808758d67b7ee218fdc662f1e5eb8d8d9ac80eb4
0152410b8c03ac908fdece013fd9d4312d058fc3
refs/heads/master
2022-12-01T03:41:57.910000
2020-08-11T11:44:24
2020-08-11T11:44:24
286,726,501
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package clases; import java.util.ArrayList; public abstract class Contacto { protected int id; protected String nombre; protected String direccion; protected String notas; protected ArrayList<Telefono> telefono; protected ArrayList<Correo> correo; public Contacto(int id, String nombre) { telefono = new ArrayList<Telefono>(); correo = new ArrayList<Correo>(); setIdentificador(id); setNombre(nombre); } public Contacto(int id, String nombre, String direccion, String notas) { telefono = new ArrayList<Telefono>(); correo = new ArrayList<Correo>(); setIdentificador(id); setNombre(nombre); setDireccion(direccion); setNotas(notas); } public int getIdentificador() { return id; } public void setIdentificador(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public String getNotas() { return notas; } public void setNotas(String notas) { this.notas = notas; } public ArrayList<Telefono> getTelefono() { return telefono; } // El Set de telefono mantiene dos formatos, puedes incluir un String o Construir un nuevo ArrayList desde la base de datos. public void setTelefono(Telefono tlf) { this.telefono.add(tlf); } public void setTelefono(ArrayList<Telefono> tlf) { this.telefono= tlf; } public ArrayList<Correo> getCorreo() { return correo; } // El Set de correos mantiene dos formatos, puedes incluir un String o Construir un nuevo ArrayList desde la base de datos. public void setCorreo(Correo correo) { this.correo.add(correo); } public void setCorreo(ArrayList<Correo> correo) { this.correo = correo; } @Override public String toString() { return "ID: " + id + "\nNombre: " + nombre + "\n" + "Dirección: " + direccion + "\n" + "Telefono: " + telefono + " Correo: " + correo + "\n" + notas; } }
UTF-8
Java
2,063
java
Contacto.java
Java
[]
null
[]
package clases; import java.util.ArrayList; public abstract class Contacto { protected int id; protected String nombre; protected String direccion; protected String notas; protected ArrayList<Telefono> telefono; protected ArrayList<Correo> correo; public Contacto(int id, String nombre) { telefono = new ArrayList<Telefono>(); correo = new ArrayList<Correo>(); setIdentificador(id); setNombre(nombre); } public Contacto(int id, String nombre, String direccion, String notas) { telefono = new ArrayList<Telefono>(); correo = new ArrayList<Correo>(); setIdentificador(id); setNombre(nombre); setDireccion(direccion); setNotas(notas); } public int getIdentificador() { return id; } public void setIdentificador(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public String getNotas() { return notas; } public void setNotas(String notas) { this.notas = notas; } public ArrayList<Telefono> getTelefono() { return telefono; } // El Set de telefono mantiene dos formatos, puedes incluir un String o Construir un nuevo ArrayList desde la base de datos. public void setTelefono(Telefono tlf) { this.telefono.add(tlf); } public void setTelefono(ArrayList<Telefono> tlf) { this.telefono= tlf; } public ArrayList<Correo> getCorreo() { return correo; } // El Set de correos mantiene dos formatos, puedes incluir un String o Construir un nuevo ArrayList desde la base de datos. public void setCorreo(Correo correo) { this.correo.add(correo); } public void setCorreo(ArrayList<Correo> correo) { this.correo = correo; } @Override public String toString() { return "ID: " + id + "\nNombre: " + nombre + "\n" + "Dirección: " + direccion + "\n" + "Telefono: " + telefono + " Correo: " + correo + "\n" + notas; } }
2,063
0.691562
0.691562
99
19.828283
23.80393
125
false
false
0
0
0
0
0
0
1.626263
false
false
8
cd3d86b3d08fac15472a08997d6ee8c7fcb6fb58
35,485,019,818,839
3aaa940097f25ceeb162cb335fff455a3027a121
/src/main/java/net/jfabricationgames/json_rpc/UnsupportedParameterException.java
fbb94fb9d747054010ab5ab24f97c8fbf5828c65
[]
no_license
tfassbender/NoteBookService
https://github.com/tfassbender/NoteBookService
a5fdffe67ff2cf24114635468067f2ef22b0202f
a225ae9edd0b3ae3d82c3ca9e164436a2861e9a0
refs/heads/master
2022-06-30T05:07:32.017000
2019-12-03T10:08:36
2019-12-03T10:08:36
219,282,962
0
0
null
false
2021-12-14T21:37:25
2019-11-03T10:20:01
2019-12-03T10:11:58
2021-12-14T21:37:23
67
0
0
4
Java
false
false
package net.jfabricationgames.json_rpc; public class UnsupportedParameterException extends Exception { private static final long serialVersionUID = -7246131768926016190L; public UnsupportedParameterException(String message, Throwable cause) { super(message, cause); } public UnsupportedParameterException(String message) { super(message); } }
UTF-8
Java
358
java
UnsupportedParameterException.java
Java
[]
null
[]
package net.jfabricationgames.json_rpc; public class UnsupportedParameterException extends Exception { private static final long serialVersionUID = -7246131768926016190L; public UnsupportedParameterException(String message, Throwable cause) { super(message, cause); } public UnsupportedParameterException(String message) { super(message); } }
358
0.801676
0.748603
14
24.642857
27.481441
72
false
false
0
0
0
0
0
0
1.285714
false
false
8
65e0beeb9902e600cb21aab99ad5d329ef22da10
15,831,249,499,533
486d66c7db41a8f8ffb4687ded7b84c67d8cd810
/src/main/java/kr/co/jdbctest/JdbcMainTest.java
e51406e2005153fc72c97e950d0aff6f80df5100
[]
no_license
dreisers/jdbcTest
https://github.com/dreisers/jdbcTest
9280b5e6e348b5a01b29b53f234244dc17cdf4d6
e1e63fa609ff9aea54ce3c1637df068b1bb48f74
refs/heads/master
2020-05-02T04:34:42.885000
2019-03-26T09:15:39
2019-03-26T09:15:39
177,753,169
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kr.co.jdbctest; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; public class JdbcMainTest { public static void main(String[] args) { // JdbcTemplate 클래스 연습 // -> 기본 자바 JDBC를 좀 더 편리하게 사용할 수 있다. // -> JdbcTemplate = DriverManager + Connection + Statement + ResultSet // DB연결 String jdbc = "src/main/java/kr/co/jdbctest/jdbc.xml"; ApplicationContext context = new FileSystemXmlApplicationContext(jdbc); //<bean id="boardDAO" class="kr.co.jdbctest.BoardDAO"> IDao dao = (IDao) context.getBean("boardDAO"); //-------------------------------------------------------------------------------- BoardDTO dto = null; List<BoardDTO> list = null; //1) 추가 /* int result = dao.insert(new BoardDTO("개나리", "sol1@soldesk.com", "www.soldesk.com", "축구선수", "영국 토트넘", "1234", "", 0)); if(result==0) { System.out.println("행 추가 실패"); }else { System.out.println("행 추가 성공"); }// if end */ //4) 수정 // -> idx=1 레코드의 이름을 수정 /* dto = new BoardDTO(); dto.setIdx(1); dto.setName("라일락"); dao.update(dto); */ //5) 삭제 // -> idx=1 레코드 삭제 dao.delete(1); //2) 목록 list = dao.list(); for(int idx=0; idx<list.size(); idx++) { dto = list.get(idx); System.out.print(dto.getIdx() + ""); System.out.print(dto.getName() + ""); System.out.print(dto.getEmail() + ""); System.out.print(dto.getHomepage() + ""); System.out.print(dto.getTitle() + ""); System.out.print(dto.getContent() + ""); System.out.print(dto.getPwd() + ""); System.out.print(dto.getWdate() + ""); System.out.print(dto.getHit() + ""); System.out.println(); }//for end //3) 레코드 갯수 System.out.println("전체 레코드 갯수 : " + dao.rowCount()); //6) 상세보기 dto = dao.read(3); System.out.print(dto.getIdx() + ""); System.out.print(dto.getName() + ""); System.out.print(dto.getEmail() + ""); System.out.print(dto.getHomepage() + ""); System.out.print(dto.getTitle() + ""); System.out.print(dto.getContent() + ""); System.out.print(dto.getPwd() + ""); System.out.print(dto.getWdate() + ""); System.out.print(dto.getHit() + ""); System.out.println(); //7) 페이징 int start = 2, end = 3; list = dao.paging(start, end); for(int idx=0; idx<list.size(); idx++) { dto = list.get(idx); System.out.print(dto.getIdx() + ""); System.out.print(dto.getName() + ""); System.out.print(dto.getEmail() + ""); System.out.print(dto.getHomepage() + ""); System.out.print(dto.getTitle() + ""); System.out.print(dto.getContent() + ""); System.out.print(dto.getPwd() + ""); System.out.print(dto.getWdate() + ""); System.out.print(dto.getHit() + ""); System.out.println(); }//for end }// main end }// class end
UHC
Java
3,105
java
JdbcMainTest.java
Java
[ { "context": "*\r\n\t\tint result = dao.insert(new BoardDTO(\"개나리\", \"sol1@soldesk.com\", \"www.soldesk.com\", \"축구선수\", \"영국 토트넘\", \"1234\", \"\"", "end": 884, "score": 0.999846875667572, "start": 868, "tag": "EMAIL", "value": "sol1@soldesk.com" }, { "context": "new BoardDTO();\r\n\t\tdto.setIdx(1);\r\n\t\tdto.setName(\"라일락\");\r\n\t\tdao.update(dto);\r\n\t\t*/\r\n\t\t\r\n\t\t//5) 삭제\r\n\t\t//", "end": 1173, "score": 0.9996793866157532, "start": 1170, "tag": "NAME", "value": "라일락" } ]
null
[]
package kr.co.jdbctest; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; public class JdbcMainTest { public static void main(String[] args) { // JdbcTemplate 클래스 연습 // -> 기본 자바 JDBC를 좀 더 편리하게 사용할 수 있다. // -> JdbcTemplate = DriverManager + Connection + Statement + ResultSet // DB연결 String jdbc = "src/main/java/kr/co/jdbctest/jdbc.xml"; ApplicationContext context = new FileSystemXmlApplicationContext(jdbc); //<bean id="boardDAO" class="kr.co.jdbctest.BoardDAO"> IDao dao = (IDao) context.getBean("boardDAO"); //-------------------------------------------------------------------------------- BoardDTO dto = null; List<BoardDTO> list = null; //1) 추가 /* int result = dao.insert(new BoardDTO("개나리", "<EMAIL>", "www.soldesk.com", "축구선수", "영국 토트넘", "1234", "", 0)); if(result==0) { System.out.println("행 추가 실패"); }else { System.out.println("행 추가 성공"); }// if end */ //4) 수정 // -> idx=1 레코드의 이름을 수정 /* dto = new BoardDTO(); dto.setIdx(1); dto.setName("라일락"); dao.update(dto); */ //5) 삭제 // -> idx=1 레코드 삭제 dao.delete(1); //2) 목록 list = dao.list(); for(int idx=0; idx<list.size(); idx++) { dto = list.get(idx); System.out.print(dto.getIdx() + ""); System.out.print(dto.getName() + ""); System.out.print(dto.getEmail() + ""); System.out.print(dto.getHomepage() + ""); System.out.print(dto.getTitle() + ""); System.out.print(dto.getContent() + ""); System.out.print(dto.getPwd() + ""); System.out.print(dto.getWdate() + ""); System.out.print(dto.getHit() + ""); System.out.println(); }//for end //3) 레코드 갯수 System.out.println("전체 레코드 갯수 : " + dao.rowCount()); //6) 상세보기 dto = dao.read(3); System.out.print(dto.getIdx() + ""); System.out.print(dto.getName() + ""); System.out.print(dto.getEmail() + ""); System.out.print(dto.getHomepage() + ""); System.out.print(dto.getTitle() + ""); System.out.print(dto.getContent() + ""); System.out.print(dto.getPwd() + ""); System.out.print(dto.getWdate() + ""); System.out.print(dto.getHit() + ""); System.out.println(); //7) 페이징 int start = 2, end = 3; list = dao.paging(start, end); for(int idx=0; idx<list.size(); idx++) { dto = list.get(idx); System.out.print(dto.getIdx() + ""); System.out.print(dto.getName() + ""); System.out.print(dto.getEmail() + ""); System.out.print(dto.getHomepage() + ""); System.out.print(dto.getTitle() + ""); System.out.print(dto.getContent() + ""); System.out.print(dto.getPwd() + ""); System.out.print(dto.getWdate() + ""); System.out.print(dto.getHit() + ""); System.out.println(); }//for end }// main end }// class end
3,096
0.568205
0.560342
101
26.960396
21.108358
119
false
false
0
0
0
0
0
0
2.673267
false
false
8
38a8e106a620dfadc0d9cc4086fa7ea561a00717
4,063,039,105,068
678ef22c5a744deffe6a04cbcba9ac7a05173fd5
/src/main/java/ui/pages/repo/AnimalSelectionOverlayRepo.java
2c770a8b81c7b813f07169b028211ed1978816b4
[]
no_license
venkataramantk/npbAuto
https://github.com/venkataramantk/npbAuto
fd90dfeed12ad06fab84fa6533fd845e0ad7841a
c5fb11d512c13878d4777d8543adb8a4cdfa95a2
refs/heads/master
2020-04-06T22:14:35.501000
2019-01-29T11:41:30
2019-01-29T11:41:30
157,829,282
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ui.pages.repo; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import ui.UiBase; /** * Created by Balu on 12/03/2018. */ public class AnimalSelectionOverlayRepo extends UiBase { @FindBy(xpath = ".//*[@class='button-inner'][contains(.,'Create CVI')]") public WebElement createCVIBtn; @FindBy(xpath = ".//*[@class='segment-button'][contains(.,'Small Animal')]") public WebElement smallAnimalTypeSelection; @FindBy(xpath = ".//*[@class='segment-button'][contains(.,'Large Animal')]") public WebElement largeAnimalTypeSelection; @FindBy(xpath = ".//*[@class='button-inner'][contains(.,'Start CVI')]") public WebElement startCVIButtonTypePopUp; }
UTF-8
Java
726
java
AnimalSelectionOverlayRepo.java
Java
[ { "context": "pport.FindBy;\nimport ui.UiBase;\n\n/**\n * Created by Balu on 12/03/2018.\n */\n\npublic class AnimalSelectionO", "end": 147, "score": 0.9749644994735718, "start": 143, "tag": "NAME", "value": "Balu" } ]
null
[]
package ui.pages.repo; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import ui.UiBase; /** * Created by Balu on 12/03/2018. */ public class AnimalSelectionOverlayRepo extends UiBase { @FindBy(xpath = ".//*[@class='button-inner'][contains(.,'Create CVI')]") public WebElement createCVIBtn; @FindBy(xpath = ".//*[@class='segment-button'][contains(.,'Small Animal')]") public WebElement smallAnimalTypeSelection; @FindBy(xpath = ".//*[@class='segment-button'][contains(.,'Large Animal')]") public WebElement largeAnimalTypeSelection; @FindBy(xpath = ".//*[@class='button-inner'][contains(.,'Start CVI')]") public WebElement startCVIButtonTypePopUp; }
726
0.694215
0.683196
25
28.040001
28.655861
80
false
false
0
0
0
0
0
0
0.48
false
false
8
6e931514b5b12b4a247cf82e88061735fa90e6c0
13,185,549,635,376
85f33719055191801e360321ac41a673b9e118df
/jdbc-json-extension-common/src/main/java/com/cf/jdbc/json/ext/common/fetch/ResultNode.java
eab4fdf5f2854375d36fe87375ca1923bdf1c5da
[ "Apache-2.0" ]
permissive
Consolefire/jdbc-json-extension
https://github.com/Consolefire/jdbc-json-extension
b4256003ff87e6603c81008a73daa0077f2ea042
639b6f77995c72c7db839f1e17ebe9236cb88fdc
refs/heads/master
2022-12-05T09:13:36.779000
2021-04-12T09:41:32
2021-04-12T09:41:32
185,373,714
0
0
Apache-2.0
false
2022-11-16T00:51:04
2019-05-07T09:52:56
2021-04-12T09:41:35
2022-11-16T00:51:01
370
0
0
3
Java
false
false
package com.cf.jdbc.json.ext.common.fetch; import java.util.List; import java.util.stream.Collectors; import com.cf.jdbc.json.ext.common.model.Node; import com.cf.jdbc.json.ext.common.model.ResultDataSet; import lombok.Getter; import lombok.NonNull; import lombok.Setter; @Getter @Setter public class ResultNode extends Node { private ResultDataSet resultDataSet; private String errorMessage; public ResultNode(@NonNull String name, ResultNode parent, List<? extends ResultNode> children) { super(name, parent, children); } public ResultNode(String name, Node parent, List<? extends Node> children) { super(name, parent, children); } public ResultNode(String name, Node parent) { super(name, parent); } public ResultNode(String name) { super(name); } public void addChild(ResultNode result) { getChildren().add(result); } public boolean hasData() { return null != resultDataSet && resultDataSet.getRowCount() > 0; } public boolean isCollection() { return hasData() && resultDataSet.getRowCount() > 1; } public ResultNode getChildByName(String name) { if (!hasChildren()) { return null; } return getChildren().parallelStream().filter(node -> name.equals(node.getName())).map(x -> (ResultNode) x) .findFirst().orElse(null); } public List<ResultNode> getChildrenByName(String name) { if (!hasChildren()) { return null; } return getChildren().parallelStream().filter(node -> name.equals(node.getName())).map(x -> (ResultNode) x) .collect(Collectors.toList()); } }
UTF-8
Java
1,716
java
ResultNode.java
Java
[]
null
[]
package com.cf.jdbc.json.ext.common.fetch; import java.util.List; import java.util.stream.Collectors; import com.cf.jdbc.json.ext.common.model.Node; import com.cf.jdbc.json.ext.common.model.ResultDataSet; import lombok.Getter; import lombok.NonNull; import lombok.Setter; @Getter @Setter public class ResultNode extends Node { private ResultDataSet resultDataSet; private String errorMessage; public ResultNode(@NonNull String name, ResultNode parent, List<? extends ResultNode> children) { super(name, parent, children); } public ResultNode(String name, Node parent, List<? extends Node> children) { super(name, parent, children); } public ResultNode(String name, Node parent) { super(name, parent); } public ResultNode(String name) { super(name); } public void addChild(ResultNode result) { getChildren().add(result); } public boolean hasData() { return null != resultDataSet && resultDataSet.getRowCount() > 0; } public boolean isCollection() { return hasData() && resultDataSet.getRowCount() > 1; } public ResultNode getChildByName(String name) { if (!hasChildren()) { return null; } return getChildren().parallelStream().filter(node -> name.equals(node.getName())).map(x -> (ResultNode) x) .findFirst().orElse(null); } public List<ResultNode> getChildrenByName(String name) { if (!hasChildren()) { return null; } return getChildren().parallelStream().filter(node -> name.equals(node.getName())).map(x -> (ResultNode) x) .collect(Collectors.toList()); } }
1,716
0.643939
0.642774
65
25.4
27.725468
114
false
false
0
0
0
0
0
0
0.476923
false
false
8
ec8740bc5fa3e3d4d2b5c2187e7ef241e920ebbc
4,269,197,533,675
d16e92e0a4f0b2aa4c73dfd2d019e36053f58fc7
/Frameworks/Springsource Spring -2.6_3.0/SpringMVC3/WEB-INF/src/com/amir/web/PriceIncreaseFormController.java
cff810d91ff9fd34488194a6033894071d8f4d0c
[]
no_license
chatdhana/tech-material-java
https://github.com/chatdhana/tech-material-java
903a6f9f39ddbd1d35e1d517d96e19ab63c25e14
10e9f99fe0cbdbceb87a2c1a5267b9c9ae8e7078
refs/heads/master
2021-01-20T20:18:18.792000
2017-12-21T09:29:30
2017-12-21T09:29:30
64,846,106
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// controller for the html form (priceincrease.jsp) package com.amir.web; import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; //import com.amir.business.Product; import com.amir.business.ProductManager; import com.amir.business.PriceIncrease; /* SimpleFormController - provides configurable form and success views, and an onSubmit chain for convenient overriding. Automatically resubmits to the form view in case of validation errors, and renders the success view in case of a valid submission. */ public class PriceIncreaseFormController extends SimpleFormController { /** Logger for this class and subclasses */ protected final Log logger = LogFactory.getLog(getClass()); private ProductManager prodMan; public ModelAndView onSubmit(Object command) throws ServletException { int increase = ((PriceIncrease) command).getPercentage(); logger.info("Increasing prices by " + increase + "%."); prodMan.increasePrice(increase); //String now = (new java.util.Date()).toString(); logger.info("returning from PriceIncreaseForm view to " + getSuccessView()); return new ModelAndView(new RedirectView(getSuccessView())); } protected Object formBackingObject(HttpServletRequest request) throws ServletException { PriceIncrease priceIncrease = new PriceIncrease(); priceIncrease.setPercentage(20); return priceIncrease; } public void setProductManager(ProductManager pm) { prodMan = pm; } public ProductManager getProductManager() { return prodMan; } }
UTF-8
Java
1,966
java
PriceIncreaseFormController.java
Java
[]
null
[]
// controller for the html form (priceincrease.jsp) package com.amir.web; import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; //import com.amir.business.Product; import com.amir.business.ProductManager; import com.amir.business.PriceIncrease; /* SimpleFormController - provides configurable form and success views, and an onSubmit chain for convenient overriding. Automatically resubmits to the form view in case of validation errors, and renders the success view in case of a valid submission. */ public class PriceIncreaseFormController extends SimpleFormController { /** Logger for this class and subclasses */ protected final Log logger = LogFactory.getLog(getClass()); private ProductManager prodMan; public ModelAndView onSubmit(Object command) throws ServletException { int increase = ((PriceIncrease) command).getPercentage(); logger.info("Increasing prices by " + increase + "%."); prodMan.increasePrice(increase); //String now = (new java.util.Date()).toString(); logger.info("returning from PriceIncreaseForm view to " + getSuccessView()); return new ModelAndView(new RedirectView(getSuccessView())); } protected Object formBackingObject(HttpServletRequest request) throws ServletException { PriceIncrease priceIncrease = new PriceIncrease(); priceIncrease.setPercentage(20); return priceIncrease; } public void setProductManager(ProductManager pm) { prodMan = pm; } public ProductManager getProductManager() { return prodMan; } }
1,966
0.717701
0.716684
62
29.741936
29.825804
117
false
false
0
0
0
0
0
0
0.419355
false
false
8
edf03bad7321f9b8234bd8b59611251d732be68d
37,615,323,582,359
efbde0c10dd9a710085be50c5253e1f06140054e
/vigyMobile/src/pl/jrola/java/android/vigym/vigymobile/db/dao/UsersDAOImpl.java
701fc85ea3ddcefcff963c970961a5d86a8dd2b1
[]
no_license
jrola90/vigyMobile
https://github.com/jrola90/vigyMobile
9696ccbdf504bc1f832eeb3c95dbc98d8214c69d
641bd484157433ed00268aa5f9e2dc9fae74451d
refs/heads/master
2020-05-28T06:10:29.420000
2014-09-06T12:00:18
2014-09-06T12:00:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.jrola.java.android.vigym.vigymobile.db.dao; import java.util.ArrayList; import java.util.List; import pl.jrola.java.android.vigym.vigymobile.db.dao.exceptions.AddUserException; import pl.jrola.java.android.vigym.vigymobile.db.to.UserTransferObject; import pl.jrola.java.android.vigym.vigymobile.utils.Utils; import pl.jrola.java.android.vigym.vigymobile.utils.db.DbUtils; import pl.jrola.java.android.vigym.vigymobile.utils.db.DbHelper; import pl.jrola.java.android.vigym.vigymobile.utils.db.DbConditionals; import pl.jrola.java.android.vigym.vigymobile.utils.db.WhereClauseHelper; import pl.jrola.java.android.vigym.vigymobile.utils.exceptions.DatabaseHelperInitialiseException; import android.content.ContentValues; import android.database.Cursor; import android.util.Log; public class UsersDAOImpl implements UsersDAO { private DbHelper db; public UsersDAOImpl(DbHelper db) { this.db = db; } @Override public UserTransferObject addUser(UserTransferObject userTransferObject) throws AddUserException { ContentValues contentValues = new ContentValues(); contentValues.put(DbUtils.DB_COLUMN_USERS_USER_NICKNAME, userTransferObject.getUser_nickname()); contentValues.put(DbUtils.DB_COLUMN_USERS_USER_PASSWORD, userTransferObject.getUser_password()); contentValues.put(DbUtils.DB_COLUMN_USERS_USER_MAIL, userTransferObject.getUser_mail()); try { db.insert(DbUtils.DB_TABLE_USERS, null, contentValues); } catch (Exception e) { Utils.logError(e); throw new AddUserException(e); } try { userTransferObject = this.getUsers(userTransferObject).get(0); } catch (DatabaseHelperInitialiseException e) { Utils.logError(e); throw new AddUserException(e); } return userTransferObject; } @Override public boolean deleteUser(Long id) throws DatabaseHelperInitialiseException { String whereClause = DbUtils.DB_COLUMN_USERS_USER_ID + "= ?"; if (db.delete(DbUtils.DB_TABLE_USERS, whereClause, new String[] { Long.toString(id) }) == 1) return true; return false; } @Override public List<UserTransferObject> getUsers( UserTransferObject userTransferObject, DbConditionals dbCond) throws DatabaseHelperInitialiseException { List<UserTransferObject> userTransferObjectList = new ArrayList<UserTransferObject>(); Cursor cursor = null; try { WhereClauseHelper whereClauseHelper = new WhereClauseHelper(); whereClauseHelper.setDbConditional(dbCond); whereClauseHelper.setCaseSensitive(false); whereClauseHelper.setWhereStatementFromMap(userTransferObject .getPropertiesMap()); cursor = db.query(true, DbUtils.DB_TABLE_USERS, null, whereClauseHelper.getWhereStatement(), whereClauseHelper.getWhereStatementValues(), null, null, null, null, null); } catch (IllegalAccessException e) { Log.e(getClass().getName(), e.getMessage()); } catch (IllegalArgumentException e) { Log.e(getClass().getName(), e.getMessage()); } while (cursor.moveToNext()) userTransferObjectList.add(new UserTransferObject(cursor)); return userTransferObjectList; } public List<UserTransferObject> getUsers( UserTransferObject userTransferObject) throws DatabaseHelperInitialiseException { return getUsers(userTransferObject, DbConditionals.AND); } @Override public UserTransferObject updateUser(UserTransferObject userTransferObject) { // TODO Auto-generated method stub return null; } public boolean changePassword(long user_id, String newPassword) { try { UserTransferObject uto = new UserTransferObject(); uto.setUser_id(user_id); WhereClauseHelper whereClauseHelper = new WhereClauseHelper(); whereClauseHelper.setDbConditional(DbConditionals.AND); whereClauseHelper.setCaseSensitive(false); whereClauseHelper.setWhereStatementFromMap(uto.getPropertiesMap()); ContentValues cv = new ContentValues(); cv.put(DbUtils.DB_COLUMN_USERS_USER_PASSWORD, newPassword); int ret = db.update(DbUtils.DB_TABLE_USERS, cv, whereClauseHelper.getWhereStatement(), whereClauseHelper.getWhereStatementValues()); if (ret == 1) return true; else return false; } catch (Exception e) { Log.e(getClass().getName(), e.getMessage()); return false; } } }
UTF-8
Java
4,237
java
UsersDAOImpl.java
Java
[]
null
[]
package pl.jrola.java.android.vigym.vigymobile.db.dao; import java.util.ArrayList; import java.util.List; import pl.jrola.java.android.vigym.vigymobile.db.dao.exceptions.AddUserException; import pl.jrola.java.android.vigym.vigymobile.db.to.UserTransferObject; import pl.jrola.java.android.vigym.vigymobile.utils.Utils; import pl.jrola.java.android.vigym.vigymobile.utils.db.DbUtils; import pl.jrola.java.android.vigym.vigymobile.utils.db.DbHelper; import pl.jrola.java.android.vigym.vigymobile.utils.db.DbConditionals; import pl.jrola.java.android.vigym.vigymobile.utils.db.WhereClauseHelper; import pl.jrola.java.android.vigym.vigymobile.utils.exceptions.DatabaseHelperInitialiseException; import android.content.ContentValues; import android.database.Cursor; import android.util.Log; public class UsersDAOImpl implements UsersDAO { private DbHelper db; public UsersDAOImpl(DbHelper db) { this.db = db; } @Override public UserTransferObject addUser(UserTransferObject userTransferObject) throws AddUserException { ContentValues contentValues = new ContentValues(); contentValues.put(DbUtils.DB_COLUMN_USERS_USER_NICKNAME, userTransferObject.getUser_nickname()); contentValues.put(DbUtils.DB_COLUMN_USERS_USER_PASSWORD, userTransferObject.getUser_password()); contentValues.put(DbUtils.DB_COLUMN_USERS_USER_MAIL, userTransferObject.getUser_mail()); try { db.insert(DbUtils.DB_TABLE_USERS, null, contentValues); } catch (Exception e) { Utils.logError(e); throw new AddUserException(e); } try { userTransferObject = this.getUsers(userTransferObject).get(0); } catch (DatabaseHelperInitialiseException e) { Utils.logError(e); throw new AddUserException(e); } return userTransferObject; } @Override public boolean deleteUser(Long id) throws DatabaseHelperInitialiseException { String whereClause = DbUtils.DB_COLUMN_USERS_USER_ID + "= ?"; if (db.delete(DbUtils.DB_TABLE_USERS, whereClause, new String[] { Long.toString(id) }) == 1) return true; return false; } @Override public List<UserTransferObject> getUsers( UserTransferObject userTransferObject, DbConditionals dbCond) throws DatabaseHelperInitialiseException { List<UserTransferObject> userTransferObjectList = new ArrayList<UserTransferObject>(); Cursor cursor = null; try { WhereClauseHelper whereClauseHelper = new WhereClauseHelper(); whereClauseHelper.setDbConditional(dbCond); whereClauseHelper.setCaseSensitive(false); whereClauseHelper.setWhereStatementFromMap(userTransferObject .getPropertiesMap()); cursor = db.query(true, DbUtils.DB_TABLE_USERS, null, whereClauseHelper.getWhereStatement(), whereClauseHelper.getWhereStatementValues(), null, null, null, null, null); } catch (IllegalAccessException e) { Log.e(getClass().getName(), e.getMessage()); } catch (IllegalArgumentException e) { Log.e(getClass().getName(), e.getMessage()); } while (cursor.moveToNext()) userTransferObjectList.add(new UserTransferObject(cursor)); return userTransferObjectList; } public List<UserTransferObject> getUsers( UserTransferObject userTransferObject) throws DatabaseHelperInitialiseException { return getUsers(userTransferObject, DbConditionals.AND); } @Override public UserTransferObject updateUser(UserTransferObject userTransferObject) { // TODO Auto-generated method stub return null; } public boolean changePassword(long user_id, String newPassword) { try { UserTransferObject uto = new UserTransferObject(); uto.setUser_id(user_id); WhereClauseHelper whereClauseHelper = new WhereClauseHelper(); whereClauseHelper.setDbConditional(DbConditionals.AND); whereClauseHelper.setCaseSensitive(false); whereClauseHelper.setWhereStatementFromMap(uto.getPropertiesMap()); ContentValues cv = new ContentValues(); cv.put(DbUtils.DB_COLUMN_USERS_USER_PASSWORD, newPassword); int ret = db.update(DbUtils.DB_TABLE_USERS, cv, whereClauseHelper.getWhereStatement(), whereClauseHelper.getWhereStatementValues()); if (ret == 1) return true; else return false; } catch (Exception e) { Log.e(getClass().getName(), e.getMessage()); return false; } } }
4,237
0.76776
0.767052
131
31.351145
27.402548
107
false
false
0
0
0
0
0
0
2.343511
false
false
8
b2d7b6b52785b1130b9588133352cb196ecec93e
38,259,568,675,904
a48952f249597be8fc0abc6cdbe56dd6b0931d0b
/SpringBoot/skill/src/main/java/com/dre/skill/design_patterns/behavior/visitor/Configurer.java
c877e638f6c54ee444d7fbbd7b3860c93e042f43
[]
no_license
akaradzha/repo-rails
https://github.com/akaradzha/repo-rails
b2f85d4b9d8b3b2d0e979b82e8b63ab47ce6b407
2409cdf5ba441d8d4a2f2f4cea1b1b6c3f1ee094
refs/heads/master
2017-12-05T18:44:58.543000
2017-08-08T13:35:08
2017-08-08T13:35:08
80,278,364
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dre.skill.design_patterns.behavior.visitor; public interface Configurer { void configure(FoxClient client); void configure(OperaClient client); }
UTF-8
Java
169
java
Configurer.java
Java
[]
null
[]
package com.dre.skill.design_patterns.behavior.visitor; public interface Configurer { void configure(FoxClient client); void configure(OperaClient client); }
169
0.769231
0.769231
8
20.125
20.966864
55
false
false
0
0
0
0
0
0
0.375
false
false
8
e0e1f929b9816dbc9d1ad9459026d67eab4937cb
35,450,660,087,604
b77e8eb573c32a392d634ff5e4e7936400e7d4f0
/src/main/java/org/grantharper/recipe/parser/RecipeParser.java
e21d507e856daad436cea1640411cc230b757640
[]
no_license
grantharper/recipe-ocr
https://github.com/grantharper/recipe-ocr
2579a3fb754c138265f5488bc2935fd3bd74842a
2c97f724d8f3a5b3372205cd53aca470e413a0c7
refs/heads/master
2021-01-25T14:56:02.802000
2018-06-09T15:50:00
2018-06-09T15:50:00
123,736,761
4
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.grantharper.recipe.parser; import org.grantharper.recipe.domain.Recipe; public interface RecipeParser { Recipe parse(String text); }
UTF-8
Java
149
java
RecipeParser.java
Java
[]
null
[]
package org.grantharper.recipe.parser; import org.grantharper.recipe.domain.Recipe; public interface RecipeParser { Recipe parse(String text); }
149
0.798658
0.798658
8
17.625
17.754841
44
false
false
0
0
0
0
0
0
0.375
false
false
8
69c7786cd428dff224a33ebaf5a409be48c076e3
19,576,460,970,415
fa25dc3707a213d7c9ae85d1726b244123838c3b
/EnterpriseManagement/src/vn/com/hkt/provider/api/IProviderPanelShowProject.java
830bbe8091697c40a482f1c5dd725f9f98ed05f2
[]
no_license
quynhnguyen1202/Enterprise_Manager
https://github.com/quynhnguyen1202/Enterprise_Manager
150e6c62c6c9f645ed16d5974ad498ce1248449c
53b5b04728890aecb5bd9c0733b0511bbaa0f8da
refs/heads/master
2020-05-21T11:43:10.303000
2013-03-30T01:17:54
2013-03-30T01:17:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package vn.com.hkt.provider.api; import java.util.List; import vn.com.hkt.data.entity.Department; import vn.com.hkt.data.entity.Enterprise; import vn.com.hkt.data.entity.Project; /** * * @author QuynhNguyen */ public interface IProviderPanelShowProject extends IProviderGeneral<Project> { public List<Department> getListDepartmentByIDEnt(long idEnterprise); public List<Enterprise> getListEnterprise(); public Enterprise getEnterpriseByID(long idEnterprise); }
UTF-8
Java
578
java
IProviderPanelShowProject.java
Java
[ { "context": "vn.com.hkt.data.entity.Project;\n\n/**\n *\n * @author QuynhNguyen\n */\npublic interface IProviderPanelShowP", "end": 301, "score": 0.6979063749313354, "start": 299, "tag": "USERNAME", "value": "Qu" }, { "context": "com.hkt.data.entity.Project;\n\n/**\n *\n * @author QuynhNguyen\n */\npublic interface IProviderPanelShowProject ex", "end": 310, "score": 0.801397979259491, "start": 301, "tag": "NAME", "value": "ynhNguyen" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package vn.com.hkt.provider.api; import java.util.List; import vn.com.hkt.data.entity.Department; import vn.com.hkt.data.entity.Enterprise; import vn.com.hkt.data.entity.Project; /** * * @author QuynhNguyen */ public interface IProviderPanelShowProject extends IProviderGeneral<Project> { public List<Department> getListDepartmentByIDEnt(long idEnterprise); public List<Enterprise> getListEnterprise(); public Enterprise getEnterpriseByID(long idEnterprise); }
578
0.769896
0.769896
20
27.9
25.043762
78
false
false
0
0
0
0
0
0
0.5
false
false
8
c20467441f752df529ca683081576d18071485bb
33,449,205,342,660
fb131418f9da4be368a550c11eb09cdca715b07e
/src/at/madlener/pgdp/b9/a5/Predator.java
684a165e913c1319bfb7e3d61610d526db9aa1e4
[]
no_license
madlenerc/pgdp
https://github.com/madlenerc/pgdp
631be093eab06440b5cc430a0f08bf126623fd9b
fbd7aca6256108b576540b3aa8d218960872e3a1
refs/heads/master
2019-07-07T16:02:13.678000
2017-01-29T15:10:24
2017-01-29T15:10:24
72,372,125
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.madlener.pgdp.b9.a5; /** * Klasse der Raubtiere. */ public class Predator extends Animal { private int daysLeft; /** * Dem Konstruktor wird das Geschlecht des Tiers uebergeben. */ public Predator(boolean female) { this(female, "", null); } public Predator(boolean female, String square, Position position) { super(female, square, position); daysLeft = getDaysWithoutFood(); } public int getDaysLeft() { return daysLeft; } @Override public void sunset() { daysLeft--; if (daysLeft < 0) { setAlive(false); } } public void eat(Vegetarian food) { daysLeft = getDaysWithoutFood(); food.setAlive(false); } public int getDaysWithoutFood() { return -1; } public String getName() { return ""; } ; /** * Checks if predator can move to given square. * * @param column Column index * @param row Row index * @return 1 if square is free, 0 if square is taken but can be eaten, -1 if out of bounds or can't be eaten */ @Override public int canMoveTo(int column, int row) { int squareState = super.canMoveTo(column, row); // if square is on board and it's not free, check if the animal can be eaten if (squareState == 0) { Animal[][] board = getPosition().boardRepresentation(); Animal other = board[column][row]; return other instanceof Vegetarian && isEnemy(other) ? 0 : -1; } return squareState; } /** * @return A formatted String containing the remaining lifetime. */ public String toLifetimeString() { return getName() + " on " + getSquare() + ": " + getDaysLeft() + "/" + getDaysWithoutFood() + " days left"; } }
UTF-8
Java
1,870
java
Predator.java
Java
[]
null
[]
package at.madlener.pgdp.b9.a5; /** * Klasse der Raubtiere. */ public class Predator extends Animal { private int daysLeft; /** * Dem Konstruktor wird das Geschlecht des Tiers uebergeben. */ public Predator(boolean female) { this(female, "", null); } public Predator(boolean female, String square, Position position) { super(female, square, position); daysLeft = getDaysWithoutFood(); } public int getDaysLeft() { return daysLeft; } @Override public void sunset() { daysLeft--; if (daysLeft < 0) { setAlive(false); } } public void eat(Vegetarian food) { daysLeft = getDaysWithoutFood(); food.setAlive(false); } public int getDaysWithoutFood() { return -1; } public String getName() { return ""; } ; /** * Checks if predator can move to given square. * * @param column Column index * @param row Row index * @return 1 if square is free, 0 if square is taken but can be eaten, -1 if out of bounds or can't be eaten */ @Override public int canMoveTo(int column, int row) { int squareState = super.canMoveTo(column, row); // if square is on board and it's not free, check if the animal can be eaten if (squareState == 0) { Animal[][] board = getPosition().boardRepresentation(); Animal other = board[column][row]; return other instanceof Vegetarian && isEnemy(other) ? 0 : -1; } return squareState; } /** * @return A formatted String containing the remaining lifetime. */ public String toLifetimeString() { return getName() + " on " + getSquare() + ": " + getDaysLeft() + "/" + getDaysWithoutFood() + " days left"; } }
1,870
0.575401
0.570053
79
22.670887
25.662228
115
false
false
0
0
0
0
0
0
0.379747
false
false
8
d17d54e1f244aab40ecb160a3f5a71f834803d65
33,449,205,342,929
1cf92ea625869479ebda753172984c1206c873fd
/app/src/main/java/mateomartinelli/user2cadem/it/supermercato/Model/Pesce.java
a92f10e72bc6742dce58a270628b3e93af069753
[]
no_license
MatteoMartinelliMM/Supermercato_MatteoMartinelli
https://github.com/MatteoMartinelliMM/Supermercato_MatteoMartinelli
01fa5dead8933c3a6d920be956fb9bce0c3d3929
3817deda520aa4837773c105b744cb65f524feb6
refs/heads/master
2021-08-23T19:51:48.813000
2017-12-06T09:01:17
2017-12-06T09:01:17
112,624,140
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mateomartinelli.user2cadem.it.supermercato.Model; import java.io.Serializable; /** * Created by utente2.academy on 11/30/2017. */ public class Pesce extends Prodotti implements Serializable{ public final int tipo = 2; public Pesce(String marca, double prezzo) { super(marca, prezzo); } }
UTF-8
Java
321
java
Pesce.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by utente2.academy on 11/30/2017.\n */\n\npublic class Pesce extends Pr", "end": 122, "score": 0.9925235509872437, "start": 107, "tag": "USERNAME", "value": "utente2.academy" } ]
null
[]
package mateomartinelli.user2cadem.it.supermercato.Model; import java.io.Serializable; /** * Created by utente2.academy on 11/30/2017. */ public class Pesce extends Prodotti implements Serializable{ public final int tipo = 2; public Pesce(String marca, double prezzo) { super(marca, prezzo); } }
321
0.716511
0.682243
14
21.928572
22.088989
60
false
false
0
0
0
0
0
0
0.428571
false
false
8
8066f9b656ba21233a3459e4cfd36d8fe8e5682a
13,065,290,550,992
82a8f35c86c274cb23279314db60ab687d33a691
/duokan/reader/ui/personal/mb.java
6a1c6b3c9d615b94fe3cbe4bad34f65cd959c5a5
[]
no_license
QMSCount/DReader
https://github.com/QMSCount/DReader
42363f6187b907dedde81ab3b9991523cbf2786d
c1537eed7091e32a5e2e52c79360606f622684bc
refs/heads/master
2021-09-14T22:16:45.495000
2018-05-20T14:57:15
2018-05-20T14:57:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.duokan.reader.ui.personal; import android.content.Context; import com.duokan.c.j; import com.duokan.reader.domain.cloud.DkCloudAnnotation; import com.duokan.reader.ui.general.ap; class mb extends ap { final /* synthetic */ DkCloudAnnotation a; final /* synthetic */ lv b; mb(lv lvVar, Context context, DkCloudAnnotation dkCloudAnnotation) { this.b = lvVar; this.a = dkCloudAnnotation; super(context); } protected void onOk() { super.onOk(); this.b.a(new DkCloudAnnotation[]{this.a}, j.personal__reading_note_info_header_view__deleting_one_note, j.personal__reading_note_info_header_view__failed_to_delete_one_note); } }
UTF-8
Java
701
java
mb.java
Java
[]
null
[]
package com.duokan.reader.ui.personal; import android.content.Context; import com.duokan.c.j; import com.duokan.reader.domain.cloud.DkCloudAnnotation; import com.duokan.reader.ui.general.ap; class mb extends ap { final /* synthetic */ DkCloudAnnotation a; final /* synthetic */ lv b; mb(lv lvVar, Context context, DkCloudAnnotation dkCloudAnnotation) { this.b = lvVar; this.a = dkCloudAnnotation; super(context); } protected void onOk() { super.onOk(); this.b.a(new DkCloudAnnotation[]{this.a}, j.personal__reading_note_info_header_view__deleting_one_note, j.personal__reading_note_info_header_view__failed_to_delete_one_note); } }
701
0.690442
0.690442
23
29.47826
37.815189
182
false
false
0
0
0
0
0
0
0.695652
false
false
8
86da9ce96a1d20415445018644efa8c2f7cec32c
13,065,290,551,116
87fb37cab3632a5cff1dcad7e77e8e8d9cb84028
/part_02/Exercise_12.java
69e096fe9c57fd0a720a9a5298f7c3efe579c97d
[]
no_license
rickypatillas/Java-Labs
https://github.com/rickypatillas/Java-Labs
e0f18abe9ff770b1920602d15f733f69d3dbaf2a
874a5e1c90d740a1c4b28289ea5a7ade428e4d9b
refs/heads/master
2021-08-14T07:59:45.866000
2017-11-15T02:58:53
2017-11-15T02:58:53
105,192,482
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package part_02; import java.util.Scanner; /** * Part 2 Exercise 12: * * * Receive the following arguments from the user: * - miles to drive * - MPG of the car * - Price per gallon of fuel * * Display the cost of the trip in the console. * * */ //public class Car{ // // public void main (String[] args) { // double miles, mpg, price; // // Scanner input = new Scanner(System.in); // // System.out.print("Miles to drive: "); // miles = input.nextDouble(); // // System.out.print("Miles per gallon: "); // mpg = input.nextDouble(); // // System.out.print("Price of gas: "); // price = input.nextDouble(); // // System.out.println("result is: " + miles + mpg + price); // // // } // //}
UTF-8
Java
805
java
Exercise_12.java
Java
[]
null
[]
package part_02; import java.util.Scanner; /** * Part 2 Exercise 12: * * * Receive the following arguments from the user: * - miles to drive * - MPG of the car * - Price per gallon of fuel * * Display the cost of the trip in the console. * * */ //public class Car{ // // public void main (String[] args) { // double miles, mpg, price; // // Scanner input = new Scanner(System.in); // // System.out.print("Miles to drive: "); // miles = input.nextDouble(); // // System.out.print("Miles per gallon: "); // mpg = input.nextDouble(); // // System.out.print("Price of gas: "); // price = input.nextDouble(); // // System.out.println("result is: " + miles + mpg + price); // // // } // //}
805
0.529193
0.522981
40
19.15
20.000687
66
false
false
0
0
0
0
0
0
0.325
false
false
8
a1684c2a120e185afcb761c71100e7f3d1c3fd2f
15,281,493,673,811
48930997b54bd14fadc29ad5ea9caa78478cf271
/JTI/src/com/khoisang/jti/chat/extend/MyWebViewClient.java
31feb55dc543504463f89390923bee7dd0c7651c
[]
no_license
lamduongvan/UHub
https://github.com/lamduongvan/UHub
e4609e0396f959c572f9cb163a6ce9369be8f6eb
85e960ac7f7fb13f2a48a61ec19788211ca08b67
refs/heads/master
2015-08-19T23:19:45.973000
2015-06-11T03:25:32
2015-06-11T03:25:32
29,896,051
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.khoisang.jti.chat.extend; /* * Lamduongvan */ import java.lang.ref.WeakReference; import android.webkit.WebView; import android.webkit.WebViewClient; import com.khoisang.jti.chat.JavascriptFunction; import com.khoisang.jti.data.People; import com.khoisang.jti.global.MyApplication; import com.khoisang.jti.ui.ActivityMain; import com.khoisang.khoisanglibary.ui.ActionEvent; public class MyWebViewClient extends WebViewClient { private WeakReference<ActivityMain> mActivityMain; public MyWebViewClient() { } public MyWebViewClient(ActivityMain activityMain) { mActivityMain = new WeakReference<ActivityMain>(activityMain); } @Override public void onPageFinished(WebView webView, String url) { MyWebView myWebView = (MyWebView) webView; if (myWebView.Error == false) { MyApplication application = (MyApplication) mActivityMain.get().getApplication(); if (application.IpChat.equalsIgnoreCase(url) == true) { People people = application.getUser(); JavascriptFunction.getInstance(myWebView).A2CFLogin(people); } } else { mActivityMain.get().handleEvent(new ActionEvent(com.khoisang.jti.constant.Event.CHATTING_CONNECTION, null)); } } @Override public void onReceivedError(WebView webView, int errorCode, String description, String failingUrl) { MyWebView myWebView = (MyWebView) webView; myWebView.Error = true; } }
UTF-8
Java
1,380
java
MyWebViewClient.java
Java
[ { "context": "package com.khoisang.jti.chat.extend;\n\n/*\n * Lamduongvan\n */\n\nimport java.lang.ref.WeakReference;\n\nimport ", "end": 56, "score": 0.9183611869812012, "start": 45, "tag": "NAME", "value": "Lamduongvan" } ]
null
[]
package com.khoisang.jti.chat.extend; /* * Lamduongvan */ import java.lang.ref.WeakReference; import android.webkit.WebView; import android.webkit.WebViewClient; import com.khoisang.jti.chat.JavascriptFunction; import com.khoisang.jti.data.People; import com.khoisang.jti.global.MyApplication; import com.khoisang.jti.ui.ActivityMain; import com.khoisang.khoisanglibary.ui.ActionEvent; public class MyWebViewClient extends WebViewClient { private WeakReference<ActivityMain> mActivityMain; public MyWebViewClient() { } public MyWebViewClient(ActivityMain activityMain) { mActivityMain = new WeakReference<ActivityMain>(activityMain); } @Override public void onPageFinished(WebView webView, String url) { MyWebView myWebView = (MyWebView) webView; if (myWebView.Error == false) { MyApplication application = (MyApplication) mActivityMain.get().getApplication(); if (application.IpChat.equalsIgnoreCase(url) == true) { People people = application.getUser(); JavascriptFunction.getInstance(myWebView).A2CFLogin(people); } } else { mActivityMain.get().handleEvent(new ActionEvent(com.khoisang.jti.constant.Event.CHATTING_CONNECTION, null)); } } @Override public void onReceivedError(WebView webView, int errorCode, String description, String failingUrl) { MyWebView myWebView = (MyWebView) webView; myWebView.Error = true; } }
1,380
0.774638
0.773913
48
27.75
28.390507
111
false
false
0
0
0
0
0
0
1.416667
false
false
8
4537d3b89c94a00bcea0260f3fca108f3a633151
249,108,143,340
58d9eb581c9b7511b553ca74a8aecc23e0368594
/src/main/java/tiles/RockTile.java
145c0c6c4a135830d88471d0057dfc1af0646c0d
[]
no_license
jpconver/conversWorld
https://github.com/jpconver/conversWorld
680be3f4e60f790a45ace54f0744844eeb69b261
d05f3eed2ba6da9b97a307f42077f7c8f9c2665a
refs/heads/master
2020-07-23T05:42:14.704000
2019-09-22T04:42:50
2019-09-22T04:42:50
207,461,263
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tiles; import application.Application; public class RockTile extends Tile { public RockTile(int id) { super(Application.getInstance().getAssets().getStaticAssets().get("stone"), id); } @Override public boolean isSolid() { return true; } }
UTF-8
Java
288
java
RockTile.java
Java
[]
null
[]
package tiles; import application.Application; public class RockTile extends Tile { public RockTile(int id) { super(Application.getInstance().getAssets().getStaticAssets().get("stone"), id); } @Override public boolean isSolid() { return true; } }
288
0.652778
0.652778
16
17
22.268251
88
false
false
0
0
0
0
0
0
0.3125
false
false
8
6897cd04cf44678dec92ea4b0c8a5c6c64c70755
26,250,840,129,159
843cff7dd15ecda4a62c04f63b8fc0b52ea0e333
/hw08/src/main/java/hr/fer/zemris/bf/lexer/TokenType.java
046db3546a9e67dd3b1fd34512e71d95513237c2
[]
no_license
mihaeljaic/OPJJ-FER
https://github.com/mihaeljaic/OPJJ-FER
feaa52509b5c12a8f44ecc9330f87673ef2da816
453d59cb3495720b0a74351dc843bdabd2d4c51c
refs/heads/master
2023-01-05T15:03:08.936000
2020-10-26T22:12:49
2020-10-26T22:12:49
268,927,476
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hr.fer.zemris.bf.lexer; /** * Token types which are used in {@link Lexer} class. * * @author Mihael Jaić * */ public enum TokenType { /** * End of file. */ EOF, /** * Variable. */ VARIABLE, /** * Constant. */ CONSTANT, /** * Operator. */ OPERATOR, /** * Open bracket. */ OPEN_BRACKET, /** * Closed bracket. */ CLOSED_BRACKET }
UTF-8
Java
415
java
TokenType.java
Java
[ { "context": " are used in {@link Lexer} class.\r\n * \r\n * @author Mihael Jaić\r\n *\r\n */\r\n\r\npublic enum TokenType {\r\n\t/**\r\n\t * En", "end": 122, "score": 0.9998758435249329, "start": 111, "tag": "NAME", "value": "Mihael Jaić" } ]
null
[]
package hr.fer.zemris.bf.lexer; /** * Token types which are used in {@link Lexer} class. * * @author <NAME> * */ public enum TokenType { /** * End of file. */ EOF, /** * Variable. */ VARIABLE, /** * Constant. */ CONSTANT, /** * Operator. */ OPERATOR, /** * Open bracket. */ OPEN_BRACKET, /** * Closed bracket. */ CLOSED_BRACKET }
409
0.497585
0.497585
35
9.828571
10.399137
53
false
false
0
0
0
0
0
0
0.857143
false
false
8
8aa965b20d0c88924b0a3a2e85b5ac225f7b4f1a
23,785,528,916,733
9766bfa814b20519d3fa77082bfaaafc278500da
/app/src/main/java/com/asura/android_study/activity/fragtofrag/MyListener.java
3a8baf362701e725e907b24318f32a777e78f461
[]
no_license
qq709238339/AndroidStudy
https://github.com/qq709238339/AndroidStudy
133b13e24459848f3bbecb64b11996c0c4ff3e35
1453719dd5db7de17d5139d102325b9c28e295e4
refs/heads/master
2021-01-22T08:27:53.328000
2019-11-25T16:23:01
2019-11-25T16:23:01
81,899,183
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.asura.android_study.activity.fragtofrag; /** * Created by Liuxd on 2016/11/1 21:29. */ public interface MyListener { void sendFrom1(String info); void sendFrom2(String info); }
UTF-8
Java
201
java
MyListener.java
Java
[ { "context": "roid_study.activity.fragtofrag;\n\n/**\n * Created by Liuxd on 2016/11/1 21:29.\n */\n\npublic interface MyListe", "end": 77, "score": 0.9996473789215088, "start": 72, "tag": "USERNAME", "value": "Liuxd" } ]
null
[]
package com.asura.android_study.activity.fragtofrag; /** * Created by Liuxd on 2016/11/1 21:29. */ public interface MyListener { void sendFrom1(String info); void sendFrom2(String info); }
201
0.711443
0.646766
10
19.1
18.667887
52
false
false
0
0
0
0
0
0
0.3
false
false
8
4d7cd0a06077339565713aa1b080023b67a3427a
11,965,778,940,172
214a2d0310e78673432dec2e6a05d03367bfd4d5
/thelatestnews/src/test/java/ru/ma/boldyrev/spring2/thelatestnews/SourceOfEarningPersistenceTest.java
86d1b3a535fd0fee88b34b9b4025c2d3605d1dd8
[]
no_license
BoldyrevMichael/TheLatestNews
https://github.com/BoldyrevMichael/TheLatestNews
0f27af4b608403190d2f24b5087330511363f4f9
0a8e763f412227bbcaedc1c8a83e415ce059a124
refs/heads/master
2020-03-25T11:10:18.484000
2018-08-25T13:35:30
2018-08-25T13:35:30
143,721,840
0
0
null
false
2018-08-25T13:35:31
2018-08-06T11:55:11
2018-08-23T02:10:44
2018-08-25T13:35:31
55,329
0
0
0
Java
false
null
package ru.ma.boldyrev.spring2.thelatestnews; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import ru.ma.boldyrev.spring2.thelatestnews.entity.SourceOfEarning; @DataJpaTest @RunWith(SpringJUnit4ClassRunner.class) public class SourceOfEarningPersistenceTest { @Autowired private TestEntityManager testEntityManager; @Test public void test() { testEntityManager.getEntityManager().createQuery("DELETE FROM SourceOfEarning").executeUpdate(); Assert.assertEquals(getCountSourceOfEarning(), 0L); testEntityManager.persist(new SourceOfEarning()); Assert.assertEquals(getCountSourceOfEarning(), 1L); testEntityManager.getEntityManager().createQuery("DELETE FROM SourceOfEarning").executeUpdate(); Assert.assertEquals(getCountSourceOfEarning(), 0L); } public long getCountSourceOfEarning() { return testEntityManager.getEntityManager().createQuery("SELECT COUNT(e) FROM SourceOfEarning e", Long.class) .getSingleResult(); } }
UTF-8
Java
1,344
java
SourceOfEarningPersistenceTest.java
Java
[]
null
[]
package ru.ma.boldyrev.spring2.thelatestnews; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import ru.ma.boldyrev.spring2.thelatestnews.entity.SourceOfEarning; @DataJpaTest @RunWith(SpringJUnit4ClassRunner.class) public class SourceOfEarningPersistenceTest { @Autowired private TestEntityManager testEntityManager; @Test public void test() { testEntityManager.getEntityManager().createQuery("DELETE FROM SourceOfEarning").executeUpdate(); Assert.assertEquals(getCountSourceOfEarning(), 0L); testEntityManager.persist(new SourceOfEarning()); Assert.assertEquals(getCountSourceOfEarning(), 1L); testEntityManager.getEntityManager().createQuery("DELETE FROM SourceOfEarning").executeUpdate(); Assert.assertEquals(getCountSourceOfEarning(), 0L); } public long getCountSourceOfEarning() { return testEntityManager.getEntityManager().createQuery("SELECT COUNT(e) FROM SourceOfEarning e", Long.class) .getSingleResult(); } }
1,344
0.774554
0.768601
34
38.529411
32.972569
117
false
false
0
0
0
0
0
0
0.617647
false
false
8
3c5c623285f00a2c2fc93eda8eef82d74ee0f4b6
10,582,799,484,884
aa720a7b3368508ed7e4ac88cf5639d68e56d7ac
/src/com/ricocarpe/magiworld/Jeu.java
540324292153afa533414d50528fbde67aa2a342
[]
no_license
Ricocarpe/MagiWorld
https://github.com/Ricocarpe/MagiWorld
26b65fb8b5e3fbe2f74b3c283c1285cfb43b5ec8
4341c6f852fcf2be876313b833d73f8220d0e89e
refs/heads/master
2020-06-26T19:39:46.947000
2019-08-08T12:24:37
2019-08-08T12:24:37
199,333,936
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ricocarpe.magiworld; import java.util.Scanner; public class Jeu { public static void makePeopleFight(Joueur joueur1, Joueur joueur2) { Scanner clavier = new Scanner(System.in); boolean isEmptygetvie = false; int numAttack; do { /////////////Pour le joueur 1 : joueur1.auTourduJoueur1(); numAttack = clavier.nextInt(); if (joueur1.getVie() > 0) { if (numAttack == 1) { joueur2.setVie(joueur2.getVie() - joueur1.basicAttack()); joueur1.syntheseBasicAttack(); } if (numAttack == 2) { joueur2.setVie(joueur2.getVie() - joueur1.specialAttack()); joueur1.specialAttack(); joueur1.syntheseSpecialAttack(); } } //////////Pour le joueur 2 if (joueur2.getVie() > 0) { joueur2.auTourduJoueur2(); numAttack = clavier.nextInt(); if (numAttack == 1) { joueur1.setVie(joueur1.getVie() - joueur2.basicAttack()); joueur2.syntheseBasicAttack(); } if (numAttack == 2) { joueur2.specialAttack(); joueur2.specialAttack(); } } if (joueur2.getVie() <= 0 || joueur1.getVie() <= 0) { isEmptygetvie = true; } } while (!isEmptygetvie); if (joueur1.getVie() >= 0 && joueur2.getVie() <= 0) { String classeName = getClassNameJoueur1(joueur1); System.out.println("le joueur " + joueur1.numeroDuJoueur1() + classeName); } else if (joueur2.getVie() >= 0 && joueur1.getVie() <= 0) { String classeName = getClassNameJoueur2(joueur2); System.out.println("le joueur " + joueur2.numeroDuJoueur2() + classeName); } } private static String getClassNameJoueur1(Joueur joueur1) { String className = ""; if (joueur1 instanceof Guerrier){ className="Guerrier"; }else if (joueur1 instanceof Rodeur){ className="Rodeur"; }else if (joueur1 instanceof Mage){ className="Mage"; }return className; } private static String getClassNameJoueur2(Joueur joueur2) { String className = ""; if (joueur2 instanceof Guerrier){ className="Guerrier"; }else if (joueur2 instanceof Rodeur){ className="Rodeur"; }else if (joueur2 instanceof Mage){ className="Mage"; }return className; } }
UTF-8
Java
2,723
java
Jeu.java
Java
[]
null
[]
package com.ricocarpe.magiworld; import java.util.Scanner; public class Jeu { public static void makePeopleFight(Joueur joueur1, Joueur joueur2) { Scanner clavier = new Scanner(System.in); boolean isEmptygetvie = false; int numAttack; do { /////////////Pour le joueur 1 : joueur1.auTourduJoueur1(); numAttack = clavier.nextInt(); if (joueur1.getVie() > 0) { if (numAttack == 1) { joueur2.setVie(joueur2.getVie() - joueur1.basicAttack()); joueur1.syntheseBasicAttack(); } if (numAttack == 2) { joueur2.setVie(joueur2.getVie() - joueur1.specialAttack()); joueur1.specialAttack(); joueur1.syntheseSpecialAttack(); } } //////////Pour le joueur 2 if (joueur2.getVie() > 0) { joueur2.auTourduJoueur2(); numAttack = clavier.nextInt(); if (numAttack == 1) { joueur1.setVie(joueur1.getVie() - joueur2.basicAttack()); joueur2.syntheseBasicAttack(); } if (numAttack == 2) { joueur2.specialAttack(); joueur2.specialAttack(); } } if (joueur2.getVie() <= 0 || joueur1.getVie() <= 0) { isEmptygetvie = true; } } while (!isEmptygetvie); if (joueur1.getVie() >= 0 && joueur2.getVie() <= 0) { String classeName = getClassNameJoueur1(joueur1); System.out.println("le joueur " + joueur1.numeroDuJoueur1() + classeName); } else if (joueur2.getVie() >= 0 && joueur1.getVie() <= 0) { String classeName = getClassNameJoueur2(joueur2); System.out.println("le joueur " + joueur2.numeroDuJoueur2() + classeName); } } private static String getClassNameJoueur1(Joueur joueur1) { String className = ""; if (joueur1 instanceof Guerrier){ className="Guerrier"; }else if (joueur1 instanceof Rodeur){ className="Rodeur"; }else if (joueur1 instanceof Mage){ className="Mage"; }return className; } private static String getClassNameJoueur2(Joueur joueur2) { String className = ""; if (joueur2 instanceof Guerrier){ className="Guerrier"; }else if (joueur2 instanceof Rodeur){ className="Rodeur"; }else if (joueur2 instanceof Mage){ className="Mage"; }return className; } }
2,723
0.515608
0.493206
91
28.923077
24.151186
86
false
false
0
0
0
0
0
0
0.406593
false
false
8
def33d5c51475aa4b48c6cb7bf439d2e1a552741
6,846,177,927,050
37cedfd87bc50f8108b2e8a1d842d169b33927a8
/src/main/java/au/net/jacksta/demo/controller/PrintController.java
9d4fedd8b5b72cd37172e77e4f0d255cae9aa8e1
[]
no_license
Jacksta66/PrintDemo
https://github.com/Jacksta66/PrintDemo
9eb451ad9f96453803d924cbd3526497b496fc37
6cd995d318c6ff75a89826d880776d97f26613fa
refs/heads/master
2021-06-25T08:54:07.699000
2019-11-17T12:26:05
2019-11-17T12:26:05
222,243,436
0
0
null
false
2021-04-26T19:41:42
2019-11-17T12:19:06
2019-11-17T12:26:08
2021-04-26T19:41:41
59
0
0
1
Java
false
false
package au.net.jacksta.demo.controller; import au.net.jacksta.demo.model.Print; import au.net.jacksta.demo.service.PrintService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; @Controller public class PrintController { @Value("${spring.application.name}") String appName; @Value("${jacksta.source.dir}") String sourceDirString; @Value("${jacksta.destination.dir}") String destinationDirString; @Value("${jacksta.temp.dir}") String tempDirString; @Autowired private PrintService jackstaPrintService; @GetMapping({"/", "/print", "/print.html"}) public String homePage(Model model) { Path sourceDir = Paths.get(sourceDirString); Path destinationDir = Paths.get(destinationDirString); List<Print> printVo = jackstaPrintService.getAdvicesForPrintHouse(sourceDir); jackstaPrintService.writeFiles(sourceDir, tempDirString); model.addAttribute("directory", sourceDirString); model.addAttribute("appName", appName); model.addAttribute("print", printVo); return "print"; } @PostMapping("/print") public String greetingSubmit(@ModelAttribute Print print) { System.out.println(print.toString()); return "print"; } }
UTF-8
Java
1,685
java
PrintController.java
Java
[]
null
[]
package au.net.jacksta.demo.controller; import au.net.jacksta.demo.model.Print; import au.net.jacksta.demo.service.PrintService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; @Controller public class PrintController { @Value("${spring.application.name}") String appName; @Value("${jacksta.source.dir}") String sourceDirString; @Value("${jacksta.destination.dir}") String destinationDirString; @Value("${jacksta.temp.dir}") String tempDirString; @Autowired private PrintService jackstaPrintService; @GetMapping({"/", "/print", "/print.html"}) public String homePage(Model model) { Path sourceDir = Paths.get(sourceDirString); Path destinationDir = Paths.get(destinationDirString); List<Print> printVo = jackstaPrintService.getAdvicesForPrintHouse(sourceDir); jackstaPrintService.writeFiles(sourceDir, tempDirString); model.addAttribute("directory", sourceDirString); model.addAttribute("appName", appName); model.addAttribute("print", printVo); return "print"; } @PostMapping("/print") public String greetingSubmit(@ModelAttribute Print print) { System.out.println(print.toString()); return "print"; } }
1,685
0.731157
0.731157
57
28.561403
23.311783
85
false
false
0
0
0
0
0
0
0.596491
false
false
8
68e41735d24b28f229d83fa38156d416f43a5f72
39,324,720,587,105
5e15dd6841c77296d4b2d1bad1204fbc8dfebd39
/FormulationTool/src/main/java/com/molcon/formulationtool/dao/ChemistryDao.java
95efdb893871ef14c5f2c6daf0cad82ca62c1c85
[]
no_license
nasasatyanasa/Formulation
https://github.com/nasasatyanasa/Formulation
f497017e6c37cc77cefb4ddeb23b0fd41c41af51
d9a76f74e29b90df05a5daed1f1afa80d36b97eb
refs/heads/master
2016-06-05T04:18:38.095000
2016-06-03T10:29:41
2016-06-03T10:29:41
51,810,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.molcon.formulationtool.dao; import java.util.List; import javax.sql.DataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.molcon.formulationtool.bean.IndexedFile; import com.molcon.formulationtool.rowmapper.IndexedFileRowMapper; @Repository @Transactional public class ChemistryDao { private Logger logger = LoggerFactory.getLogger(ManagerDao.class); private JdbcTemplate jdbcTemplate; @Autowired public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } public List<IndexedFile> getDetailsforPatent(String patent) { String sql = " SELECT * FROM INDEXEDFILE WHERE tan= ? "; List<IndexedFile> indexedFiles = null; try { indexedFiles = jdbcTemplate.query(sql, new IndexedFileRowMapper(), patent); } catch(EmptyResultDataAccessException e) { logger.info("No data found for this tan :"+patent); } return indexedFiles; } public List<IndexedFile> getDetailsforChemicalName( String chemicalName) { List<IndexedFile> indexedFiles = null; String sql = " SELECT * FROM INDEXEDFILE WHERE ( par= ? OR cth= ? ) AND "+ " amd='' AND hmd ='' AND sub='' AND md='' AND hom='' and ltr='' "; try { indexedFiles = jdbcTemplate.query(sql, new IndexedFileRowMapper(), chemicalName,chemicalName); } catch(EmptyResultDataAccessException e) { logger.info("No data found for this chemicalName :"+chemicalName); } return indexedFiles; } }
UTF-8
Java
1,791
java
ChemistryDao.java
Java
[]
null
[]
package com.molcon.formulationtool.dao; import java.util.List; import javax.sql.DataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.molcon.formulationtool.bean.IndexedFile; import com.molcon.formulationtool.rowmapper.IndexedFileRowMapper; @Repository @Transactional public class ChemistryDao { private Logger logger = LoggerFactory.getLogger(ManagerDao.class); private JdbcTemplate jdbcTemplate; @Autowired public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } public List<IndexedFile> getDetailsforPatent(String patent) { String sql = " SELECT * FROM INDEXEDFILE WHERE tan= ? "; List<IndexedFile> indexedFiles = null; try { indexedFiles = jdbcTemplate.query(sql, new IndexedFileRowMapper(), patent); } catch(EmptyResultDataAccessException e) { logger.info("No data found for this tan :"+patent); } return indexedFiles; } public List<IndexedFile> getDetailsforChemicalName( String chemicalName) { List<IndexedFile> indexedFiles = null; String sql = " SELECT * FROM INDEXEDFILE WHERE ( par= ? OR cth= ? ) AND "+ " amd='' AND hmd ='' AND sub='' AND md='' AND hom='' and ltr='' "; try { indexedFiles = jdbcTemplate.query(sql, new IndexedFileRowMapper(), chemicalName,chemicalName); } catch(EmptyResultDataAccessException e) { logger.info("No data found for this chemicalName :"+chemicalName); } return indexedFiles; } }
1,791
0.752652
0.751535
61
28.360655
27.322622
97
false
false
0
0
0
0
0
0
1.803279
false
false
3
ca71d2a02fcf09d9c68138c275636532ada87a10
4,698,694,285,281
81f05c44b5de7a4101c3b04f4b6cbce48dd0aa57
/src/main/java/freeTrourAutomationPages/HomePage.java
b78c99d384c9aeb1b383d06df8e296274d207328
[]
no_license
fourstars2020/FreeTourAutomation_group
https://github.com/fourstars2020/FreeTourAutomation_group
e3a595fd9e3eae062b2085fb0a5d7ce0cc5ee9ec
89253d7f39459d447be9c0610d84bb8bedf13200
refs/heads/master
2022-07-17T05:52:38.322000
2019-12-28T00:15:11
2019-12-28T00:15:11
230,509,565
0
0
null
false
2022-06-29T17:52:22
2019-12-27T19:57:15
2019-12-28T00:22:51
2022-06-29T17:52:21
92
0
0
4
HTML
false
false
package freeTrourAutomationPages; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class HomePage extends TestBase{ //pagefactory_ (OR) Object Reposotory: @FindBy(xpath="//a[contains(text(),'REGISTER')]") WebElement RegistrationBtn; //initilize Object Reposotory: public HomePage(){ PageFactory.initElements(driver, this); } //Actions_ Methods: public String verifyHomePageTitle(){ return driver.getTitle(); } public void clickOnRegistrationLink(){ RegistrationBtn.click(); } }
UTF-8
Java
650
java
HomePage.java
Java
[]
null
[]
package freeTrourAutomationPages; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class HomePage extends TestBase{ //pagefactory_ (OR) Object Reposotory: @FindBy(xpath="//a[contains(text(),'REGISTER')]") WebElement RegistrationBtn; //initilize Object Reposotory: public HomePage(){ PageFactory.initElements(driver, this); } //Actions_ Methods: public String verifyHomePageTitle(){ return driver.getTitle(); } public void clickOnRegistrationLink(){ RegistrationBtn.click(); } }
650
0.693846
0.693846
45
13.444445
17.010527
51
false
false
0
0
0
0
0
0
1.533333
false
false
3
3e6f9b72145509fbfffc336481c7eb8bfeaa189d
37,254,546,358,085
892b08bf8b9b4dd1285fcfe23d3adc0c202f5cfe
/230. 二叉搜索树中第K小的元素/src/Solution.java
005ec81f9f75e96ffd5c256e996bc714b2c4e19a
[]
no_license
VERGESSE/leetCode
https://github.com/VERGESSE/leetCode
a1db5f41b351ee88632db480d9026030fa6e1d37
1253a6a44cb5e29b2ded1eaf29ee9eb6f3597d4b
refs/heads/master
2022-12-06T23:48:20.479000
2022-11-27T03:51:25
2022-11-27T03:51:25
238,168,506
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.LinkedList; /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public int kthSmallest(TreeNode root, int k) { LinkedList<TreeNode> stack = new LinkedList<>(); while (true){ while (root != null){ stack.addLast(root); root = root.left; } TreeNode res = stack.removeLast(); if (--k == 0) return res.val; else root = res.right; } } }
UTF-8
Java
615
java
Solution.java
Java
[]
null
[]
import java.util.LinkedList; /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public int kthSmallest(TreeNode root, int k) { LinkedList<TreeNode> stack = new LinkedList<>(); while (true){ while (root != null){ stack.addLast(root); root = root.left; } TreeNode res = stack.removeLast(); if (--k == 0) return res.val; else root = res.right; } } }
615
0.505691
0.504065
28
21
16.824726
56
false
false
0
0
0
0
0
0
0.428571
false
false
3
340d096cf51680e95a1601092101594a1120730f
12,781,822,741,869
6a201ec90fe594a5444ee6470ea3c67fe5e6a736
/src/com/qa/dependency_inversion/FrontendDeveloper.java
a5fbe7eb93fc334a034444d058345f5e712f7d69
[]
no_license
MrWalshyType2/solid-principles
https://github.com/MrWalshyType2/solid-principles
b34c56817387a73ce990329b26bd18bbb66e3129
6d3409a0d82e6b1d69a26d649c241cf7cb19bc63
refs/heads/master
2022-11-06T23:07:43.022000
2020-07-08T14:18:42
2020-07-08T14:18:42
278,067,513
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.qa.dependency_inversion; public class FrontendDeveloper implements Developer { @Override public void develop() { writeJavascript(); } private void writeJavascript() { System.out.println("Writing JS for the web..."); } }
UTF-8
Java
245
java
FrontendDeveloper.java
Java
[]
null
[]
package com.qa.dependency_inversion; public class FrontendDeveloper implements Developer { @Override public void develop() { writeJavascript(); } private void writeJavascript() { System.out.println("Writing JS for the web..."); } }
245
0.726531
0.726531
14
16.5
18.836704
53
false
false
0
0
0
0
0
0
0.857143
false
false
3
108d097460a514599d7cc6d73c5b6a477476cd3d
36,043,365,587,986
ba27ad42cec56790959c8064a081e689f797bf4b
/src/main/java/com/workstudy/controller/TeacherController.java
180ee8b8019a3e331e383999805902ae92bed9e2
[]
no_license
yeqifu/workStudyMS
https://github.com/yeqifu/workStudyMS
37517a34a5ef0afdca4b395802c279ddf8f42b12
a1781b15c7451dc8ffff5acb02f044973c91fa9f
refs/heads/master
2023-04-28T17:26:09.681000
2021-05-08T13:02:12
2021-05-08T13:02:12
363,682,615
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.workstudy.controller; import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.workstudy.common.realm.ActiveUser; import com.workstudy.common.utils.CRUDRUtils; import com.workstudy.common.utils.Constant; import com.workstudy.common.utils.R; import com.workstudy.entity.Student; import com.workstudy.entity.StudentApplyTeacher; import com.workstudy.entity.Teacher; import com.workstudy.mapper.StudentApplyTeacherMapper; import com.workstudy.service.StudentApplyTeacherService; import com.workstudy.service.StudentService; import com.workstudy.service.TeacherService; import com.workstudy.vo.StudentApplyTeacherVo; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.crypto.hash.Md5Hash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; /** * @Author: 刘其悦 * @Date: 2021/5/3 11:17 */ @RestController public class TeacherController { @Autowired private TeacherService teacherService; @Autowired private StudentApplyTeacherService studentApplyTeacherService; @Autowired private StudentService studentService; @Autowired private StudentApplyTeacherMapper studentApplyTeacherMapper; /** * 老师注册 * * @param teacher * @return */ @PostMapping("/register/teacher") public R registerTeacher(@RequestBody Teacher teacher) { // 生成32位的盐 String salt = IdUtil.simpleUUID(); teacher.setSalt(salt); // 将老师密码的明文加盐散列2次变成密文 Md5Hash md5Hash = new Md5Hash(teacher.getPassword(),salt, Constant.HASHITERATIONS); teacher.setPassword(md5Hash.toString()); boolean flag = teacherService.save(teacher); return CRUDRUtils.addR(flag); } /** * 查询所有选择该老师的申请---审核中的申请 * @return */ @GetMapping("/apply") @RequiresRoles("teacher") public R queryCheckApplyAll(StudentApplyTeacherVo studentApplyTeacherVo){ ActiveUser activeUser = (ActiveUser)SecurityUtils.getSubject().getPrincipal(); Teacher teacher = (Teacher)activeUser.getUser(); Page<StudentApplyTeacher> page = new Page<>(studentApplyTeacherVo.getCurrentPage(),studentApplyTeacherVo.getPageSize()); Page<StudentApplyTeacher> studentApplyTeacherPage = studentApplyTeacherMapper.queryMyCheckAll(page, teacher.getTeacherNumber(), 0); return R.ok("查询成功").put("data",studentApplyTeacherPage); } /** * 查询所有选择该老师的申请---审核通过和未通过的申请 * @return */ @GetMapping("/applySuccessOrFail") @RequiresRoles("teacher") public R queryCheckApplySuccessOrFailAll(StudentApplyTeacherVo studentApplyTeacherVo){ ActiveUser activeUser = (ActiveUser)SecurityUtils.getSubject().getPrincipal(); Teacher teacher = (Teacher)activeUser.getUser(); Page<StudentApplyTeacher> page = new Page<>(studentApplyTeacherVo.getCurrentPage(),studentApplyTeacherVo.getPageSize()); Page<StudentApplyTeacher> studentApplyTeacherPage = studentApplyTeacherMapper.queryMyCheckSuccessOrFailAll(page, teacher.getTeacherNumber()); return R.ok("查询成功").put("data",studentApplyTeacherPage); } /** * 老师审核学生申请 * @param id 申请ID * @param type 类型 1-通过 2-拒绝 * @param reason 拒绝填写原因 * @return */ @PostMapping("/checkApply/{id}/{type}") @RequiresRoles("teacher") public R checkApply(@PathVariable("id") Integer id,@PathVariable("type") Integer type,@RequestParam(value = "reason",required = false) String reason){ StudentApplyTeacher studentApplyTeacher = new StudentApplyTeacher(); studentApplyTeacher.setId(id); if (type == 1){ studentApplyTeacher.setStatus((byte) 1); }else if (type == 2){ studentApplyTeacher.setStatus((byte) 2); studentApplyTeacher.setReason(reason); } studentApplyTeacher.setReplyDate(new Date()); boolean flag = studentApplyTeacherService.updateById(studentApplyTeacher); if (flag == true){ return R.ok("审核成功"); }else { return R.error("审核失败"); } } /** * 根据老师ID查询该老师 * @param id * @return */ @GetMapping("/teacher/{id}") public R queryTeacherById(@PathVariable("id") Integer id){ Teacher teacher = teacherService.getById(id); return R.ok("查询成功").put("data",teacher); } /** * 修改老师信息 * @param teacher * @return */ @PutMapping("/teacher") public R updateTeacher(@RequestBody Teacher teacher){ Teacher teacherDataBase = teacherService.getById(teacher.getId()); boolean flag = teacherService.updateById(teacher); Teacher newTeacher = teacherService.getById(teacherDataBase.getId()); if (flag){ return R.ok("修改成功!").put("data",newTeacher); }else { return R.error("修改失败!"); } } }
UTF-8
Java
5,362
java
TeacherController.java
Java
[ { "context": "notation.*;\n\nimport java.util.*;\n\n/**\n * @Author: 刘其悦\n * @Date: 2021/5/3 11:17\n */\n@RestController\npubl", "end": 1044, "score": 0.9998472929000854, "start": 1041, "tag": "NAME", "value": "刘其悦" } ]
null
[]
package com.workstudy.controller; import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.workstudy.common.realm.ActiveUser; import com.workstudy.common.utils.CRUDRUtils; import com.workstudy.common.utils.Constant; import com.workstudy.common.utils.R; import com.workstudy.entity.Student; import com.workstudy.entity.StudentApplyTeacher; import com.workstudy.entity.Teacher; import com.workstudy.mapper.StudentApplyTeacherMapper; import com.workstudy.service.StudentApplyTeacherService; import com.workstudy.service.StudentService; import com.workstudy.service.TeacherService; import com.workstudy.vo.StudentApplyTeacherVo; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.crypto.hash.Md5Hash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.*; /** * @Author: 刘其悦 * @Date: 2021/5/3 11:17 */ @RestController public class TeacherController { @Autowired private TeacherService teacherService; @Autowired private StudentApplyTeacherService studentApplyTeacherService; @Autowired private StudentService studentService; @Autowired private StudentApplyTeacherMapper studentApplyTeacherMapper; /** * 老师注册 * * @param teacher * @return */ @PostMapping("/register/teacher") public R registerTeacher(@RequestBody Teacher teacher) { // 生成32位的盐 String salt = IdUtil.simpleUUID(); teacher.setSalt(salt); // 将老师密码的明文加盐散列2次变成密文 Md5Hash md5Hash = new Md5Hash(teacher.getPassword(),salt, Constant.HASHITERATIONS); teacher.setPassword(md5Hash.toString()); boolean flag = teacherService.save(teacher); return CRUDRUtils.addR(flag); } /** * 查询所有选择该老师的申请---审核中的申请 * @return */ @GetMapping("/apply") @RequiresRoles("teacher") public R queryCheckApplyAll(StudentApplyTeacherVo studentApplyTeacherVo){ ActiveUser activeUser = (ActiveUser)SecurityUtils.getSubject().getPrincipal(); Teacher teacher = (Teacher)activeUser.getUser(); Page<StudentApplyTeacher> page = new Page<>(studentApplyTeacherVo.getCurrentPage(),studentApplyTeacherVo.getPageSize()); Page<StudentApplyTeacher> studentApplyTeacherPage = studentApplyTeacherMapper.queryMyCheckAll(page, teacher.getTeacherNumber(), 0); return R.ok("查询成功").put("data",studentApplyTeacherPage); } /** * 查询所有选择该老师的申请---审核通过和未通过的申请 * @return */ @GetMapping("/applySuccessOrFail") @RequiresRoles("teacher") public R queryCheckApplySuccessOrFailAll(StudentApplyTeacherVo studentApplyTeacherVo){ ActiveUser activeUser = (ActiveUser)SecurityUtils.getSubject().getPrincipal(); Teacher teacher = (Teacher)activeUser.getUser(); Page<StudentApplyTeacher> page = new Page<>(studentApplyTeacherVo.getCurrentPage(),studentApplyTeacherVo.getPageSize()); Page<StudentApplyTeacher> studentApplyTeacherPage = studentApplyTeacherMapper.queryMyCheckSuccessOrFailAll(page, teacher.getTeacherNumber()); return R.ok("查询成功").put("data",studentApplyTeacherPage); } /** * 老师审核学生申请 * @param id 申请ID * @param type 类型 1-通过 2-拒绝 * @param reason 拒绝填写原因 * @return */ @PostMapping("/checkApply/{id}/{type}") @RequiresRoles("teacher") public R checkApply(@PathVariable("id") Integer id,@PathVariable("type") Integer type,@RequestParam(value = "reason",required = false) String reason){ StudentApplyTeacher studentApplyTeacher = new StudentApplyTeacher(); studentApplyTeacher.setId(id); if (type == 1){ studentApplyTeacher.setStatus((byte) 1); }else if (type == 2){ studentApplyTeacher.setStatus((byte) 2); studentApplyTeacher.setReason(reason); } studentApplyTeacher.setReplyDate(new Date()); boolean flag = studentApplyTeacherService.updateById(studentApplyTeacher); if (flag == true){ return R.ok("审核成功"); }else { return R.error("审核失败"); } } /** * 根据老师ID查询该老师 * @param id * @return */ @GetMapping("/teacher/{id}") public R queryTeacherById(@PathVariable("id") Integer id){ Teacher teacher = teacherService.getById(id); return R.ok("查询成功").put("data",teacher); } /** * 修改老师信息 * @param teacher * @return */ @PutMapping("/teacher") public R updateTeacher(@RequestBody Teacher teacher){ Teacher teacherDataBase = teacherService.getById(teacher.getId()); boolean flag = teacherService.updateById(teacher); Teacher newTeacher = teacherService.getById(teacherDataBase.getId()); if (flag){ return R.ok("修改成功!").put("data",newTeacher); }else { return R.error("修改失败!"); } } }
5,362
0.691673
0.686764
146
33.876713
30.758869
154
false
false
0
0
0
0
0
0
0.493151
false
false
3
ab4e8030f6ffe3bf80e8a9c8cc2ab38f45f4c186
35,802,847,422,168
2f8328b47d02bf37a442a9d4f2d91c5cb6e548cd
/biji-metadata-api/src/main/java/com.renren.biji/user/service/UserService.java
79984c82cea5971fceeec00d083d9a53e55a578a
[]
no_license
Cooperwl/biji
https://github.com/Cooperwl/biji
ff933ab5aa12736e0620fd296f664532d66c3b39
48fa0d010560430684b4b0ad71288c1c9bf56562
refs/heads/master
2021-01-24T11:08:29.457000
2016-10-08T10:10:34
2016-10-08T10:10:34
70,256,490
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.renren.biji.user.service; import com.renren.biji.user.dto.UserDTO; /** * Created by Administrator on 2016/10/7 0007. */ public interface UserService { UserDTO getUserInfo(Integer userId); }
UTF-8
Java
211
java
UserService.java
Java
[ { "context": "m.renren.biji.user.dto.UserDTO;\n\n/**\n * Created by Administrator on 2016/10/7 0007.\n */\npublic interface UserServi", "end": 112, "score": 0.5232746601104736, "start": 99, "tag": "NAME", "value": "Administrator" } ]
null
[]
package com.renren.biji.user.service; import com.renren.biji.user.dto.UserDTO; /** * Created by Administrator on 2016/10/7 0007. */ public interface UserService { UserDTO getUserInfo(Integer userId); }
211
0.739336
0.687204
11
18.181818
18.991951
46
false
false
0
0
0
0
0
0
0.272727
false
false
3
a7af0a89b0e34d8be728e4696b8bfe35547225cf
39,195,871,577,489
c2df82e45d887fedb14676fa2f6d1707ea30d7b5
/service/business/src/main/java/cn/fintecher/pangolin/business/repository/CaseOutboundCollectionRepository.java
b57695769a2666fb98f04901be9990947d13188a
[]
no_license
lvguoying/Vue-iview--service
https://github.com/lvguoying/Vue-iview--service
8c8e709a7dd5ce1425fba428146d2848e6ecf499
3b134f3aa36070ddb316d4ec66c0322d71fa0631
refs/heads/master
2020-03-28T09:03:36.176000
2018-09-09T09:31:36
2018-09-09T09:31:36
148,010,715
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.fintecher.pangolin.business.repository; import cn.fintecher.pangolin.entity.CaseOutboundCollection; import cn.fintecher.pangolin.entity.QCaseOutboundCollection; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer; import org.springframework.data.querydsl.binding.QuerydslBindings; import org.springframework.data.repository.query.Param; /** * Created by huyanmin. * Description: * Date: 2018-01-17 */ public interface CaseOutboundCollectionRepository extends QueryDslPredicateExecutor<CaseOutboundCollection>, JpaRepository<CaseOutboundCollection, String>, QuerydslBinderCustomizer<QCaseOutboundCollection> { @Override default void customize(final QuerydslBindings bindings, final QCaseOutboundCollection root) { } /** * @Description 获得指定用户所持有的未结案案件总数 */ @Query(value = "select count(*) from case_outbound_collection where current_collector = :userId and collection_status in (20,21,22,23,25,171,172)", nativeQuery = true) Integer getCaseCount(@Param("userId") String userId); }
UTF-8
Java
1,273
java
CaseOutboundCollectionRepository.java
Java
[ { "context": "k.data.repository.query.Param;\n\n/**\n * Created by huyanmin.\n * Description:\n * Date: 2018-01-17\n */\npublic i", "end": 583, "score": 0.9996024966239929, "start": 575, "tag": "USERNAME", "value": "huyanmin" } ]
null
[]
package cn.fintecher.pangolin.business.repository; import cn.fintecher.pangolin.entity.CaseOutboundCollection; import cn.fintecher.pangolin.entity.QCaseOutboundCollection; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer; import org.springframework.data.querydsl.binding.QuerydslBindings; import org.springframework.data.repository.query.Param; /** * Created by huyanmin. * Description: * Date: 2018-01-17 */ public interface CaseOutboundCollectionRepository extends QueryDslPredicateExecutor<CaseOutboundCollection>, JpaRepository<CaseOutboundCollection, String>, QuerydslBinderCustomizer<QCaseOutboundCollection> { @Override default void customize(final QuerydslBindings bindings, final QCaseOutboundCollection root) { } /** * @Description 获得指定用户所持有的未结案案件总数 */ @Query(value = "select count(*) from case_outbound_collection where current_collector = :userId and collection_status in (20,21,22,23,25,171,172)", nativeQuery = true) Integer getCaseCount(@Param("userId") String userId); }
1,273
0.807103
0.787732
28
43.25
49.523174
207
false
false
0
0
0
0
0
0
0.75
false
false
3
e2f0ebf83ec617e13a6034a0102b65000493f762
39,230,231,293,908
612ed4f8faa481eef9a5310c43698b73af9a258b
/calendarmraddonforJira7/src/main/java/com/atlassian/jira/ext/calendar/ParameterUtils.java
8f6001fd0f4f5d5348d24a6c065ac6d61c412b23
[]
no_license
MrAddon/Jira-Calendar-Plugin-By-StatusColors
https://github.com/MrAddon/Jira-Calendar-Plugin-By-StatusColors
f59b11d8c6d800bc41e627b97476158ce901f611
ac0b5693f88c89bc1d6ede62b9071d5810f9a96e
refs/heads/master
2021-01-05T04:18:22.324000
2020-02-16T11:24:14
2020-02-16T11:24:14
240,877,552
6
1
null
false
2020-10-13T19:35:07
2020-02-16T11:13:36
2020-09-15T18:05:37
2020-10-13T19:35:05
988
3
1
2
Java
false
false
package com.atlassian.jira.ext.calendar; import com.atlassian.core.util.DateUtils; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class ParameterUtils { static final DateFormat format = new SimpleDateFormat("MMyyyy"); public static boolean getBoolean(String booleanStr) { if(booleanStr == null) { return true; } return Boolean.valueOf(booleanStr).booleanValue(); } public static Long getLong(String paramStr) { try { return new Long(paramStr); } catch (Exception e) { return null; } } public static Long getDuration(String durStr) { if (durStr != null) { try { return new Long(DateUtils.getDuration(durStr) * DateUtils.SECOND_MILLIS); } catch (Exception e) { return null; } } else { return null; } } public static Date getMonth(String monthStr) { try { return format.parse(monthStr); } catch (Exception e) { return null; } } public static Date endOfMonth(Date month) { Calendar calendar = Calendar.getInstance(); calendar.setTime(month); calendar.set(Calendar.DAY_OF_MONTH, calendar.getMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, calendar.getMaximum(Calendar.HOUR_OF_DAY)); calendar.set(Calendar.MINUTE, calendar.getMaximum(Calendar.MINUTE)); calendar.set(Calendar.SECOND, calendar.getMaximum(Calendar.SECOND)); calendar.set(Calendar.MILLISECOND, calendar.getMaximum(Calendar.MILLISECOND)); return calendar.getTime(); } public static String getMonthStr(Date month) { return format.format(month); } public static Calendar cloneAddMonths(Calendar cal, int months) { Calendar newMonthCal = (Calendar) cal.clone(); newMonthCal.add(Calendar.MONTH, months); return newMonthCal; } public static boolean isProject(String value) { return isBaseMethod(value, "project-"); } public static boolean isFilter(String value) { return isBaseMethod(value, "filter-"); } public static Long getProjectId(String value) { if(isProject(value)) { return new Long(value.substring(8)); } return null; } public static Long getFilterId(String value) { if (isFilter(value)) { return new Long(value.substring(7)); } return null; } private static boolean isBaseMethod(String value, String prefix) { return ((value != null) && (value.startsWith(prefix))); } }
UTF-8
Java
2,897
java
ParameterUtils.java
Java
[]
null
[]
package com.atlassian.jira.ext.calendar; import com.atlassian.core.util.DateUtils; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class ParameterUtils { static final DateFormat format = new SimpleDateFormat("MMyyyy"); public static boolean getBoolean(String booleanStr) { if(booleanStr == null) { return true; } return Boolean.valueOf(booleanStr).booleanValue(); } public static Long getLong(String paramStr) { try { return new Long(paramStr); } catch (Exception e) { return null; } } public static Long getDuration(String durStr) { if (durStr != null) { try { return new Long(DateUtils.getDuration(durStr) * DateUtils.SECOND_MILLIS); } catch (Exception e) { return null; } } else { return null; } } public static Date getMonth(String monthStr) { try { return format.parse(monthStr); } catch (Exception e) { return null; } } public static Date endOfMonth(Date month) { Calendar calendar = Calendar.getInstance(); calendar.setTime(month); calendar.set(Calendar.DAY_OF_MONTH, calendar.getMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, calendar.getMaximum(Calendar.HOUR_OF_DAY)); calendar.set(Calendar.MINUTE, calendar.getMaximum(Calendar.MINUTE)); calendar.set(Calendar.SECOND, calendar.getMaximum(Calendar.SECOND)); calendar.set(Calendar.MILLISECOND, calendar.getMaximum(Calendar.MILLISECOND)); return calendar.getTime(); } public static String getMonthStr(Date month) { return format.format(month); } public static Calendar cloneAddMonths(Calendar cal, int months) { Calendar newMonthCal = (Calendar) cal.clone(); newMonthCal.add(Calendar.MONTH, months); return newMonthCal; } public static boolean isProject(String value) { return isBaseMethod(value, "project-"); } public static boolean isFilter(String value) { return isBaseMethod(value, "filter-"); } public static Long getProjectId(String value) { if(isProject(value)) { return new Long(value.substring(8)); } return null; } public static Long getFilterId(String value) { if (isFilter(value)) { return new Long(value.substring(7)); } return null; } private static boolean isBaseMethod(String value, String prefix) { return ((value != null) && (value.startsWith(prefix))); } }
2,897
0.591647
0.590956
117
23.76923
23.445293
88
false
false
0
0
0
0
0
0
0.393162
false
false
3
b2daeb070a9d83a864991f4d0b44253243ea422f
5,446,018,602,037
2fceb96b4e29571c43015479fcf0e3ff8d925d86
/android/axeac_sdk/src/main/java/com/axeac/android/sdk/utils/CommonUtil.java
6ddd5e8cc20196a1e0e1ea32bed4d83f18392771
[ "Apache-2.0" ]
permissive
tian321go/XLHTAndroid
https://github.com/tian321go/XLHTAndroid
636553ddff0e5a2f257cd431d8605a65496121c8
54b56673a93a706948ce005197c2041e6769c0d2
refs/heads/master
2020-04-04T19:25:11.308000
2018-11-05T11:18:09
2018-11-05T11:18:09
156,204,920
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.axeac.android.sdk.utils; import android.content.Context; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.view.View; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 普通工具类 * @author axeac * @version 1.0.0 * */ public class CommonUtil { /** * 判断IP地址是否正确 * @param ip * IP地址 * */ public static boolean isIP(String ip) { Pattern pattern = Pattern .compile("\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b"); Matcher matcher = pattern.matcher(ip); return matcher.matches(); } /** * 判断网络是否连接 * @param ctx * Context对象 * */ public static boolean isNetworkConnected(Context ctx) { ConnectivityManager connMgr = (ConnectivityManager) ctx .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null) { return networkInfo.isAvailable(); } return false; } public static byte[] copyOfRange(byte[] original, int from, int to) { int newLength = to - from; if (newLength < 0) { throw new IllegalArgumentException(from + " > " + to); } byte[] copy = new byte[newLength]; System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength)); return copy; } /** * 判断是否为数字类型 * @param str * 字符串 * */ public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher(str).matches(); } /** * 将字符串转换为float类型并返回true * @param str * 字符串 * */ public static boolean isFloat(String str) { boolean isFloat = true; try { Float.parseFloat(str); } catch (Exception e) { isFloat = false; } return isFloat; } /** * 是否是电话号码 * @param str * 字符串 * */ public static boolean isTelNumber(String str) { Pattern pattern = Pattern .compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"); return pattern.matcher(str).matches(); } /** * 判断密码格式是否正确 * @param pwd * 密码字符串 * */ public static boolean isPassWord(String pwd) { Pattern pattern = Pattern .compile("[0-9a-zA-Z]{6,}"); return pattern.matcher(pwd).matches(); } public static boolean getBoolean(String str) { if (str == null || str.trim().equals("")) return false; return str.trim().equals("1") || str.trim().toLowerCase().equals("true") || str.toLowerCase().equals("T"); } /** * 根据颜色值或字符串获得颜色 * @param color * 颜色值 * */ public static int getColor(String color) { if (color == null) { return Color.BLACK; } color = color.trim(); if (color.length() == 0 || color.equals("0") || color.length() != 9) return Color.BLACK; try { int red = Integer.parseInt(color.substring(0, 3)); int green = Integer.parseInt(color.substring(3, 6)); int blue = Integer.parseInt(color.substring(6, 9)); return Color.rgb(red, green, blue); } catch (Throwable e) { return Color.BLACK; } } /** * 判断字符串是否为颜色值 * @param s * 字符串 * */ public static boolean validRGBColor(String s) { s = s.trim(); if (s == null || s.trim().equals("")) return false; if (s.length() != 9) { return false; } int r = Integer.parseInt(s.substring(0, 3)); int g = Integer.parseInt(s.substring(3, 6)); int b = Integer.parseInt(s.substring(6, 9)); if (r > 255 || g > 255 || b > 255) { return false; } return true; } public static Integer[] sortDesc(Integer[] pos) { int temp; int i; int j = 0; for (i = 1; i < pos.length; i++) for (j = 0; j < pos.length; j++) { if (pos[i] > pos[j]) { temp = pos[i]; pos[i] = pos[j]; pos[j] = temp; } } return pos; } /** * Integer类型数组从小到大排序 * */ public static Integer[] sortAsc(Integer[] pos) { int temp; int i; int j = 0; for (i = 1; i < pos.length; i++) for (j = 0; j < pos.length; j++) { if (pos[i] < pos[j]) { temp = pos[i]; pos[i] = pos[j]; pos[j] = temp; } } return pos; } public static int obtainMaxData(int maxData, int count) { int arg = count; if (maxData <= 100) arg = count; else if (maxData <= 1000) arg = count * 10; else if (maxData <= 10000) arg = count * 100; else if (maxData <= 100000) arg = count * 1000; else arg = count * 10000; return maxData % arg != 0 ? (maxData / arg + 1) * arg : maxData; } /** * 根据传入字符串判定是否弹吐司 * @param msg * 字符串 * */ public static boolean isResponseNoToast(String msg) { if (null == msg || "".equals(msg) || "空".equals(msg) || "null".equals(msg) || "OK".equals(msg) || "操作成功".equals(msg)) { return true; } else { return false; } } /** * describe:Measure the view, and finally getMeasuredWidth () to get the width and height. * * 测量这个view,最后通过getMeasuredWidth()获取宽度和高度. * * @param v * The view to be measured * 要测量的view * * @return * Measured the view after * 测量过的view */ public static void measureView(View v) { if (v == null) { return; } int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); v.measure(w, h); } }
UTF-8
Java
6,807
java
CommonUtil.java
Java
[ { "context": "t java.util.regex.Pattern;\n/**\n * 普通工具类\n * @author axeac\n * @version 1.0.0\n * */\npublic class CommonUtil {", "end": 293, "score": 0.9996902346611023, "start": 288, "tag": "USERNAME", "value": "axeac" } ]
null
[]
package com.axeac.android.sdk.utils; import android.content.Context; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.view.View; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 普通工具类 * @author axeac * @version 1.0.0 * */ public class CommonUtil { /** * 判断IP地址是否正确 * @param ip * IP地址 * */ public static boolean isIP(String ip) { Pattern pattern = Pattern .compile("\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b"); Matcher matcher = pattern.matcher(ip); return matcher.matches(); } /** * 判断网络是否连接 * @param ctx * Context对象 * */ public static boolean isNetworkConnected(Context ctx) { ConnectivityManager connMgr = (ConnectivityManager) ctx .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null) { return networkInfo.isAvailable(); } return false; } public static byte[] copyOfRange(byte[] original, int from, int to) { int newLength = to - from; if (newLength < 0) { throw new IllegalArgumentException(from + " > " + to); } byte[] copy = new byte[newLength]; System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength)); return copy; } /** * 判断是否为数字类型 * @param str * 字符串 * */ public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher(str).matches(); } /** * 将字符串转换为float类型并返回true * @param str * 字符串 * */ public static boolean isFloat(String str) { boolean isFloat = true; try { Float.parseFloat(str); } catch (Exception e) { isFloat = false; } return isFloat; } /** * 是否是电话号码 * @param str * 字符串 * */ public static boolean isTelNumber(String str) { Pattern pattern = Pattern .compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"); return pattern.matcher(str).matches(); } /** * 判断密码格式是否正确 * @param pwd * 密码字符串 * */ public static boolean isPassWord(String pwd) { Pattern pattern = Pattern .compile("[0-9a-zA-Z]{6,}"); return pattern.matcher(pwd).matches(); } public static boolean getBoolean(String str) { if (str == null || str.trim().equals("")) return false; return str.trim().equals("1") || str.trim().toLowerCase().equals("true") || str.toLowerCase().equals("T"); } /** * 根据颜色值或字符串获得颜色 * @param color * 颜色值 * */ public static int getColor(String color) { if (color == null) { return Color.BLACK; } color = color.trim(); if (color.length() == 0 || color.equals("0") || color.length() != 9) return Color.BLACK; try { int red = Integer.parseInt(color.substring(0, 3)); int green = Integer.parseInt(color.substring(3, 6)); int blue = Integer.parseInt(color.substring(6, 9)); return Color.rgb(red, green, blue); } catch (Throwable e) { return Color.BLACK; } } /** * 判断字符串是否为颜色值 * @param s * 字符串 * */ public static boolean validRGBColor(String s) { s = s.trim(); if (s == null || s.trim().equals("")) return false; if (s.length() != 9) { return false; } int r = Integer.parseInt(s.substring(0, 3)); int g = Integer.parseInt(s.substring(3, 6)); int b = Integer.parseInt(s.substring(6, 9)); if (r > 255 || g > 255 || b > 255) { return false; } return true; } public static Integer[] sortDesc(Integer[] pos) { int temp; int i; int j = 0; for (i = 1; i < pos.length; i++) for (j = 0; j < pos.length; j++) { if (pos[i] > pos[j]) { temp = pos[i]; pos[i] = pos[j]; pos[j] = temp; } } return pos; } /** * Integer类型数组从小到大排序 * */ public static Integer[] sortAsc(Integer[] pos) { int temp; int i; int j = 0; for (i = 1; i < pos.length; i++) for (j = 0; j < pos.length; j++) { if (pos[i] < pos[j]) { temp = pos[i]; pos[i] = pos[j]; pos[j] = temp; } } return pos; } public static int obtainMaxData(int maxData, int count) { int arg = count; if (maxData <= 100) arg = count; else if (maxData <= 1000) arg = count * 10; else if (maxData <= 10000) arg = count * 100; else if (maxData <= 100000) arg = count * 1000; else arg = count * 10000; return maxData % arg != 0 ? (maxData / arg + 1) * arg : maxData; } /** * 根据传入字符串判定是否弹吐司 * @param msg * 字符串 * */ public static boolean isResponseNoToast(String msg) { if (null == msg || "".equals(msg) || "空".equals(msg) || "null".equals(msg) || "OK".equals(msg) || "操作成功".equals(msg)) { return true; } else { return false; } } /** * describe:Measure the view, and finally getMeasuredWidth () to get the width and height. * * 测量这个view,最后通过getMeasuredWidth()获取宽度和高度. * * @param v * The view to be measured * 要测量的view * * @return * Measured the view after * 测量过的view */ public static void measureView(View v) { if (v == null) { return; } int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); v.measure(w, h); } }
6,807
0.489739
0.470761
240
26.008333
23.287334
224
false
false
0
0
0
0
0
0
0.608333
false
false
3
843c3eac2f93dac2296022ee21473386b5c19a33
37,134,287,278,569
58debcda38ec42b177127e66c1ba6b90fa695482
/PrepaJava/src/TP1/Ex2.java
3a89d0e04fcfa5135ae5a4550025084cf4dfdef5
[]
no_license
WebStain/Java-Paratical-Work
https://github.com/WebStain/Java-Paratical-Work
5521d7c9053386ca53f1bb72eda60b49a7bb7201
e5264933eda0082866fbf9fd2cbb3fec5d91ca0c
refs/heads/master
2022-12-24T11:46:54.664000
2020-10-07T21:59:54
2020-10-07T21:59:54
280,285,320
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package TP1; public class Ex2 { static double cote ; public static double surface () {return cote*cote;} // il faut ajouter le mot cle static au variable double cote car les methodes statiques ont le droit d'acceder qu'aux les variables statiques }
UTF-8
Java
257
java
Ex2.java
Java
[]
null
[]
package TP1; public class Ex2 { static double cote ; public static double surface () {return cote*cote;} // il faut ajouter le mot cle static au variable double cote car les methodes statiques ont le droit d'acceder qu'aux les variables statiques }
257
0.750973
0.743191
7
35.714287
46.521008
142
false
false
0
0
0
0
0
0
0.857143
false
false
3
e3ac88a7bb9b2294043b632a421d6dfbfe842261
30,992,484,027,888
241d2a75aca0a10f2ff48cbe9c652538f98a75ef
/SwapValues/src/com/intellij/Main.java
537cc272f863579415f6313c1d5c3e8f04cc7bed
[]
no_license
ian-richard/JavaChallenges
https://github.com/ian-richard/JavaChallenges
e97ecfff04ed57f6cd49def90aedb8d68222a15a
661d7a22ce6782842df9af4b60edb7f77f120d68
refs/heads/main
2023-09-02T00:18:32.472000
2021-10-25T09:53:21
2021-10-25T09:53:21
415,993,554
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.intellij; public class Main { public static void main(String[] args) { Integer[] values = new Integer[]{1,2}; var t1 = new Swapper(values); System.out.println(t1); } }
UTF-8
Java
214
java
Main.java
Java
[]
null
[]
package com.intellij; public class Main { public static void main(String[] args) { Integer[] values = new Integer[]{1,2}; var t1 = new Swapper(values); System.out.println(t1); } }
214
0.593458
0.574766
10
20.4
17.459667
46
false
false
0
0
0
0
0
0
0.5
false
false
3
c57d08d4d00a61c6fefbbb4b4b860aaaeb8cf70d
28,303,834,500,778
f43f09457e83ee5c7600d2e9c2f402674db3b81c
/Lesson 11 interfaces/src/a/animals/tests/Test1.java
763b75f9e54cb2640ae327c1494e205fedcbb0a1
[]
no_license
dankosorkin/822-124
https://github.com/dankosorkin/822-124
73d05271f079df319284234aa1c8fdeb839ea4e2
18352dbc5d14f2c7607e37045de10f97a4c5b8b4
refs/heads/master
2023-03-03T13:45:18.492000
2021-02-15T14:04:50
2021-02-15T14:04:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package a.animals.tests; import a.animals.Animal; import a.animals.Bat; import a.animals.Bee; import a.animals.Cat; import a.animals.Kiwi; import a.animals.Owl; public class Test1 { public static void main(String[] args) { Animal[] animals = new Animal[10]; animals[0] = new Cat(); animals[1] = new Bat(); animals[2] = new Kiwi(); animals[3] = new Owl(); // animals[4] = new Ant(); animals[5] = new Bee(); animals[6] = new Cat(); animals[7] = new Cat(); animals[8] = new Kiwi(); animals[9] = new Cat(); for (int i = 0; i < animals.length; i++) { Animal currAnimal = animals[i]; if (currAnimal != null) { currAnimal.speak(); } } } }
UTF-8
Java
716
java
Test1.java
Java
[]
null
[]
package a.animals.tests; import a.animals.Animal; import a.animals.Bat; import a.animals.Bee; import a.animals.Cat; import a.animals.Kiwi; import a.animals.Owl; public class Test1 { public static void main(String[] args) { Animal[] animals = new Animal[10]; animals[0] = new Cat(); animals[1] = new Bat(); animals[2] = new Kiwi(); animals[3] = new Owl(); // animals[4] = new Ant(); animals[5] = new Bee(); animals[6] = new Cat(); animals[7] = new Cat(); animals[8] = new Kiwi(); animals[9] = new Cat(); for (int i = 0; i < animals.length; i++) { Animal currAnimal = animals[i]; if (currAnimal != null) { currAnimal.speak(); } } } }
716
0.581006
0.561453
36
17.888889
13.067725
44
false
false
0
0
0
0
0
0
1.75
false
false
3
070457371df34ba143c94103c0c63c4d731522fe
28,303,834,497,159
76852b1b29410436817bafa34c6dedaedd0786cd
/sources-2020-07-19-tempmail/sources/com/google/android/gms/internal/ads/zzame.java
bbe8e515d776b2a38ccd183cd7d33e479e3601d7
[]
no_license
zteeed/tempmail-apks
https://github.com/zteeed/tempmail-apks
040e64e07beadd8f5e48cd7bea8b47233e99611c
19f8da1993c2f783b8847234afb52d94b9d1aa4c
refs/heads/master
2023-01-09T06:43:40.830000
2020-11-04T18:55:05
2020-11-04T18:55:05
310,075,224
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.internal.ads; import android.content.pm.ApplicationInfo; import android.location.Location; /* compiled from: com.google.android.gms:play-services-ads@@19.2.0 */ public interface zzame { zzdvf<Location> a(ApplicationInfo applicationInfo); }
UTF-8
Java
277
java
zzame.java
Java
[]
null
[]
package com.google.android.gms.internal.ads; import android.content.pm.ApplicationInfo; import android.location.Location; /* compiled from: com.google.android.gms:play-services-ads@@19.2.0 */ public interface zzame { zzdvf<Location> a(ApplicationInfo applicationInfo); }
277
0.783394
0.768953
9
29.777779
23.971176
69
false
false
0
0
0
0
0
0
0.444444
false
false
3
d3a81088540ab170ca575708e8a2db7e76b29126
16,114,717,322,906
70006a3c75a1fd75fdec8c905965248c40ffdd48
/DungeonMaster/src/dnd/game/entity/living/LivingEntity.java
f6bc431dfbcec7c46433cfea566c0ed26baa9b97
[]
no_license
saisun1008/dndGame
https://github.com/saisun1008/dndGame
8cf39ebc3d5b3201ba514b0b3ae8a68004d3b278
35f9906da3af127beb12aebce63bf003fb068c93
refs/heads/master
2016-09-06T13:20:50.145000
2015-07-09T00:31:27
2015-07-09T00:32:23
38,787,232
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dnd.game.entity.living; import dnd.game.AbilityType; import dnd.game.DamageType; import dnd.game.Entity; import dnd.game.Inventory; import dnd.game.InventoryInterface; import dnd.game.entity.item.EquippableItem; import dnd.util.Modifier; import dnd.util.ModifierSet; /** * LivingEntity is an extension of the basic Entity class and is used for * defining the player, monsters and NPCs (or any other living creature in the * game world) * * @see Entity * */ public abstract class LivingEntity extends Entity implements InventoryInterface { private Inventory inventory = new Inventory(); private ModifierSet<AbilityType> rawAbilityScores = new ModifierSet<AbilityType>(); private int actualHP; private int level; public LivingEntity() { setName(getClass().getSimpleName()); } /** * @return The inventory of this LivingEntity */ public Inventory getInventory() { return inventory; } /** * Get the ability roll modifier for a given ability type * @param abilityType The ability type of the modifier to get * @return the modifier value for the given ability type */ public int getAbilityModifier(AbilityType abilityType) { ModifierSet<AbilityType> tmp = abilityModifiers(); int baseValue = rawAbilityScores.delta(abilityType); int modifier = tmp.delta(abilityType); // The modifier value is: the floor of half the ability value minus 5. // This value cannot be less than -5. return Math.max(-5, ((baseValue + modifier) / 2) - 5); } /** * Bind an inventory to this LivingEntity * @param inventory The inventory to bind */ protected void setInventory(Inventory inventory) { this.inventory = inventory; } /** * @return whether the entity is alive */ public boolean isAlive() { return actualHP > 0; } /** * @return The current hit point value for this LivingEntity */ public int getHP() { return actualHP; } /** * @param value The current hit point value for this LivingEntity */ public void setHP(int value) { actualHP = value > getTotalHP() ? getTotalHP() : value; } /** * @return The max number of hit points this LivingEntity can have */ public int getTotalHP() { return abilityModifiers().delta(AbilityType.HP); } /** * Set the current hit points to the maximum number of hit points this * LivingEntity can have */ public void resetHP() { actualHP = getTotalHP(); } /** * Sets the player's level value * @param level the level to set */ public void setLevel(int level) { this.level = level - 1; resetHP(); } /** * Get the level value for the player * @return the player's level */ public int getLevel() { return level + 1; } /** * @return the raw ability modifier scores (used during char generation) */ public ModifierSet<AbilityType> getRawAbilityScores() { if (rawAbilityScores == null) { rawAbilityScores = new ModifierSet<AbilityType>(); } return rawAbilityScores; } /** * Alias for {@link #resetHP()} */ public void spawn() { resetHP(); } /** * @return the armor class given the modifiers and equipped items */ public int armorClass() { return 10 + abilityModifiers().delta(AbilityType.DEX) + damageModifiers().delta(DamageType.ARMOR) + damageModifiers().delta(DamageType.SHIELD); } @Override public ModifierSet<AbilityType> abilityModifiers() { ModifierSet<AbilityType> set = new ModifierSet<AbilityType>(); set.add(super.abilityModifiers()); // sum up total abilities in equipped items for (EquippableItem item : inventory.getEquippedItems()) { set.add(item.abilityModifiers()); } set.add(adjustedAbilityScores()); // add raw ability scores return set; } @Override public ModifierSet<DamageType> damageModifiers() { ModifierSet<DamageType> set = new ModifierSet<DamageType>(); set.add(super.damageModifiers()); // sum up total abilities in equipped items for (EquippableItem item : inventory.getEquippedItems()) { set.add(item.damageModifiers()); } return set; } @Override public String formatAbilityModifiers() { String hp = "HP: " + getHP() + "/" + getTotalHP(); if (getHP() <= 0) hp += " (Dead)"; ModifierSet<AbilityType> modifiers = abilityModifiers(); StringBuilder builder = new StringBuilder(); for (AbilityType t : AbilityType.values()) { if (t == AbilityType.HP) continue; int value = rawAbilityScores.delta(t) + modifiers.delta(t); int modifier = getAbilityModifier(t); builder.append(t + ": " + value + " (" + (modifier >= 0 ? "+" : "") + modifier + ")\n"); } return builder.toString() + hp + "\n"; } @Override public String formatDamageModifiers() { String extra = "AC: " + armorClass() + "\n"; extra += "Attack modifiers: "; int levelPlusOne = level + 1; for (int i = levelPlusOne; i > 0; i -= 5) { if (i != levelPlusOne) { extra += "/"; } extra += "+" + i; } extra += "\n"; return super.formatDamageModifiers() + extra; } /** * Calculate the adjustment bonus/penalties for ability scores (10-11 baseline +0) * TODO: Remove this * @return the modifier that is added to {@link #abilityModifiers()}. */ private Modifier<AbilityType> adjustedAbilityScores() { Modifier<AbilityType> mod = new Modifier<AbilityType>(); if (rawAbilityScores.isEmpty()) return mod; // don't do adjustment on empty set for (AbilityType type : AbilityType.values()) { int adjust; if (type == AbilityType.HP) adjust = rawAbilityScores.delta(type); // no adjust for HP //else adjust = (rawAbilityScores.delta(type) / 2) - 5; else adjust = 0; mod.setDelta(type, adjust); } return mod; } }
UTF-8
Java
5,639
java
LivingEntity.java
Java
[]
null
[]
package dnd.game.entity.living; import dnd.game.AbilityType; import dnd.game.DamageType; import dnd.game.Entity; import dnd.game.Inventory; import dnd.game.InventoryInterface; import dnd.game.entity.item.EquippableItem; import dnd.util.Modifier; import dnd.util.ModifierSet; /** * LivingEntity is an extension of the basic Entity class and is used for * defining the player, monsters and NPCs (or any other living creature in the * game world) * * @see Entity * */ public abstract class LivingEntity extends Entity implements InventoryInterface { private Inventory inventory = new Inventory(); private ModifierSet<AbilityType> rawAbilityScores = new ModifierSet<AbilityType>(); private int actualHP; private int level; public LivingEntity() { setName(getClass().getSimpleName()); } /** * @return The inventory of this LivingEntity */ public Inventory getInventory() { return inventory; } /** * Get the ability roll modifier for a given ability type * @param abilityType The ability type of the modifier to get * @return the modifier value for the given ability type */ public int getAbilityModifier(AbilityType abilityType) { ModifierSet<AbilityType> tmp = abilityModifiers(); int baseValue = rawAbilityScores.delta(abilityType); int modifier = tmp.delta(abilityType); // The modifier value is: the floor of half the ability value minus 5. // This value cannot be less than -5. return Math.max(-5, ((baseValue + modifier) / 2) - 5); } /** * Bind an inventory to this LivingEntity * @param inventory The inventory to bind */ protected void setInventory(Inventory inventory) { this.inventory = inventory; } /** * @return whether the entity is alive */ public boolean isAlive() { return actualHP > 0; } /** * @return The current hit point value for this LivingEntity */ public int getHP() { return actualHP; } /** * @param value The current hit point value for this LivingEntity */ public void setHP(int value) { actualHP = value > getTotalHP() ? getTotalHP() : value; } /** * @return The max number of hit points this LivingEntity can have */ public int getTotalHP() { return abilityModifiers().delta(AbilityType.HP); } /** * Set the current hit points to the maximum number of hit points this * LivingEntity can have */ public void resetHP() { actualHP = getTotalHP(); } /** * Sets the player's level value * @param level the level to set */ public void setLevel(int level) { this.level = level - 1; resetHP(); } /** * Get the level value for the player * @return the player's level */ public int getLevel() { return level + 1; } /** * @return the raw ability modifier scores (used during char generation) */ public ModifierSet<AbilityType> getRawAbilityScores() { if (rawAbilityScores == null) { rawAbilityScores = new ModifierSet<AbilityType>(); } return rawAbilityScores; } /** * Alias for {@link #resetHP()} */ public void spawn() { resetHP(); } /** * @return the armor class given the modifiers and equipped items */ public int armorClass() { return 10 + abilityModifiers().delta(AbilityType.DEX) + damageModifiers().delta(DamageType.ARMOR) + damageModifiers().delta(DamageType.SHIELD); } @Override public ModifierSet<AbilityType> abilityModifiers() { ModifierSet<AbilityType> set = new ModifierSet<AbilityType>(); set.add(super.abilityModifiers()); // sum up total abilities in equipped items for (EquippableItem item : inventory.getEquippedItems()) { set.add(item.abilityModifiers()); } set.add(adjustedAbilityScores()); // add raw ability scores return set; } @Override public ModifierSet<DamageType> damageModifiers() { ModifierSet<DamageType> set = new ModifierSet<DamageType>(); set.add(super.damageModifiers()); // sum up total abilities in equipped items for (EquippableItem item : inventory.getEquippedItems()) { set.add(item.damageModifiers()); } return set; } @Override public String formatAbilityModifiers() { String hp = "HP: " + getHP() + "/" + getTotalHP(); if (getHP() <= 0) hp += " (Dead)"; ModifierSet<AbilityType> modifiers = abilityModifiers(); StringBuilder builder = new StringBuilder(); for (AbilityType t : AbilityType.values()) { if (t == AbilityType.HP) continue; int value = rawAbilityScores.delta(t) + modifiers.delta(t); int modifier = getAbilityModifier(t); builder.append(t + ": " + value + " (" + (modifier >= 0 ? "+" : "") + modifier + ")\n"); } return builder.toString() + hp + "\n"; } @Override public String formatDamageModifiers() { String extra = "AC: " + armorClass() + "\n"; extra += "Attack modifiers: "; int levelPlusOne = level + 1; for (int i = levelPlusOne; i > 0; i -= 5) { if (i != levelPlusOne) { extra += "/"; } extra += "+" + i; } extra += "\n"; return super.formatDamageModifiers() + extra; } /** * Calculate the adjustment bonus/penalties for ability scores (10-11 baseline +0) * TODO: Remove this * @return the modifier that is added to {@link #abilityModifiers()}. */ private Modifier<AbilityType> adjustedAbilityScores() { Modifier<AbilityType> mod = new Modifier<AbilityType>(); if (rawAbilityScores.isEmpty()) return mod; // don't do adjustment on empty set for (AbilityType type : AbilityType.values()) { int adjust; if (type == AbilityType.HP) adjust = rawAbilityScores.delta(type); // no adjust for HP //else adjust = (rawAbilityScores.delta(type) / 2) - 5; else adjust = 0; mod.setDelta(type, adjust); } return mod; } }
5,639
0.682922
0.678844
213
25.474178
24.138792
91
false
false
0
0
0
0
0
0
1.652582
false
false
3
1e2f31d1eb753f3caddbb94115530d0169c0fec0
4,939,212,421,676
9f39b68032fe82843406442c757d475a035d6267
/WadlParser/src/edu/sjtu/ist/bjggzxb/WadlParser/impl/OptionNodeImpl.java
688bf36897ee430ff93b44d9fa4e88fd38fb325a
[]
no_license
mtaslimkhan/WadlParser
https://github.com/mtaslimkhan/WadlParser
42e14c8ef505d3fad537f252425a398b72348177
eb286fc1e734b84224e16636dd53bd904dbc2ea3
refs/heads/master
2020-12-07T02:22:03.493000
2012-08-20T13:47:37
2012-08-20T13:47:37
15,105,164
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * An option element defines one of a set of possible values for the parameter represented * by its parent param element. An option element has the following attributes: * * value * A required attribute that defines one of the possible values of the parent parameter. * mediaType * When present this indicates that the parent parameter acts as a media type selector * for responses. The value of the attribute is the media type that is expected when the * parameter has the value given in the value attribute. * * An option element may have zero or more doc elements that document the meaning of the value. */ package edu.sjtu.ist.bjggzxb.WadlParser.impl; import java.util.List; import java.util.ArrayList; import edu.sjtu.ist.bjggzxb.WadlParser.core.DocNode; import edu.sjtu.ist.bjggzxb.WadlParser.core.OptionNode; public class OptionNodeImpl extends GenericNodeImpl implements OptionNode{ private String value; private String mediaType; private List<DocNode> docNodes; public OptionNodeImpl() { value = null; this.docNodes = new ArrayList<DocNode>(); } public String getValue() { return value; } protected void setValue(String value) { this.value = value; } public String getMediaType() { return mediaType; } protected void setMediaType(String mediaType) { this.mediaType = mediaType; } @Override protected boolean addDoc(DocNode doc) { if (doc != null){ docNodes.add(doc); return true; } return false; } public List<DocNode> getAllDocs() { return docNodes; } @Override public boolean equals(Object other) { if (other instanceof OptionNodeImpl) { OptionNodeImpl option = (OptionNodeImpl) other; if (option.getValue().equals(this.value)) return true; } return false; } }
UTF-8
Java
1,773
java
OptionNodeImpl.java
Java
[]
null
[]
/* * An option element defines one of a set of possible values for the parameter represented * by its parent param element. An option element has the following attributes: * * value * A required attribute that defines one of the possible values of the parent parameter. * mediaType * When present this indicates that the parent parameter acts as a media type selector * for responses. The value of the attribute is the media type that is expected when the * parameter has the value given in the value attribute. * * An option element may have zero or more doc elements that document the meaning of the value. */ package edu.sjtu.ist.bjggzxb.WadlParser.impl; import java.util.List; import java.util.ArrayList; import edu.sjtu.ist.bjggzxb.WadlParser.core.DocNode; import edu.sjtu.ist.bjggzxb.WadlParser.core.OptionNode; public class OptionNodeImpl extends GenericNodeImpl implements OptionNode{ private String value; private String mediaType; private List<DocNode> docNodes; public OptionNodeImpl() { value = null; this.docNodes = new ArrayList<DocNode>(); } public String getValue() { return value; } protected void setValue(String value) { this.value = value; } public String getMediaType() { return mediaType; } protected void setMediaType(String mediaType) { this.mediaType = mediaType; } @Override protected boolean addDoc(DocNode doc) { if (doc != null){ docNodes.add(doc); return true; } return false; } public List<DocNode> getAllDocs() { return docNodes; } @Override public boolean equals(Object other) { if (other instanceof OptionNodeImpl) { OptionNodeImpl option = (OptionNodeImpl) other; if (option.getValue().equals(this.value)) return true; } return false; } }
1,773
0.736041
0.736041
71
23.985916
26.634983
95
false
false
0
0
0
0
0
0
1.352113
false
false
3
887d457723737a54790b6c9ce90e07031dc951a1
4,793,183,524,499
d66d901f2f50f3e7fa13b8028602d9854e8e135b
/src/main/java/com/dxfeed/processor/CodeBlockPostProcessor.java
45fba2d7d1867df7a09ffb5bf1c6459b6a5d9fcd
[ "Apache-2.0" ]
permissive
dxFeed/asciidoc2zendesk
https://github.com/dxFeed/asciidoc2zendesk
a8f5de156248ed3f6869564d6646cb7d3caadb37
b5209473d3276a7a13e152315bff8da03b46fe5d
refs/heads/master
2022-09-13T14:11:58.854000
2021-03-01T08:36:12
2021-03-01T08:47:18
235,594,537
0
0
Apache-2.0
false
2022-09-01T23:20:41
2020-01-22T14:47:18
2021-03-01T08:47:33
2022-09-01T23:20:39
224
0
0
2
Java
false
false
package com.dxfeed.processor; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.ast.Document; import org.asciidoctor.extension.Postprocessor; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @Slf4j public class CodeBlockPostProcessor extends Postprocessor { private static final String CODE_START = "(.*)(<code .*>)(.*)"; private static final String CODE_END = "(.*)(</code>)(.*)"; private static final Pattern START_PATTERN = Pattern.compile(CODE_START, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); private static final Pattern END_PATTERN = Pattern.compile(CODE_END, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); @Override public String process(Document document, String convertedDocument) { ThreadLocal<Boolean> inCodeBlock = ThreadLocal.withInitial(() -> false); return Arrays.stream(convertedDocument.split("\n")) .map(s -> this.processString(s, inCodeBlock)) .collect(Collectors.joining("\n")); } private String processString(String string, ThreadLocal<Boolean> inCodeBlock) { String input = string; Matcher matcherA = START_PATTERN.matcher(input); if (matcherA.matches()) { // System.err.println("A) " + input); input = matcherA.group(1) + matcherA.group(3); } Matcher matcherB = END_PATTERN.matcher(input); if (matcherB.matches()) { // System.err.println("B) " + input); input = matcherB.group(1) + matcherB.group(3); } return input; } }
UTF-8
Java
1,639
java
CodeBlockPostProcessor.java
Java
[]
null
[]
package com.dxfeed.processor; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.ast.Document; import org.asciidoctor.extension.Postprocessor; import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @Slf4j public class CodeBlockPostProcessor extends Postprocessor { private static final String CODE_START = "(.*)(<code .*>)(.*)"; private static final String CODE_END = "(.*)(</code>)(.*)"; private static final Pattern START_PATTERN = Pattern.compile(CODE_START, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); private static final Pattern END_PATTERN = Pattern.compile(CODE_END, Pattern.DOTALL | Pattern.CASE_INSENSITIVE); @Override public String process(Document document, String convertedDocument) { ThreadLocal<Boolean> inCodeBlock = ThreadLocal.withInitial(() -> false); return Arrays.stream(convertedDocument.split("\n")) .map(s -> this.processString(s, inCodeBlock)) .collect(Collectors.joining("\n")); } private String processString(String string, ThreadLocal<Boolean> inCodeBlock) { String input = string; Matcher matcherA = START_PATTERN.matcher(input); if (matcherA.matches()) { // System.err.println("A) " + input); input = matcherA.group(1) + matcherA.group(3); } Matcher matcherB = END_PATTERN.matcher(input); if (matcherB.matches()) { // System.err.println("B) " + input); input = matcherB.group(1) + matcherB.group(3); } return input; } }
1,639
0.658938
0.654667
43
37.11628
31.175579
122
false
false
0
0
0
0
0
0
0.674419
false
false
3
0ef78393a1975f49836ea237292e430fc83653d1
34,488,587,392,253
2793a7b04bda89582bd470c990e93e05066efead
/jpl/src/ch17/ex03/ResourceImpl.java
545a03f1096c624ea43e96e7830fbb1037746ee6
[]
no_license
hiroki-yoneda/JavaTraining
https://github.com/hiroki-yoneda/JavaTraining
ab5006ff930135421b7670fcdad8664e3a227cf6
7f7b1ebbc17b87053bae32b24705f8ef634f38c5
refs/heads/master
2021-06-25T07:56:09.537000
2021-02-19T05:24:33
2021-02-19T05:24:33
199,353,793
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jpl.ch17.ex03; import java.util.Map; import java.util.WeakHashMap; public final class ResourceImpl implements Resource { // Resourceオブジェクトがキーへの弱い参照を保持するようにする // 強い参照になり、キーが到達不可能にならないことを防ぐため // WeakHashMap は、オブジェクトに関連づけられた情報が不要だと想定して削除をする Map<Object, Object> map = new WeakHashMap<Object, Object>(); boolean needsRelease = false; ResourceImpl(Object key) { // ハッシュコードを使用する代わりに、キーを管理することで参照オブジェクトを使用する map.put(key, new Object()); // 外部リソースの設定 needsRelease = true; } public void use(Object key, Object... args) { if (map.get(key) == null) { throw new IllegalArgumentException("wrong key"); } // リソースの使用 } public synchronized void release() { if (needsRelease) { needsRelease = false; // リソース解放 } } }
UTF-8
Java
1,048
java
ResourceImpl.java
Java
[]
null
[]
package jpl.ch17.ex03; import java.util.Map; import java.util.WeakHashMap; public final class ResourceImpl implements Resource { // Resourceオブジェクトがキーへの弱い参照を保持するようにする // 強い参照になり、キーが到達不可能にならないことを防ぐため // WeakHashMap は、オブジェクトに関連づけられた情報が不要だと想定して削除をする Map<Object, Object> map = new WeakHashMap<Object, Object>(); boolean needsRelease = false; ResourceImpl(Object key) { // ハッシュコードを使用する代わりに、キーを管理することで参照オブジェクトを使用する map.put(key, new Object()); // 外部リソースの設定 needsRelease = true; } public void use(Object key, Object... args) { if (map.get(key) == null) { throw new IllegalArgumentException("wrong key"); } // リソースの使用 } public synchronized void release() { if (needsRelease) { needsRelease = false; // リソース解放 } } }
1,048
0.716755
0.711436
37
19.324324
18.464069
61
false
false
0
0
0
0
0
0
1.405405
false
false
3
7087278eec65c2d3c96e2a3a34f28737cbb39b74
34,488,587,394,075
042ea4d393be8d5ec3221d380c33377d31e1fbfa
/src/com/demon/hadoop/custom/fs_distributed/BlockManager.java
571f24e87e9ea429f9c8056144686c25b4c250a6
[]
no_license
windfish/essay
https://github.com/windfish/essay
7c9dc49784fb29a86923df475a574d0374284529
a259ee0f05dbb33ecba57c8b71c57eee41302f77
refs/heads/master
2022-12-25T18:31:48.201000
2020-11-17T06:53:46
2020-11-17T06:53:46
55,202,008
8
1
null
false
2022-12-16T09:43:20
2016-04-01T03:46:55
2021-10-20T02:01:05
2022-12-16T09:43:16
18,978
3
1
20
Java
false
false
package com.demon.hadoop.custom.fs_distributed; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * 数据块管理 */ public class BlockManager { public static List<Server> loadServers(){ List<Server> servers = new ArrayList<>(); String serverStr = PropertiesUtil.getProperty("servers"); String[] ss = serverStr.split(","); for(String s: ss){ servers.add(new Server(s)); } return servers; } private Random r = new Random(); /** * 选择存放数据块的服务器 * @param servers */ public List<Server> choseServer(List<Server> servers){ List<Server> choseServers = new ArrayList<>(); String blockReplication = PropertiesUtil.getProperty("block_replication"); int blocks = Integer.parseInt(blockReplication); if(servers.size() <= blocks){ return servers; } for(int i=0; i<blocks; i++){ choseServers.add(servers.remove(r.nextInt(servers.size()))); } return choseServers; } }
UTF-8
Java
1,103
java
BlockManager.java
Java
[]
null
[]
package com.demon.hadoop.custom.fs_distributed; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * 数据块管理 */ public class BlockManager { public static List<Server> loadServers(){ List<Server> servers = new ArrayList<>(); String serverStr = PropertiesUtil.getProperty("servers"); String[] ss = serverStr.split(","); for(String s: ss){ servers.add(new Server(s)); } return servers; } private Random r = new Random(); /** * 选择存放数据块的服务器 * @param servers */ public List<Server> choseServer(List<Server> servers){ List<Server> choseServers = new ArrayList<>(); String blockReplication = PropertiesUtil.getProperty("block_replication"); int blocks = Integer.parseInt(blockReplication); if(servers.size() <= blocks){ return servers; } for(int i=0; i<blocks; i++){ choseServers.add(servers.remove(r.nextInt(servers.size()))); } return choseServers; } }
1,103
0.602241
0.601307
43
23.906977
22.31572
82
false
false
0
0
0
0
0
0
0.44186
false
false
3
b2b98800aad7789d7055a25f66c0e44d29c8790b
18,631,568,167,739
b85e263c4c04c7af0ca4e6191c08ea49253f1eb0
/src/main/java/com/hr319wg/eva/web/EvaSelectionCaclBackBean.java
e5ace1a4c2595cdd003a8223edd909541e0f6e91
[]
no_license
htsia/zghr
https://github.com/htsia/zghr
8e353ac0a88b7ab5a79f0618e4f1c0e4243a3478
c76f4cae7a233697affb46b43b2e011c4a73f7fc
refs/heads/master
2021-01-17T05:34:08.064000
2013-08-15T04:18:22
2013-08-15T04:18:22
10,811,567
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hr319wg.eva.web; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import javax.faces.model.SelectItem; import com.hr319wg.common.web.BaseBackingBean; import com.hr319wg.common.web.PageVO; import com.hr319wg.eva.pojo.bo.EvaGradeItemBO; import com.hr319wg.eva.pojo.bo.EvaMasterBO; import com.hr319wg.eva.pojo.bo.EvaObjectsBO; import com.hr319wg.eva.pojo.bo.EvaPlanBO; import com.hr319wg.eva.pojo.bo.EvaSelectionResultItemBO; import com.hr319wg.eva.pojo.bo.EvaSelectionResultSetBO; import com.hr319wg.eva.ucc.IEvaGradeUCC; import com.hr319wg.eva.ucc.IEvaObjectsUCC; import com.hr319wg.eva.ucc.IEvaPlanUCC; import com.hr319wg.eva.ucc.IEvaScoreUCC; import com.hr319wg.sys.cache.SysCacheTool; public class EvaSelectionCaclBackBean extends BaseBackingBean { private IEvaObjectsUCC objectUCC; private IEvaGradeUCC gradeUCC; private IEvaPlanUCC evaplanucc; private IEvaScoreUCC scoreucc; private String pageInit; private String planId; private String setId; private List setItemList; public String delete(){ try{ EvaSelectionResultSetBO bo=objectUCC.findEvaSelectionResultSetBO(setId); if(bo.getIsSel()!=null&&bo.getIsSel().equals("1")){ super.showMessageDetail("该结果是统计结果不能删除!"); }else{ List itemList=objectUCC.getEvaSelectionResultItemBOBySetId(setId); if(itemList!=null&&itemList.size()>0){ for(int i=0;i<itemList.size();i++){ EvaSelectionResultItemBO bo1=(EvaSelectionResultItemBO)itemList.get(i); objectUCC.deleteEvaSelectionResultItemBO(bo1.getItemId()); } } objectUCC.deleteEvaSelectionResultSetBO(setId); } }catch(Exception e){ e.printStackTrace(); } return ""; } public void doQuery(){ try{ setItemList=objectUCC.getEvaSelectionResultSetBOByPlanId(planId); if(setItemList!=null&&setItemList.size()>0){ for(int i=0;i<setItemList.size();i++){ EvaSelectionResultSetBO setbo=(EvaSelectionResultSetBO)setItemList.get(i); String items=""; if(setbo.getGradeItems()!=null&&!setbo.getGradeItems().equals("")){ String[] ids=setbo.getGradeItems().split(","); for(int j=0;j<ids.length;j++){ if(ids[j]!=null&&!ids[j].equals("")){ EvaGradeItemBO bo=gradeUCC.getGradeItem(ids[j]); if(items.equals("")){ items+=bo.getItemName(); }else{ items+=","+bo.getItemName(); } } } setbo.setGradeItemsDes(items); } setItemList.set(i, setbo); } } }catch(Exception e){ e.printStackTrace(); } } public String getPageInit() { if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); } doQuery(); return pageInit; } public void setPageInit(String pageInit) { this.pageInit = pageInit; } public String getPlanId() { return planId; } public void setPlanId(String planId) { this.planId = planId; } public String getSetId() { return setId; } public void setSetId(String setId) { this.setId = setId; } public List getSetItemList() { return setItemList; } public void setSetItemList(List setItemList) { this.setItemList = setItemList; } public IEvaObjectsUCC getObjectUCC() { return objectUCC; } public void setObjectUCC(IEvaObjectsUCC objectUCC) { this.objectUCC = objectUCC; } public IEvaGradeUCC getGradeUCC() { return gradeUCC; } public void setGradeUCC(IEvaGradeUCC gradeUCC) { this.gradeUCC = gradeUCC; } public IEvaPlanUCC getEvaplanucc() { return evaplanucc; } public void setEvaplanucc(IEvaPlanUCC evaplanucc) { this.evaplanucc = evaplanucc; } public IEvaScoreUCC getScoreucc() { return scoreucc; } public void setScoreucc(IEvaScoreUCC scoreucc) { this.scoreucc = scoreucc; } //增加设置 private String initEdit; private EvaSelectionResultSetBO setbo=new EvaSelectionResultSetBO(); private List gradeItemList; private String[] gradeItems; public EvaSelectionResultSetBO getSetbo() { return setbo; } public void setSetbo(EvaSelectionResultSetBO setbo) { this.setbo = setbo; } public String saveSet(){ try{ String id=""; if(gradeItems!=null&&gradeItems.length>0){ for(int i=0;i<gradeItems.length;i++){ if(gradeItems[i]!=null&&!gradeItems[i].equals("")){ if(id.equals("")){ id+=gradeItems[i]; }else{ id+=","+gradeItems[i]; } } } } setbo.setIsCacl("0"); setbo.setIsSel("0"); setbo.setGradeItems(id); setbo.setPlanId(planId); objectUCC.saveEvaSelectionResultSetBO(setbo); }catch(Exception e){ e.printStackTrace(); } return "success"; } public String[] getGradeItems() { return gradeItems; } public void setGradeItems(String[] gradeItems) { this.gradeItems = gradeItems; } public List getGradeItemList() { return gradeItemList; } public void setGradeItemList(List gradeItemList) { this.gradeItemList = gradeItemList; } public String getInitEdit() { try{ if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); }else if(super.getRequestParameter("setId")!=null){ setId=super.getRequestParameter("setId"); setbo=objectUCC.findEvaSelectionResultSetBO(setId); planId=setbo.getPlanId(); if(setbo.getGradeItems()!=null&&!setbo.getGradeItems().equals("")){ gradeItems=setbo.getGradeItems().split(","); } } EvaPlanBO bo=evaplanucc.findPlanById(planId); gradeItemList=new ArrayList(); if(bo.getPlanGrade()!=null&&!bo.getPlanGrade().equals("")){ List gradeList=gradeUCC.getAllGradeItem(bo.getPlanGrade()); if(gradeList!=null&&gradeList.size()>0){ for(int i=0;i<gradeList.size();i++){ EvaGradeItemBO itembo=(EvaGradeItemBO)gradeList.get(i); SelectItem si=new SelectItem(); si.setLabel(itembo.getItemName()); si.setValue(itembo.getItemID()); gradeItemList.add(si); } } } }catch(Exception e){ e.printStackTrace(); } return initEdit; } public void setInitEdit(String initEdit) { this.initEdit = initEdit; } //计算 public String calc(){ try{ EvaSelectionResultSetBO bo=objectUCC.findEvaSelectionResultSetBO(setId); List itemList=objectUCC.getEvaSelectionResultItemBOBySetId(setId); if(itemList!=null&&itemList.size()>0){ for(int i=0;i<itemList.size();i++){ EvaSelectionResultItemBO bo1=(EvaSelectionResultItemBO)itemList.get(i); objectUCC.deleteEvaSelectionResultItemBO(bo1.getItemId()); } } caclElectionScoreByPlanIdAndGradeItem(bo.getPlanId(),bo.getGradeItems()); bo.setIsCacl("1"); objectUCC.saveEvaSelectionResultSetBO(bo); super.showMessageDetail("计算成功"); }catch(Exception e){ super.showMessageDetail("计算失败"); e.printStackTrace(); } return ""; } public void caclElectionScoreByPlanIdAndGradeItem(String planId,String gradeItem){ try{ EvaPlanBO planbo =evaplanucc.findPlanById(planId); NumberFormat nf = NumberFormat.getInstance(); if (planbo.getScorePers() != null && !planbo.getScorePers().equals("")) { int intPers = Integer.parseInt(planbo.getScorePers()); nf.setMaximumFractionDigits(intPers); } else { nf.setMaximumFractionDigits(2); } List gradeList = gradeUCC.getAllGradeItem(planbo.getPlanGrade()); List objectList=objectUCC.getObjectsByPlanId(null, planId); if(objectList!=null&&objectList.size()>0){ for(int i=0;i<objectList.size();i++){ EvaObjectsBO obj=(EvaObjectsBO)objectList.get(i); List masterList=objectUCC.getMasters(obj.getObjectID(),null); List masterType=new ArrayList(); if(masterList!=null&&masterList.size()>0){ for(int j=0;j<masterList.size();j++){ EvaMasterBO masterbo=(EvaMasterBO)masterList.get(j); if(!masterType.contains(masterbo.getMasterType())){ masterType.add(masterbo.getMasterType()); } } } if(masterType!=null&&masterType.size()>0){ for(int j=0;j<masterType.size();j++){ String type=(String)masterType.get(j); List mList=objectUCC.getMastersByMasterType(obj.getObjectID(), type); double count=0; double purview=0; if(mList!=null&&mList.size()>0){ for(int m=0;m<mList.size();m++){ EvaMasterBO masterbo=(EvaMasterBO)mList.get(m); if(masterbo.getGradeId()!=null&&gradeItem.indexOf(masterbo.getGradeId())!=-1){ count++; } purview+=Double.parseDouble(masterbo.getPurview()); } } double calatesocre=count*100*purview/(100*mList.size()); EvaSelectionResultItemBO vo=new EvaSelectionResultItemBO(); vo.setSetId(setId); vo.setObjectId(obj.getObjectID()); vo.setMasterType(type); vo.setCaclScore(nf.format(calatesocre)); vo.setCaclPers(nf.format(count/mList.size()*100)); objectUCC.saveEvaSelectionResultItemBO(vo); } } } } }catch(Exception e){ e.printStackTrace(); } } public String setResult(){ try{ List setList=objectUCC.getEvaSelectionResultSetBOByPlanId(planId); if(setList!=null&&setList.size()>0){ for(int i=0;i<setList.size();i++){ EvaSelectionResultSetBO setbo=(EvaSelectionResultSetBO)setList.get(i); setbo.setIsSel("0"); objectUCC.saveEvaSelectionResultSetBO(setbo); } } EvaSelectionResultSetBO bo=objectUCC.findEvaSelectionResultSetBO(setId); EvaPlanBO planbo =evaplanucc.findPlanById(planId); NumberFormat nf = NumberFormat.getInstance(); if (planbo.getScorePers() != null && !planbo.getScorePers().equals("")) { int intPers = Integer.parseInt(planbo.getScorePers()); nf.setMaximumFractionDigits(intPers); } else { nf.setMaximumFractionDigits(2); } List gradeList = gradeUCC.getAllGradeItem(planbo.getPlanGrade()); List objectList=objectUCC.getObjectsByPlanId(null, planId); if(objectList!=null&&objectList.size()>0){ for(int i=0;i<objectList.size();i++){ EvaObjectsBO obj=(EvaObjectsBO)objectList.get(i); List scoreList=objectUCC.getEvaSelectionResultItemBOBySetIdAndObjId(setId, obj.getObjectID()); double score=0; if(scoreList!=null&&scoreList.size()>0){ for(int m=0;m<scoreList.size();m++){ EvaSelectionResultItemBO itembo=(EvaSelectionResultItemBO)scoreList.get(m); score+=Double.parseDouble(itembo.getCaclScore()); } for(int m=0;m<gradeList.size();m++){ EvaGradeItemBO grade=(EvaGradeItemBO)gradeList.get(m); double hi=Double.parseDouble(grade.getHighValue()); double low=Double.parseDouble(grade.getLowValue()); if(score>=low&&score<hi){ obj.setGradeItem(grade.getItemID()); break; } } obj.setScore(nf.format(score)); objectUCC.savaEvaObject(obj); } } } bo.setIsSel("1"); objectUCC.saveEvaSelectionResultSetBO(bo); }catch(Exception e){ e.printStackTrace(); } return ""; } //投票结果分析 private String initResult; private String initResultList; private String superId; private String superName; private PageVO mypage=new PageVO(); private String planOrgId; public String getPlanOrgId() { return super.getUserInfo().getOrgId(); } public void setPlanOrgId(String planOrgId) { this.planOrgId = planOrgId; } public String getInitResultList() { try{ if(super.getRequestParameter("superId")!=null){ superId=super.getRequestParameter("superId"); superName=SysCacheTool.findOrgById(superId).getName(); } if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); EvaPlanBO bo=evaplanucc.findPlanById(planId); if(bo.getPlanGrade()!=null&&!bo.getPlanGrade().equals("")){ List gradeList=gradeUCC.getAllGradeItem(bo.getPlanGrade()); super.getHttpSession().setAttribute("gradeList", gradeList); } } if(super.getRequestParameter("setId")!=null){ setId=super.getRequestParameter("setId"); } doParameter(); }catch(Exception e){ e.printStackTrace(); } return initResultList; } public void setInitResultList(String initResultList) { this.initResultList = initResultList; } public String getSuperId() { return superId; } public void setSuperId(String superId) { this.superId = superId; } public String getSuperName() { return superName; } public void setSuperName(String superName) { this.superName = superName; } public PageVO getMypage() { return mypage; } public void setMypage(PageVO mypage) { this.mypage = mypage; } public String first() { mypage.setCurrentPage(1); doParameter(); return ""; } public String pre() { if (mypage.getCurrentPage() > 1) { mypage.setCurrentPage(mypage.getCurrentPage() - 1); } doParameter(); return ""; } public String next() { if (mypage.getCurrentPage() < mypage.getTotalPage()) { mypage.setCurrentPage(mypage.getCurrentPage() + 1); } doParameter(); return ""; } public String last() { mypage.setCurrentPage(mypage.getTotalPage()); doParameter(); return ""; } public String doParameter() { try { if (mypage.getCurrentPage() == 0) { mypage.setCurrentPage(1); } if(planId!=null&&!planId.equals("")&&superId!=null&&!superId.equals("")){ EvaPlanBO planbo=evaplanucc.findPlanById(planId); List objectList=new ArrayList(); if(planbo.getPlanObjectType().equals(EvaPlanBO.OBJCT_TYPE_PERSON)){ objectList=objectUCC.getObjectsByPlanIdAndOrgId(mypage,planId,superId); }else{ objectList=objectUCC.getObjectsByPlanIdAndOrgId(mypage,planId,null); } super.getHttpSession().setAttribute("objectType", planbo.getPlanObjectType()); super.getHttpSession().setAttribute("objectList", objectList); super.getHttpSession().setAttribute("planId", planId); super.getHttpSession().setAttribute("setId", setId); super.getHttpSession().setAttribute("superId", superId); } } catch (Exception e) { e.printStackTrace(); } return ""; } public String getClear(){ super.getHttpSession().setAttribute("objectList",null); return ""; } public String getInitResult() { if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); } if(super.getRequestParameter("setId")!=null){ setId=super.getRequestParameter("setId"); } return initResult; } public void setInitResult(String initResult) { this.initResult = initResult; } }
GB18030
Java
14,854
java
EvaSelectionCaclBackBean.java
Java
[]
null
[]
package com.hr319wg.eva.web; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import javax.faces.model.SelectItem; import com.hr319wg.common.web.BaseBackingBean; import com.hr319wg.common.web.PageVO; import com.hr319wg.eva.pojo.bo.EvaGradeItemBO; import com.hr319wg.eva.pojo.bo.EvaMasterBO; import com.hr319wg.eva.pojo.bo.EvaObjectsBO; import com.hr319wg.eva.pojo.bo.EvaPlanBO; import com.hr319wg.eva.pojo.bo.EvaSelectionResultItemBO; import com.hr319wg.eva.pojo.bo.EvaSelectionResultSetBO; import com.hr319wg.eva.ucc.IEvaGradeUCC; import com.hr319wg.eva.ucc.IEvaObjectsUCC; import com.hr319wg.eva.ucc.IEvaPlanUCC; import com.hr319wg.eva.ucc.IEvaScoreUCC; import com.hr319wg.sys.cache.SysCacheTool; public class EvaSelectionCaclBackBean extends BaseBackingBean { private IEvaObjectsUCC objectUCC; private IEvaGradeUCC gradeUCC; private IEvaPlanUCC evaplanucc; private IEvaScoreUCC scoreucc; private String pageInit; private String planId; private String setId; private List setItemList; public String delete(){ try{ EvaSelectionResultSetBO bo=objectUCC.findEvaSelectionResultSetBO(setId); if(bo.getIsSel()!=null&&bo.getIsSel().equals("1")){ super.showMessageDetail("该结果是统计结果不能删除!"); }else{ List itemList=objectUCC.getEvaSelectionResultItemBOBySetId(setId); if(itemList!=null&&itemList.size()>0){ for(int i=0;i<itemList.size();i++){ EvaSelectionResultItemBO bo1=(EvaSelectionResultItemBO)itemList.get(i); objectUCC.deleteEvaSelectionResultItemBO(bo1.getItemId()); } } objectUCC.deleteEvaSelectionResultSetBO(setId); } }catch(Exception e){ e.printStackTrace(); } return ""; } public void doQuery(){ try{ setItemList=objectUCC.getEvaSelectionResultSetBOByPlanId(planId); if(setItemList!=null&&setItemList.size()>0){ for(int i=0;i<setItemList.size();i++){ EvaSelectionResultSetBO setbo=(EvaSelectionResultSetBO)setItemList.get(i); String items=""; if(setbo.getGradeItems()!=null&&!setbo.getGradeItems().equals("")){ String[] ids=setbo.getGradeItems().split(","); for(int j=0;j<ids.length;j++){ if(ids[j]!=null&&!ids[j].equals("")){ EvaGradeItemBO bo=gradeUCC.getGradeItem(ids[j]); if(items.equals("")){ items+=bo.getItemName(); }else{ items+=","+bo.getItemName(); } } } setbo.setGradeItemsDes(items); } setItemList.set(i, setbo); } } }catch(Exception e){ e.printStackTrace(); } } public String getPageInit() { if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); } doQuery(); return pageInit; } public void setPageInit(String pageInit) { this.pageInit = pageInit; } public String getPlanId() { return planId; } public void setPlanId(String planId) { this.planId = planId; } public String getSetId() { return setId; } public void setSetId(String setId) { this.setId = setId; } public List getSetItemList() { return setItemList; } public void setSetItemList(List setItemList) { this.setItemList = setItemList; } public IEvaObjectsUCC getObjectUCC() { return objectUCC; } public void setObjectUCC(IEvaObjectsUCC objectUCC) { this.objectUCC = objectUCC; } public IEvaGradeUCC getGradeUCC() { return gradeUCC; } public void setGradeUCC(IEvaGradeUCC gradeUCC) { this.gradeUCC = gradeUCC; } public IEvaPlanUCC getEvaplanucc() { return evaplanucc; } public void setEvaplanucc(IEvaPlanUCC evaplanucc) { this.evaplanucc = evaplanucc; } public IEvaScoreUCC getScoreucc() { return scoreucc; } public void setScoreucc(IEvaScoreUCC scoreucc) { this.scoreucc = scoreucc; } //增加设置 private String initEdit; private EvaSelectionResultSetBO setbo=new EvaSelectionResultSetBO(); private List gradeItemList; private String[] gradeItems; public EvaSelectionResultSetBO getSetbo() { return setbo; } public void setSetbo(EvaSelectionResultSetBO setbo) { this.setbo = setbo; } public String saveSet(){ try{ String id=""; if(gradeItems!=null&&gradeItems.length>0){ for(int i=0;i<gradeItems.length;i++){ if(gradeItems[i]!=null&&!gradeItems[i].equals("")){ if(id.equals("")){ id+=gradeItems[i]; }else{ id+=","+gradeItems[i]; } } } } setbo.setIsCacl("0"); setbo.setIsSel("0"); setbo.setGradeItems(id); setbo.setPlanId(planId); objectUCC.saveEvaSelectionResultSetBO(setbo); }catch(Exception e){ e.printStackTrace(); } return "success"; } public String[] getGradeItems() { return gradeItems; } public void setGradeItems(String[] gradeItems) { this.gradeItems = gradeItems; } public List getGradeItemList() { return gradeItemList; } public void setGradeItemList(List gradeItemList) { this.gradeItemList = gradeItemList; } public String getInitEdit() { try{ if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); }else if(super.getRequestParameter("setId")!=null){ setId=super.getRequestParameter("setId"); setbo=objectUCC.findEvaSelectionResultSetBO(setId); planId=setbo.getPlanId(); if(setbo.getGradeItems()!=null&&!setbo.getGradeItems().equals("")){ gradeItems=setbo.getGradeItems().split(","); } } EvaPlanBO bo=evaplanucc.findPlanById(planId); gradeItemList=new ArrayList(); if(bo.getPlanGrade()!=null&&!bo.getPlanGrade().equals("")){ List gradeList=gradeUCC.getAllGradeItem(bo.getPlanGrade()); if(gradeList!=null&&gradeList.size()>0){ for(int i=0;i<gradeList.size();i++){ EvaGradeItemBO itembo=(EvaGradeItemBO)gradeList.get(i); SelectItem si=new SelectItem(); si.setLabel(itembo.getItemName()); si.setValue(itembo.getItemID()); gradeItemList.add(si); } } } }catch(Exception e){ e.printStackTrace(); } return initEdit; } public void setInitEdit(String initEdit) { this.initEdit = initEdit; } //计算 public String calc(){ try{ EvaSelectionResultSetBO bo=objectUCC.findEvaSelectionResultSetBO(setId); List itemList=objectUCC.getEvaSelectionResultItemBOBySetId(setId); if(itemList!=null&&itemList.size()>0){ for(int i=0;i<itemList.size();i++){ EvaSelectionResultItemBO bo1=(EvaSelectionResultItemBO)itemList.get(i); objectUCC.deleteEvaSelectionResultItemBO(bo1.getItemId()); } } caclElectionScoreByPlanIdAndGradeItem(bo.getPlanId(),bo.getGradeItems()); bo.setIsCacl("1"); objectUCC.saveEvaSelectionResultSetBO(bo); super.showMessageDetail("计算成功"); }catch(Exception e){ super.showMessageDetail("计算失败"); e.printStackTrace(); } return ""; } public void caclElectionScoreByPlanIdAndGradeItem(String planId,String gradeItem){ try{ EvaPlanBO planbo =evaplanucc.findPlanById(planId); NumberFormat nf = NumberFormat.getInstance(); if (planbo.getScorePers() != null && !planbo.getScorePers().equals("")) { int intPers = Integer.parseInt(planbo.getScorePers()); nf.setMaximumFractionDigits(intPers); } else { nf.setMaximumFractionDigits(2); } List gradeList = gradeUCC.getAllGradeItem(planbo.getPlanGrade()); List objectList=objectUCC.getObjectsByPlanId(null, planId); if(objectList!=null&&objectList.size()>0){ for(int i=0;i<objectList.size();i++){ EvaObjectsBO obj=(EvaObjectsBO)objectList.get(i); List masterList=objectUCC.getMasters(obj.getObjectID(),null); List masterType=new ArrayList(); if(masterList!=null&&masterList.size()>0){ for(int j=0;j<masterList.size();j++){ EvaMasterBO masterbo=(EvaMasterBO)masterList.get(j); if(!masterType.contains(masterbo.getMasterType())){ masterType.add(masterbo.getMasterType()); } } } if(masterType!=null&&masterType.size()>0){ for(int j=0;j<masterType.size();j++){ String type=(String)masterType.get(j); List mList=objectUCC.getMastersByMasterType(obj.getObjectID(), type); double count=0; double purview=0; if(mList!=null&&mList.size()>0){ for(int m=0;m<mList.size();m++){ EvaMasterBO masterbo=(EvaMasterBO)mList.get(m); if(masterbo.getGradeId()!=null&&gradeItem.indexOf(masterbo.getGradeId())!=-1){ count++; } purview+=Double.parseDouble(masterbo.getPurview()); } } double calatesocre=count*100*purview/(100*mList.size()); EvaSelectionResultItemBO vo=new EvaSelectionResultItemBO(); vo.setSetId(setId); vo.setObjectId(obj.getObjectID()); vo.setMasterType(type); vo.setCaclScore(nf.format(calatesocre)); vo.setCaclPers(nf.format(count/mList.size()*100)); objectUCC.saveEvaSelectionResultItemBO(vo); } } } } }catch(Exception e){ e.printStackTrace(); } } public String setResult(){ try{ List setList=objectUCC.getEvaSelectionResultSetBOByPlanId(planId); if(setList!=null&&setList.size()>0){ for(int i=0;i<setList.size();i++){ EvaSelectionResultSetBO setbo=(EvaSelectionResultSetBO)setList.get(i); setbo.setIsSel("0"); objectUCC.saveEvaSelectionResultSetBO(setbo); } } EvaSelectionResultSetBO bo=objectUCC.findEvaSelectionResultSetBO(setId); EvaPlanBO planbo =evaplanucc.findPlanById(planId); NumberFormat nf = NumberFormat.getInstance(); if (planbo.getScorePers() != null && !planbo.getScorePers().equals("")) { int intPers = Integer.parseInt(planbo.getScorePers()); nf.setMaximumFractionDigits(intPers); } else { nf.setMaximumFractionDigits(2); } List gradeList = gradeUCC.getAllGradeItem(planbo.getPlanGrade()); List objectList=objectUCC.getObjectsByPlanId(null, planId); if(objectList!=null&&objectList.size()>0){ for(int i=0;i<objectList.size();i++){ EvaObjectsBO obj=(EvaObjectsBO)objectList.get(i); List scoreList=objectUCC.getEvaSelectionResultItemBOBySetIdAndObjId(setId, obj.getObjectID()); double score=0; if(scoreList!=null&&scoreList.size()>0){ for(int m=0;m<scoreList.size();m++){ EvaSelectionResultItemBO itembo=(EvaSelectionResultItemBO)scoreList.get(m); score+=Double.parseDouble(itembo.getCaclScore()); } for(int m=0;m<gradeList.size();m++){ EvaGradeItemBO grade=(EvaGradeItemBO)gradeList.get(m); double hi=Double.parseDouble(grade.getHighValue()); double low=Double.parseDouble(grade.getLowValue()); if(score>=low&&score<hi){ obj.setGradeItem(grade.getItemID()); break; } } obj.setScore(nf.format(score)); objectUCC.savaEvaObject(obj); } } } bo.setIsSel("1"); objectUCC.saveEvaSelectionResultSetBO(bo); }catch(Exception e){ e.printStackTrace(); } return ""; } //投票结果分析 private String initResult; private String initResultList; private String superId; private String superName; private PageVO mypage=new PageVO(); private String planOrgId; public String getPlanOrgId() { return super.getUserInfo().getOrgId(); } public void setPlanOrgId(String planOrgId) { this.planOrgId = planOrgId; } public String getInitResultList() { try{ if(super.getRequestParameter("superId")!=null){ superId=super.getRequestParameter("superId"); superName=SysCacheTool.findOrgById(superId).getName(); } if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); EvaPlanBO bo=evaplanucc.findPlanById(planId); if(bo.getPlanGrade()!=null&&!bo.getPlanGrade().equals("")){ List gradeList=gradeUCC.getAllGradeItem(bo.getPlanGrade()); super.getHttpSession().setAttribute("gradeList", gradeList); } } if(super.getRequestParameter("setId")!=null){ setId=super.getRequestParameter("setId"); } doParameter(); }catch(Exception e){ e.printStackTrace(); } return initResultList; } public void setInitResultList(String initResultList) { this.initResultList = initResultList; } public String getSuperId() { return superId; } public void setSuperId(String superId) { this.superId = superId; } public String getSuperName() { return superName; } public void setSuperName(String superName) { this.superName = superName; } public PageVO getMypage() { return mypage; } public void setMypage(PageVO mypage) { this.mypage = mypage; } public String first() { mypage.setCurrentPage(1); doParameter(); return ""; } public String pre() { if (mypage.getCurrentPage() > 1) { mypage.setCurrentPage(mypage.getCurrentPage() - 1); } doParameter(); return ""; } public String next() { if (mypage.getCurrentPage() < mypage.getTotalPage()) { mypage.setCurrentPage(mypage.getCurrentPage() + 1); } doParameter(); return ""; } public String last() { mypage.setCurrentPage(mypage.getTotalPage()); doParameter(); return ""; } public String doParameter() { try { if (mypage.getCurrentPage() == 0) { mypage.setCurrentPage(1); } if(planId!=null&&!planId.equals("")&&superId!=null&&!superId.equals("")){ EvaPlanBO planbo=evaplanucc.findPlanById(planId); List objectList=new ArrayList(); if(planbo.getPlanObjectType().equals(EvaPlanBO.OBJCT_TYPE_PERSON)){ objectList=objectUCC.getObjectsByPlanIdAndOrgId(mypage,planId,superId); }else{ objectList=objectUCC.getObjectsByPlanIdAndOrgId(mypage,planId,null); } super.getHttpSession().setAttribute("objectType", planbo.getPlanObjectType()); super.getHttpSession().setAttribute("objectList", objectList); super.getHttpSession().setAttribute("planId", planId); super.getHttpSession().setAttribute("setId", setId); super.getHttpSession().setAttribute("superId", superId); } } catch (Exception e) { e.printStackTrace(); } return ""; } public String getClear(){ super.getHttpSession().setAttribute("objectList",null); return ""; } public String getInitResult() { if(super.getRequestParameter("planId")!=null){ planId=super.getRequestParameter("planId"); } if(super.getRequestParameter("setId")!=null){ setId=super.getRequestParameter("setId"); } return initResult; } public void setInitResult(String initResult) { this.initResult = initResult; } }
14,854
0.672708
0.666013
494
27.935223
22.380041
99
false
false
0
0
0
0
0
0
3.364372
false
false
3
8e3fef36d041f12f88f0e0763fe56fa4c7b5d0f7
21,758,304,384,862
80ae37b254c3c900bfac734c07b3971c015b12a6
/java_professional/src/main/java/collections/collectionsgupta/map/HashMap6.java
e19c61a331d64d661707bca557b1fcac07d40c5b
[]
no_license
PutosForks/GitTest
https://github.com/PutosForks/GitTest
8b4c710f7853e2ea3c0aa53e01cead3c52194abe
43a8a95b830f961b3a243a3c6861728b5285abce
refs/heads/master
2021-09-16T06:56:36.454000
2018-06-18T05:34:03
2018-06-18T05:34:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collections.collectionsgupta.map; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; enum Color { RED, BLUE, YELLOW; } public class HashMap6 { public static void main(String[] args) { Map<Color, String> colorMap = new HashMap<>(); colorMap.put(Color.RED, "Passion"); colorMap.put(Color.BLUE, "Stability"); colorMap.put(Color.YELLOW, "Energy"); Collection<String> mood = colorMap.values(); Set<Color> colors = colorMap.keySet(); Set<Map.Entry<Color, String>> colorsMood = colorMap.entrySet(); for (String s : mood) System.out.println(s); for (Color c : colors) System.out.println(c); for (Map.Entry pair : colorsMood) System.out.println(pair.getKey() + ":" + pair.getValue()); } }
UTF-8
Java
913
java
HashMap6.java
Java
[]
null
[]
package collections.collectionsgupta.map; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; enum Color { RED, BLUE, YELLOW; } public class HashMap6 { public static void main(String[] args) { Map<Color, String> colorMap = new HashMap<>(); colorMap.put(Color.RED, "Passion"); colorMap.put(Color.BLUE, "Stability"); colorMap.put(Color.YELLOW, "Energy"); Collection<String> mood = colorMap.values(); Set<Color> colors = colorMap.keySet(); Set<Map.Entry<Color, String>> colorsMood = colorMap.entrySet(); for (String s : mood) System.out.println(s); for (Color c : colors) System.out.println(c); for (Map.Entry pair : colorsMood) System.out.println(pair.getKey() + ":" + pair.getValue()); } }
913
0.589266
0.588171
33
25.424242
21.434935
71
false
false
0
0
0
0
0
0
0.69697
false
false
3
701428efd5242f16e012cffa793263ccfdb4bfc4
13,314,398,684,855
23fabcef7cae496e0669bec44aef6aace1d8a7fe
/src/com/doku/javafundamental/polimorfisme/Hewan.java
8eceb49d12c5a5130ad527f3c0a3dfe5f3909e4e
[]
no_license
jamalfazlur/java-fundamental-batch4
https://github.com/jamalfazlur/java-fundamental-batch4
af89b4fb06edab808a92057e987743e84cf44cbd
c7c14658cb0f1252ce7a6ac65aad2e8b890996a2
refs/heads/master
2020-09-08T06:32:26.472000
2019-11-12T09:20:30
2019-11-12T09:20:30
221,046,468
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.doku.javafundamental.polimorfisme; public class Hewan { public Hewan(){ System.out.println("[inheritance] - construct Hewan"); } public void makan() { // base method System.out.println("Hewan sedang makan.."); } }
UTF-8
Java
261
java
Hewan.java
Java
[]
null
[]
package com.doku.javafundamental.polimorfisme; public class Hewan { public Hewan(){ System.out.println("[inheritance] - construct Hewan"); } public void makan() { // base method System.out.println("Hewan sedang makan.."); } }
261
0.636015
0.636015
11
22.727272
22.099325
62
false
false
0
0
0
0
0
0
0.272727
false
false
3
70f01d5c1f296a91af96d07802308f8300802669
33,621,004,041,183
e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0
/sample-project-5400/src/main/java/com/example/project/sample5400/other/sample2/Other2_499.java
ccf5afe41fa3391231df5411775c80bca1e1f58a
[]
no_license
snicoll-scratches/test-spring-components-index
https://github.com/snicoll-scratches/test-spring-components-index
77e0ad58c8646c7eb1d1563bf31f51aa42a0636e
aa48681414a11bb704bdbc8acabe45fa5ef2fd2d
refs/heads/main
2021-06-13T08:46:58.532000
2019-12-09T15:11:10
2019-12-09T15:11:10
65,806,297
5
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.project.sample5400.other.sample2; public class Other2_499 { }
UTF-8
Java
84
java
Other2_499.java
Java
[]
null
[]
package com.example.project.sample5400.other.sample2; public class Other2_499 { }
84
0.785714
0.678571
5
15.8
20.913155
53
false
false
0
0
0
0
0
0
0.2
false
false
3
4957d78ab9b29c2b6310dbaf598fbd1db1041bf0
33,621,004,040,479
252f346895718b046546e6a89079c67a60c81c62
/src/main/java/com/keremc/lobby/user/LobbyTeam.java
77e1f7b75daa197ba44da717862e892a1ad7e2b2
[]
no_license
keremnc/lobby
https://github.com/keremnc/lobby
83bb25f0a6ec3e77297f5702c547435ccaaaf919
08fee52483d903a450063213b8abbb6d3196f81d
refs/heads/master
2021-09-28T14:40:11.817000
2017-12-06T22:40:03
2017-12-06T22:40:03
112,795,114
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.keremc.lobby.user; import lombok.Data; import org.apache.commons.lang3.Validate; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; @Data public class LobbyTeam { private final UUID teamId = UUID.randomUUID(); private UUID leader; private final Set<UUID> teamMembers; public int size() { return teamMembers.size(); } public void removeMember(final UUID uuid) { Validate.notNull(uuid); teamMembers.remove(uuid); } public void addMember(final UUID uuid) { Validate.notNull(uuid); teamMembers.add(uuid); } public boolean isMember(final UUID uuid) { Validate.notNull(uuid); return teamMembers.contains(uuid); } public List<Player> getPlayers() { return teamMembers.stream().map(Bukkit::getPlayer).collect(Collectors.toList()); } public void sendMessage(final String message) { Validate.notNull(message); getPlayers().forEach(player -> sendMessage(message)); } }
UTF-8
Java
1,056
java
LobbyTeam.java
Java
[]
null
[]
package com.keremc.lobby.user; import lombok.Data; import org.apache.commons.lang3.Validate; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; @Data public class LobbyTeam { private final UUID teamId = UUID.randomUUID(); private UUID leader; private final Set<UUID> teamMembers; public int size() { return teamMembers.size(); } public void removeMember(final UUID uuid) { Validate.notNull(uuid); teamMembers.remove(uuid); } public void addMember(final UUID uuid) { Validate.notNull(uuid); teamMembers.add(uuid); } public boolean isMember(final UUID uuid) { Validate.notNull(uuid); return teamMembers.contains(uuid); } public List<Player> getPlayers() { return teamMembers.stream().map(Bukkit::getPlayer).collect(Collectors.toList()); } public void sendMessage(final String message) { Validate.notNull(message); getPlayers().forEach(player -> sendMessage(message)); } }
1,056
0.748106
0.747159
48
21
18.637999
82
false
false
0
0
0
0
0
0
1.208333
false
false
3
4cc004331401e36ef47954f370af0d2754034429
32,049,046,001,565
15e19a7ee3d7afa06712465cbf099155b1c474d6
/11_decorator/src/main/java/drink/Plus.java
23d6e488fcb408102b861322aed725b2ca226a48
[]
no_license
voctrals/d23
https://github.com/voctrals/d23
00fde4a19d225589d161d0f3c28b159e6340b53b
545f30283a98d2056f12e0a97e392b4afa466a43
refs/heads/master
2021-06-26T09:09:13.533000
2019-12-12T03:25:19
2019-12-12T03:25:19
162,224,260
0
0
null
false
2020-10-13T11:20:16
2018-12-18T03:24:52
2019-12-12T03:25:30
2020-10-13T11:20:14
38
0
0
1
Java
false
false
package drink; /** * @author lei.liu * @since 18-12-21 */ public abstract class Plus extends DrinkType { private DrinkType drinkType; public Plus(DrinkType drinkType) { this.drinkType = drinkType; } }
UTF-8
Java
225
java
Plus.java
Java
[ { "context": "package drink;\n\n/**\n * @author lei.liu\n * @since 18-12-21\n */\npublic abstract class Plus", "end": 38, "score": 0.9992111921310425, "start": 31, "tag": "NAME", "value": "lei.liu" } ]
null
[]
package drink; /** * @author lei.liu * @since 18-12-21 */ public abstract class Plus extends DrinkType { private DrinkType drinkType; public Plus(DrinkType drinkType) { this.drinkType = drinkType; } }
225
0.662222
0.635556
12
17.75
15.589126
46
false
false
0
0
0
0
0
0
0.25
false
false
3
09dde1eec0651913bd6aa29d098b178118c4ac87
30,253,749,690,533
2404f2bdfb99e7e1070a1b9663e1b2b784066c76
/JPAwithMysql/src/main/java/com/jpa/controller/UserController.java
d01494a0384bd410e75eaa6b3f569454f4d6e7da
[]
no_license
harshsinghal1010/Springboot-JPACrud
https://github.com/harshsinghal1010/Springboot-JPACrud
ec3f1eede5d8c956e5747623febf1804ad922171
0379f9c60f0c205d1543e7f6c13c1fd98e630c44
refs/heads/master
2020-04-13T05:35:34.062000
2018-12-24T14:07:13
2018-12-24T14:07:13
162,996,581
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jpa.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.jpa.entity.User; import com.jpa.model.ApiStatus; import com.jpa.service.IUserService; @RestController public class UserController { @Autowired private IUserService service ; @Autowired private ApiStatus api; @PostMapping("/add") public ResponseEntity<?> register(@ModelAttribute("user") User user) { int id =service.insert(user); return showResponse("User Added" , "success" , id); } @GetMapping("/find") private ResponseEntity<?> findOne(@RequestParam("id") int userId) { User user = service.findById(userId); if(user==null) return showResponse("user not found" , "error" , null); else return ResponseEntity.status(HttpStatus.OK).body(user); } @GetMapping("/findall") private ResponseEntity<?> findAll(){ List<User> list = service.findAll(); if(list.isEmpty()) return showResponse("user not found" , "error" , null); else return ResponseEntity.status(HttpStatus.OK).body(list); } @PutMapping("/update") public ResponseEntity<?> update(@ModelAttribute("user") User user) { User user1 = service.findById(user.getUid()); if(user1==null) showResponse("user not found" , "error" , null); service.update(user); return showResponse("User updated" , "success" , null); } @DeleteMapping("/delete") public ResponseEntity<?> delete(@RequestParam("id") int id) { User user1 = service.findById(id); if(user1==null) return showResponse("user not found" , "error" , null); service.delete(id); return showResponse("User deleted" , "success" , null); } private ResponseEntity<ApiStatus> showResponse(String message , String status , Integer id){ api.setMessage(message); api.setStatus(status); api.setUserId(id); return ResponseEntity.status(HttpStatus.OK).body(api); } @ExceptionHandler({Exception.class}) private ResponseEntity<ApiStatus> showException(Exception ex){ api.setMessage(ex. getMessage()); api.setStatus("error"); api.setUserId(null); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(api); } }
UTF-8
Java
2,771
java
UserController.java
Java
[]
null
[]
package com.jpa.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.jpa.entity.User; import com.jpa.model.ApiStatus; import com.jpa.service.IUserService; @RestController public class UserController { @Autowired private IUserService service ; @Autowired private ApiStatus api; @PostMapping("/add") public ResponseEntity<?> register(@ModelAttribute("user") User user) { int id =service.insert(user); return showResponse("User Added" , "success" , id); } @GetMapping("/find") private ResponseEntity<?> findOne(@RequestParam("id") int userId) { User user = service.findById(userId); if(user==null) return showResponse("user not found" , "error" , null); else return ResponseEntity.status(HttpStatus.OK).body(user); } @GetMapping("/findall") private ResponseEntity<?> findAll(){ List<User> list = service.findAll(); if(list.isEmpty()) return showResponse("user not found" , "error" , null); else return ResponseEntity.status(HttpStatus.OK).body(list); } @PutMapping("/update") public ResponseEntity<?> update(@ModelAttribute("user") User user) { User user1 = service.findById(user.getUid()); if(user1==null) showResponse("user not found" , "error" , null); service.update(user); return showResponse("User updated" , "success" , null); } @DeleteMapping("/delete") public ResponseEntity<?> delete(@RequestParam("id") int id) { User user1 = service.findById(id); if(user1==null) return showResponse("user not found" , "error" , null); service.delete(id); return showResponse("User deleted" , "success" , null); } private ResponseEntity<ApiStatus> showResponse(String message , String status , Integer id){ api.setMessage(message); api.setStatus(status); api.setUserId(id); return ResponseEntity.status(HttpStatus.OK).body(api); } @ExceptionHandler({Exception.class}) private ResponseEntity<ApiStatus> showException(Exception ex){ api.setMessage(ex. getMessage()); api.setStatus("error"); api.setUserId(null); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(api); } }
2,771
0.737279
0.735835
112
23.75
24.314348
93
false
false
0
0
0
0
0
0
1.625
false
false
3
fb133f82233327742ff961b0e35509e1359b9734
39,651,138,107,302
78322410c99f81b9a94fbeb68ab87f74688c9428
/src/com/rifledluffy/survival/domestication/animal/animals/DomesticSheep.java
3b106f77c72a5f6d1c4212259b9ccbe1b33f85d5
[]
no_license
RifleDLuffy/RFSurvival
https://github.com/RifleDLuffy/RFSurvival
a679cfd8d595aa81f84298cd915799ca39b4d371
9d6877eea871a9800147dfcd8a91c183c5d07092
refs/heads/master
2020-05-03T07:49:20.535000
2019-03-30T03:55:00
2019-03-30T03:56:33
178,508,575
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rifledluffy.survival.domestication.animal.animals; import com.rifledluffy.survival.domestication.animal.types.DomesticMedium; import org.bukkit.entity.Sheep; public class DomesticSheep extends DomesticMedium { private Sheep sheep; public DomesticSheep(Sheep sheep, int thirstThreshold, int hungerThreshold) { super(sheep, thirstThreshold, hungerThreshold); this.sheep = sheep; } public DomesticSheep(Sheep sheep, int hydration, int hunger, int thirstThreshold, int hungerThreshold) { super(sheep, hydration, hunger, thirstThreshold, hungerThreshold); this.sheep = sheep; } }
UTF-8
Java
644
java
DomesticSheep.java
Java
[]
null
[]
package com.rifledluffy.survival.domestication.animal.animals; import com.rifledluffy.survival.domestication.animal.types.DomesticMedium; import org.bukkit.entity.Sheep; public class DomesticSheep extends DomesticMedium { private Sheep sheep; public DomesticSheep(Sheep sheep, int thirstThreshold, int hungerThreshold) { super(sheep, thirstThreshold, hungerThreshold); this.sheep = sheep; } public DomesticSheep(Sheep sheep, int hydration, int hunger, int thirstThreshold, int hungerThreshold) { super(sheep, hydration, hunger, thirstThreshold, hungerThreshold); this.sheep = sheep; } }
644
0.75
0.75
19
32.894737
33.351231
108
false
false
0
0
0
0
0
0
1.052632
false
false
3
4ca233a00460f00bcff3950ced4a84fcef425b06
37,684,043,056,263
4691acca4e62da71a857385cffce2b6b4aef3bb3
/algorithms-modules/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/greedy/NonGreedyAlgorithm.java
af274a385ed964514d42952984102e38648829aa
[ "MIT" ]
permissive
lor6/tutorials
https://github.com/lor6/tutorials
800f2e48d7968c047407bbd8a61b47be7ec352f2
e993db2c23d559d503b8bf8bc27aab0847224593
refs/heads/master
2023-05-29T06:17:47.980000
2023-05-19T08:37:45
2023-05-19T08:37:45
145,218,314
7
11
MIT
true
2018-08-18T12:29:20
2018-08-18T12:29:19
2018-08-18T12:01:20
2018-08-18T12:01:05
108,692
0
0
0
null
false
null
package com.baeldung.algorithms.greedy; import java.util.List; public class NonGreedyAlgorithm { int currentLevel = 0; final int maxLevel = 3; SocialConnector tc; public NonGreedyAlgorithm(SocialConnector tc, int level) { super(); this.tc = tc; this.currentLevel = level; } public long findMostFollowersPath(String account) { List<SocialUser> followers = tc.getFollowers(account); long total = currentLevel > 0 ? followers.size() : 0; if (currentLevel < maxLevel ) { currentLevel++; long[] count = new long[followers.size()]; int i = 0; for (SocialUser el : followers) { NonGreedyAlgorithm sub = new NonGreedyAlgorithm(tc, currentLevel); count[i] = sub.findMostFollowersPath(el.getUsername()); i++; } long max = 0; for (; i > 0; i--) { if (count[i-1] > max ) max = count[i-1]; } return total + max; } return total; } }
UTF-8
Java
1,156
java
NonGreedyAlgorithm.java
Java
[]
null
[]
package com.baeldung.algorithms.greedy; import java.util.List; public class NonGreedyAlgorithm { int currentLevel = 0; final int maxLevel = 3; SocialConnector tc; public NonGreedyAlgorithm(SocialConnector tc, int level) { super(); this.tc = tc; this.currentLevel = level; } public long findMostFollowersPath(String account) { List<SocialUser> followers = tc.getFollowers(account); long total = currentLevel > 0 ? followers.size() : 0; if (currentLevel < maxLevel ) { currentLevel++; long[] count = new long[followers.size()]; int i = 0; for (SocialUser el : followers) { NonGreedyAlgorithm sub = new NonGreedyAlgorithm(tc, currentLevel); count[i] = sub.findMostFollowersPath(el.getUsername()); i++; } long max = 0; for (; i > 0; i--) { if (count[i-1] > max ) max = count[i-1]; } return total + max; } return total; } }
1,156
0.511246
0.50346
43
25.88372
21.06933
82
false
false
0
0
0
0
0
0
0.55814
false
false
3
f9340d52d00d414fea8d9306c2a025e8adea898c
34,471,407,576,737
2c397c5b632c9baf9b7e9efcd5cb5b76e5569c26
/dao/src/main/java/com/imust/newckbk/dao/FxtjbDao.java
20b095ff78ff8fab23d1a35ffb67ea463cff926b
[]
no_license
jkzzk/newckbk
https://github.com/jkzzk/newckbk
8d34ec96b7facad51ffe73473eee950aa6ff808c
0ca6a925ced5b8b8b55a169559efc5aeb4fd68e1
refs/heads/master
2023-03-19T04:23:39.095000
2021-03-04T13:58:47
2021-03-04T13:58:47
293,687,178
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.imust.newckbk.dao; import com.imust.newckbk.domain.Fxtjb; import com.imust.newckbk.base.BaseDao; import com.imust.newckbk.domain.ext.BktjjlExt; import com.imust.newckbk.domain.ext.FxtjbExt; import java.util.List; import java.util.Map; /** * @date 2020-08-23 * @author zzk * */ public interface FxtjbDao extends BaseDao<Fxtjb, String>{ /** * 分页查询 * * @param data * @return */ List<FxtjbExt> getExtByPage(Map data); /** * 更新所有记录状态为 2 */ void abandonOld(); /** * 删除所有状态为2的记录 */ int clearFxtjb(); /** * 查询当前生效的辅修条件 * * @return */ FxtjbExt getEffectiveSet(); }
UTF-8
Java
741
java
FxtjbDao.java
Java
[ { "context": " java.util.Map;\n\n\n/**\n* @date 2020-08-23\n* @author zzk\n* \n*/\npublic interface FxtjbDao extends BaseDao<F", "end": 287, "score": 0.9996151924133301, "start": 284, "tag": "USERNAME", "value": "zzk" } ]
null
[]
package com.imust.newckbk.dao; import com.imust.newckbk.domain.Fxtjb; import com.imust.newckbk.base.BaseDao; import com.imust.newckbk.domain.ext.BktjjlExt; import com.imust.newckbk.domain.ext.FxtjbExt; import java.util.List; import java.util.Map; /** * @date 2020-08-23 * @author zzk * */ public interface FxtjbDao extends BaseDao<Fxtjb, String>{ /** * 分页查询 * * @param data * @return */ List<FxtjbExt> getExtByPage(Map data); /** * 更新所有记录状态为 2 */ void abandonOld(); /** * 删除所有状态为2的记录 */ int clearFxtjb(); /** * 查询当前生效的辅修条件 * * @return */ FxtjbExt getEffectiveSet(); }
741
0.606241
0.591382
43
14.674418
14.688582
57
false
false
0
0
0
0
0
0
0.27907
false
false
3
285920cfa178bc1a2d384fde6210e9efc253856e
37,323,265,837,320
426696f94bfac99a308e13de25d07dd8e28c572b
/jps/jps-builders/src/org/jetbrains/jps/incremental/artifacts/instructions/ArtifactSourceRoot.java
503aae76962511835288e565063b3791478d3e00
[ "Apache-2.0" ]
permissive
soucod/jdksoucod-ideasc-2011
https://github.com/soucod/jdksoucod-ideasc-2011
8fae49dcd81b2429aa8cf7f827beb20113e0f059
75fb4ce21c3b625ca5a4f18bf5bc5acdaa098a59
refs/heads/master
2020-11-25T07:52:28.398000
2019-12-28T03:53:52
2019-12-28T03:53:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.jetbrains.jps.incremental.artifacts.instructions; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.incremental.CompileContext; import org.jetbrains.jps.incremental.artifacts.ArtifactOutputToSourceMapping; import org.jetbrains.jps.incremental.artifacts.ArtifactSourceToOutputMapping; import java.io.File; import java.io.IOException; /** * @author nik */ public abstract class ArtifactSourceRoot { private final SourceFileFilter myFilter; protected ArtifactSourceRoot(@NotNull SourceFileFilter filter) { myFilter = filter; } @NotNull public abstract File getRootFile(); public abstract boolean containsFile(String filePath); public abstract void copyFromRoot(String filePath, int rootIndex, String outputPath, CompileContext context, ArtifactSourceToOutputMapping srcOutMapping, ArtifactOutputToSourceMapping outSrcMapping) throws IOException; public SourceFileFilter getFilter() { return myFilter; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return myFilter.equals(((ArtifactSourceRoot)o).myFilter); } @Override public int hashCode() { return myFilter.hashCode(); } }
UTF-8
Java
1,360
java
ArtifactSourceRoot.java
Java
[ { "context": ".File;\nimport java.io.IOException;\n\n/**\n * @author nik\n */\npublic abstract class ArtifactSourceRoot {\n ", "end": 383, "score": 0.9988663196563721, "start": 380, "tag": "USERNAME", "value": "nik" } ]
null
[]
package org.jetbrains.jps.incremental.artifacts.instructions; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.incremental.CompileContext; import org.jetbrains.jps.incremental.artifacts.ArtifactOutputToSourceMapping; import org.jetbrains.jps.incremental.artifacts.ArtifactSourceToOutputMapping; import java.io.File; import java.io.IOException; /** * @author nik */ public abstract class ArtifactSourceRoot { private final SourceFileFilter myFilter; protected ArtifactSourceRoot(@NotNull SourceFileFilter filter) { myFilter = filter; } @NotNull public abstract File getRootFile(); public abstract boolean containsFile(String filePath); public abstract void copyFromRoot(String filePath, int rootIndex, String outputPath, CompileContext context, ArtifactSourceToOutputMapping srcOutMapping, ArtifactOutputToSourceMapping outSrcMapping) throws IOException; public SourceFileFilter getFilter() { return myFilter; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return myFilter.equals(((ArtifactSourceRoot)o).myFilter); } @Override public int hashCode() { return myFilter.hashCode(); } }
1,360
0.7125
0.7125
46
28.565218
28.953976
104
false
false
0
0
0
0
0
0
0.521739
false
false
3
006c9c1d645ab0a041740730c01f59cf71a9e58d
6,287,832,158,213
57c8a435f7e9d4b55bd2fa14e7130e36d79659dc
/Semester 1 (ICP)/assignment 5/cw/a5q22.java
6251979d1e6b0f40c09fd3eae96f4ecb2fa65863
[ "MIT" ]
permissive
MartyMiniac/ITER-Assignment
https://github.com/MartyMiniac/ITER-Assignment
c18594ab9f293de8c05371d0e5588e80178cbd6a
a7b355f40cc52a337ad90bb8328e54c4a9534530
refs/heads/master
2023-08-15T20:33:38.262000
2021-10-09T02:51:05
2021-10-09T02:51:05
211,330,872
24
12
MIT
false
2021-06-21T05:40:38
2019-09-27T13:55:02
2021-06-21T04:59:02
2021-06-21T05:40:37
152
8
6
2
Java
false
false
import java.util.*; class a5q22 { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.print("Enter a number :"); int n=in.nextInt(); int c=0,a=1; while(n>=a) { if(n%a==0) { c++; } a++; } if(c==2) { System.out.println(n+" is a Prime Number "); } else { System.out.println(n+" is a Non Prime Number "); } } }
UTF-8
Java
395
java
a5q22.java
Java
[]
null
[]
import java.util.*; class a5q22 { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.print("Enter a number :"); int n=in.nextInt(); int c=0,a=1; while(n>=a) { if(n%a==0) { c++; } a++; } if(c==2) { System.out.println(n+" is a Prime Number "); } else { System.out.println(n+" is a Non Prime Number "); } } }
395
0.541772
0.524051
27
13.62963
15.009006
51
false
false
0
0
0
0
0
0
2.259259
false
false
3
bbac4edf48afaebc24cc24618b8ac5dc59dacf7f
23,828,478,598,377
bba110e32a2d28af8350f2c5488e0bd26eee871b
/WebAppAsistenciaCepuns/src/java/com/empresa/proyecto/controlador/matricula/MatriculaRegistrarServlet.java
6cf738c9f90088f59f374aab499566a4fcfb4f7e
[]
no_license
magadiflo/Sistema-de-control-de-asistencia---CEPUNS
https://github.com/magadiflo/Sistema-de-control-de-asistencia---CEPUNS
8173002107c67a42c5c8f276aaee9fdb506a2a39
c9d234b6eddd83410d288dff51948dc4c6c252a8
refs/heads/master
2020-03-25T06:23:01.999000
2018-08-08T18:17:43
2018-08-08T18:17:43
143,498,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.empresa.proyecto.controlador.matricula; import com.empresa.proyecto.entidad.EspecialidadBE; import com.empresa.proyecto.entidad.MatriculaBE; import com.empresa.proyecto.entidad.MatriculaDiasBE; import com.empresa.proyecto.entidad.MatriculaEspecialidadBE; import com.empresa.proyecto.entidad.ParametroBE; import com.empresa.proyecto.entidad.ProgramacionHorarioBE; import com.empresa.proyecto.entidad.TurnoBE; import com.empresa.proyecto.negocio.EspecialidadManager; import com.empresa.proyecto.negocio.MatriculaManager; import com.empresa.proyecto.negocio.ParametroManager; import com.empresa.proyecto.util.Util; import com.empresa.proyecto.util.UtilSeguridad; import com.empresa.proyecto.util.constante.Constante; import com.empresa.proyecto.util.constante.ParametroTipoConstante; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author VICTOR */ @WebServlet(name = "MatriculaRegistrarServlet", urlPatterns = {"/aperturarCiclo"}) public class MatriculaRegistrarServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet MatriculaRegistrarServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet MatriculaRegistrarServlet at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (UtilSeguridad.estaLogueado(request, response)) { try { Util.enviarMensaje(request); ParametroBE filtroCiclo = new ParametroBE(); filtroCiclo.getParametroTipo().setIdentParametroTipo(ParametroTipoConstante.CICLO); List<ParametroBE> ciclos = new ParametroManager().obtener(filtroCiclo); List<EspecialidadBE> especialidades = new EspecialidadManager().obtener(new EspecialidadBE()); request.setAttribute("ciclos", ciclos); request.setAttribute("especialidades", especialidades); } catch (Exception e) { e.printStackTrace(); Util.guardarMensaje(request, Constante.MENSAJE_ERROR); Util.enviarMensaje(request); } request.getRequestDispatcher("aperturarCiclo.jsp").forward(request, response); } } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (UtilSeguridad.estaLogueado(request, response)) { String characterSplit = "-"; String[] idDias = null; String[] idEspecialidades = null; String[] checkEspecialidades = null; String[] fecha_inicio_unidad = null; String[] fecha_fin_unidad = null; MatriculaDiasBE matriculaDias = null; MatriculaEspecialidadBE matriculaEspecialidad = null; ProgramacionHorarioBE unidad = null; try { MatriculaBE matricula = new MatriculaBE(); matricula.setAnio(Util.obtenerValorEntero(request.getParameter("anio"))); matricula.getCiclo().setIdentParametro(Util.obtenerValorEntero(request.getParameter("id_004_ciclo"))); matricula.setLimiteFaltasPorcentaje(Util.obtenerValorEntero(request.getParameter("limite_faltas_porcentaje"))); matricula.setAsignarPrimerTurnoDefecto(true); TurnoBE turno = new TurnoBE(); turno.setHoraInicio(request.getParameter("hora_inicio")); turno.setHoraFin(request.getParameter("hora_fin")); matricula.getListTurno().add(turno); idDias = request.getParameterValues("dias"); for (int i = 0; i < idDias.length; i++) { matriculaDias = new MatriculaDiasBE(); matriculaDias.getDia().setIdentParametro(Util.obtenerValorEntero(idDias[i])); matricula.addMatriculaDia(matriculaDias); } checkEspecialidades = request.getParameterValues("checkEspecialidades"); idEspecialidades = request.getParameterValues("idEspecialidades"); for (int i = 0; i < checkEspecialidades.length; i++) { if (Constante.CHECKED_ON.equals(checkEspecialidades[i])) { matriculaEspecialidad = new MatriculaEspecialidadBE(); matriculaEspecialidad.getEspecialidad().setIdentEspecialidad(Util.obtenerValorEntero(idEspecialidades[i])); matricula.addMatriculaEspecialidad(matriculaEspecialidad); } } fecha_inicio_unidad = request.getParameterValues("fecha_inicio_unidad_agregada"); fecha_fin_unidad = request.getParameterValues("fecha_fin_unidad_agregada"); for (int i = 0; i < fecha_inicio_unidad.length; i++) { unidad = new ProgramacionHorarioBE(); unidad.setFechaInicio(Util.obtenerDateFormatoAnioMesDia(fecha_inicio_unidad[i], characterSplit)); unidad.setFechaFin(Util.obtenerDateFormatoAnioMesDia(fecha_fin_unidad[i], characterSplit)); matricula.addProgramacionHorario(unidad); } int idMatricula = new MatriculaManager().registrar(matricula); Util.guardarMensaje(request, Constante.REGISTRO_EXITOSO); } catch (Exception e) { e.printStackTrace(); Util.guardarMensaje(request, Constante.MENSAJE_ERROR); } response.sendRedirect(request.getContextPath() + "/aperturarCiclo"); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
UTF-8
Java
7,997
java
MatriculaRegistrarServlet.java
Java
[ { "context": "rvlet.http.HttpServletResponse;\n\n/**\n *\n * @author VICTOR\n */\n@WebServlet(name = \"MatriculaRegistrarSe", "end": 1293, "score": 0.6427303552627563, "start": 1292, "tag": "NAME", "value": "V" }, { "context": "let.http.HttpServletResponse;\n\n/**\n *\n * @author VICTOR\n */\n@WebServlet(name = \"MatriculaRegistrarServlet", "end": 1298, "score": 0.6282238960266113, "start": 1293, "tag": "USERNAME", "value": "ICTOR" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.empresa.proyecto.controlador.matricula; import com.empresa.proyecto.entidad.EspecialidadBE; import com.empresa.proyecto.entidad.MatriculaBE; import com.empresa.proyecto.entidad.MatriculaDiasBE; import com.empresa.proyecto.entidad.MatriculaEspecialidadBE; import com.empresa.proyecto.entidad.ParametroBE; import com.empresa.proyecto.entidad.ProgramacionHorarioBE; import com.empresa.proyecto.entidad.TurnoBE; import com.empresa.proyecto.negocio.EspecialidadManager; import com.empresa.proyecto.negocio.MatriculaManager; import com.empresa.proyecto.negocio.ParametroManager; import com.empresa.proyecto.util.Util; import com.empresa.proyecto.util.UtilSeguridad; import com.empresa.proyecto.util.constante.Constante; import com.empresa.proyecto.util.constante.ParametroTipoConstante; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author VICTOR */ @WebServlet(name = "MatriculaRegistrarServlet", urlPatterns = {"/aperturarCiclo"}) public class MatriculaRegistrarServlet extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet MatriculaRegistrarServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet MatriculaRegistrarServlet at " + request.getContextPath() + "</h1>"); out.println("</body>"); out.println("</html>"); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (UtilSeguridad.estaLogueado(request, response)) { try { Util.enviarMensaje(request); ParametroBE filtroCiclo = new ParametroBE(); filtroCiclo.getParametroTipo().setIdentParametroTipo(ParametroTipoConstante.CICLO); List<ParametroBE> ciclos = new ParametroManager().obtener(filtroCiclo); List<EspecialidadBE> especialidades = new EspecialidadManager().obtener(new EspecialidadBE()); request.setAttribute("ciclos", ciclos); request.setAttribute("especialidades", especialidades); } catch (Exception e) { e.printStackTrace(); Util.guardarMensaje(request, Constante.MENSAJE_ERROR); Util.enviarMensaje(request); } request.getRequestDispatcher("aperturarCiclo.jsp").forward(request, response); } } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (UtilSeguridad.estaLogueado(request, response)) { String characterSplit = "-"; String[] idDias = null; String[] idEspecialidades = null; String[] checkEspecialidades = null; String[] fecha_inicio_unidad = null; String[] fecha_fin_unidad = null; MatriculaDiasBE matriculaDias = null; MatriculaEspecialidadBE matriculaEspecialidad = null; ProgramacionHorarioBE unidad = null; try { MatriculaBE matricula = new MatriculaBE(); matricula.setAnio(Util.obtenerValorEntero(request.getParameter("anio"))); matricula.getCiclo().setIdentParametro(Util.obtenerValorEntero(request.getParameter("id_004_ciclo"))); matricula.setLimiteFaltasPorcentaje(Util.obtenerValorEntero(request.getParameter("limite_faltas_porcentaje"))); matricula.setAsignarPrimerTurnoDefecto(true); TurnoBE turno = new TurnoBE(); turno.setHoraInicio(request.getParameter("hora_inicio")); turno.setHoraFin(request.getParameter("hora_fin")); matricula.getListTurno().add(turno); idDias = request.getParameterValues("dias"); for (int i = 0; i < idDias.length; i++) { matriculaDias = new MatriculaDiasBE(); matriculaDias.getDia().setIdentParametro(Util.obtenerValorEntero(idDias[i])); matricula.addMatriculaDia(matriculaDias); } checkEspecialidades = request.getParameterValues("checkEspecialidades"); idEspecialidades = request.getParameterValues("idEspecialidades"); for (int i = 0; i < checkEspecialidades.length; i++) { if (Constante.CHECKED_ON.equals(checkEspecialidades[i])) { matriculaEspecialidad = new MatriculaEspecialidadBE(); matriculaEspecialidad.getEspecialidad().setIdentEspecialidad(Util.obtenerValorEntero(idEspecialidades[i])); matricula.addMatriculaEspecialidad(matriculaEspecialidad); } } fecha_inicio_unidad = request.getParameterValues("fecha_inicio_unidad_agregada"); fecha_fin_unidad = request.getParameterValues("fecha_fin_unidad_agregada"); for (int i = 0; i < fecha_inicio_unidad.length; i++) { unidad = new ProgramacionHorarioBE(); unidad.setFechaInicio(Util.obtenerDateFormatoAnioMesDia(fecha_inicio_unidad[i], characterSplit)); unidad.setFechaFin(Util.obtenerDateFormatoAnioMesDia(fecha_fin_unidad[i], characterSplit)); matricula.addProgramacionHorario(unidad); } int idMatricula = new MatriculaManager().registrar(matricula); Util.guardarMensaje(request, Constante.REGISTRO_EXITOSO); } catch (Exception e) { e.printStackTrace(); Util.guardarMensaje(request, Constante.MENSAJE_ERROR); } response.sendRedirect(request.getContextPath() + "/aperturarCiclo"); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
7,997
0.648618
0.647493
181
43.18232
31.474009
131
false
false
0
0
0
0
0
0
0.607735
false
false
3
96b0f3caa5ce5517665f6c5bff70fdd4505d4b18
30,726,196,097,425
ff79e46531d5ad204abd019472087b0ee67d6bd5
/common/util/src/och/util/model/IntWrap.java
f0a67ab2a51a8f60e805968febbd39eb72e365a8
[ "Apache-2.0" ]
permissive
Frankie-666/live-chat-engine
https://github.com/Frankie-666/live-chat-engine
24f927f152bf1ef46b54e3d55ad5cf764c37c646
3125d34844bb82a34489d05f1dc5e9c4aaa885a0
refs/heads/master
2020-12-25T16:36:00.156000
2015-08-16T09:16:57
2015-08-16T09:16:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2015 Evgeny Dolganov (evgenij.dolganov@gmail.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package och.util.model; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class IntWrap { public int val; public IntWrap() { super(); } public IntWrap(int val) { this.val = val; } public static <T> Map<T, Integer> unwrapMap(Map<T, IntWrap> map){ if(map == null) return null; HashMap<T, Integer> out = new HashMap<>(); for (Entry<T, IntWrap> entry : map.entrySet()) { out.put(entry.getKey(), entry.getValue().val); } return out; } }
UTF-8
Java
1,140
java
IntWrap.java
Java
[ { "context": "/*\n * Copyright 2015 Evgeny Dolganov (evgenij.dolganov@gmail.com).\n *\n * Licensed unde", "end": 36, "score": 0.9998629093170166, "start": 21, "tag": "NAME", "value": "Evgeny Dolganov" }, { "context": "/*\n * Copyright 2015 Evgeny Dolganov (evgenij.dolganov@gmail.com).\n *\n * Licensed under the Apache License, Versio", "end": 64, "score": 0.9999331831932068, "start": 38, "tag": "EMAIL", "value": "evgenij.dolganov@gmail.com" } ]
null
[]
/* * Copyright 2015 <NAME> (<EMAIL>). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package och.util.model; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class IntWrap { public int val; public IntWrap() { super(); } public IntWrap(int val) { this.val = val; } public static <T> Map<T, Integer> unwrapMap(Map<T, IntWrap> map){ if(map == null) return null; HashMap<T, Integer> out = new HashMap<>(); for (Entry<T, IntWrap> entry : map.entrySet()) { out.put(entry.getKey(), entry.getValue().val); } return out; } }
1,112
0.692982
0.685965
47
23.25532
25.100197
75
false
false
0
0
0
0
0
0
1.170213
false
false
3
c8406222191189ee78082ef79fd0c7bd3dd94f33
8,993,661,581,856
77cdfb1aa6332233a2b8aefcefc8de3362404127
/src/main/java/io/wedeploy/example/WeDeployController.java
e6cf7fe3152ced646bfe871657772ae1fef10439
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
chuk001/java-maven-example
https://github.com/chuk001/java-maven-example
49188dbbcdb2687b38dbeeca23cd2929cdab3624
a4c93e013d0875fda12ae441dfc4f658904a4646
refs/heads/master
2023-04-24T04:36:50.055000
2018-04-03T01:17:31
2018-04-03T01:17:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.wedeploy.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @EnableAutoConfiguration public class WeDeployController { public static void main(String[] args) { SpringApplication.run(WeDeployController.class, args); } @RequestMapping("/") public String hello() { return "layout.html"; } }
UTF-8
Java
544
java
WeDeployController.java
Java
[]
null
[]
package io.wedeploy.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @EnableAutoConfiguration public class WeDeployController { public static void main(String[] args) { SpringApplication.run(WeDeployController.class, args); } @RequestMapping("/") public String hello() { return "layout.html"; } }
544
0.768382
0.768382
21
24.952381
23.00823
70
false
false
0
0
0
0
0
0
0.380952
false
false
3
51af68cc106eed8b478bbd1557b884db4eb8591a
25,692,494,426,328
8f54037568b0e319b8e6e3fee8bc45a9c1aa330d
/springcloud/user/src/main/java/top/uaian/cloud/controller/UserOrderController.java
3987200c6b8c9c5cf5e36fb59e2553f198035752
[]
no_license
xukainan/microservice
https://github.com/xukainan/microservice
5bf25f0d519313a2323873b57f7eeacf5859e50e
83f2b48021d07d29d4e5a35245dc7b02344397bc
refs/heads/master
2023-01-12T06:08:26.694000
2020-11-18T09:12:51
2020-11-18T09:12:51
288,141,120
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package top.uaian.cloud.controller; import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty; import com.netflix.ribbon.proxy.annotation.Hystrix; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import top.uaian.cloud.OrderService; import top.uaian.cloud.base.BaseResult; import top.uaian.cloud.base.Constants; import top.uaian.cloud.order.Order; import java.util.List; /** * description: <br> * date: 2020/8/18 9:54 <br> * @author: xukainan <br> * version: 1.0 <br> */ @RestController @RequestMapping("/user") @RefreshScope //@DefaultProperties(defaultFallback = "defaultFallbackMethod") public class UserOrderController { @Autowired OrderService orderService; @Value("${env:local}") String env; @GetMapping("/listOrders") // @HystrixCommand(fallbackMethod = "timeoutMethod",commandProperties = { // @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "5000") // }) // @HystrixCommand(fallbackMethod = "listUserOrders_error"); // @HystrixCommand public BaseResult<List<Order>> listUserOrders(@RequestParam(value = "usercode",required = false, defaultValue = "") String usercode){ BaseResult<List<Order>> baseResult = new BaseResult<List<Order>>(); baseResult = orderService.listUserOrders(usercode); return baseResult; } // public BaseResult<List<Order>> listUserOrders_error(@RequestParam("usercode") String usercode){ // return new BaseResult().renderError(404, "查询失败!"); // } // // public BaseResult<List<Order>> defaultFallbackMethod(){ // return new BaseResult().renderError(400, "查询失败!"); // // } // // public BaseResult<List<Order>> timeoutMethod(String usercode){ // return new BaseResult().renderError(400, "超时!"); // // } @GetMapping("/testConfig") public BaseResult<String> testConfig(){ BaseResult<String> baseResult = new BaseResult<>(); baseResult.renderSuccess(env); return baseResult; } }
UTF-8
Java
2,695
java
UserOrderController.java
Java
[ { "context": "on: <br>\n * date: 2020/8/18 9:54 <br>\n * @author: xukainan <br>\n * version: 1.0 <br>\n */\n@RestController\n@Re", "end": 1115, "score": 0.9993830919265747, "start": 1107, "tag": "USERNAME", "value": "xukainan" } ]
null
[]
package top.uaian.cloud.controller; import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty; import com.netflix.ribbon.proxy.annotation.Hystrix; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import top.uaian.cloud.OrderService; import top.uaian.cloud.base.BaseResult; import top.uaian.cloud.base.Constants; import top.uaian.cloud.order.Order; import java.util.List; /** * description: <br> * date: 2020/8/18 9:54 <br> * @author: xukainan <br> * version: 1.0 <br> */ @RestController @RequestMapping("/user") @RefreshScope //@DefaultProperties(defaultFallback = "defaultFallbackMethod") public class UserOrderController { @Autowired OrderService orderService; @Value("${env:local}") String env; @GetMapping("/listOrders") // @HystrixCommand(fallbackMethod = "timeoutMethod",commandProperties = { // @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "5000") // }) // @HystrixCommand(fallbackMethod = "listUserOrders_error"); // @HystrixCommand public BaseResult<List<Order>> listUserOrders(@RequestParam(value = "usercode",required = false, defaultValue = "") String usercode){ BaseResult<List<Order>> baseResult = new BaseResult<List<Order>>(); baseResult = orderService.listUserOrders(usercode); return baseResult; } // public BaseResult<List<Order>> listUserOrders_error(@RequestParam("usercode") String usercode){ // return new BaseResult().renderError(404, "查询失败!"); // } // // public BaseResult<List<Order>> defaultFallbackMethod(){ // return new BaseResult().renderError(400, "查询失败!"); // // } // // public BaseResult<List<Order>> timeoutMethod(String usercode){ // return new BaseResult().renderError(400, "超时!"); // // } @GetMapping("/testConfig") public BaseResult<String> testConfig(){ BaseResult<String> baseResult = new BaseResult<>(); baseResult.renderSuccess(env); return baseResult; } }
2,695
0.739603
0.730236
73
35.561646
29.867739
137
false
false
0
0
0
0
0
0
0.520548
false
false
3
e31d434e2c3fb24e7660581383d50e2279b67064
30,477,087,979,728
48990e1d5a995d9fdeb3f652ed18b99d542b9ea3
/src/java/Modelo/Comic.java
e09c8246121ea68800002ae11ef260dbeed7d48f
[]
no_license
ajogonpez/Practica-5-HLC
https://github.com/ajogonpez/Practica-5-HLC
d70a9cf33d7c700d93bacd2c1aa1953eccceebd3
3004e93dd0569bcd8f6ec9b6add7e812d439c33b
refs/heads/main
2023-03-17T00:41:19.055000
2021-03-04T20:18:03
2021-03-04T20:18:03
344,597,823
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Modelo; import java.sql.Date; public class Comic { private String titulo; private int edicion; private Date fechaSalida; private String imagen; public String getTitulo() { return titulo; } public void setTitulo(String titulo) { this.titulo = titulo; } public int getEdicion() { return edicion; } public void setEdicion(int edicion) { this.edicion = edicion; } public Date getFechaSalida() { return fechaSalida; } public void setFechaSalida(Date fechaSalida) { this.fechaSalida = fechaSalida; } public String getImagen() { return imagen; } public void setImagen(String imagen) { this.imagen = imagen; } }
UTF-8
Java
826
java
Comic.java
Java
[]
null
[]
package Modelo; import java.sql.Date; public class Comic { private String titulo; private int edicion; private Date fechaSalida; private String imagen; public String getTitulo() { return titulo; } public void setTitulo(String titulo) { this.titulo = titulo; } public int getEdicion() { return edicion; } public void setEdicion(int edicion) { this.edicion = edicion; } public Date getFechaSalida() { return fechaSalida; } public void setFechaSalida(Date fechaSalida) { this.fechaSalida = fechaSalida; } public String getImagen() { return imagen; } public void setImagen(String imagen) { this.imagen = imagen; } }
826
0.567797
0.567797
45
16.355556
14.954978
50
false
false
0
0
0
0
0
0
0.311111
false
false
3
7cf66dc981aff7d0c1e8432d4763c88faa5b4804
34,720,515,654,208
93a90d6d088a231504983a6eec14c6be12c4384c
/.svn/pristine/7c/7cf66dc981aff7d0c1e8432d4763c88faa5b4804.svn-base
774ef7167ff0b6c3b95d203c4fcb7a8745d1acda
[]
no_license
omusico/lottory-wp
https://github.com/omusico/lottory-wp
2cce9f5b41b4ae9c0601ad53f0c2ff9732f6a6cc
acbaa93f1790cbce11da4dfbcf2b04a28d67e785
refs/heads/master
2020-12-25T00:39:21.209000
2015-12-06T10:49:31
2015-12-06T10:49:31
52,852,522
1
1
null
true
2016-03-01T06:05:47
2016-03-01T06:05:47
2016-03-01T06:05:45
2015-12-06T11:45:10
133,010
0
0
0
null
null
null
package com.xhcms.lottery.account.service.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.commons.lang.time.DateUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import com.xhcms.commons.lang.Paging; import com.xhcms.lottery.account.service.AccountQueryService; import com.xhcms.lottery.commons.data.Order; import com.xhcms.lottery.commons.data.Recharge; import com.xhcms.lottery.commons.data.Withdraw; import com.xhcms.lottery.commons.persist.dao.BetPartnerDao; import com.xhcms.lottery.commons.persist.dao.OrderDao; import com.xhcms.lottery.commons.persist.dao.RechargeDao; import com.xhcms.lottery.commons.persist.dao.WithdrawDao; import com.xhcms.lottery.commons.persist.entity.OrderPO; import com.xhcms.lottery.commons.persist.entity.RechargePO; import com.xhcms.lottery.commons.persist.entity.WithdrawPO; import com.xhcms.lottery.commons.persist.service.GetPresetSchemeService; import com.xhcms.lottery.utils.PagingUtils; @Transactional public class AccountQueryServiceImpl implements AccountQueryService { @Autowired private BetPartnerDao betPartnerDao; @Autowired private WithdrawDao withdrawDao; @Autowired private GetPresetSchemeService getPresetSchemeService; @Autowired private RechargeDao rechargeDao; @Autowired private OrderDao orderDao; @Override @Transactional(readOnly = true) public BigDecimal[] sumBonus(Long schemeId, Long userId) { BigDecimal[] sums = { BigDecimal.ZERO, BigDecimal.ZERO }; Object[] o = betPartnerDao.sumBonus(schemeId, userId); if (o != null) { for (int i = 0; i < 2; i++) { if (o[i] != null) { sums[i] = new BigDecimal(o[i].toString()); } } } return sums; } @Override @Transactional(readOnly = true) public void listWithdraw(Long userId, Date begin, Date end, int status, Paging paging) { if(end != null){ end = DateUtils.addDays(end, 1); } List<WithdrawPO> list = withdrawDao.find(userId, null, begin, end, status, paging); List<Withdraw> results = new ArrayList<Withdraw>(list.size()); Withdraw wh = null; for (WithdrawPO po : list) { wh = new Withdraw(); BeanUtils.copyProperties(po, wh); results.add(wh); } paging.setResults(results); } @Override @Transactional(readOnly = true) public void listRecharge(Long userId, Date begin, Date end, int status, Paging paging) { if(end != null){ end = DateUtils.addDays(end, 1); } List<RechargePO> list = rechargeDao.find(userId, null, begin, end, status, paging); List<Recharge> results = new ArrayList<Recharge>(); Recharge rh = null; for (RechargePO po : list) { rh = new Recharge(); BeanUtils.copyProperties(po, rh); results.add(rh); } paging.setResults(results); } @Override @Transactional(readOnly = true) public void listJournal(Paging paging, Long userId,int type, Date from, Date to) { List<OrderPO> orderPOs=orderDao.list(paging, userId, type, from, to); if(orderPOs!=null) PagingUtils.makeCopyAndSetPaging(orderPOs, paging, Order.class); } }
UTF-8
Java
3,499
7cf66dc981aff7d0c1e8432d4763c88faa5b4804.svn-base
Java
[]
null
[]
package com.xhcms.lottery.account.service.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.commons.lang.time.DateUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import com.xhcms.commons.lang.Paging; import com.xhcms.lottery.account.service.AccountQueryService; import com.xhcms.lottery.commons.data.Order; import com.xhcms.lottery.commons.data.Recharge; import com.xhcms.lottery.commons.data.Withdraw; import com.xhcms.lottery.commons.persist.dao.BetPartnerDao; import com.xhcms.lottery.commons.persist.dao.OrderDao; import com.xhcms.lottery.commons.persist.dao.RechargeDao; import com.xhcms.lottery.commons.persist.dao.WithdrawDao; import com.xhcms.lottery.commons.persist.entity.OrderPO; import com.xhcms.lottery.commons.persist.entity.RechargePO; import com.xhcms.lottery.commons.persist.entity.WithdrawPO; import com.xhcms.lottery.commons.persist.service.GetPresetSchemeService; import com.xhcms.lottery.utils.PagingUtils; @Transactional public class AccountQueryServiceImpl implements AccountQueryService { @Autowired private BetPartnerDao betPartnerDao; @Autowired private WithdrawDao withdrawDao; @Autowired private GetPresetSchemeService getPresetSchemeService; @Autowired private RechargeDao rechargeDao; @Autowired private OrderDao orderDao; @Override @Transactional(readOnly = true) public BigDecimal[] sumBonus(Long schemeId, Long userId) { BigDecimal[] sums = { BigDecimal.ZERO, BigDecimal.ZERO }; Object[] o = betPartnerDao.sumBonus(schemeId, userId); if (o != null) { for (int i = 0; i < 2; i++) { if (o[i] != null) { sums[i] = new BigDecimal(o[i].toString()); } } } return sums; } @Override @Transactional(readOnly = true) public void listWithdraw(Long userId, Date begin, Date end, int status, Paging paging) { if(end != null){ end = DateUtils.addDays(end, 1); } List<WithdrawPO> list = withdrawDao.find(userId, null, begin, end, status, paging); List<Withdraw> results = new ArrayList<Withdraw>(list.size()); Withdraw wh = null; for (WithdrawPO po : list) { wh = new Withdraw(); BeanUtils.copyProperties(po, wh); results.add(wh); } paging.setResults(results); } @Override @Transactional(readOnly = true) public void listRecharge(Long userId, Date begin, Date end, int status, Paging paging) { if(end != null){ end = DateUtils.addDays(end, 1); } List<RechargePO> list = rechargeDao.find(userId, null, begin, end, status, paging); List<Recharge> results = new ArrayList<Recharge>(); Recharge rh = null; for (RechargePO po : list) { rh = new Recharge(); BeanUtils.copyProperties(po, rh); results.add(rh); } paging.setResults(results); } @Override @Transactional(readOnly = true) public void listJournal(Paging paging, Long userId,int type, Date from, Date to) { List<OrderPO> orderPOs=orderDao.list(paging, userId, type, from, to); if(orderPOs!=null) PagingUtils.makeCopyAndSetPaging(orderPOs, paging, Order.class); } }
3,499
0.682766
0.681623
100
33.990002
24.605486
92
false
false
0
0
0
0
0
0
0.99
false
false
3
71b72181fa360301e617d07d67409d3bce7f3069
24,034,637,041,613
14e8ed13c240b1447aec617539a362aa36322dff
/hcrp_web/src/main/java/com/hcis/hcrp/cms/freemarker/directive/LinkListDirective.java
62d5b03656b5f6d70a922ac4e39f9621033a4db8
[]
no_license
hongchentang/mvn-hong
https://github.com/hongchentang/mvn-hong
e21600607c1a9f276e1095833e5e74d58d25100f
32571fa424e1bb013e79777908ec40084a6f8a10
refs/heads/master
2022-07-12T05:55:19.771000
2020-04-20T03:48:40
2020-04-20T03:48:40
256,177,812
0
0
null
false
2022-06-25T07:30:42
2020-04-16T10:07:44
2020-04-20T03:59:30
2022-06-25T07:30:42
16,622
0
0
1
Java
false
false
package com.hcis.hcrp.cms.freemarker.directive; import java.io.IOException; import java.io.Writer; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import com.hcis.ipanther.core.utils.BeanLocator; import com.hcis.hcrp.cms.common.utils.CmsCommonDirective; import com.hcis.hcrp.cms.link.entity.CmsLink; import com.hcis.hcrp.cms.link.service.ICmsLinkService; import freemarker.core.Environment; import freemarker.ext.beans.BeanModel; import freemarker.ext.beans.BeansWrapper; import freemarker.template.SimpleNumber; import freemarker.template.TemplateDirectiveBody; import freemarker.template.TemplateDirectiveModel; import freemarker.template.TemplateException; import freemarker.template.TemplateModel; public class LinkListDirective extends CmsCommonDirective implements TemplateDirectiveModel{ protected static ICmsLinkService cmsLinkService=(ICmsLinkService) BeanLocator.getBean("cmsLinkService"); public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)throws TemplateException, IOException { //获取参数 //类型 String type=getParam(params, "type"); //是否启用 String isOk=getParam(params, "isOk"); //是否启用 String orderNum=getParam(params, "orderNum"); //显示条数 int num=getParamInt(params, "num",9); Writer out =env.getOut(); if (body!=null) { //设置循环变量 if (loopVars!=null && loopVars.length>0 ) { //查询信息 Map<String, Object> map=new HashMap<String, Object>(); if(StringUtils.isNotEmpty(type)){ map.put("type", type); } if(StringUtils.isNotEmpty(isOk)&&isOk.equals("true")){ map.put("isok", "01"); } if(StringUtils.isNotEmpty(orderNum)&&orderNum.equals("01")){ map.put("orderSql", "T.ORDER_NUM ASC"); }else{ map.put("orderSql", "T.CREATE_TIME DESC"); } List<CmsLink> list=cmsLinkService.listLink(map,num); if(list!=null){ for (int i = 0; i < list.size(); i++) { loopVars[0]=new BeanModel(list.get(i),new BeansWrapper()); if(loopVars.length>1){ loopVars[1]=new SimpleNumber(i); } body.render(env.getOut()); } } } } } }
UTF-8
Java
2,254
java
LinkListDirective.java
Java
[]
null
[]
package com.hcis.hcrp.cms.freemarker.directive; import java.io.IOException; import java.io.Writer; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import com.hcis.ipanther.core.utils.BeanLocator; import com.hcis.hcrp.cms.common.utils.CmsCommonDirective; import com.hcis.hcrp.cms.link.entity.CmsLink; import com.hcis.hcrp.cms.link.service.ICmsLinkService; import freemarker.core.Environment; import freemarker.ext.beans.BeanModel; import freemarker.ext.beans.BeansWrapper; import freemarker.template.SimpleNumber; import freemarker.template.TemplateDirectiveBody; import freemarker.template.TemplateDirectiveModel; import freemarker.template.TemplateException; import freemarker.template.TemplateModel; public class LinkListDirective extends CmsCommonDirective implements TemplateDirectiveModel{ protected static ICmsLinkService cmsLinkService=(ICmsLinkService) BeanLocator.getBean("cmsLinkService"); public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)throws TemplateException, IOException { //获取参数 //类型 String type=getParam(params, "type"); //是否启用 String isOk=getParam(params, "isOk"); //是否启用 String orderNum=getParam(params, "orderNum"); //显示条数 int num=getParamInt(params, "num",9); Writer out =env.getOut(); if (body!=null) { //设置循环变量 if (loopVars!=null && loopVars.length>0 ) { //查询信息 Map<String, Object> map=new HashMap<String, Object>(); if(StringUtils.isNotEmpty(type)){ map.put("type", type); } if(StringUtils.isNotEmpty(isOk)&&isOk.equals("true")){ map.put("isok", "01"); } if(StringUtils.isNotEmpty(orderNum)&&orderNum.equals("01")){ map.put("orderSql", "T.ORDER_NUM ASC"); }else{ map.put("orderSql", "T.CREATE_TIME DESC"); } List<CmsLink> list=cmsLinkService.listLink(map,num); if(list!=null){ for (int i = 0; i < list.size(); i++) { loopVars[0]=new BeanModel(list.get(i),new BeansWrapper()); if(loopVars.length>1){ loopVars[1]=new SimpleNumber(i); } body.render(env.getOut()); } } } } } }
2,254
0.713831
0.708826
74
28.702703
24.201145
105
false
false
0
0
0
0
0
0
2.878378
false
false
3