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
1fff3d957b69731977cdd1a1d778be789f8eaf24
23,957,327,635,640
1b917d27be9cc2f70117ad14a8e3fc9a19812ee4
/zjsjyyt/core/biz/src/main/java/cn/richinfo/zjsjyyt/core/biz/mgputsum/impl/MgPutSumMgrImpl.java
74e3cd90796b2d052a64617ef7367cf2bae973af
[]
no_license
Soochief/base
https://github.com/Soochief/base
e85e55e22aa0f9e05a34b159765edccb1fb5eb73
050572afbb45f049a973b528678caaf6dab5f542
refs/heads/master
2016-09-14T01:49:23.921000
2016-08-14T20:15:36
2016-08-14T20:15:36
65,684,605
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** ŽžŽ••Žž••Ž•ŽŽŽ••ŽŽŽ Ž•Ž•Ž•Ž•Ž•ž•žŽ•Ž••••Ž    * 投放汇总业务实现 */ package cn.richinfo.zjsjyyt.core.biz.mgputsum.impl; import cn.richinfo.zjsjyyt.core.biz.base.BaseMgrImpl; import cn.richinfo.zjsjyyt.core.biz.mgputsum.MgPutSumMgr; import cn.richinfo.zjsjyyt.core.dal.base.BaseMapper; import cn.richinfo.zjsjyyt.core.dal.mgputsum.MgPutSumMapper; import cn.richinfo.zjsjyyt.core.dal.mgvisitres.MgVisitResMapper; import cn.richinfo.zjsjyyt.core.dal.mgvisitresopt.MgVisitResOptMapper; import cn.richinfo.zjsjyyt.core.mdl.mgputsum.MgPutSumMdl; import cn.richinfo.zjsjyyt.core.mdl.mgputsum.MgPutSumPkMdl; import cn.richinfo.zjsjyyt.core.mdl.mgputsum.MgPutSumSqlMdl; import cn.richinfo.zjsjyyt.core.mdl.mgvisitres.MgVisitResMdl; import cn.richinfo.zjsjyyt.core.mdl.mgvisitres.MgVisitResPkMdl; import com.alex.pub.bean.common.RequestMdl; import com.alex.pub.bean.common.ResponseMdl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** *  ŽžŽ••ŽžŽŽŽž•žŽŽŽŽž•ŽŽŽ Ž•Ž•ŽžŽŽ••••žŽ•žŽ••ž•ž    * 描述:投放汇总业务实现 * 作者:周晓峰 * 创建时间:2015-12-7 10:53:25 */ @Service public class MgPutSumMgrImpl extends BaseMgrImpl<MgPutSumMdl, MgPutSumSqlMdl, MgPutSumPkMdl> implements MgPutSumMgr { @Autowired private MgPutSumMapper mgPutSumMapper; @Autowired private MgVisitResMapper mgVisitResMapper; @Autowired private MgVisitResOptMapper mgVisitResOptMapper; @Override public String getOperationObject() { return "投放汇总"; } @Override public BaseMapper<MgPutSumMdl, MgPutSumSqlMdl, MgPutSumPkMdl> getMapper() { return this.mgPutSumMapper; } @Override public ResponseMdl<Integer> queryMaxConfVersion(RequestMdl<MgPutSumMdl> mgPutSumMdlRequestMdl) { return mgPutSumMapper.selectMaxConfVersion(mgPutSumMdlRequestMdl); } @Override public ResponseMdl<Long> updatePutSum(RequestMdl<MgVisitResMdl> mgVisitResMdlRequestMdl) { RequestMdl<MgPutSumSqlMdl> requestMdl = new RequestMdl<MgPutSumSqlMdl>(); MgPutSumSqlMdl sqlMdl = new MgPutSumSqlMdl(); sqlMdl.setConditionGroup(new MgPutSumSqlMdl.MgPutSumAndGroup().vreIdEqual(mgVisitResMdlRequestMdl.getBody().getVreId())); requestMdl.setBody(sqlMdl); ResponseMdl<List<MgPutSumMdl>> respPutSumMdl = mgPutSumMapper.selectList(requestMdl); //保存到汇总表中 RequestMdl<List<MgPutSumMdl>> reqPutSumListMdl = new RequestMdl<List<MgPutSumMdl>>(); ResponseMdl<Long> responseMdl =null; if (respPutSumMdl.isSuccess() && respPutSumMdl.getBody().size() > 0) { for (int i = 0; i < respPutSumMdl.getBody().size(); i++) { respPutSumMdl.getBody().get(i).setVreActivityEnd(mgVisitResMdlRequestMdl.getBody().getVreActivityEnd()); respPutSumMdl.getBody().get(i).setVreActivityStart(mgVisitResMdlRequestMdl.getBody().getVreActivityStart()); } reqPutSumListMdl.setBody(respPutSumMdl.getBody()); for (int i = 0; i < respPutSumMdl.getBody().size(); i++) { RequestMdl<MgPutSumMdl> requMdl1 = new RequestMdl<MgPutSumMdl>(); requMdl1.setBody(respPutSumMdl.getBody().get(i)); responseMdl = mgPutSumMapper.updateByPkSelective(requMdl1); } } return responseMdl; } // @Override // public ResponseMdl<MgVisitResMdl> selectByVreId(RequestMdl<MgVisitResMdl> mgVisitResrequestMdl) { // ResponseMdl<MgVisitResMdl> responseMdl = new ResponseMdl<MgVisitResMdl>(); // if (null == mgVisitResrequestMdl || null == mgVisitResrequestMdl.getBody()) { // responseMdl.setSuccess(false); // responseMdl.setInfo("MgVisitResrequestMdl信息有误"); // return responseMdl; // } // RequestMdl<MgVisitResPkMdl> requestMdl = new RequestMdl<MgVisitResPkMdl>(); // requestMdl.setBody(new MgVisitResPkMdl(mgVisitResrequestMdl.getBody().getVreId())); // responseMdl = mgVisitResMapper.selectByPk(requestMdl); // RequestMdl requestMdl=new RequestMdl<MgVisitResSqlMdl>(); -------------------方法二 // MgVisitResSqlMdl sqlMdl = new MgVisitResSqlMdl(); // sqlMdl.setConditionGroup(new MgVisitResSqlMdl.MgVisitResAndGroup().vreIdEqual(mgVisitResrequestMdl.getBody().getVreId())); // requestMdl.setBody(sqlMdl); // ResponseMdl<MgVisitResMdl> res= mgVisitResMapper.selectOne(requestMdl); // return responseMdl; // } }
UTF-8
Java
4,957
java
MgPutSumMgrImpl.java
Java
[ { "context": "Ž•žŽ••ž•ž   \n * 描述:投放汇总业务实现\n * 作者:周晓峰\n * 创建时间:2015-12-7 10:53:25\n */\n@Service\npublic cl", "end": 1224, "score": 0.9943084716796875, "start": 1221, "tag": "NAME", "value": "周晓峰" } ]
null
[]
/** ŽžŽ••Žž••Ž•ŽŽŽ••ŽŽŽ Ž•Ž•Ž•Ž•Ž•ž•žŽ•Ž••••Ž    * 投放汇总业务实现 */ package cn.richinfo.zjsjyyt.core.biz.mgputsum.impl; import cn.richinfo.zjsjyyt.core.biz.base.BaseMgrImpl; import cn.richinfo.zjsjyyt.core.biz.mgputsum.MgPutSumMgr; import cn.richinfo.zjsjyyt.core.dal.base.BaseMapper; import cn.richinfo.zjsjyyt.core.dal.mgputsum.MgPutSumMapper; import cn.richinfo.zjsjyyt.core.dal.mgvisitres.MgVisitResMapper; import cn.richinfo.zjsjyyt.core.dal.mgvisitresopt.MgVisitResOptMapper; import cn.richinfo.zjsjyyt.core.mdl.mgputsum.MgPutSumMdl; import cn.richinfo.zjsjyyt.core.mdl.mgputsum.MgPutSumPkMdl; import cn.richinfo.zjsjyyt.core.mdl.mgputsum.MgPutSumSqlMdl; import cn.richinfo.zjsjyyt.core.mdl.mgvisitres.MgVisitResMdl; import cn.richinfo.zjsjyyt.core.mdl.mgvisitres.MgVisitResPkMdl; import com.alex.pub.bean.common.RequestMdl; import com.alex.pub.bean.common.ResponseMdl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** *  ŽžŽ••ŽžŽŽŽž•žŽŽŽŽž•ŽŽŽ Ž•Ž•ŽžŽŽ••••žŽ•žŽ••ž•ž    * 描述:投放汇总业务实现 * 作者:周晓峰 * 创建时间:2015-12-7 10:53:25 */ @Service public class MgPutSumMgrImpl extends BaseMgrImpl<MgPutSumMdl, MgPutSumSqlMdl, MgPutSumPkMdl> implements MgPutSumMgr { @Autowired private MgPutSumMapper mgPutSumMapper; @Autowired private MgVisitResMapper mgVisitResMapper; @Autowired private MgVisitResOptMapper mgVisitResOptMapper; @Override public String getOperationObject() { return "投放汇总"; } @Override public BaseMapper<MgPutSumMdl, MgPutSumSqlMdl, MgPutSumPkMdl> getMapper() { return this.mgPutSumMapper; } @Override public ResponseMdl<Integer> queryMaxConfVersion(RequestMdl<MgPutSumMdl> mgPutSumMdlRequestMdl) { return mgPutSumMapper.selectMaxConfVersion(mgPutSumMdlRequestMdl); } @Override public ResponseMdl<Long> updatePutSum(RequestMdl<MgVisitResMdl> mgVisitResMdlRequestMdl) { RequestMdl<MgPutSumSqlMdl> requestMdl = new RequestMdl<MgPutSumSqlMdl>(); MgPutSumSqlMdl sqlMdl = new MgPutSumSqlMdl(); sqlMdl.setConditionGroup(new MgPutSumSqlMdl.MgPutSumAndGroup().vreIdEqual(mgVisitResMdlRequestMdl.getBody().getVreId())); requestMdl.setBody(sqlMdl); ResponseMdl<List<MgPutSumMdl>> respPutSumMdl = mgPutSumMapper.selectList(requestMdl); //保存到汇总表中 RequestMdl<List<MgPutSumMdl>> reqPutSumListMdl = new RequestMdl<List<MgPutSumMdl>>(); ResponseMdl<Long> responseMdl =null; if (respPutSumMdl.isSuccess() && respPutSumMdl.getBody().size() > 0) { for (int i = 0; i < respPutSumMdl.getBody().size(); i++) { respPutSumMdl.getBody().get(i).setVreActivityEnd(mgVisitResMdlRequestMdl.getBody().getVreActivityEnd()); respPutSumMdl.getBody().get(i).setVreActivityStart(mgVisitResMdlRequestMdl.getBody().getVreActivityStart()); } reqPutSumListMdl.setBody(respPutSumMdl.getBody()); for (int i = 0; i < respPutSumMdl.getBody().size(); i++) { RequestMdl<MgPutSumMdl> requMdl1 = new RequestMdl<MgPutSumMdl>(); requMdl1.setBody(respPutSumMdl.getBody().get(i)); responseMdl = mgPutSumMapper.updateByPkSelective(requMdl1); } } return responseMdl; } // @Override // public ResponseMdl<MgVisitResMdl> selectByVreId(RequestMdl<MgVisitResMdl> mgVisitResrequestMdl) { // ResponseMdl<MgVisitResMdl> responseMdl = new ResponseMdl<MgVisitResMdl>(); // if (null == mgVisitResrequestMdl || null == mgVisitResrequestMdl.getBody()) { // responseMdl.setSuccess(false); // responseMdl.setInfo("MgVisitResrequestMdl信息有误"); // return responseMdl; // } // RequestMdl<MgVisitResPkMdl> requestMdl = new RequestMdl<MgVisitResPkMdl>(); // requestMdl.setBody(new MgVisitResPkMdl(mgVisitResrequestMdl.getBody().getVreId())); // responseMdl = mgVisitResMapper.selectByPk(requestMdl); // RequestMdl requestMdl=new RequestMdl<MgVisitResSqlMdl>(); -------------------方法二 // MgVisitResSqlMdl sqlMdl = new MgVisitResSqlMdl(); // sqlMdl.setConditionGroup(new MgVisitResSqlMdl.MgVisitResAndGroup().vreIdEqual(mgVisitResrequestMdl.getBody().getVreId())); // requestMdl.setBody(sqlMdl); // ResponseMdl<MgVisitResMdl> res= mgVisitResMapper.selectOne(requestMdl); // return responseMdl; // } }
4,957
0.683755
0.679645
99
45.696968
36.808392
132
false
false
0
0
0
0
0
0
0.606061
false
false
2
b5689157df32198f4222168924eb8d78e6357c7c
30,219,389,924,703
41d2f424650f05e9c16cbe5cd69cbb58144ee97d
/OnlineStore/src/main/java/com/app/project/domain/dtos/UserDtos/UserSetAddressDto.java
f2c37b371da1445144cfe15721f02c49bbb3e58c
[]
no_license
ValoGenev/OnlineShop
https://github.com/ValoGenev/OnlineShop
deadfc234a004919b4549fc5fa7cafa26845b9b8
396ab8b97ac21b0b6bf73a11cd3b7f11c811f343
refs/heads/master
2022-05-30T23:38:38.272000
2020-01-14T15:45:22
2020-01-14T15:45:22
233,285,620
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.app.project.domain.dtos.UserDtos; import com.app.project.domain.entities.User; import java.util.Set; public class UserSetAddressDto { private String country; private String town; private String street; public UserSetAddressDto(String country, String town, String street) { this.country = country; this.town = town; this.street = street; } public UserSetAddressDto() { } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getTown() { return town; } public void setTown(String town) { this.town = town; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } }
UTF-8
Java
907
java
UserSetAddressDto.java
Java
[]
null
[]
package com.app.project.domain.dtos.UserDtos; import com.app.project.domain.entities.User; import java.util.Set; public class UserSetAddressDto { private String country; private String town; private String street; public UserSetAddressDto(String country, String town, String street) { this.country = country; this.town = town; this.street = street; } public UserSetAddressDto() { } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getTown() { return town; } public void setTown(String town) { this.town = town; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } }
907
0.592062
0.592062
45
18.155556
17.328148
74
false
false
0
0
0
0
0
0
0.377778
false
false
2
5506cd11e7bdf722e27a095a6b97dbc2f06378a7
18,665,927,913,728
c278b2e06e98b0b99ca7350cfc12d2e535db1841
/posp/trans-core/src/main/java/com/yl/pay/pos/action/trans/TransactionFactory.java
15f01dd4cbf72f31b5ec5c6242b6a91b46ca553c
[]
no_license
SplendorAnLin/paymentSystem
https://github.com/SplendorAnLin/paymentSystem
ea778c03179a36755c52498fd3f5f1a5bbeb5d34
db308a354a23bd3a48ff88c16b29a43c4e483e7d
refs/heads/master
2023-02-26T14:16:27.283000
2022-10-20T07:50:35
2022-10-20T07:50:35
191,535,643
5
6
null
false
2023-02-22T06:42:24
2019-06-12T09:01:15
2022-10-20T07:51:14
2023-02-22T06:42:23
60,525
4
5
93
Java
false
false
package com.yl.pay.pos.action.trans; import java.util.Map; /** * Title: 交易处理工厂 * Description: * Copyright: Copyright (c)2011 * Company: com.yl.pay * @author jun.yu */ public class TransactionFactory { private Map<String, ITransaction> serviceMap; public Map<String, ITransaction> getServiceMap() { return serviceMap; } public void setServiceMap(Map<String, ITransaction> serviceMap) { this.serviceMap = serviceMap; } //根据业务处理类型获取处理服务 public ITransaction getTransaction(String key) { return serviceMap.get(key); } }
UTF-8
Java
583
java
TransactionFactory.java
Java
[ { "context": "opyright (c)2011\n * Company: com.yl.pay\n * @author jun.yu\n */\n\npublic class TransactionFactory {\n\tprivate M", "end": 172, "score": 0.9917563796043396, "start": 166, "tag": "NAME", "value": "jun.yu" } ]
null
[]
package com.yl.pay.pos.action.trans; import java.util.Map; /** * Title: 交易处理工厂 * Description: * Copyright: Copyright (c)2011 * Company: com.yl.pay * @author jun.yu */ public class TransactionFactory { private Map<String, ITransaction> serviceMap; public Map<String, ITransaction> getServiceMap() { return serviceMap; } public void setServiceMap(Map<String, ITransaction> serviceMap) { this.serviceMap = serviceMap; } //根据业务处理类型获取处理服务 public ITransaction getTransaction(String key) { return serviceMap.get(key); } }
583
0.72744
0.720074
28
18.392857
18.544039
66
false
false
0
0
0
0
0
0
0.821429
false
false
2
3223f3186002b612f21085574fa26cc64103033f
25,606,595,082,329
86744d973217bbcc35cd7043b52ad8cab75021c3
/src/main/java/com/fractal/practicante/bibliospa/modelo/validaciones/ValidacionLibroAlumno.java
df3c9295492c0ef7687298c677bfe2c35113892f
[]
no_license
Mar0124421/biblioSPA
https://github.com/Mar0124421/biblioSPA
dd14bccec7b2d72f2ea6f4528ad402e730fe769f
10bf07aba5c7eb7fe2d4fa250b9c872dcf23140f
refs/heads/master
2020-06-23T04:34:40.254000
2019-07-25T23:22:36
2019-07-25T23:22:36
198,514,156
0
0
null
true
2019-07-23T21:58:54
2019-07-23T21:58:54
2019-07-23T21:05:47
2019-07-23T21:05:45
23
0
0
0
null
false
false
package com.fractal.practicante.bibliospa.modelo.validaciones; import com.fractal.practicante.bibliospa.modelo.beans.LibroDeAlumno; /** * Clase que contiene las validaciones del objeto LibroAlumno * * @author Rubén Gustavo García Málaga */ public class ValidacionLibroAlumno { /** * Verificamos que el idUsuario y idLibro sean positivos * * @param objeto LibroDeAlumno al que se le evaluan los atributos * @return devuelve true si sus datos son correctos */ public boolean validarLibroAlumno(LibroDeAlumno objeto) { int idUsuario = objeto.getId(); int idLibro = objeto.getIdLibro(); if (idUsuario < 1) { System.out.println("id usuario negativo"); return false; } else if (idLibro < 1) { System.out.println("id libro negativo"); return false; } else { System.out.println("id's correctos"); return true; } } }
UTF-8
Java
988
java
ValidacionLibroAlumno.java
Java
[ { "context": "validaciones del objeto LibroAlumno\n * \n * @author Rubén Gustavo García Málaga\n */\npublic class ValidacionLibroAlumno {\n /**\n", "end": 242, "score": 0.9998548626899719, "start": 215, "tag": "NAME", "value": "Rubén Gustavo García Málaga" } ]
null
[]
package com.fractal.practicante.bibliospa.modelo.validaciones; import com.fractal.practicante.bibliospa.modelo.beans.LibroDeAlumno; /** * Clase que contiene las validaciones del objeto LibroAlumno * * @author <NAME> */ public class ValidacionLibroAlumno { /** * Verificamos que el idUsuario y idLibro sean positivos * * @param objeto LibroDeAlumno al que se le evaluan los atributos * @return devuelve true si sus datos son correctos */ public boolean validarLibroAlumno(LibroDeAlumno objeto) { int idUsuario = objeto.getId(); int idLibro = objeto.getIdLibro(); if (idUsuario < 1) { System.out.println("id usuario negativo"); return false; } else if (idLibro < 1) { System.out.println("id libro negativo"); return false; } else { System.out.println("id's correctos"); return true; } } }
964
0.628426
0.626396
35
27.142857
23.818531
69
false
false
0
0
0
0
0
0
0.285714
false
false
2
1523b109202cbfae7b3434db3f76ac87c0a3aa00
34,729,105,575,520
b85e263c4c04c7af0ca4e6191c08ea49253f1eb0
/src/main/java/com/hr319wg/util/FileUtil.java
9d3341052cf1faa51677a9cf659656441100a741
[]
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.util; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Vector; import javax.faces.context.FacesContext; import javax.imageio.ImageIO; import javax.servlet.ServletContext; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import jxl.Cell; import jxl.Range; import jxl.Workbook; import jxl.format.CellFormat; import jxl.write.Label; import jxl.write.WritableCell; import jxl.write.WritableImage; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; import org.apache.fop.apps.Driver; import org.apache.fop.tools.DocumentInputSource; import org.apache.myfaces.custom.fileupload.UploadedFile; import org.apache.tools.zip.ZipEntry; import org.apache.tools.zip.ZipFile; import org.w3c.dom.Document; import org.w3c.tidy.Tidy; import com.hr319wg.ccp.pojo.bo.PartyBO; import com.hr319wg.common.Constants; import com.hr319wg.common.exception.SysException; import com.hr319wg.common.pojo.vo.User; import com.hr319wg.common.web.SysContext; import com.hr319wg.emp.pojo.bo.PersonBO; import com.hr319wg.org.pojo.bo.OrgBO; import com.hr319wg.post.pojo.bo.PostBO; import com.hr319wg.sys.api.ActivePageAPI; import com.hr319wg.sys.cache.SysCacheTool; import com.hr319wg.sys.pojo.bo.CodeItemBO; import com.hr319wg.sys.pojo.bo.CodeSetBO; import com.hr319wg.sys.pojo.bo.InfoItemBO; import com.hr319wg.sys.pojo.bo.InfoSetBO; import com.hr319wg.sys.pojo.vo.CellVO; import com.hr319wg.sys.pojo.vo.RecordVO; import com.hr319wg.sys.pojo.vo.TableVO; import com.hr319wg.user.pojo.bo.RoleInfoBO; import com.hr319wg.wage.pojo.bo.WageBankItemBO; import com.hr319wg.wage.pojo.bo.WageUnitBO; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; public class FileUtil { public static String getRealPath(String path){ ServletContext context = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); String actpath=context.getRealPath(path); if (!actpath.endsWith(File.separator)){ actpath+=File.separator; } return actpath; } // 从路径中抽取文件名 public static String parseFileName(String fullFileName) { if(fullFileName==null||fullFileName.equals("")){ return "noname"; } int len = fullFileName.length(); int pos = fullFileName.lastIndexOf('\\'); return fullFileName.substring(pos+1,len); } public static String addCsvField(String str){ if(str == null) return ","; StringBuffer sb ; if(str.indexOf("\"") != -1) sb = new StringBuffer(str.replaceAll("\"","\"\"")); else sb = new StringBuffer(str); if (sb.length()>14){ // 避免大数字变成科学计数法 sb.insert(0,'\t'); } return sb.append(",").toString(); } /** * 创建文件 * * fileContent 文件内容 * absolutePath 文件存放绝对路径 * fileType 文件类型,即文件后缀 如 xls 、 doc 等 * 返回 不含路径的文件名 */ public static String formatUploadFile(UploadedFile upfile) throws SysException { String fileName=""; String []fpa=parseFileName(upfile.getName()).split("\\."); if (fpa.length<=1){ fileName=CommonFuns.getUUID(); } else{ fileName=CommonFuns.getUUID()+"."+fpa[1]; } return fileName; } public static String createFile(UploadedFile upfile, String absolutePath) throws SysException { String fileName; try { File dir = new File(absolutePath); if (!dir.exists()) { dir.mkdirs(); } fileName = formatUploadFile(upfile); String path = absolutePath + File.separator + fileName; FileOutputStream fos = new FileOutputStream(path); try { fos.write(upfile.getBytes()); } finally { fos.close(); } } catch (Exception e) { e.printStackTrace(); throw new SysException("", "指定位置创建文件失败", e, FileUtil.class); } return fileName; } public static String createFile(byte[] fileContent, String absolutePath, String fileType) throws SysException { String fileName; try { File dir = new File(absolutePath); if (!dir.exists()) { dir.mkdirs(); } fileName = CommonFuns.getSysDate("yyyyMMddHHmmss") + "_" + new Random().nextInt(10000) + "." + fileType; String path = absolutePath + File.separator + fileName; FileOutputStream fos = new FileOutputStream(path); try { fos.write(fileContent); } finally { fos.close(); } } catch (Exception e) { e.printStackTrace(); throw new SysException("", "指定位置创建文件失败", e, FileUtil.class); } return fileName; } public static void createFile(byte[] fileContent, String path) throws SysException { try { FileOutputStream fos = new FileOutputStream(path); try { fos.write(fileContent); } finally { fos.close(); } } catch (Exception e) { e.printStackTrace(); throw new SysException("", "指定位置创建文件失败", e, FileUtil.class); } } /** * * 读取excle文件-批量增加人员 * * absolutePath 文件存放的绝对路径 * fileName 文件名称 (不带路径) * colDataType 数据读取列的数据类型 * keyDataType 记录索引数据类型 沿用指标集分类(机构、人员、岗位等) * keyCol 索引数据所在列 * impRs 读出数据存放 的hastable(如果为null不执行读数据操作)。 key:人员id、机构id等,value:String[] 数据列一致。 * startCol 读取数据开始列(从0开始) * startRow 读取数据开始行(从0开始) * delFile 是否删除原文件 true 是, false 否 * codeType 0 代码 1 描述 * 返回 boolean 读文件数据是否有错误。数据无错误 true,数据有错误 false. 若返回false,原文件不删除,并在源文件的里生成新的sheet,记录错误信息 * */ public static boolean readNewExcelFile(String absolutePath, String fileName, InfoItemBO[] cols, Map impRs, boolean delFile, String codeType) throws SysException { Hashtable htcode=new Hashtable(); // 用于利用描述反查代码 String tempFile=absolutePath + File.separator + fileName; String errorFile=absolutePath + File.separator + "ERROR_" + fileName; boolean noError=true; // -------进行转码------- if ("1".equals(Constants.IMPORT_CSV2UTF8)){ FileANSI2UTF(tempFile); } File f = new File(tempFile); BufferedReader br = null; BufferedWriter bw=null; ActivePageAPI api=(ActivePageAPI) SysContext.getBean("sys_activePageApi"); try { //读文件 br = new BufferedReader(new FileReader(f)); //创建错误日志文件 bw = new BufferedWriter(new FileWriter(new File(errorFile))); String headerLine = br.readLine(); // 读入标题行 if(headerLine == null){ throw new SysException("导入的文件为空,请导入有内容的文件!"); } int columns = headerLine.split(",").length; if (cols.length != columns) { throw new SysException("您所选项的数目和Excel列的数目不一样,请重新选择!"); } String lineData ; int parsingLineNumber = 0; //正在处理的行号,用于记录错误日志等. int excelCount=0; int errorCount=0; while((lineData = br.readLine()) != null){ parsingLineNumber ++; excelCount++; // excel数据行数 if (lineData.endsWith(",")){ lineData+=" "; // 如果最后为逗号,表明该列为空,只有补上空格后split才有效 } String[] data = lineData.split(","); data[data.length-1]=data[data.length-1].trim(); // 如果补空格,还得去掉 boolean add=true; for(int i=0;i<cols.length;i++){ //格式化数据 if (InfoItemBO.DATA_TYPE_ORG.equals(cols[i].getItemDataType())){ //机构数据 OrgBO oo=SysCacheTool.findOrgByCode(data[i]); if (oo!=null){ data[i]=oo.getOrgId(); } else{ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"机构数据不存在"); noError=false; break; } } else if ("A001077".equals(cols[i].getItemId())){ String sql="select count(*) from a001 where a001077='"+data[i]+"'"; if (api.queryForInt(sql)>0){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"该身份证号已存在!"); noError=false; break; } } else if (InfoItemBO.DATA_TYPE_DATE6.equals(cols[i].getItemDataType())){ if (data[i].length()!=0 && data[i].length()!=6){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"不符合yyyyMM格式!"); noError=false; break; } else{ if (data[i].length()==6){ data[i]=data[i].substring(0, 4) + "-" + data[i].substring(4, 6); } } } else if (InfoItemBO.DATA_TYPE_DATE.equals(cols[i].getItemDataType())){ if (data[i].length()!=0 && data[i].length()!=8){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"不符合yyyyMMdd格式!"); noError=false; break; } else{ if (data[i].length()==8){ data[i]=data[i].substring(0, 4) + "-" + data[i].substring(4, 6)+"-"+data[i].substring(6, 8); } } } else if (InfoItemBO.DATA_TYPE_CODE.equals(cols[i].getItemDataType())){ if (data[i]!=null && !"".equals(data[i])){ if ("1".equals(codeType)){ // 代码描述转换 Hashtable itemhash=(Hashtable)htcode.get(cols[i].getItemCodeSet()); if (itemhash==null){ // 构建 itemhash=new Hashtable(); List codeitemlist=SysCacheTool.queryCodeItemBySetId(cols[i].getItemCodeSet()); for(int j=0;j<codeitemlist.size();j++){ CodeItemBO cb=(CodeItemBO)codeitemlist.get(j); itemhash.put(cb.getItemName(),cb.getItemId()); } htcode.put(cols[i].getItemCodeSet(),itemhash); } String newcode=(String)itemhash.get(data[i]); if (newcode!=null){ data[i]=newcode; } else{ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, "代码["+data[i]+"]不存在"); noError=false; break; } } else{ // 代码匹配 CodeItemBO code=SysCacheTool.findCodeItem("",data[i]); if (code==null){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, "代码["+data[i]+"]不存在!"); noError=false; break; } } } } if ("1".equals(cols[i].getItemNotNull())){ // 不为空 if (data[i]==null || "".equals(data[i])){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"为空,而该字段不允许为空!"); noError=false; break; } } } if (add) { if ("auto".equals(data[0])){ data[0]="auto"+String.valueOf(parsingLineNumber); } impRs.put(data[0],data); } } } catch(Exception e){ } finally { try { if(br != null) br.close(); if(bw != null){ bw.close(); if ("1".equals(Constants.EXPORT_CSV2UTF8)){ FileUTF2ANSI(errorFile); } } if (delFile) { f.delete(); } } catch (Exception ea) { ea.printStackTrace(); } } return noError; } public static boolean readExcelFile(String absolutePath, String fileName, String [] colDataType, String [] colCodeSet, String keyDataType, int keyCol, Map impRs, int startCol, int startRow, boolean delFile) throws SysException { int count = colDataType.length; InfoItemBO [] item = new InfoItemBO[count]; for (int i = 0; i < count; i++) { item[i] = new InfoItemBO(); item[i].setItemDataType(colDataType[i]); item[i].setItemCodeSet(colCodeSet[i]); } return readExcelFile(absolutePath, fileName, item, keyDataType, keyCol, impRs, startCol, startRow, delFile); } public static void checkExcelFile(String absolutePath, String fileName, InfoSetBO set, InfoItemBO[] cols, int keyCol, Map impRs, int startCol, int startRow, boolean delFile, int nameCol, String []items) throws SysException{ if (items==null || items.length==0){ throw new SysException("没有定义检查项目!"); } Hashtable ht=new Hashtable(); // 0 已存在该数据 1 数据库不存在该人员 2 对比数据 for(int i=0;i<items.length;i++){ ht.put(items[i],items[i]); } if (impRs == null) { throw new SysException("impRs参数为null"); } else { impRs.clear(); } File f = new File(absolutePath + File.separator + fileName); if (!f.exists() || !f.isFile()) { throw new SysException("指定文件不存在"); } ActivePageAPI api=(ActivePageAPI) SysContext.getBean("sys_activePageApi"); BufferedReader br = null; try { //读文件 br = new BufferedReader(new FileReader(f)); String headerLine = br.readLine(); // 读入标题行 if(headerLine == null){ throw new SysException("导入的文件为空,请导入有内容的文件!"); } int columns = headerLine.split(",").length; if ((cols.length + startCol) > columns) { throw new SysException("您所选项的数目超过Excel列的数目,请重新选择!"); } if(startRow < 1){ startRow = 1; } for(int i=1;i<startRow;i++){ br.readLine(); } String lineData ; int parsingLineNumber = startRow -1; //正在处理的行号,用于记录错误日志等. int excelCount=0; int errorCount=0; while((lineData = br.readLine()) != null){ parsingLineNumber ++; excelCount++; // excel数据行数 if (lineData.endsWith(",")){ lineData+=" "; // 如果最后为逗号,表明该列为空,只有补上空格后split才有效 } String[] data = lineData.split(","); data[data.length-1]=data[data.length-1].trim(); // 如果补空格,还得去掉 String key = data[keyCol]; String msg=""; if (key != null && !"".equals(key.trim())) { key = key.trim(); } String sql="select id from a001 where upper(A001077)='"+CommonFuns.ID15to18(key).toUpperCase()+"' or upper(A001077)='"+CommonFuns.ID18to15(key).toUpperCase()+"'"; String pid=api.queryForString(sql); String []error=new String[cols.length+3]; for(int i=0;i<cols.length+2;i++){ error[i]=data[i]; } boolean correct=true; if ("".equals(pid)){ if (ht.get("1")!=null){ errorCount++; error[cols.length+2]="该人员不在数据库中"; impRs.put(key, error); continue; } }else{ sql="select id from "+set.getSetId()+" where id='"+pid+"'"; if (!"".equals(api.queryForString(sql))){ // 存在 error[keyCol]=pid; errorCount++; error[cols.length+2]="该数据已经入库"; impRs.put(pid, error); } if (!"".equals(pid) && ht.get("2")!=null){ CellVO []head=new CellVO[cols.length+1]; sql="select id"; head[0]=new CellVO(); head[0].setItemId("ID"); for(int i=0;i<cols.length;i++){ sql+=","+cols[i].getItemId(); head[i+1]=new CellVO(); head[i+1].setItemId(cols[i].getItemId()); } sql+=" from "+set.getSetId()+" where id='"+pid+"'"; if (InfoSetBO.RS_TYPE_SINGLE.equals(set.getSet_rsType()) && !"A001".equals(set.getSetId())){ sql+=" and "+set.getSetId()+"000='00901'"; } Vector vt=api.getDataListBySql(head,sql); if (vt.size()>0){ CellVO[]row=(CellVO[])vt.get(0); for(int i=0;i<cols.length;i++){ if (CommonFuns.filterNull(error[i+2]).equals(row[i+1].getValue())){ error[i+2]+="√"; } else{ error[i+2]+="×"; correct=false; } } } } } if (correct){ error[cols.length+2]+=" 一致"; } else{ error[cols.length+2]+=" 不同"; } impRs.put(pid, error); } int rightCount=excelCount-errorCount; impRs.put("-1","EXCEL中共有数据:"+String.valueOf(excelCount)+" 其中有问题数据:"+String.valueOf(errorCount)+" 正确数据:"+String.valueOf(rightCount)); } catch(Exception e){ } } /** * 读取excle文件 * * absolutePath 文件存放路径 * fileName 文件名称(不含路径) * cols 数据读取列的数据类型 * keyDataType 记录索引数据类型 A 人员ID A1旧系统员工编号A001999 A2考勤卡号 A3使用身份证 * keyCol 索引数据所在列 * impRs 读出数据存放 的hastable(如果为null不执行读数据操作)。 key:人员id、机构id等,value:String[] 数据列一致。 * startCol 读取数据开始列(从0开始) * startRow 读取数据开始行(从0开始) * delFile 是否删除原文件 true 是, false 否 * nameCol 名称字段 -1 不校验 否则校验 * 返回 boolean 读文件数据是否有错误。数据无错误 true,数据有错误 false. 若返回false,原文件不删除,并在源文件的里生成新的sheet,记录错误信息 * User 用户信息 * codeType 0 代码 1 描述 */ public static boolean readExcelFile(String absolutePath, String fileName, InfoItemBO[] cols, String keyDataType, int keyCol, Map impRs, int startCol, int startRow, boolean delFile) throws SysException { return readExcelFile(absolutePath,fileName,cols,keyDataType,keyCol, impRs,startCol,startRow, delFile,-1,null,"0"); } public static boolean readExcelFile(String absolutePath, String fileName, InfoItemBO[] cols, String keyDataType, int keyCol, Map impRs, int startCol, int startRow, boolean delFile, int nameCol, User user, String codeType) throws SysException { if (impRs == null) { throw new SysException("impRs参数为null"); } else { impRs.clear(); } if (keyDataType == null || "".equals(keyDataType)) { throw new SysException("没有指定文件索引类型"); } String tempFile=absolutePath + File.separator + fileName; String errorFile=""; // -------进行转码------- if ("1".equals(Constants.IMPORT_CSV2UTF8)){ FileANSI2UTF(tempFile); } File f = new File(tempFile); if (!f.exists() || !f.isFile()) { throw new SysException("指定文件不存在"); } BufferedReader br = null; BufferedWriter bw = null; boolean isError = false; Hashtable htcode=new Hashtable(); // 用于利用描述反查代码 errorFile=absolutePath + File.separator + "ERROR_" + fileName; try { //读文件 br = new BufferedReader(new FileReader(f)); //创建错误日志文件 bw = new BufferedWriter(new FileWriter(new File(errorFile))); //获取第一张Sheet表 String headerLine = br.readLine(); // 读入标题行 if(headerLine == null){ throw new SysException("导入的文件为空,请导入有内容的文件!"); } int columns = headerLine.split(",").length; if ((cols.length + startCol) > columns) { throw new SysException("您所选项的数目超过Excel列的数目,请重新选择!"); } if(startRow < 1){ startRow = 1; } for(int i=1;i<startRow;i++){ br.readLine(); } String lineData ; int parsingLineNumber = startRow -1; //正在处理的行号,用于记录错误日志等. while((lineData = br.readLine()) != null){ parsingLineNumber ++; if (lineData.endsWith(",")){ lineData+=" "; // 如果最后为逗号,表明该列为空,只有补上空格后split才有效 } String[] data = lineData.split(","); data[data.length-1]=data[data.length-1].trim(); // 如果补空格,还得去掉 if(data.length != (cols.length + startCol)){ addErrorFormatLabel(bw, parsingLineNumber, keyCol, "Excel中列数目多于配置,不能导入!"); isError = true; continue; } String key = data[keyCol]; String msg=""; if (key != null && !"".equals(key.trim())) { key = key.trim(); if (keyDataType.startsWith("A")){ PersonBO obj=null; if ("A".equals(keyDataType)) { // 员工编号 obj = SysCacheTool.findPersonByCode(key); } else if ("A1".equals(keyDataType)){ //使用旧系统员工编号A001999 obj = SysCacheTool.findPersonByOldCode(key); } else if ("A2".equals(keyDataType)){ //考勤卡号 obj = SysCacheTool.findPersonByAttendCode(key); } else if ("A3".equals(keyDataType)){ //身份证号 obj = SysCacheTool.findPersonByIDNum(key); } if (obj == null) { msg="记录错误,人员(编号:"+key+")不存在"; addErrorFormatLabel(bw, parsingLineNumber, keyCol, msg); isError = true; continue; } if (nameCol!=-1){ // 还需要校验名称 if (data[nameCol]!=null && !data[nameCol].equals(obj.getName())){ msg="记录错误,人员名称不匹配(编号:"+key+" 系统:"+obj.getName()+" 文件:"+data[nameCol]+")"; addErrorFormatLabel(bw, parsingLineNumber, keyCol, msg); isError = true; continue; } } if (user!=null && !RoleInfoBO.ORGTYPE_ALL.equals(user.getprocessUnit())){ // 不是全集团时,需要判断是否本单位人 if (!obj.getOrgId().equals(user.getOrgId())){ msg="非本单位人员(编号:"+key+"),不得导入"; addErrorFormatLabel(bw, parsingLineNumber, keyCol, msg); isError = true; continue; } } key = obj.getPersonId(); } else if ("B".equals(keyDataType)) { OrgBO obj = SysCacheTool.findOrgByCode(key); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, keyCol, "记录错误,机构不存在"); isError = true; continue; } key = obj.getOrgId(); } else if ("C".equals(keyDataType)) { PostBO obj = SysCacheTool.findPost(key); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, keyCol, "记录错误,岗位不存在"); isError = true; continue; } key = obj.getPostId(); } else if ("D".equals(keyDataType)) { PartyBO obj = SysCacheTool.findParty(key); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, keyCol, "记录错误,党组织不存在"); isError = true; continue; } key = obj.getPartyId(); } } else { //出现空数据,停止读取 break; } int colNum = cols.length; String[] rs = new String[colNum]; boolean colError = false; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); for (int j = startCol; j < startCol + colNum; j++) { //start for String value = data[j]; String colDataType = cols[j - startCol].getItemDataType(); // 数据类型 String colLength=cols[j - startCol].getItemDataLength(); // 长度 String colPre=CommonFuns.filterNull(cols[j - startCol].getItemPrecision()); // 小数位 if (value != null && !"".equals(value.trim())) { // 唯一性校验 当前只校验A001 if (keyDataType.startsWith("A") && "1".equals(cols[j - startCol].getItemIsunique()) && cols[j - startCol].getItemId().startsWith("A001")){ String countSql="select count(*) from A001 where "+cols[j - startCol].getItemId()+"='"+value+"' and id<>'"+key+"'"; ActivePageAPI api=(ActivePageAPI)SysContext.getBean("sys_activePageApi"); if (api.queryForInt(countSql)>0){ addErrorFormatLabel(bw, parsingLineNumber, j, cols[j - startCol].getItemName()+"["+value+"]出现重复"); colError = true; } } if (InfoItemBO.DATA_TYPE_CODE.equals(colDataType)) { String code = value.trim(); if ("0".equals(codeType)){ // 按代码查询 CodeItemBO tmp = SysCacheTool.findCodeItem(cols[j - startCol].getItemCodeSet(), code); if (tmp == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "代码["+code+"]不存在"); colError = true; } else { rs[j - startCol] = tmp.getItemId(); } } else{ // 按描述查询 Hashtable itemhash=(Hashtable)htcode.get(cols[j - startCol].getItemCodeSet()); if (itemhash==null){ // 构建 itemhash=new Hashtable(); List codeitemlist=SysCacheTool.queryCodeItemBySetId(cols[j - startCol].getItemCodeSet()); for(int i=0;i<codeitemlist.size();i++){ CodeItemBO cb=(CodeItemBO)codeitemlist.get(i); itemhash.put(cb.getItemName(),cb.getItemId()); } htcode.put(cols[j - startCol].getItemCodeSet(),itemhash); } String newcode=(String)itemhash.get(code); if (newcode!=null){ rs[j - startCol]=newcode; } else{ addErrorFormatLabel(bw, parsingLineNumber, j, "描述["+code+"]不存在对应代码"); colError = true; } } } else if (InfoItemBO.DATA_TYPE_ORG.equals(colDataType)) { OrgBO obj = SysCacheTool.findOrgByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "机构["+value+"]不存在"); colError = true; } else { rs[j - startCol] = obj.getOrgId(); } } else if (InfoItemBO.DATA_TYPE_PERSON.equals(colDataType)) { PersonBO obj = SysCacheTool.findPersonByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "人员["+value+"]不存在"); colError = true; } else { rs[j - startCol] = obj.getPersonId(); } } else if (InfoItemBO.DATA_TYPE_POST.equals(colDataType)) { PostBO obj = SysCacheTool.findPostByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "岗位不存在"); colError = true; } else { rs[j - startCol] = obj.getPostId(); } } else if (InfoItemBO.DATA_TYPE_WAGE.equals(colDataType)) { OrgBO obj = SysCacheTool.findOrgByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "发薪单位不存在"); colError = true; } else { WageUnitBO bo = SysCacheTool.findWageUnit(obj.getOrgId()); if (bo == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "发薪单位不存在"); colError = true; } else { rs[j - startCol] = bo.getUnitId(); } } } else if (InfoItemBO.DATA_TYPE_PARTY.equals(colDataType)) { PartyBO obj = SysCacheTool.findParty(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "党组织不存在"); colError = true; } else { rs[j - startCol] = obj.getPartyId(); } } else if (InfoItemBO.DATA_TYPE_INT.equals(colDataType)) { try { String tempStr = value.trim(); if (tempStr.indexOf(".") > 0) { String str = tempStr.substring(0, tempStr.indexOf(".")); Long.parseLong(str); rs[j - startCol] = str; } else { Long.parseLong(tempStr); rs[j - startCol] = tempStr; } } catch (NumberFormatException e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是整型数据"); } } else if (InfoItemBO.DATA_TYPE_FLOAT.equals(colDataType)) { try { Double.parseDouble(value.trim()); // 对小数格式处理 rs[j - startCol] = CommonFuns.formateItem(colDataType,colPre,value.trim()); } catch (NumberFormatException e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是小数数据"); } } else if (InfoItemBO.DATA_TYPE_DATE6.equals(colDataType)) { try { value = value.trim(); if (value.length() == 6) { if (Integer.parseInt(value.substring(0, 4)) > 1900 && Integer.parseInt(value.substring(4, 6)) <= 12) { value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + "01"; java.sql.Date dt = java.sql.Date.valueOf(value); value = sdf.format(dt); rs[j - startCol] = value; } else { throw new Exception(); } } else { throw new Exception(); } } catch (Exception e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是六位日期"); } } else if (InfoItemBO.DATA_TYPE_DATE.equals(colDataType)) { try { value = value.trim(); if (value.length() == 8) { if (Integer.parseInt(value.substring(0, 4)) > 1900 && Integer.parseInt(value.substring(4, 6)) <= 12 && Integer.parseInt(value.substring(6, 8)) <= 31) { value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6, 8); java.sql.Date dt = java.sql.Date.valueOf(value); value = sdf1.format(dt); rs[j - startCol] = value; } else { throw new Exception(); } } else { throw new Exception(); } } catch (Exception e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是八位日期"); } } else { rs[j - startCol] = value.trim(); } } else {//end content not null rs[j - startCol] = ""; } }//end for // 处理多记录子集数据有多行的情况 key=key+"|"+String.valueOf(parsingLineNumber); if (!colError) impRs.put(key, rs); if (!isError && colError) isError = colError; } return !isError; } catch (SysException be) { throw be; } catch (Exception e) { throw new SysException("", "读取文件失败", e, FileUtil.class); } finally { try { if(br != null) br.close(); if(bw != null) { bw.close(); if ("1".equals(Constants.EXPORT_CSV2UTF8)){ FileUTF2ANSI(errorFile); } } if (delFile && !isError) { f.delete(); } } catch (Exception ea) { ea.printStackTrace(); } } } /** * 将错误信息记录到错误日志中 */ public static void addErrorFormatLabel(BufferedWriter bw, int row, int col, String error) { try { bw.write(FileUtil.addCsvField("第 " + row + " 行,第 " + (col+1) + " 列 " + error)); bw.newLine(); bw.flush(); } catch (IOException e) { e.printStackTrace(); } } /** * 导出文件 * path 导出文件存放绝对路径 * table 数据对象 * 返回 excel 导出文件名称(含绝对路径) */ public static void exportFile(String path, TableVO table, boolean delFile) throws SysException { exportFile( path, table, delFile,false); } public static void exportFile(String path, TableVO table, boolean delFile,boolean linkDept) throws SysException { try { File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } if (delFile) { delDiskFile(path); } File file = new File(path + "result.xls"); WritableWorkbook book = Workbook.createWorkbook(file); WritableSheet sheet = book.createSheet("sheet", 0); CellVO[] header = table.getHeader(); if (header != null && header.length > 0) { int count = header.length; int index=0; for (int n = 0; n < count; n++) { if (InfoItemBO.DATA_TYPE_CLOB.equals(header[n].getItemDataType()) || (InfoItemBO.PROPERTY_CONTROL_HIDE.equals(header[n].getItemProperty()) && !"B001003".equals(header[n].getItemId())) || header[n].getPermission() == CellVO.PERMISSION_REFUSE || !header[n].getSelected()){ } else { if (header[n].isShowId()) { Label label = new Label(index++, 0, header[n].getItemName()+"代码"); sheet.addCell(label); }else{ Label label = new Label(index++, 0, header[n].getItemName()); sheet.addCell(label); } } } } if (table.getRowData() != null && table.getRowData().length > 0) { int count = table.getRowData().length; for (int i = 0; i < count; i++) { RecordVO rvo = table.getRowData()[i]; CellVO[] data = rvo.getCell(); int size = data.length; int index=0; for (int n = 0; n < size; n++) { if (InfoItemBO.DATA_TYPE_CLOB.equals(header[n].getItemDataType()) || (InfoItemBO.PROPERTY_CONTROL_HIDE.equals(header[n].getItemProperty()) && !"B001003".equals(header[n].getItemId())) || header[n].getPermission() == CellVO.PERMISSION_REFUSE || !header[n].getSelected()){ } else { String value2 ; if (InfoItemBO.DATA_TYPE_CODE.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode(data[n].getItemCodeSet(), data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_ORG.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("OU", data[n].getValue()); if (linkDept && "A001705".equals(data[n].getItemId())) { // 部门显示处理 OrgBO bo = SysCacheTool.findOrgById(data[n].getValue()); OrgBO superbo=SysCacheTool.findOrgById(bo.getSuperId()); if (superbo!=null && OrgBO.DEPTTYPE.equals(superbo.getorgType())){ value2=CommonFuns.filterNull(superbo.getName()+bo.getName()); } } } else if (InfoItemBO.DATA_TYPE_POST.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("PO", data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_PERSON.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("PE", data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_PARTY.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("PA", data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_WAGE.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("WAGE", data[n].getValue()); } else { value2 = CommonFuns.filterNull(data[n].getValue()); } try { if (InfoItemBO.DATA_TYPE_INT.equals(data[n].getItemDataType()) || InfoItemBO.DATA_TYPE_FLOAT.equals(data[n].getItemDataType()) || InfoItemBO.DATA_TYPE_COMPUTE.equals(data[n].getItemDataType())) { Label label = new Label(index++, i+1, value2); sheet.addCell(label); } else { if (data[n].isShowId()) { String id = data[n].getValue(); if (CommonFuns.filterNull(id).length() > 4) id = id.substring(4, id.length()); Label label = new Label(index++, i+1, value2); sheet.addCell(label); } Label label = new Label(index++, i+1, value2); sheet.addCell(label); } } catch (Exception e) { Label label = new Label(index++, i+1, value2); sheet.addCell(label); } } } } } book.write(); book.close(); } catch (Exception e) { throw new SysException("", "导出excel错误", e, FileUtil.class); } } public static String exportBankXLSFile(String path, List bankitem, List values, boolean delFile) throws SysException { try { String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".xls"; String old = path +File.separator +"blank.xls"; String newfile = path +File.separator +filename; File ofile = new File(old); FileInputStream fin = new FileInputStream(ofile); FileOutputStream fout = new FileOutputStream(newfile); Workbook template = Workbook.getWorkbook(fin); WritableWorkbook xls = Workbook.createWorkbook(fout, template); WritableSheet sheet = xls.getSheet(0); // 标题 for(int i=0;i<bankitem.size();i++){ WageBankItemBO wi=(WageBankItemBO)bankitem.get(i); Label tlb2=new Label(i,0,wi.getPayName()); sheet.addCell(tlb2); } for(int i=0;i<values.size();i++){ String data[] = (String[]) values.get(i); for(int j=0;j<data.length;j++){ WageBankItemBO wb=(WageBankItemBO)bankitem.get(j); if (!"seq".equals(wb.getFieldID()) && !"1".equals(wb.getRadixPoint())){ // 不显示小数点 data[j]=data[j].replaceAll("\\.",""); } if ("yyyy-MM-dd".equals(wb.getDateFormat()) || "yyyyMMdd".equals(wb.getDateFormat()) || "yyyy-MM".equals(wb.getDateFormat()) || "yyyyMM".equals(wb.getDateFormat())){ data[j]=CommonFuns.getDateByFormat(data[j],wb.getDateFormat()); } if (wb.getBeforeChar()!=null){ //左补足 data[j]=org.apache.commons.lang.StringUtils.leftPad(data[j],Integer.parseInt(wb.getWidth()),wb.getBeforeChar()); } if (wb.getBehindChar()!=null){ //右补足 data[j]=org.apache.commons.lang.StringUtils.rightPad(data[j],Integer.parseInt(wb.getWidth()),wb.getBehindChar()); } if ("1".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && data[j].length()>Integer.parseInt(wb.getWidth())){ //左裁剪 data[j]=data[j].substring(0,Integer.parseInt(wb.getWidth())); } if ("0".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && data[j].length()>Integer.parseInt(wb.getWidth())){ //右裁剪 data[j]=data[j].substring(data[j].length()-Integer.parseInt(wb.getWidth())); } Label tlb=new Label(j,i+1,data[j]); sheet.addCell(tlb); } } xls.write(); xls.close(); template.close(); fin.close(); fout.close(); return filename; } catch (Exception ie) { throw new SysException("E1400003","读取文件错误!",ie,FileUtil.class); } } public static String exportBankTXTFile(String path, List bankitem, List values, boolean showTitle, boolean delFile) throws SysException { BufferedWriter bw = null; try { File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".txt"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); if (showTitle){ // 显示标题 bw.newLine(); //起新行 sb.delete(0,sb.length());//清空 for (int n = 0; n < bankitem.size(); n++) { WageBankItemBO wb=(WageBankItemBO)bankitem.get(n); String value2=wb.getPayName(); if (wb.getBeforeChar()!=null){ //左补足 value2=CommonFuns.leftPad(value2,Integer.parseInt(wb.getWidth())," "); } if (wb.getBehindChar()!=null){ //右补足 value2=CommonFuns.rightPad(value2,Integer.parseInt(wb.getWidth())," "); } if (wb.getSeparator()!=null){ value2+=" "; } sb.append(value2); } bw.write(sb.toString()); } int colNum = 0; int rowNum ; if (values != null && values.size() > 0) { rowNum = values.size(); for (int i = 0; i < rowNum; i++) { bw.newLine(); //起新行 sb.delete(0,sb.length());//清空 String data[] = (String[]) values.get(i); for (int n = 0; n < bankitem.size(); n++) { String value2=data[n]; WageBankItemBO wb=(WageBankItemBO)bankitem.get(n); if (!"1".equals(wb.getRadixPoint())){ // 不显示小数点 value2=value2.replaceAll("\\.",""); } if ("yyyy-MM-dd".equals(wb.getDateFormat()) || "yyyyMMdd".equals(wb.getDateFormat()) || "yyyy-MM".equals(wb.getDateFormat()) || "yyyyMM".equals(wb.getDateFormat())){ value2=CommonFuns.getDateByFormat(value2,wb.getDateFormat()); } if (wb.getBeforeChar()!=null){ //左补足 value2=CommonFuns.leftPad(value2,Integer.parseInt(wb.getWidth()),wb.getBeforeChar()); } if (wb.getBehindChar()!=null){ //右补足 value2=CommonFuns.rightPad(value2,Integer.parseInt(wb.getWidth()),wb.getBehindChar()); } if ("1".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && value2.length()>Integer.parseInt(wb.getWidth())){ //左裁剪 value2=value2.substring(0,Integer.parseInt(wb.getWidth())); } if ("0".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && value2.length()>Integer.parseInt(wb.getWidth())){ //右裁剪 value2=value2.substring(value2.length()-Integer.parseInt(wb.getWidth())); } if (wb.getSeparator()!=null){ if ("9".equals(wb.getSeparator())){ value2+="\t"; } else{ value2+=wb.getSeparator(); } } sb.append(value2); } bw.write(sb.toString()); } bw.newLine(); // 补上0d0a } return filename; } catch (Exception e) { throw new SysException("", "导出文件错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } } // path 路径 // sets集合名称 public static String exportInfoStru(String path,String []sets) throws SysException{ String filename=""; BufferedWriter bw=null; try{ File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".txt"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); sb.append(" ==系统结构说明== "); bw.write(sb.toString()); bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append(" 导出时间:"+CommonFuns.getSysDate("yyyy-MM-dd")); bw.write(sb.toString()); bw.newLine(); // 补上0d0a if (sets!=null){ for(int i=0;i<sets.length;i++){ bw.newLine(); // 补上0d0a InfoSetBO setbo=SysCacheTool.findInfoSet(sets[i]); sb.delete(0,sb.length());//清空 sb.append(setbo.getSetId()).append(setbo.getSetName()); bw.write(sb.toString()); bw.newLine(); // 补上0d0a bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append("字段\t名称\t描述\t类型\t关联代码\t用途"); bw.write(sb.toString()); bw.newLine(); // 补上0d0a List list=SysCacheTool.queryInfoItemBySetId(sets[i]); for(int j=0;j<list.size();j++){ InfoItemBO itembo=(InfoItemBO)list.get(j); if (InfoItemBO.PROPERTY_CONTROL_HIDE.equals(itembo.getItemProperty())) continue; sb.delete(0,sb.length());//清空 sb.append(itembo.getItemId()).append("\t").append(itembo.getItemName()).append("\t").append(CommonFuns.filterNull(itembo.getItemDesc())).append("\t").append(CommonFuns.filterNull(itembo.getItemCodeSet())).append("\t").append(CommonFuns.filterNull(itembo.getItemIssue())); bw.write(sb.toString()); bw.newLine(); // 补上0d0a } } } } catch(Exception e){ throw new SysException("", "导出文件错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } return filename; } public static String exportCodeInfo(String path,String []sets) throws SysException{ String filename=""; BufferedWriter bw=null; try{ File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".txt"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); sb.append(" ==系统代码说明== "); bw.write(sb.toString()); bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append(" 导出时间:"+CommonFuns.getSysDate("yyyy-MM-dd")); bw.write(sb.toString()); bw.newLine(); // 补上0d0a if (sets!=null){ for(int i=0;i<sets.length;i++){ bw.newLine(); // 补上0d0a CodeSetBO setbo=SysCacheTool.findCodeSet(sets[i]); sb.delete(0,sb.length());//清空 sb.append(setbo.getSetId()).append(setbo.getSetName()); bw.write(sb.toString()); bw.newLine(); // 补上0d0a bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append("唯一代码\t用户代码\t描述"); bw.write(sb.toString()); bw.newLine(); // 补上0d0a List list=SysCacheTool.queryCodeItemBySetId(sets[i]); for(int j=0;j<list.size();j++){ CodeItemBO itembo=(CodeItemBO)list.get(j); sb.delete(0,sb.length());//清空 sb.append(itembo.getItemId()).append("\t").append(itembo.getUserItemId()).append("\t").append(CommonFuns.filterNull(itembo.getItemName())); bw.write(sb.toString()); bw.newLine(); // 补上0d0a } } } } catch(Exception e){ throw new SysException("", "导出文件错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } return filename; } /** * 导出文件 * * path 导出文件存放绝对路径 * header 列头名称 * colDataType 列的数据类型。 数组长度和列头数组一致,且一一对应,数据类型和指标项数据类型一致。如果导出时不需要对数据进行处理,则为null。 * values 数据记录 。 每一条记录都是String[],长度和列头数组一致,且一一对应。 * 返回 excel 导出文件名称(不含路径) */ public static String exportFile(String path, String [] header, String [] colDataType, List values, boolean delFile) throws SysException { BufferedWriter bw = null; try { if (header != null && colDataType != null && colDataType.length != colDataType.length) { throw new SysException("数据类型和显示列头长度不匹配"); } File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".csv"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); int colNum = 0; int rowNum ; if (header != null && header.length > 0) { colNum = header.length; for (int n = 0; n < colNum; n++) { sb.append(FileUtil.addCsvField(header[n])); } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } if (values != null && values.size() > 0) { rowNum = values.size(); for (int i = 0; i < rowNum; i++) { bw.newLine(); //起新行 sb.delete(0,sb.length());//清空 String data[] = (String[]) values.get(i); for (int n = 0; n < colNum; n++) { String value2 ; if (colDataType != null) { if (InfoItemBO.DATA_TYPE_CODE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("", data[n]); } else if (InfoItemBO.DATA_TYPE_ORG.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("OU", data[n]); } else if (InfoItemBO.DATA_TYPE_POST.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PO", data[n]); } else if (InfoItemBO.DATA_TYPE_PERSON.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PE", data[n]); } else if (InfoItemBO.DATA_TYPE_PARTY.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PA", data[n]); } else if (InfoItemBO.DATA_TYPE_WAGE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("WAGE", data[n]); } else { value2 = CommonFuns.filterNull(data[n]); } try { if (InfoItemBO.DATA_TYPE_INT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_FLOAT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_COMPUTE.equals(colDataType[n])) { // jxl.write.Number labelN = new jxl.write.Number(n, i + 1, Double.parseDouble(value2)); // sheet.addCell(labelN); sb.append(FileUtil.addCsvField(value2)); } else { sb.append(FileUtil.addCsvField(value2)); } } catch (Exception e) { sb.append(FileUtil.addCsvField(value2)); } } else { value2 = CommonFuns.filterNull(data[n]); sb.append(FileUtil.addCsvField(value2)); } } //写单行文件 sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } } return filename; } catch (Exception e) { throw new SysException("", "导出excel错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } } public static String exportFileWithOtherInfo(String path, List otherInfo, String [] header, String [] colDataType, List values, boolean delFile) throws SysException { BufferedWriter bw = null; try { if (header != null && colDataType != null && colDataType.length != colDataType.length) { throw new SysException("数据类型和显示列头长度不匹配"); } File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".csv"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); int rowIndex = 0; if (otherInfo != null && otherInfo.size() > 0) { for (int i = 0; i < otherInfo.size(); i++) { String [] info = (String[]) otherInfo.get(i); if (info != null && info.length > 0) { for (int j = 0; j < info.length; j++) { sb.append(FileUtil.addCsvField(info[j])); } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); rowIndex++; } } } int colNum = 0; int rowNum ; if (header != null && header.length > 0) { colNum = header.length; bw.newLine(); sb.delete(0,sb.length()); for (int n = 0; n < colNum; n++) { sb.append(FileUtil.addCsvField(header[n])); } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } if (values != null && values.size() > 0) { rowNum = values.size(); for (int i = rowIndex; i < rowNum + rowIndex; i++) { String data[] = (String[]) values.get(i - rowIndex); for (int n = 0; n < colNum; n++) { String value2 ; if (colDataType != null) { if (InfoItemBO.DATA_TYPE_CODE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("", data[n]); } else if (InfoItemBO.DATA_TYPE_ORG.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("OU", data[n]); } else if (InfoItemBO.DATA_TYPE_POST.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PO", data[n]); } else if (InfoItemBO.DATA_TYPE_PERSON.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PE", data[n]); } else if (InfoItemBO.DATA_TYPE_PARTY.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PA", data[n]); } else if (InfoItemBO.DATA_TYPE_WAGE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("WAGE", data[n]); } else { value2 = CommonFuns.filterNull(data[n]); } try { if (InfoItemBO.DATA_TYPE_INT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_FLOAT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_COMPUTE.equals(colDataType[n])) { // jxl.write.Number labelN = new jxl.write.Number(n, i + 1, Double.parseDouble(value2)); // sheet.addCell(labelN); sb.append(FileUtil.addCsvField(value2)); } else { sb.append(FileUtil.addCsvField(value2)); sb.append(FileUtil.addCsvField(value2)); } } catch (Exception e) { sb.append(FileUtil.addCsvField(value2)); sb.append(FileUtil.addCsvField(value2)); } } else { value2 = CommonFuns.filterNull(data[n]); sb.append(FileUtil.addCsvField(value2)); sb.append(FileUtil.addCsvField(value2)); } } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } } return filename; } catch (Exception e) { e.printStackTrace(); throw new SysException("", "导出excel错误", e, FileUtil.class); }finally{ try { if(bw != null)bw.close(); }catch(Exception e){ e.printStackTrace(); } } } /** * 得到不含路径的文件名 或者 绝对路径 * * fullFileName 文件全名(带路径) * isPath 是否返回文件绝对路径 * 返回 文件名称 */ public static boolean fileExists(String fullFileName) throws SysException { File f = new File(fullFileName); if (f.exists()) { return true; } return false; } public static String getFileNameOrPath(String fullFileName, boolean isPath) throws SysException { if (fullFileName == null || "".equals(fullFileName)) { return ""; } File f = new File(fullFileName); if (f.exists()) { if (isPath) { f.getAbsolutePath(); } else { return f.getName(); } } else { throw new SysException("指定文件或目录不存在"); } return ""; } /** * 删除指定路径下的文件 导出的excel文件 * * path */ public static void delDiskFile(String path) { File dir = new File(path); String[] filename = dir.list(); if (filename == null) return; int count = filename.length; String date = CommonFuns.getSysDate("yyyyMMdd"); for (int i = 0; i < count; i++) { String str = filename[i]; if (str.indexOf(date) == -1 && str.indexOf("csc") > -1) { File f = new File(path + File.separator + filename[i]); f.delete(); } } } // 删除文件 public static void FileDelete(String src) throws IOException{ File f = new File(src); f.delete(); } // 拷贝文件 public static void FileCopy(String src, String dst) throws IOException{ InputStream in = new FileInputStream(new File(src)); OutputStream out = new FileOutputStream(new File(dst)); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0){ out.write(buf, 0, len); } in.close(); out.close(); } // 读入文件 public static byte[]ReadInFile(String fileName) throws IOException{ InputStream in = new FileInputStream(new File(fileName)); byte[] buf = new byte[in.available()]; in.read(buf); in.close(); return buf; } public static void createDirectory(String directory, String subDirectory) { String dir[]; File fl = new File(directory); try { if (!fl.exists()) fl.mkdir(); if (!"".equals(subDirectory)) { dir = subDirectory.replace('\\', '/').split("/"); for (int i = 0; i < dir.length; i++) { File subFile = new File(directory + File.separator + dir[i]); if (!subFile.exists()) subFile.mkdir(); directory += File.separator + dir[i]; } } } catch (Exception ex) { ex.printStackTrace(); } } // 返回解开文件名列表 public static List unZip(String zipFileName, String outputDirectory) throws Exception { List fileList=new ArrayList(); try { createDirectory(outputDirectory, ""); ZipFile zipFile = new ZipFile(zipFileName); Enumeration e = zipFile.getEntries(); while (e.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry)e.nextElement(); if (zipEntry.isDirectory()) { String name = zipEntry.getName(); name = name.substring(0, name.length() - 1); File f = new File(outputDirectory + File.separator + name); f.mkdir(); } else { String fileName = zipEntry.getName(); fileList.add(fileName); fileName = fileName.replace('\\', '/'); if (fileName.indexOf("/") != -1){ createDirectory(outputDirectory, fileName.substring(0, fileName.lastIndexOf("/"))); } File f = new File(outputDirectory + File.separator + zipEntry.getName()); f.createNewFile(); InputStream in = zipFile.getInputStream(zipEntry); FileOutputStream out=new FileOutputStream(f); byte[] by = new byte[1024]; int c; while ( (c = in.read(by)) != -1) { out.write(by, 0, c); } out.close(); in.close(); } } zipFile.close(); } catch (Exception ex) { ex.printStackTrace(); } return fileList; } public static void transPhotoToPNG(String oldfile,String newfile) throws Exception { RenderedImage img = ImageIO.read(new File(oldfile)); ImageIO.write(img, "png", new File(newfile)); } public static void GenSmallJPG(String oldfile,String newfile,float tagsize) throws Exception { java.io.File file = new java.io.File(oldfile); //读入刚才上传的文件 Image src = javax.imageio.ImageIO.read(file); //构造Image对象 int old_w = src.getWidth(null); //得到源图宽 int old_h = src.getHeight(null); int new_w = 0; int new_h = 0; //得到源图长 //int tempsize; float tempdouble; if (old_w > old_h) { tempdouble = old_w / tagsize; } else { tempdouble = old_h / tagsize; } new_w = Math.round(old_w / tempdouble); new_h = Math.round(old_h / tempdouble);//计算新图长宽 BufferedImage tag = new BufferedImage(new_w, new_h, BufferedImage.TYPE_INT_RGB); tag.getGraphics().drawImage(src, 0, 0, new_w, new_h,null); //绘制缩小后的图 FileOutputStream newimage = new FileOutputStream(newfile); //输出到文件流 JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(newimage); encoder.encode(tag); //近JPEG编码 newimage.close(); } public static void addPhotoToExcel(String excelFile,String pngfile,int row,int col) throws Exception { File file= new File(excelFile); Workbook wb = Workbook.getWorkbook(file); WritableWorkbook wwb = jxl.Workbook.createWorkbook(new File(excelFile),wb); WritableSheet sheet = wwb.getSheet(0); // 取得图片单元格大小(可能是合并的) int colspan=1; int rowspan=1; Range[] ranges =sheet.getMergedCells(); for(int i=0;i<ranges.length;i++){ if (ranges[i].getTopLeft().getRow()==row && ranges[i].getTopLeft().getColumn()==col){ colspan=ranges[i].getBottomRight().getColumn()-ranges[i].getTopLeft().getColumn()+1; rowspan=ranges[i].getBottomRight().getRow()-ranges[i].getTopLeft().getRow()+1; break; } } File fileImage=new File(pngfile); WritableImage image=new WritableImage(col,row,colspan,rowspan,fileImage);//从A1开始 跨2行3个单元格 sheet.addImage(image); wwb.write(); wwb.close(); wb.close(); } private static Document xml2FO(Document xml, String styleSheet) { DOMSource xmlDomSource = new DOMSource(xml); DOMResult domResult = new DOMResult(); Transformer transformer = getTransformer(styleSheet); try { transformer.transform(xmlDomSource, domResult); } catch (javax.xml.transform.TransformerException e) { return null; } return (Document) domResult.getNode(); } private static byte[] fo2PDF(Document foDocument) { DocumentInputSource fopInputSource = new DocumentInputSource( foDocument); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); Driver driver = new Driver(fopInputSource, out); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.run(); return out.toByteArray(); } catch (Exception ex) { return null; } } private static Transformer getTransformer(String styleSheet) { try { TransformerFactory tFactory = TransformerFactory.newInstance(); DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); dFactory.setNamespaceAware(true); DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); Document xslDoc = dBuilder.parse(styleSheet); DOMSource xslDomSource = new DOMSource(xslDoc); return tFactory.newTransformer(xslDomSource); } catch (javax.xml.transform.TransformerException e) { e.printStackTrace(); return null; } catch (java.io.IOException e) { e.printStackTrace(); return null; } catch (javax.xml.parsers.ParserConfigurationException e) { e.printStackTrace(); return null; } catch (org.xml.sax.SAXException e) { e.printStackTrace(); return null; } } public static void Html2Pdf(String htmlFileName,String styleSheet) throws SysException { FileInputStream input = null; try { input = new FileInputStream(htmlFileName); } catch (java.io.FileNotFoundException e) { throw new SysException("File not found: " + htmlFileName); } Tidy tidy = new Tidy(); Document xmlDoc = tidy.parseDOM(input, null); Document foDoc = xml2FO(xmlDoc, styleSheet); String pdfFileName = htmlFileName.substring(0, htmlFileName.indexOf(".")) + ".pdf"; try { OutputStream pdf = new FileOutputStream(new File(pdfFileName)); pdf.write(fo2PDF(foDoc)); } catch (java.io.FileNotFoundException e) { throw new SysException("Error creating PDF: " + pdfFileName); } catch (java.io.IOException e) { throw new SysException("Error writing PDF: " + pdfFileName); } } public static void modifyExcelContent(WritableSheet sheet,WritableCell cell,String content)throws Exception { if (sheet==null || cell==null) return; CellFormat cf=cell.getCellFormat(); Label l=new Label(cell.getColumn(),cell.getRow(),CommonFuns.filterNull(content)); if (cf!=null) l.setCellFormat(cf); sheet.addCell(l); } public static String exportTaxRptFile(String path,List dataTable) throws SysException { try { String filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".xls"; String old = path +"file"+File.separator +"wage"+File.separator+"template"+File.separator+"TaxRpt.xls"; String newfile = path +"file" +File.separator +"wage"+File.separator+"download"+File.separator+filename; FileCopy(old,newfile); File fout = new File(newfile); Workbook fin=Workbook.getWorkbook(fout); WritableWorkbook xls = Workbook.createWorkbook(fout,fin); WritableSheet sheet = xls.getSheet(0); int row=0; int startrow=-1; int PersonCount=-1; int A815713=-1; int A815714=-1; int A815708=-1; int TaxFree=-1; int Rate=-1; int Deduction=-1; int orgrow=-1,orgcol=-1; int daterow=-1,datecol=-1; while(row<10){ for(int col=0;col<10;col++){ Cell cell=sheet.getCell(col,row); if ("[OrgName]".equals(cell.getContents())){ orgrow=row; orgcol=col; } else if ("[Date]".equals(cell.getContents())){ daterow=row; datecol=col; } else if ("[PersonCount]".equals(cell.getContents())){ PersonCount=col; } else if ("[A815713]".equals(cell.getContents())){ startrow=row; A815713=col; } else if ("[A815708]".equals(cell.getContents())){ A815708=col; } else if ("[A815714]".equals(cell.getContents())){ A815714=col; } else if ("[TaxFree]".equals(cell.getContents())){ TaxFree=col; } else if ("[Rate]".equals(cell.getContents())){ Rate=col; } else if ("[Deduction]".equals(cell.getContents())){ Deduction=col; } } row++; } // 有数据 if (dataTable!=null && dataTable.size()>0){ for(int k=0;k<dataTable.size();k++){ TableVO table=(TableVO)dataTable.get(k); String sheetName=""; if (table.getSetName()!=null && !"".equals(table.getSetName())){ sheetName=table.getSetName(); } else{ sheetName="sheet"+String.valueOf(k+1); } xls.copySheet(0,sheetName,k+1); sheet = xls.getSheet(k+1); if (orgrow!=-1 && orgcol!=-1) modifyExcelContent(sheet,sheet.getWritableCell(orgcol,orgrow),table.getSetName()); // 机构 if (daterow!=-1 && datecol!=-1) modifyExcelContent(sheet,sheet.getWritableCell(datecol,daterow),table.getTag()); // 时间 for(int j=0;j<table.getRowData().length;j++){ CellVO[]cells=table.getRowData()[j].getCell(); int pos=startrow+j; if (PersonCount!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(PersonCount,pos),cells[0].getValue()); } if (A815713!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(A815713,pos),cells[1].getValue()); } if (A815714!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(A815714,pos),cells[2].getValue()); } if (Rate!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(Rate,pos),cells[3].getValue()); } if (Deduction!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(Deduction,pos),cells[4].getValue()); } if (A815708!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(A815708,pos),cells[5].getValue()); } if (TaxFree!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(TaxFree,pos),cells[6].getValue()); } } } xls.removeSheet(0); } xls.write(); xls.close(); return filename; } catch (Exception ie) { throw new SysException("E1400003","读取文件错误(run)",ie,FileUtil.class); } } public static void copyFile(String oldPath, String newPath) { try { int bytesum = 0; int byteread = 0; File oldfile = new File(oldPath); if (oldfile.exists()) { //文件存在时 FileInputStream inStream = new FileInputStream(oldPath); //读入原文件 FileOutputStream fs = new FileOutputStream(newPath); byte[] buffer = new byte[1444]; int length; while ( (byteread = inStream.read(buffer)) != -1) { bytesum += byteread; //字节数 文件大小 fs.write(buffer, 0, byteread); } inStream.close(); fs.close(); } } catch (Exception e) { e.printStackTrace(); } } public static void FileUTF2ANSI(String path){ String bak=path+".bak"; copyFile(path,bak); try{ Reader streamReader = new InputStreamReader(new FileInputStream(bak), "UTF-8"); BufferedReader reader = new BufferedReader(streamReader); String line = null; //BufferedWriter bw = new BufferedWriter(new FileWriter(path)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path),"GBK")); while ((line = reader.readLine()) != null) { bw.write(line); bw.newLine(); } reader.close(); bw.close(); } catch(Exception e){ } } public static void FileANSI2UTF(String path){ String bak=path+".bak"; copyFile(path,bak); try{ Reader streamReader = new InputStreamReader(new FileInputStream(bak),"GBK"); BufferedReader reader = new BufferedReader(streamReader); String line = null; BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path),"UTF-8")); while ((line = reader.readLine()) != null) { bw.write(line); bw.newLine(); } reader.close(); bw.close(); // 加上标示 } catch(Exception e){ } } /* window 运行无误 linu不行 public static void FileANSI2UTF(String path){ File f=new File(path); try{ byte[] bs=new byte[(int)f.length()]; FileInputStream fis=new FileInputStream(f); try{ int io=0; while(io<bs.length){ int n=fis.read(bs,io,bs.length-io); if(n<=0){ break; } } } finally{ fis.close(); } String s=new String(bs); bs=s.getBytes("UTF-8"); FileOutputStream fos=new FileOutputStream(f); try{ byte[] head=new byte[3]; head[0]=(byte)0xef; head[1]=(byte)0xbb; head[2]=(byte)0xbf; fos.write(head); fos.write(bs); } finally{ fos.close(); } } catch(Exception e){ } } */ }
GB18030
Java
95,629
java
FileUtil.java
Java
[ { "context": " }\r\n key = obj.getPersonId();\r\n }\r\n el", "end": 28914, "score": 0.6989245414733887, "start": 28903, "tag": "KEY", "value": "getPersonId" }, { "context": " // 处理多记录子集数据有多行的情况\r\n ...
null
[]
package com.hr319wg.util; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Reader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Vector; import javax.faces.context.FacesContext; import javax.imageio.ImageIO; import javax.servlet.ServletContext; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import jxl.Cell; import jxl.Range; import jxl.Workbook; import jxl.format.CellFormat; import jxl.write.Label; import jxl.write.WritableCell; import jxl.write.WritableImage; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import org.apache.avalon.framework.logger.ConsoleLogger; import org.apache.avalon.framework.logger.Logger; import org.apache.fop.apps.Driver; import org.apache.fop.tools.DocumentInputSource; import org.apache.myfaces.custom.fileupload.UploadedFile; import org.apache.tools.zip.ZipEntry; import org.apache.tools.zip.ZipFile; import org.w3c.dom.Document; import org.w3c.tidy.Tidy; import com.hr319wg.ccp.pojo.bo.PartyBO; import com.hr319wg.common.Constants; import com.hr319wg.common.exception.SysException; import com.hr319wg.common.pojo.vo.User; import com.hr319wg.common.web.SysContext; import com.hr319wg.emp.pojo.bo.PersonBO; import com.hr319wg.org.pojo.bo.OrgBO; import com.hr319wg.post.pojo.bo.PostBO; import com.hr319wg.sys.api.ActivePageAPI; import com.hr319wg.sys.cache.SysCacheTool; import com.hr319wg.sys.pojo.bo.CodeItemBO; import com.hr319wg.sys.pojo.bo.CodeSetBO; import com.hr319wg.sys.pojo.bo.InfoItemBO; import com.hr319wg.sys.pojo.bo.InfoSetBO; import com.hr319wg.sys.pojo.vo.CellVO; import com.hr319wg.sys.pojo.vo.RecordVO; import com.hr319wg.sys.pojo.vo.TableVO; import com.hr319wg.user.pojo.bo.RoleInfoBO; import com.hr319wg.wage.pojo.bo.WageBankItemBO; import com.hr319wg.wage.pojo.bo.WageUnitBO; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; public class FileUtil { public static String getRealPath(String path){ ServletContext context = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); String actpath=context.getRealPath(path); if (!actpath.endsWith(File.separator)){ actpath+=File.separator; } return actpath; } // 从路径中抽取文件名 public static String parseFileName(String fullFileName) { if(fullFileName==null||fullFileName.equals("")){ return "noname"; } int len = fullFileName.length(); int pos = fullFileName.lastIndexOf('\\'); return fullFileName.substring(pos+1,len); } public static String addCsvField(String str){ if(str == null) return ","; StringBuffer sb ; if(str.indexOf("\"") != -1) sb = new StringBuffer(str.replaceAll("\"","\"\"")); else sb = new StringBuffer(str); if (sb.length()>14){ // 避免大数字变成科学计数法 sb.insert(0,'\t'); } return sb.append(",").toString(); } /** * 创建文件 * * fileContent 文件内容 * absolutePath 文件存放绝对路径 * fileType 文件类型,即文件后缀 如 xls 、 doc 等 * 返回 不含路径的文件名 */ public static String formatUploadFile(UploadedFile upfile) throws SysException { String fileName=""; String []fpa=parseFileName(upfile.getName()).split("\\."); if (fpa.length<=1){ fileName=CommonFuns.getUUID(); } else{ fileName=CommonFuns.getUUID()+"."+fpa[1]; } return fileName; } public static String createFile(UploadedFile upfile, String absolutePath) throws SysException { String fileName; try { File dir = new File(absolutePath); if (!dir.exists()) { dir.mkdirs(); } fileName = formatUploadFile(upfile); String path = absolutePath + File.separator + fileName; FileOutputStream fos = new FileOutputStream(path); try { fos.write(upfile.getBytes()); } finally { fos.close(); } } catch (Exception e) { e.printStackTrace(); throw new SysException("", "指定位置创建文件失败", e, FileUtil.class); } return fileName; } public static String createFile(byte[] fileContent, String absolutePath, String fileType) throws SysException { String fileName; try { File dir = new File(absolutePath); if (!dir.exists()) { dir.mkdirs(); } fileName = CommonFuns.getSysDate("yyyyMMddHHmmss") + "_" + new Random().nextInt(10000) + "." + fileType; String path = absolutePath + File.separator + fileName; FileOutputStream fos = new FileOutputStream(path); try { fos.write(fileContent); } finally { fos.close(); } } catch (Exception e) { e.printStackTrace(); throw new SysException("", "指定位置创建文件失败", e, FileUtil.class); } return fileName; } public static void createFile(byte[] fileContent, String path) throws SysException { try { FileOutputStream fos = new FileOutputStream(path); try { fos.write(fileContent); } finally { fos.close(); } } catch (Exception e) { e.printStackTrace(); throw new SysException("", "指定位置创建文件失败", e, FileUtil.class); } } /** * * 读取excle文件-批量增加人员 * * absolutePath 文件存放的绝对路径 * fileName 文件名称 (不带路径) * colDataType 数据读取列的数据类型 * keyDataType 记录索引数据类型 沿用指标集分类(机构、人员、岗位等) * keyCol 索引数据所在列 * impRs 读出数据存放 的hastable(如果为null不执行读数据操作)。 key:人员id、机构id等,value:String[] 数据列一致。 * startCol 读取数据开始列(从0开始) * startRow 读取数据开始行(从0开始) * delFile 是否删除原文件 true 是, false 否 * codeType 0 代码 1 描述 * 返回 boolean 读文件数据是否有错误。数据无错误 true,数据有错误 false. 若返回false,原文件不删除,并在源文件的里生成新的sheet,记录错误信息 * */ public static boolean readNewExcelFile(String absolutePath, String fileName, InfoItemBO[] cols, Map impRs, boolean delFile, String codeType) throws SysException { Hashtable htcode=new Hashtable(); // 用于利用描述反查代码 String tempFile=absolutePath + File.separator + fileName; String errorFile=absolutePath + File.separator + "ERROR_" + fileName; boolean noError=true; // -------进行转码------- if ("1".equals(Constants.IMPORT_CSV2UTF8)){ FileANSI2UTF(tempFile); } File f = new File(tempFile); BufferedReader br = null; BufferedWriter bw=null; ActivePageAPI api=(ActivePageAPI) SysContext.getBean("sys_activePageApi"); try { //读文件 br = new BufferedReader(new FileReader(f)); //创建错误日志文件 bw = new BufferedWriter(new FileWriter(new File(errorFile))); String headerLine = br.readLine(); // 读入标题行 if(headerLine == null){ throw new SysException("导入的文件为空,请导入有内容的文件!"); } int columns = headerLine.split(",").length; if (cols.length != columns) { throw new SysException("您所选项的数目和Excel列的数目不一样,请重新选择!"); } String lineData ; int parsingLineNumber = 0; //正在处理的行号,用于记录错误日志等. int excelCount=0; int errorCount=0; while((lineData = br.readLine()) != null){ parsingLineNumber ++; excelCount++; // excel数据行数 if (lineData.endsWith(",")){ lineData+=" "; // 如果最后为逗号,表明该列为空,只有补上空格后split才有效 } String[] data = lineData.split(","); data[data.length-1]=data[data.length-1].trim(); // 如果补空格,还得去掉 boolean add=true; for(int i=0;i<cols.length;i++){ //格式化数据 if (InfoItemBO.DATA_TYPE_ORG.equals(cols[i].getItemDataType())){ //机构数据 OrgBO oo=SysCacheTool.findOrgByCode(data[i]); if (oo!=null){ data[i]=oo.getOrgId(); } else{ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"机构数据不存在"); noError=false; break; } } else if ("A001077".equals(cols[i].getItemId())){ String sql="select count(*) from a001 where a001077='"+data[i]+"'"; if (api.queryForInt(sql)>0){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"该身份证号已存在!"); noError=false; break; } } else if (InfoItemBO.DATA_TYPE_DATE6.equals(cols[i].getItemDataType())){ if (data[i].length()!=0 && data[i].length()!=6){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"不符合yyyyMM格式!"); noError=false; break; } else{ if (data[i].length()==6){ data[i]=data[i].substring(0, 4) + "-" + data[i].substring(4, 6); } } } else if (InfoItemBO.DATA_TYPE_DATE.equals(cols[i].getItemDataType())){ if (data[i].length()!=0 && data[i].length()!=8){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"不符合yyyyMMdd格式!"); noError=false; break; } else{ if (data[i].length()==8){ data[i]=data[i].substring(0, 4) + "-" + data[i].substring(4, 6)+"-"+data[i].substring(6, 8); } } } else if (InfoItemBO.DATA_TYPE_CODE.equals(cols[i].getItemDataType())){ if (data[i]!=null && !"".equals(data[i])){ if ("1".equals(codeType)){ // 代码描述转换 Hashtable itemhash=(Hashtable)htcode.get(cols[i].getItemCodeSet()); if (itemhash==null){ // 构建 itemhash=new Hashtable(); List codeitemlist=SysCacheTool.queryCodeItemBySetId(cols[i].getItemCodeSet()); for(int j=0;j<codeitemlist.size();j++){ CodeItemBO cb=(CodeItemBO)codeitemlist.get(j); itemhash.put(cb.getItemName(),cb.getItemId()); } htcode.put(cols[i].getItemCodeSet(),itemhash); } String newcode=(String)itemhash.get(data[i]); if (newcode!=null){ data[i]=newcode; } else{ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, "代码["+data[i]+"]不存在"); noError=false; break; } } else{ // 代码匹配 CodeItemBO code=SysCacheTool.findCodeItem("",data[i]); if (code==null){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, "代码["+data[i]+"]不存在!"); noError=false; break; } } } } if ("1".equals(cols[i].getItemNotNull())){ // 不为空 if (data[i]==null || "".equals(data[i])){ add=false; addErrorFormatLabel(bw, parsingLineNumber, i, data[i]+"为空,而该字段不允许为空!"); noError=false; break; } } } if (add) { if ("auto".equals(data[0])){ data[0]="auto"+String.valueOf(parsingLineNumber); } impRs.put(data[0],data); } } } catch(Exception e){ } finally { try { if(br != null) br.close(); if(bw != null){ bw.close(); if ("1".equals(Constants.EXPORT_CSV2UTF8)){ FileUTF2ANSI(errorFile); } } if (delFile) { f.delete(); } } catch (Exception ea) { ea.printStackTrace(); } } return noError; } public static boolean readExcelFile(String absolutePath, String fileName, String [] colDataType, String [] colCodeSet, String keyDataType, int keyCol, Map impRs, int startCol, int startRow, boolean delFile) throws SysException { int count = colDataType.length; InfoItemBO [] item = new InfoItemBO[count]; for (int i = 0; i < count; i++) { item[i] = new InfoItemBO(); item[i].setItemDataType(colDataType[i]); item[i].setItemCodeSet(colCodeSet[i]); } return readExcelFile(absolutePath, fileName, item, keyDataType, keyCol, impRs, startCol, startRow, delFile); } public static void checkExcelFile(String absolutePath, String fileName, InfoSetBO set, InfoItemBO[] cols, int keyCol, Map impRs, int startCol, int startRow, boolean delFile, int nameCol, String []items) throws SysException{ if (items==null || items.length==0){ throw new SysException("没有定义检查项目!"); } Hashtable ht=new Hashtable(); // 0 已存在该数据 1 数据库不存在该人员 2 对比数据 for(int i=0;i<items.length;i++){ ht.put(items[i],items[i]); } if (impRs == null) { throw new SysException("impRs参数为null"); } else { impRs.clear(); } File f = new File(absolutePath + File.separator + fileName); if (!f.exists() || !f.isFile()) { throw new SysException("指定文件不存在"); } ActivePageAPI api=(ActivePageAPI) SysContext.getBean("sys_activePageApi"); BufferedReader br = null; try { //读文件 br = new BufferedReader(new FileReader(f)); String headerLine = br.readLine(); // 读入标题行 if(headerLine == null){ throw new SysException("导入的文件为空,请导入有内容的文件!"); } int columns = headerLine.split(",").length; if ((cols.length + startCol) > columns) { throw new SysException("您所选项的数目超过Excel列的数目,请重新选择!"); } if(startRow < 1){ startRow = 1; } for(int i=1;i<startRow;i++){ br.readLine(); } String lineData ; int parsingLineNumber = startRow -1; //正在处理的行号,用于记录错误日志等. int excelCount=0; int errorCount=0; while((lineData = br.readLine()) != null){ parsingLineNumber ++; excelCount++; // excel数据行数 if (lineData.endsWith(",")){ lineData+=" "; // 如果最后为逗号,表明该列为空,只有补上空格后split才有效 } String[] data = lineData.split(","); data[data.length-1]=data[data.length-1].trim(); // 如果补空格,还得去掉 String key = data[keyCol]; String msg=""; if (key != null && !"".equals(key.trim())) { key = key.trim(); } String sql="select id from a001 where upper(A001077)='"+CommonFuns.ID15to18(key).toUpperCase()+"' or upper(A001077)='"+CommonFuns.ID18to15(key).toUpperCase()+"'"; String pid=api.queryForString(sql); String []error=new String[cols.length+3]; for(int i=0;i<cols.length+2;i++){ error[i]=data[i]; } boolean correct=true; if ("".equals(pid)){ if (ht.get("1")!=null){ errorCount++; error[cols.length+2]="该人员不在数据库中"; impRs.put(key, error); continue; } }else{ sql="select id from "+set.getSetId()+" where id='"+pid+"'"; if (!"".equals(api.queryForString(sql))){ // 存在 error[keyCol]=pid; errorCount++; error[cols.length+2]="该数据已经入库"; impRs.put(pid, error); } if (!"".equals(pid) && ht.get("2")!=null){ CellVO []head=new CellVO[cols.length+1]; sql="select id"; head[0]=new CellVO(); head[0].setItemId("ID"); for(int i=0;i<cols.length;i++){ sql+=","+cols[i].getItemId(); head[i+1]=new CellVO(); head[i+1].setItemId(cols[i].getItemId()); } sql+=" from "+set.getSetId()+" where id='"+pid+"'"; if (InfoSetBO.RS_TYPE_SINGLE.equals(set.getSet_rsType()) && !"A001".equals(set.getSetId())){ sql+=" and "+set.getSetId()+"000='00901'"; } Vector vt=api.getDataListBySql(head,sql); if (vt.size()>0){ CellVO[]row=(CellVO[])vt.get(0); for(int i=0;i<cols.length;i++){ if (CommonFuns.filterNull(error[i+2]).equals(row[i+1].getValue())){ error[i+2]+="√"; } else{ error[i+2]+="×"; correct=false; } } } } } if (correct){ error[cols.length+2]+=" 一致"; } else{ error[cols.length+2]+=" 不同"; } impRs.put(pid, error); } int rightCount=excelCount-errorCount; impRs.put("-1","EXCEL中共有数据:"+String.valueOf(excelCount)+" 其中有问题数据:"+String.valueOf(errorCount)+" 正确数据:"+String.valueOf(rightCount)); } catch(Exception e){ } } /** * 读取excle文件 * * absolutePath 文件存放路径 * fileName 文件名称(不含路径) * cols 数据读取列的数据类型 * keyDataType 记录索引数据类型 A 人员ID A1旧系统员工编号A001999 A2考勤卡号 A3使用身份证 * keyCol 索引数据所在列 * impRs 读出数据存放 的hastable(如果为null不执行读数据操作)。 key:人员id、机构id等,value:String[] 数据列一致。 * startCol 读取数据开始列(从0开始) * startRow 读取数据开始行(从0开始) * delFile 是否删除原文件 true 是, false 否 * nameCol 名称字段 -1 不校验 否则校验 * 返回 boolean 读文件数据是否有错误。数据无错误 true,数据有错误 false. 若返回false,原文件不删除,并在源文件的里生成新的sheet,记录错误信息 * User 用户信息 * codeType 0 代码 1 描述 */ public static boolean readExcelFile(String absolutePath, String fileName, InfoItemBO[] cols, String keyDataType, int keyCol, Map impRs, int startCol, int startRow, boolean delFile) throws SysException { return readExcelFile(absolutePath,fileName,cols,keyDataType,keyCol, impRs,startCol,startRow, delFile,-1,null,"0"); } public static boolean readExcelFile(String absolutePath, String fileName, InfoItemBO[] cols, String keyDataType, int keyCol, Map impRs, int startCol, int startRow, boolean delFile, int nameCol, User user, String codeType) throws SysException { if (impRs == null) { throw new SysException("impRs参数为null"); } else { impRs.clear(); } if (keyDataType == null || "".equals(keyDataType)) { throw new SysException("没有指定文件索引类型"); } String tempFile=absolutePath + File.separator + fileName; String errorFile=""; // -------进行转码------- if ("1".equals(Constants.IMPORT_CSV2UTF8)){ FileANSI2UTF(tempFile); } File f = new File(tempFile); if (!f.exists() || !f.isFile()) { throw new SysException("指定文件不存在"); } BufferedReader br = null; BufferedWriter bw = null; boolean isError = false; Hashtable htcode=new Hashtable(); // 用于利用描述反查代码 errorFile=absolutePath + File.separator + "ERROR_" + fileName; try { //读文件 br = new BufferedReader(new FileReader(f)); //创建错误日志文件 bw = new BufferedWriter(new FileWriter(new File(errorFile))); //获取第一张Sheet表 String headerLine = br.readLine(); // 读入标题行 if(headerLine == null){ throw new SysException("导入的文件为空,请导入有内容的文件!"); } int columns = headerLine.split(",").length; if ((cols.length + startCol) > columns) { throw new SysException("您所选项的数目超过Excel列的数目,请重新选择!"); } if(startRow < 1){ startRow = 1; } for(int i=1;i<startRow;i++){ br.readLine(); } String lineData ; int parsingLineNumber = startRow -1; //正在处理的行号,用于记录错误日志等. while((lineData = br.readLine()) != null){ parsingLineNumber ++; if (lineData.endsWith(",")){ lineData+=" "; // 如果最后为逗号,表明该列为空,只有补上空格后split才有效 } String[] data = lineData.split(","); data[data.length-1]=data[data.length-1].trim(); // 如果补空格,还得去掉 if(data.length != (cols.length + startCol)){ addErrorFormatLabel(bw, parsingLineNumber, keyCol, "Excel中列数目多于配置,不能导入!"); isError = true; continue; } String key = data[keyCol]; String msg=""; if (key != null && !"".equals(key.trim())) { key = key.trim(); if (keyDataType.startsWith("A")){ PersonBO obj=null; if ("A".equals(keyDataType)) { // 员工编号 obj = SysCacheTool.findPersonByCode(key); } else if ("A1".equals(keyDataType)){ //使用旧系统员工编号A001999 obj = SysCacheTool.findPersonByOldCode(key); } else if ("A2".equals(keyDataType)){ //考勤卡号 obj = SysCacheTool.findPersonByAttendCode(key); } else if ("A3".equals(keyDataType)){ //身份证号 obj = SysCacheTool.findPersonByIDNum(key); } if (obj == null) { msg="记录错误,人员(编号:"+key+")不存在"; addErrorFormatLabel(bw, parsingLineNumber, keyCol, msg); isError = true; continue; } if (nameCol!=-1){ // 还需要校验名称 if (data[nameCol]!=null && !data[nameCol].equals(obj.getName())){ msg="记录错误,人员名称不匹配(编号:"+key+" 系统:"+obj.getName()+" 文件:"+data[nameCol]+")"; addErrorFormatLabel(bw, parsingLineNumber, keyCol, msg); isError = true; continue; } } if (user!=null && !RoleInfoBO.ORGTYPE_ALL.equals(user.getprocessUnit())){ // 不是全集团时,需要判断是否本单位人 if (!obj.getOrgId().equals(user.getOrgId())){ msg="非本单位人员(编号:"+key+"),不得导入"; addErrorFormatLabel(bw, parsingLineNumber, keyCol, msg); isError = true; continue; } } key = obj.getPersonId(); } else if ("B".equals(keyDataType)) { OrgBO obj = SysCacheTool.findOrgByCode(key); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, keyCol, "记录错误,机构不存在"); isError = true; continue; } key = obj.getOrgId(); } else if ("C".equals(keyDataType)) { PostBO obj = SysCacheTool.findPost(key); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, keyCol, "记录错误,岗位不存在"); isError = true; continue; } key = obj.getPostId(); } else if ("D".equals(keyDataType)) { PartyBO obj = SysCacheTool.findParty(key); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, keyCol, "记录错误,党组织不存在"); isError = true; continue; } key = obj.getPartyId(); } } else { //出现空数据,停止读取 break; } int colNum = cols.length; String[] rs = new String[colNum]; boolean colError = false; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); for (int j = startCol; j < startCol + colNum; j++) { //start for String value = data[j]; String colDataType = cols[j - startCol].getItemDataType(); // 数据类型 String colLength=cols[j - startCol].getItemDataLength(); // 长度 String colPre=CommonFuns.filterNull(cols[j - startCol].getItemPrecision()); // 小数位 if (value != null && !"".equals(value.trim())) { // 唯一性校验 当前只校验A001 if (keyDataType.startsWith("A") && "1".equals(cols[j - startCol].getItemIsunique()) && cols[j - startCol].getItemId().startsWith("A001")){ String countSql="select count(*) from A001 where "+cols[j - startCol].getItemId()+"='"+value+"' and id<>'"+key+"'"; ActivePageAPI api=(ActivePageAPI)SysContext.getBean("sys_activePageApi"); if (api.queryForInt(countSql)>0){ addErrorFormatLabel(bw, parsingLineNumber, j, cols[j - startCol].getItemName()+"["+value+"]出现重复"); colError = true; } } if (InfoItemBO.DATA_TYPE_CODE.equals(colDataType)) { String code = value.trim(); if ("0".equals(codeType)){ // 按代码查询 CodeItemBO tmp = SysCacheTool.findCodeItem(cols[j - startCol].getItemCodeSet(), code); if (tmp == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "代码["+code+"]不存在"); colError = true; } else { rs[j - startCol] = tmp.getItemId(); } } else{ // 按描述查询 Hashtable itemhash=(Hashtable)htcode.get(cols[j - startCol].getItemCodeSet()); if (itemhash==null){ // 构建 itemhash=new Hashtable(); List codeitemlist=SysCacheTool.queryCodeItemBySetId(cols[j - startCol].getItemCodeSet()); for(int i=0;i<codeitemlist.size();i++){ CodeItemBO cb=(CodeItemBO)codeitemlist.get(i); itemhash.put(cb.getItemName(),cb.getItemId()); } htcode.put(cols[j - startCol].getItemCodeSet(),itemhash); } String newcode=(String)itemhash.get(code); if (newcode!=null){ rs[j - startCol]=newcode; } else{ addErrorFormatLabel(bw, parsingLineNumber, j, "描述["+code+"]不存在对应代码"); colError = true; } } } else if (InfoItemBO.DATA_TYPE_ORG.equals(colDataType)) { OrgBO obj = SysCacheTool.findOrgByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "机构["+value+"]不存在"); colError = true; } else { rs[j - startCol] = obj.getOrgId(); } } else if (InfoItemBO.DATA_TYPE_PERSON.equals(colDataType)) { PersonBO obj = SysCacheTool.findPersonByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "人员["+value+"]不存在"); colError = true; } else { rs[j - startCol] = obj.getPersonId(); } } else if (InfoItemBO.DATA_TYPE_POST.equals(colDataType)) { PostBO obj = SysCacheTool.findPostByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "岗位不存在"); colError = true; } else { rs[j - startCol] = obj.getPostId(); } } else if (InfoItemBO.DATA_TYPE_WAGE.equals(colDataType)) { OrgBO obj = SysCacheTool.findOrgByCode(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "发薪单位不存在"); colError = true; } else { WageUnitBO bo = SysCacheTool.findWageUnit(obj.getOrgId()); if (bo == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "发薪单位不存在"); colError = true; } else { rs[j - startCol] = bo.getUnitId(); } } } else if (InfoItemBO.DATA_TYPE_PARTY.equals(colDataType)) { PartyBO obj = SysCacheTool.findParty(value.trim()); if (obj == null) { addErrorFormatLabel(bw, parsingLineNumber, j, "党组织不存在"); colError = true; } else { rs[j - startCol] = obj.getPartyId(); } } else if (InfoItemBO.DATA_TYPE_INT.equals(colDataType)) { try { String tempStr = value.trim(); if (tempStr.indexOf(".") > 0) { String str = tempStr.substring(0, tempStr.indexOf(".")); Long.parseLong(str); rs[j - startCol] = str; } else { Long.parseLong(tempStr); rs[j - startCol] = tempStr; } } catch (NumberFormatException e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是整型数据"); } } else if (InfoItemBO.DATA_TYPE_FLOAT.equals(colDataType)) { try { Double.parseDouble(value.trim()); // 对小数格式处理 rs[j - startCol] = CommonFuns.formateItem(colDataType,colPre,value.trim()); } catch (NumberFormatException e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是小数数据"); } } else if (InfoItemBO.DATA_TYPE_DATE6.equals(colDataType)) { try { value = value.trim(); if (value.length() == 6) { if (Integer.parseInt(value.substring(0, 4)) > 1900 && Integer.parseInt(value.substring(4, 6)) <= 12) { value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + "01"; java.sql.Date dt = java.sql.Date.valueOf(value); value = sdf.format(dt); rs[j - startCol] = value; } else { throw new Exception(); } } else { throw new Exception(); } } catch (Exception e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是六位日期"); } } else if (InfoItemBO.DATA_TYPE_DATE.equals(colDataType)) { try { value = value.trim(); if (value.length() == 8) { if (Integer.parseInt(value.substring(0, 4)) > 1900 && Integer.parseInt(value.substring(4, 6)) <= 12 && Integer.parseInt(value.substring(6, 8)) <= 31) { value = value.substring(0, 4) + "-" + value.substring(4, 6) + "-" + value.substring(6, 8); java.sql.Date dt = java.sql.Date.valueOf(value); value = sdf1.format(dt); rs[j - startCol] = value; } else { throw new Exception(); } } else { throw new Exception(); } } catch (Exception e) { colError = true; addErrorFormatLabel(bw, parsingLineNumber, j, "数据格式错误,不是八位日期"); } } else { rs[j - startCol] = value.trim(); } } else {//end content not null rs[j - startCol] = ""; } }//end for // 处理多记录子集数据有多行的情况 key=key+"|"+String.valueOf(parsingLineNumber); if (!colError) impRs.put(key, rs); if (!isError && colError) isError = colError; } return !isError; } catch (SysException be) { throw be; } catch (Exception e) { throw new SysException("", "读取文件失败", e, FileUtil.class); } finally { try { if(br != null) br.close(); if(bw != null) { bw.close(); if ("1".equals(Constants.EXPORT_CSV2UTF8)){ FileUTF2ANSI(errorFile); } } if (delFile && !isError) { f.delete(); } } catch (Exception ea) { ea.printStackTrace(); } } } /** * 将错误信息记录到错误日志中 */ public static void addErrorFormatLabel(BufferedWriter bw, int row, int col, String error) { try { bw.write(FileUtil.addCsvField("第 " + row + " 行,第 " + (col+1) + " 列 " + error)); bw.newLine(); bw.flush(); } catch (IOException e) { e.printStackTrace(); } } /** * 导出文件 * path 导出文件存放绝对路径 * table 数据对象 * 返回 excel 导出文件名称(含绝对路径) */ public static void exportFile(String path, TableVO table, boolean delFile) throws SysException { exportFile( path, table, delFile,false); } public static void exportFile(String path, TableVO table, boolean delFile,boolean linkDept) throws SysException { try { File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } if (delFile) { delDiskFile(path); } File file = new File(path + "result.xls"); WritableWorkbook book = Workbook.createWorkbook(file); WritableSheet sheet = book.createSheet("sheet", 0); CellVO[] header = table.getHeader(); if (header != null && header.length > 0) { int count = header.length; int index=0; for (int n = 0; n < count; n++) { if (InfoItemBO.DATA_TYPE_CLOB.equals(header[n].getItemDataType()) || (InfoItemBO.PROPERTY_CONTROL_HIDE.equals(header[n].getItemProperty()) && !"B001003".equals(header[n].getItemId())) || header[n].getPermission() == CellVO.PERMISSION_REFUSE || !header[n].getSelected()){ } else { if (header[n].isShowId()) { Label label = new Label(index++, 0, header[n].getItemName()+"代码"); sheet.addCell(label); }else{ Label label = new Label(index++, 0, header[n].getItemName()); sheet.addCell(label); } } } } if (table.getRowData() != null && table.getRowData().length > 0) { int count = table.getRowData().length; for (int i = 0; i < count; i++) { RecordVO rvo = table.getRowData()[i]; CellVO[] data = rvo.getCell(); int size = data.length; int index=0; for (int n = 0; n < size; n++) { if (InfoItemBO.DATA_TYPE_CLOB.equals(header[n].getItemDataType()) || (InfoItemBO.PROPERTY_CONTROL_HIDE.equals(header[n].getItemProperty()) && !"B001003".equals(header[n].getItemId())) || header[n].getPermission() == CellVO.PERMISSION_REFUSE || !header[n].getSelected()){ } else { String value2 ; if (InfoItemBO.DATA_TYPE_CODE.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode(data[n].getItemCodeSet(), data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_ORG.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("OU", data[n].getValue()); if (linkDept && "A001705".equals(data[n].getItemId())) { // 部门显示处理 OrgBO bo = SysCacheTool.findOrgById(data[n].getValue()); OrgBO superbo=SysCacheTool.findOrgById(bo.getSuperId()); if (superbo!=null && OrgBO.DEPTTYPE.equals(superbo.getorgType())){ value2=CommonFuns.filterNull(superbo.getName()+bo.getName()); } } } else if (InfoItemBO.DATA_TYPE_POST.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("PO", data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_PERSON.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("PE", data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_PARTY.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("PA", data[n].getValue()); } else if (InfoItemBO.DATA_TYPE_WAGE.equals(data[n].getItemDataType())) { value2 = CodeUtil.interpertCode("WAGE", data[n].getValue()); } else { value2 = CommonFuns.filterNull(data[n].getValue()); } try { if (InfoItemBO.DATA_TYPE_INT.equals(data[n].getItemDataType()) || InfoItemBO.DATA_TYPE_FLOAT.equals(data[n].getItemDataType()) || InfoItemBO.DATA_TYPE_COMPUTE.equals(data[n].getItemDataType())) { Label label = new Label(index++, i+1, value2); sheet.addCell(label); } else { if (data[n].isShowId()) { String id = data[n].getValue(); if (CommonFuns.filterNull(id).length() > 4) id = id.substring(4, id.length()); Label label = new Label(index++, i+1, value2); sheet.addCell(label); } Label label = new Label(index++, i+1, value2); sheet.addCell(label); } } catch (Exception e) { Label label = new Label(index++, i+1, value2); sheet.addCell(label); } } } } } book.write(); book.close(); } catch (Exception e) { throw new SysException("", "导出excel错误", e, FileUtil.class); } } public static String exportBankXLSFile(String path, List bankitem, List values, boolean delFile) throws SysException { try { String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".xls"; String old = path +File.separator +"blank.xls"; String newfile = path +File.separator +filename; File ofile = new File(old); FileInputStream fin = new FileInputStream(ofile); FileOutputStream fout = new FileOutputStream(newfile); Workbook template = Workbook.getWorkbook(fin); WritableWorkbook xls = Workbook.createWorkbook(fout, template); WritableSheet sheet = xls.getSheet(0); // 标题 for(int i=0;i<bankitem.size();i++){ WageBankItemBO wi=(WageBankItemBO)bankitem.get(i); Label tlb2=new Label(i,0,wi.getPayName()); sheet.addCell(tlb2); } for(int i=0;i<values.size();i++){ String data[] = (String[]) values.get(i); for(int j=0;j<data.length;j++){ WageBankItemBO wb=(WageBankItemBO)bankitem.get(j); if (!"seq".equals(wb.getFieldID()) && !"1".equals(wb.getRadixPoint())){ // 不显示小数点 data[j]=data[j].replaceAll("\\.",""); } if ("yyyy-MM-dd".equals(wb.getDateFormat()) || "yyyyMMdd".equals(wb.getDateFormat()) || "yyyy-MM".equals(wb.getDateFormat()) || "yyyyMM".equals(wb.getDateFormat())){ data[j]=CommonFuns.getDateByFormat(data[j],wb.getDateFormat()); } if (wb.getBeforeChar()!=null){ //左补足 data[j]=org.apache.commons.lang.StringUtils.leftPad(data[j],Integer.parseInt(wb.getWidth()),wb.getBeforeChar()); } if (wb.getBehindChar()!=null){ //右补足 data[j]=org.apache.commons.lang.StringUtils.rightPad(data[j],Integer.parseInt(wb.getWidth()),wb.getBehindChar()); } if ("1".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && data[j].length()>Integer.parseInt(wb.getWidth())){ //左裁剪 data[j]=data[j].substring(0,Integer.parseInt(wb.getWidth())); } if ("0".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && data[j].length()>Integer.parseInt(wb.getWidth())){ //右裁剪 data[j]=data[j].substring(data[j].length()-Integer.parseInt(wb.getWidth())); } Label tlb=new Label(j,i+1,data[j]); sheet.addCell(tlb); } } xls.write(); xls.close(); template.close(); fin.close(); fout.close(); return filename; } catch (Exception ie) { throw new SysException("E1400003","读取文件错误!",ie,FileUtil.class); } } public static String exportBankTXTFile(String path, List bankitem, List values, boolean showTitle, boolean delFile) throws SysException { BufferedWriter bw = null; try { File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".txt"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); if (showTitle){ // 显示标题 bw.newLine(); //起新行 sb.delete(0,sb.length());//清空 for (int n = 0; n < bankitem.size(); n++) { WageBankItemBO wb=(WageBankItemBO)bankitem.get(n); String value2=wb.getPayName(); if (wb.getBeforeChar()!=null){ //左补足 value2=CommonFuns.leftPad(value2,Integer.parseInt(wb.getWidth())," "); } if (wb.getBehindChar()!=null){ //右补足 value2=CommonFuns.rightPad(value2,Integer.parseInt(wb.getWidth())," "); } if (wb.getSeparator()!=null){ value2+=" "; } sb.append(value2); } bw.write(sb.toString()); } int colNum = 0; int rowNum ; if (values != null && values.size() > 0) { rowNum = values.size(); for (int i = 0; i < rowNum; i++) { bw.newLine(); //起新行 sb.delete(0,sb.length());//清空 String data[] = (String[]) values.get(i); for (int n = 0; n < bankitem.size(); n++) { String value2=data[n]; WageBankItemBO wb=(WageBankItemBO)bankitem.get(n); if (!"1".equals(wb.getRadixPoint())){ // 不显示小数点 value2=value2.replaceAll("\\.",""); } if ("yyyy-MM-dd".equals(wb.getDateFormat()) || "yyyyMMdd".equals(wb.getDateFormat()) || "yyyy-MM".equals(wb.getDateFormat()) || "yyyyMM".equals(wb.getDateFormat())){ value2=CommonFuns.getDateByFormat(value2,wb.getDateFormat()); } if (wb.getBeforeChar()!=null){ //左补足 value2=CommonFuns.leftPad(value2,Integer.parseInt(wb.getWidth()),wb.getBeforeChar()); } if (wb.getBehindChar()!=null){ //右补足 value2=CommonFuns.rightPad(value2,Integer.parseInt(wb.getWidth()),wb.getBehindChar()); } if ("1".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && value2.length()>Integer.parseInt(wb.getWidth())){ //左裁剪 value2=value2.substring(0,Integer.parseInt(wb.getWidth())); } if ("0".equals(wb.getCutStyle()) && !"0".equals(wb.getWidth()) && value2.length()>Integer.parseInt(wb.getWidth())){ //右裁剪 value2=value2.substring(value2.length()-Integer.parseInt(wb.getWidth())); } if (wb.getSeparator()!=null){ if ("9".equals(wb.getSeparator())){ value2+="\t"; } else{ value2+=wb.getSeparator(); } } sb.append(value2); } bw.write(sb.toString()); } bw.newLine(); // 补上0d0a } return filename; } catch (Exception e) { throw new SysException("", "导出文件错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } } // path 路径 // sets集合名称 public static String exportInfoStru(String path,String []sets) throws SysException{ String filename=""; BufferedWriter bw=null; try{ File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".txt"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); sb.append(" ==系统结构说明== "); bw.write(sb.toString()); bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append(" 导出时间:"+CommonFuns.getSysDate("yyyy-MM-dd")); bw.write(sb.toString()); bw.newLine(); // 补上0d0a if (sets!=null){ for(int i=0;i<sets.length;i++){ bw.newLine(); // 补上0d0a InfoSetBO setbo=SysCacheTool.findInfoSet(sets[i]); sb.delete(0,sb.length());//清空 sb.append(setbo.getSetId()).append(setbo.getSetName()); bw.write(sb.toString()); bw.newLine(); // 补上0d0a bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append("字段\t名称\t描述\t类型\t关联代码\t用途"); bw.write(sb.toString()); bw.newLine(); // 补上0d0a List list=SysCacheTool.queryInfoItemBySetId(sets[i]); for(int j=0;j<list.size();j++){ InfoItemBO itembo=(InfoItemBO)list.get(j); if (InfoItemBO.PROPERTY_CONTROL_HIDE.equals(itembo.getItemProperty())) continue; sb.delete(0,sb.length());//清空 sb.append(itembo.getItemId()).append("\t").append(itembo.getItemName()).append("\t").append(CommonFuns.filterNull(itembo.getItemDesc())).append("\t").append(CommonFuns.filterNull(itembo.getItemCodeSet())).append("\t").append(CommonFuns.filterNull(itembo.getItemIssue())); bw.write(sb.toString()); bw.newLine(); // 补上0d0a } } } } catch(Exception e){ throw new SysException("", "导出文件错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } return filename; } public static String exportCodeInfo(String path,String []sets) throws SysException{ String filename=""; BufferedWriter bw=null; try{ File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".txt"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); sb.append(" ==系统代码说明== "); bw.write(sb.toString()); bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append(" 导出时间:"+CommonFuns.getSysDate("yyyy-MM-dd")); bw.write(sb.toString()); bw.newLine(); // 补上0d0a if (sets!=null){ for(int i=0;i<sets.length;i++){ bw.newLine(); // 补上0d0a CodeSetBO setbo=SysCacheTool.findCodeSet(sets[i]); sb.delete(0,sb.length());//清空 sb.append(setbo.getSetId()).append(setbo.getSetName()); bw.write(sb.toString()); bw.newLine(); // 补上0d0a bw.newLine(); // 补上0d0a sb.delete(0,sb.length());//清空 sb.append("唯一代码\t用户代码\t描述"); bw.write(sb.toString()); bw.newLine(); // 补上0d0a List list=SysCacheTool.queryCodeItemBySetId(sets[i]); for(int j=0;j<list.size();j++){ CodeItemBO itembo=(CodeItemBO)list.get(j); sb.delete(0,sb.length());//清空 sb.append(itembo.getItemId()).append("\t").append(itembo.getUserItemId()).append("\t").append(CommonFuns.filterNull(itembo.getItemName())); bw.write(sb.toString()); bw.newLine(); // 补上0d0a } } } } catch(Exception e){ throw new SysException("", "导出文件错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } return filename; } /** * 导出文件 * * path 导出文件存放绝对路径 * header 列头名称 * colDataType 列的数据类型。 数组长度和列头数组一致,且一一对应,数据类型和指标项数据类型一致。如果导出时不需要对数据进行处理,则为null。 * values 数据记录 。 每一条记录都是String[],长度和列头数组一致,且一一对应。 * 返回 excel 导出文件名称(不含路径) */ public static String exportFile(String path, String [] header, String [] colDataType, List values, boolean delFile) throws SysException { BufferedWriter bw = null; try { if (header != null && colDataType != null && colDataType.length != colDataType.length) { throw new SysException("数据类型和显示列头长度不匹配"); } File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".csv"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); int colNum = 0; int rowNum ; if (header != null && header.length > 0) { colNum = header.length; for (int n = 0; n < colNum; n++) { sb.append(FileUtil.addCsvField(header[n])); } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } if (values != null && values.size() > 0) { rowNum = values.size(); for (int i = 0; i < rowNum; i++) { bw.newLine(); //起新行 sb.delete(0,sb.length());//清空 String data[] = (String[]) values.get(i); for (int n = 0; n < colNum; n++) { String value2 ; if (colDataType != null) { if (InfoItemBO.DATA_TYPE_CODE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("", data[n]); } else if (InfoItemBO.DATA_TYPE_ORG.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("OU", data[n]); } else if (InfoItemBO.DATA_TYPE_POST.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PO", data[n]); } else if (InfoItemBO.DATA_TYPE_PERSON.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PE", data[n]); } else if (InfoItemBO.DATA_TYPE_PARTY.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PA", data[n]); } else if (InfoItemBO.DATA_TYPE_WAGE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("WAGE", data[n]); } else { value2 = CommonFuns.filterNull(data[n]); } try { if (InfoItemBO.DATA_TYPE_INT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_FLOAT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_COMPUTE.equals(colDataType[n])) { // jxl.write.Number labelN = new jxl.write.Number(n, i + 1, Double.parseDouble(value2)); // sheet.addCell(labelN); sb.append(FileUtil.addCsvField(value2)); } else { sb.append(FileUtil.addCsvField(value2)); } } catch (Exception e) { sb.append(FileUtil.addCsvField(value2)); } } else { value2 = CommonFuns.filterNull(data[n]); sb.append(FileUtil.addCsvField(value2)); } } //写单行文件 sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } } return filename; } catch (Exception e) { throw new SysException("", "导出excel错误", e, FileUtil.class); } finally { try { if (bw != null) bw.close(); } catch (Exception e) { e.printStackTrace(); } } } public static String exportFileWithOtherInfo(String path, List otherInfo, String [] header, String [] colDataType, List values, boolean delFile) throws SysException { BufferedWriter bw = null; try { if (header != null && colDataType != null && colDataType.length != colDataType.length) { throw new SysException("数据类型和显示列头长度不匹配"); } File dirPath = new File(path); if (!dirPath.exists()) { dirPath.mkdirs(); } String dir = path + File.separator; String filename ; if (delFile) { delDiskFile(path); } filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".csv"; File f = new File(dir + filename); bw = new BufferedWriter(new FileWriter(f)); StringBuffer sb = new StringBuffer(); int rowIndex = 0; if (otherInfo != null && otherInfo.size() > 0) { for (int i = 0; i < otherInfo.size(); i++) { String [] info = (String[]) otherInfo.get(i); if (info != null && info.length > 0) { for (int j = 0; j < info.length; j++) { sb.append(FileUtil.addCsvField(info[j])); } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); rowIndex++; } } } int colNum = 0; int rowNum ; if (header != null && header.length > 0) { colNum = header.length; bw.newLine(); sb.delete(0,sb.length()); for (int n = 0; n < colNum; n++) { sb.append(FileUtil.addCsvField(header[n])); } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } if (values != null && values.size() > 0) { rowNum = values.size(); for (int i = rowIndex; i < rowNum + rowIndex; i++) { String data[] = (String[]) values.get(i - rowIndex); for (int n = 0; n < colNum; n++) { String value2 ; if (colDataType != null) { if (InfoItemBO.DATA_TYPE_CODE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("", data[n]); } else if (InfoItemBO.DATA_TYPE_ORG.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("OU", data[n]); } else if (InfoItemBO.DATA_TYPE_POST.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PO", data[n]); } else if (InfoItemBO.DATA_TYPE_PERSON.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PE", data[n]); } else if (InfoItemBO.DATA_TYPE_PARTY.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("PA", data[n]); } else if (InfoItemBO.DATA_TYPE_WAGE.equals(colDataType[n])) { value2 = CodeUtil.interpertCode("WAGE", data[n]); } else { value2 = CommonFuns.filterNull(data[n]); } try { if (InfoItemBO.DATA_TYPE_INT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_FLOAT.equals(colDataType[n]) || InfoItemBO.DATA_TYPE_COMPUTE.equals(colDataType[n])) { // jxl.write.Number labelN = new jxl.write.Number(n, i + 1, Double.parseDouble(value2)); // sheet.addCell(labelN); sb.append(FileUtil.addCsvField(value2)); } else { sb.append(FileUtil.addCsvField(value2)); sb.append(FileUtil.addCsvField(value2)); } } catch (Exception e) { sb.append(FileUtil.addCsvField(value2)); sb.append(FileUtil.addCsvField(value2)); } } else { value2 = CommonFuns.filterNull(data[n]); sb.append(FileUtil.addCsvField(value2)); sb.append(FileUtil.addCsvField(value2)); } } sb.delete(sb.length()-1,sb.length()); bw.write(sb.toString()); } } return filename; } catch (Exception e) { e.printStackTrace(); throw new SysException("", "导出excel错误", e, FileUtil.class); }finally{ try { if(bw != null)bw.close(); }catch(Exception e){ e.printStackTrace(); } } } /** * 得到不含路径的文件名 或者 绝对路径 * * fullFileName 文件全名(带路径) * isPath 是否返回文件绝对路径 * 返回 文件名称 */ public static boolean fileExists(String fullFileName) throws SysException { File f = new File(fullFileName); if (f.exists()) { return true; } return false; } public static String getFileNameOrPath(String fullFileName, boolean isPath) throws SysException { if (fullFileName == null || "".equals(fullFileName)) { return ""; } File f = new File(fullFileName); if (f.exists()) { if (isPath) { f.getAbsolutePath(); } else { return f.getName(); } } else { throw new SysException("指定文件或目录不存在"); } return ""; } /** * 删除指定路径下的文件 导出的excel文件 * * path */ public static void delDiskFile(String path) { File dir = new File(path); String[] filename = dir.list(); if (filename == null) return; int count = filename.length; String date = CommonFuns.getSysDate("yyyyMMdd"); for (int i = 0; i < count; i++) { String str = filename[i]; if (str.indexOf(date) == -1 && str.indexOf("csc") > -1) { File f = new File(path + File.separator + filename[i]); f.delete(); } } } // 删除文件 public static void FileDelete(String src) throws IOException{ File f = new File(src); f.delete(); } // 拷贝文件 public static void FileCopy(String src, String dst) throws IOException{ InputStream in = new FileInputStream(new File(src)); OutputStream out = new FileOutputStream(new File(dst)); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0){ out.write(buf, 0, len); } in.close(); out.close(); } // 读入文件 public static byte[]ReadInFile(String fileName) throws IOException{ InputStream in = new FileInputStream(new File(fileName)); byte[] buf = new byte[in.available()]; in.read(buf); in.close(); return buf; } public static void createDirectory(String directory, String subDirectory) { String dir[]; File fl = new File(directory); try { if (!fl.exists()) fl.mkdir(); if (!"".equals(subDirectory)) { dir = subDirectory.replace('\\', '/').split("/"); for (int i = 0; i < dir.length; i++) { File subFile = new File(directory + File.separator + dir[i]); if (!subFile.exists()) subFile.mkdir(); directory += File.separator + dir[i]; } } } catch (Exception ex) { ex.printStackTrace(); } } // 返回解开文件名列表 public static List unZip(String zipFileName, String outputDirectory) throws Exception { List fileList=new ArrayList(); try { createDirectory(outputDirectory, ""); ZipFile zipFile = new ZipFile(zipFileName); Enumeration e = zipFile.getEntries(); while (e.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry)e.nextElement(); if (zipEntry.isDirectory()) { String name = zipEntry.getName(); name = name.substring(0, name.length() - 1); File f = new File(outputDirectory + File.separator + name); f.mkdir(); } else { String fileName = zipEntry.getName(); fileList.add(fileName); fileName = fileName.replace('\\', '/'); if (fileName.indexOf("/") != -1){ createDirectory(outputDirectory, fileName.substring(0, fileName.lastIndexOf("/"))); } File f = new File(outputDirectory + File.separator + zipEntry.getName()); f.createNewFile(); InputStream in = zipFile.getInputStream(zipEntry); FileOutputStream out=new FileOutputStream(f); byte[] by = new byte[1024]; int c; while ( (c = in.read(by)) != -1) { out.write(by, 0, c); } out.close(); in.close(); } } zipFile.close(); } catch (Exception ex) { ex.printStackTrace(); } return fileList; } public static void transPhotoToPNG(String oldfile,String newfile) throws Exception { RenderedImage img = ImageIO.read(new File(oldfile)); ImageIO.write(img, "png", new File(newfile)); } public static void GenSmallJPG(String oldfile,String newfile,float tagsize) throws Exception { java.io.File file = new java.io.File(oldfile); //读入刚才上传的文件 Image src = javax.imageio.ImageIO.read(file); //构造Image对象 int old_w = src.getWidth(null); //得到源图宽 int old_h = src.getHeight(null); int new_w = 0; int new_h = 0; //得到源图长 //int tempsize; float tempdouble; if (old_w > old_h) { tempdouble = old_w / tagsize; } else { tempdouble = old_h / tagsize; } new_w = Math.round(old_w / tempdouble); new_h = Math.round(old_h / tempdouble);//计算新图长宽 BufferedImage tag = new BufferedImage(new_w, new_h, BufferedImage.TYPE_INT_RGB); tag.getGraphics().drawImage(src, 0, 0, new_w, new_h,null); //绘制缩小后的图 FileOutputStream newimage = new FileOutputStream(newfile); //输出到文件流 JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(newimage); encoder.encode(tag); //近JPEG编码 newimage.close(); } public static void addPhotoToExcel(String excelFile,String pngfile,int row,int col) throws Exception { File file= new File(excelFile); Workbook wb = Workbook.getWorkbook(file); WritableWorkbook wwb = jxl.Workbook.createWorkbook(new File(excelFile),wb); WritableSheet sheet = wwb.getSheet(0); // 取得图片单元格大小(可能是合并的) int colspan=1; int rowspan=1; Range[] ranges =sheet.getMergedCells(); for(int i=0;i<ranges.length;i++){ if (ranges[i].getTopLeft().getRow()==row && ranges[i].getTopLeft().getColumn()==col){ colspan=ranges[i].getBottomRight().getColumn()-ranges[i].getTopLeft().getColumn()+1; rowspan=ranges[i].getBottomRight().getRow()-ranges[i].getTopLeft().getRow()+1; break; } } File fileImage=new File(pngfile); WritableImage image=new WritableImage(col,row,colspan,rowspan,fileImage);//从A1开始 跨2行3个单元格 sheet.addImage(image); wwb.write(); wwb.close(); wb.close(); } private static Document xml2FO(Document xml, String styleSheet) { DOMSource xmlDomSource = new DOMSource(xml); DOMResult domResult = new DOMResult(); Transformer transformer = getTransformer(styleSheet); try { transformer.transform(xmlDomSource, domResult); } catch (javax.xml.transform.TransformerException e) { return null; } return (Document) domResult.getNode(); } private static byte[] fo2PDF(Document foDocument) { DocumentInputSource fopInputSource = new DocumentInputSource( foDocument); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); Driver driver = new Driver(fopInputSource, out); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.run(); return out.toByteArray(); } catch (Exception ex) { return null; } } private static Transformer getTransformer(String styleSheet) { try { TransformerFactory tFactory = TransformerFactory.newInstance(); DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance(); dFactory.setNamespaceAware(true); DocumentBuilder dBuilder = dFactory.newDocumentBuilder(); Document xslDoc = dBuilder.parse(styleSheet); DOMSource xslDomSource = new DOMSource(xslDoc); return tFactory.newTransformer(xslDomSource); } catch (javax.xml.transform.TransformerException e) { e.printStackTrace(); return null; } catch (java.io.IOException e) { e.printStackTrace(); return null; } catch (javax.xml.parsers.ParserConfigurationException e) { e.printStackTrace(); return null; } catch (org.xml.sax.SAXException e) { e.printStackTrace(); return null; } } public static void Html2Pdf(String htmlFileName,String styleSheet) throws SysException { FileInputStream input = null; try { input = new FileInputStream(htmlFileName); } catch (java.io.FileNotFoundException e) { throw new SysException("File not found: " + htmlFileName); } Tidy tidy = new Tidy(); Document xmlDoc = tidy.parseDOM(input, null); Document foDoc = xml2FO(xmlDoc, styleSheet); String pdfFileName = htmlFileName.substring(0, htmlFileName.indexOf(".")) + ".pdf"; try { OutputStream pdf = new FileOutputStream(new File(pdfFileName)); pdf.write(fo2PDF(foDoc)); } catch (java.io.FileNotFoundException e) { throw new SysException("Error creating PDF: " + pdfFileName); } catch (java.io.IOException e) { throw new SysException("Error writing PDF: " + pdfFileName); } } public static void modifyExcelContent(WritableSheet sheet,WritableCell cell,String content)throws Exception { if (sheet==null || cell==null) return; CellFormat cf=cell.getCellFormat(); Label l=new Label(cell.getColumn(),cell.getRow(),CommonFuns.filterNull(content)); if (cf!=null) l.setCellFormat(cf); sheet.addCell(l); } public static String exportTaxRptFile(String path,List dataTable) throws SysException { try { String filename = CommonFuns.getSysDate("yyyyMMddHHmmss") + new Random().nextInt(10000) + ".xls"; String old = path +"file"+File.separator +"wage"+File.separator+"template"+File.separator+"TaxRpt.xls"; String newfile = path +"file" +File.separator +"wage"+File.separator+"download"+File.separator+filename; FileCopy(old,newfile); File fout = new File(newfile); Workbook fin=Workbook.getWorkbook(fout); WritableWorkbook xls = Workbook.createWorkbook(fout,fin); WritableSheet sheet = xls.getSheet(0); int row=0; int startrow=-1; int PersonCount=-1; int A815713=-1; int A815714=-1; int A815708=-1; int TaxFree=-1; int Rate=-1; int Deduction=-1; int orgrow=-1,orgcol=-1; int daterow=-1,datecol=-1; while(row<10){ for(int col=0;col<10;col++){ Cell cell=sheet.getCell(col,row); if ("[OrgName]".equals(cell.getContents())){ orgrow=row; orgcol=col; } else if ("[Date]".equals(cell.getContents())){ daterow=row; datecol=col; } else if ("[PersonCount]".equals(cell.getContents())){ PersonCount=col; } else if ("[A815713]".equals(cell.getContents())){ startrow=row; A815713=col; } else if ("[A815708]".equals(cell.getContents())){ A815708=col; } else if ("[A815714]".equals(cell.getContents())){ A815714=col; } else if ("[TaxFree]".equals(cell.getContents())){ TaxFree=col; } else if ("[Rate]".equals(cell.getContents())){ Rate=col; } else if ("[Deduction]".equals(cell.getContents())){ Deduction=col; } } row++; } // 有数据 if (dataTable!=null && dataTable.size()>0){ for(int k=0;k<dataTable.size();k++){ TableVO table=(TableVO)dataTable.get(k); String sheetName=""; if (table.getSetName()!=null && !"".equals(table.getSetName())){ sheetName=table.getSetName(); } else{ sheetName="sheet"+String.valueOf(k+1); } xls.copySheet(0,sheetName,k+1); sheet = xls.getSheet(k+1); if (orgrow!=-1 && orgcol!=-1) modifyExcelContent(sheet,sheet.getWritableCell(orgcol,orgrow),table.getSetName()); // 机构 if (daterow!=-1 && datecol!=-1) modifyExcelContent(sheet,sheet.getWritableCell(datecol,daterow),table.getTag()); // 时间 for(int j=0;j<table.getRowData().length;j++){ CellVO[]cells=table.getRowData()[j].getCell(); int pos=startrow+j; if (PersonCount!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(PersonCount,pos),cells[0].getValue()); } if (A815713!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(A815713,pos),cells[1].getValue()); } if (A815714!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(A815714,pos),cells[2].getValue()); } if (Rate!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(Rate,pos),cells[3].getValue()); } if (Deduction!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(Deduction,pos),cells[4].getValue()); } if (A815708!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(A815708,pos),cells[5].getValue()); } if (TaxFree!=-1){ modifyExcelContent(sheet,sheet.getWritableCell(TaxFree,pos),cells[6].getValue()); } } } xls.removeSheet(0); } xls.write(); xls.close(); return filename; } catch (Exception ie) { throw new SysException("E1400003","读取文件错误(run)",ie,FileUtil.class); } } public static void copyFile(String oldPath, String newPath) { try { int bytesum = 0; int byteread = 0; File oldfile = new File(oldPath); if (oldfile.exists()) { //文件存在时 FileInputStream inStream = new FileInputStream(oldPath); //读入原文件 FileOutputStream fs = new FileOutputStream(newPath); byte[] buffer = new byte[1444]; int length; while ( (byteread = inStream.read(buffer)) != -1) { bytesum += byteread; //字节数 文件大小 fs.write(buffer, 0, byteread); } inStream.close(); fs.close(); } } catch (Exception e) { e.printStackTrace(); } } public static void FileUTF2ANSI(String path){ String bak=path+".bak"; copyFile(path,bak); try{ Reader streamReader = new InputStreamReader(new FileInputStream(bak), "UTF-8"); BufferedReader reader = new BufferedReader(streamReader); String line = null; //BufferedWriter bw = new BufferedWriter(new FileWriter(path)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path),"GBK")); while ((line = reader.readLine()) != null) { bw.write(line); bw.newLine(); } reader.close(); bw.close(); } catch(Exception e){ } } public static void FileANSI2UTF(String path){ String bak=path+".bak"; copyFile(path,bak); try{ Reader streamReader = new InputStreamReader(new FileInputStream(bak),"GBK"); BufferedReader reader = new BufferedReader(streamReader); String line = null; BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path),"UTF-8")); while ((line = reader.readLine()) != null) { bw.write(line); bw.newLine(); } reader.close(); bw.close(); // 加上标示 } catch(Exception e){ } } /* window 运行无误 linu不行 public static void FileANSI2UTF(String path){ File f=new File(path); try{ byte[] bs=new byte[(int)f.length()]; FileInputStream fis=new FileInputStream(f); try{ int io=0; while(io<bs.length){ int n=fis.read(bs,io,bs.length-io); if(n<=0){ break; } } } finally{ fis.close(); } String s=new String(bs); bs=s.getBytes("UTF-8"); FileOutputStream fos=new FileOutputStream(f); try{ byte[] head=new byte[3]; head[0]=(byte)0xef; head[1]=(byte)0xbb; head[2]=(byte)0xbf; fos.write(head); fos.write(bs); } finally{ fos.close(); } } catch(Exception e){ } } */ }
95,629
0.437473
0.429338
2,070
42.363285
29.433695
295
false
false
0
0
0
0
0
0
0.760386
false
false
2
d3ea9bda2a2ce51e0b5bbb0fd4959de2973df930
36,825,049,596,357
ad669899637de9c2659b3adc9ef64c04e428841d
/Random_Code/BubbleSort.java
3de30404f91ccc1f3a6dc07a430cb81c9553321b
[]
no_license
devyash/Random_Java_codes
https://github.com/devyash/Random_Java_codes
6e9c20c86ae56b5c7c5b923958cab07f6758ef59
7dd11ad42841e71b46d5b51b60d04b415a3f812b
refs/heads/master
2020-04-16T15:53:45.074000
2017-02-09T01:08:08
2017-02-09T01:08:08
61,729,507
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; class BubbleSort{ public static void main(String[] args) { int n,l[]; BubbleSort obj1= new BubbleSort(); n=obj1.getN(); l=obj1.getL(n); l=obj1.sort(n,l); obj1.printl(l); } public int getN() { int n=0; try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the number of elements"); n= Integer.parseInt(br.readLine()); } catch(Exception e){ System.out.println("Some Shitty Exception(Mostly NumberFormatException)"); } return n; } public int[] getL(int n){ int[]l= new int[n]; try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the elements"); for(int i=0;i<n;i++){ l[i]= Integer.parseInt(br.readLine()); } } catch(NullPointerException e2){ System.out.println("NullPointerException"); } catch(IOException e){ System.out.println("IOException"); } return l; } public int[] sort(int n, int []l){ for(int i=0; i<=n-1;i++){ for (int j=0;j<n-1-i;j++) { if(l[j]<l[j+1]){ int temp=0; temp =l[j]; l[j]=l[j+1]; l[j+1]=temp; } } } return l; } public void printl(int []l){ System.out.println("List of elements:"); for (int i=0;i<l.length-1 ;i++ ) { System.out.println(l[i]); } } }
UTF-8
Java
1,364
java
BubbleSort.java
Java
[]
null
[]
import java.io.*; class BubbleSort{ public static void main(String[] args) { int n,l[]; BubbleSort obj1= new BubbleSort(); n=obj1.getN(); l=obj1.getL(n); l=obj1.sort(n,l); obj1.printl(l); } public int getN() { int n=0; try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the number of elements"); n= Integer.parseInt(br.readLine()); } catch(Exception e){ System.out.println("Some Shitty Exception(Mostly NumberFormatException)"); } return n; } public int[] getL(int n){ int[]l= new int[n]; try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the elements"); for(int i=0;i<n;i++){ l[i]= Integer.parseInt(br.readLine()); } } catch(NullPointerException e2){ System.out.println("NullPointerException"); } catch(IOException e){ System.out.println("IOException"); } return l; } public int[] sort(int n, int []l){ for(int i=0; i<=n-1;i++){ for (int j=0;j<n-1-i;j++) { if(l[j]<l[j+1]){ int temp=0; temp =l[j]; l[j]=l[j+1]; l[j+1]=temp; } } } return l; } public void printl(int []l){ System.out.println("List of elements:"); for (int i=0;i<l.length-1 ;i++ ) { System.out.println(l[i]); } } }
1,364
0.593842
0.580645
78
16.5
18.510391
77
false
false
0
0
0
0
0
0
2.461539
false
false
2
79d68a5ff74bd3a00e666c71e833bf6bf128afa8
1,932,735,317,805
5d4d86b4495ddff44211690c464687a1e911100c
/db/src/main/java/pond/db/sql/Sql.java
28623839f2d2eb78cc976c5d4384d79787e746d1
[ "Apache-2.0" ]
permissive
edwinyxc/pond
https://github.com/edwinyxc/pond
5b9e8469b9bd7e4ec963f1266bb9f9cc4f111fde
6084e434897924a2820e016ffaa5758b7cbdf195
refs/heads/master
2022-07-10T14:20:39.502000
2020-09-16T07:11:15
2020-09-16T07:11:15
23,340,385
5
1
Apache-2.0
false
2022-06-28T14:29:41
2014-08-26T05:51:09
2020-09-16T07:11:46
2022-06-28T14:29:38
6,125
4
1
7
JavaScript
false
false
package pond.db.sql; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pond.common.f.Tuple; import pond.db.Prototype; import pond.db.Record; import pond.db.sql.dialect.Dialect; import java.util.Map; import static pond.common.S.avoidNull; /** * Created by ed on 2014/4/28. */ public interface Sql { public static Logger logger = LoggerFactory.getLogger(Sql.class); <T> T dialect(Dialect d); static SqlInsert insert() { return new TSqlInsert(); } static SqlUpdate update(String table) { return new TSqlUpdate(table); } static SqlUpdate update(Class<? extends Record> aClass) { return new TSqlUpdate(Prototype.proto(aClass).table()); } static SqlSelect select(String... cols) { return new TSqlSelect(cols); } static SqlSelect selectFromRequest(Map<String, Object> req, Record model) { return Sql.select("*").from(model.table()).paginate(req).fields(req).filter(req, model).sort(req); } static SqlSelect selectFromRequest(Map<String, Object> req, Class<? extends Record> cls) { return selectFromRequest(req, Prototype.proto(cls)); } static SqlDelete delete() { return new TSqlDelete(); } String preparedSql(); Object[] params(); default public String debug() { Object[] p = params(); String[] _debug = new String[p.length]; for (int i = 0; i < p.length; i++) { _debug[i] = avoidNull(p[i], "").toString(); } return String.format("{ sql: %s, params: [ %s ]}", preparedSql(), String.join(",", _debug) ); } default Tuple<String, Object[]> tuple() { return Tuple.t2(preparedSql(), params()); } }
UTF-8
Java
1,679
java
Sql.java
Java
[ { "context": "static pond.common.S.avoidNull;\n\n/**\n * Created by ed on 2014/4/28.\n */\npublic interface Sql {\n\n publi", "end": 276, "score": 0.9516932368278503, "start": 274, "tag": "USERNAME", "value": "ed" } ]
null
[]
package pond.db.sql; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pond.common.f.Tuple; import pond.db.Prototype; import pond.db.Record; import pond.db.sql.dialect.Dialect; import java.util.Map; import static pond.common.S.avoidNull; /** * Created by ed on 2014/4/28. */ public interface Sql { public static Logger logger = LoggerFactory.getLogger(Sql.class); <T> T dialect(Dialect d); static SqlInsert insert() { return new TSqlInsert(); } static SqlUpdate update(String table) { return new TSqlUpdate(table); } static SqlUpdate update(Class<? extends Record> aClass) { return new TSqlUpdate(Prototype.proto(aClass).table()); } static SqlSelect select(String... cols) { return new TSqlSelect(cols); } static SqlSelect selectFromRequest(Map<String, Object> req, Record model) { return Sql.select("*").from(model.table()).paginate(req).fields(req).filter(req, model).sort(req); } static SqlSelect selectFromRequest(Map<String, Object> req, Class<? extends Record> cls) { return selectFromRequest(req, Prototype.proto(cls)); } static SqlDelete delete() { return new TSqlDelete(); } String preparedSql(); Object[] params(); default public String debug() { Object[] p = params(); String[] _debug = new String[p.length]; for (int i = 0; i < p.length; i++) { _debug[i] = avoidNull(p[i], "").toString(); } return String.format("{ sql: %s, params: [ %s ]}", preparedSql(), String.join(",", _debug) ); } default Tuple<String, Object[]> tuple() { return Tuple.t2(preparedSql(), params()); } }
1,679
0.645622
0.639071
72
22.319445
23.624861
102
false
false
0
0
0
0
0
0
0.569444
false
false
2
7c4198e998f77f3e4c8899f15120f6237e72ce91
24,086,176,641,063
119d466bbc0d93d1889b6aee92ea0aec9f1279aa
/core/src/tbs/switchylanes/animation/MovingText.java
920bcefbfcbac5699ce9bc5a295ec993889f518d
[]
no_license
Micnubinub/SwitchyLanes
https://github.com/Micnubinub/SwitchyLanes
0c34941aed94b656b5e6359d56ea05ebaa22a9da
0008e88a9bec46941309757992f096dc8d2554f2
refs/heads/master
2022-11-06T14:59:26.066000
2022-10-21T07:50:59
2022-10-21T07:50:59
52,811,469
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tbs.switchylanes.animation; import tbs.switchylanes.utility.GameObject; public class MovingText extends GameObject { public String text; public boolean active; public int alpha; public int alphaMin; public int speed; public int scaleInc; public MovingText() { this.text = ""; } public void update() { if (active) { yPos -= speed; alpha -= alphaMin; // scale += scaleInc; if (alpha <= 0) { alpha = 0; active = false; } } } public void activate(String text, int x, int y, int spd, int am, int a, int growth) { alphaMin = am; alpha = a; xPos = x; yPos = y; speed = spd; this.text = text; scaleInc = growth; active = true; } }
UTF-8
Java
697
java
MovingText.java
Java
[]
null
[]
package tbs.switchylanes.animation; import tbs.switchylanes.utility.GameObject; public class MovingText extends GameObject { public String text; public boolean active; public int alpha; public int alphaMin; public int speed; public int scaleInc; public MovingText() { this.text = ""; } public void update() { if (active) { yPos -= speed; alpha -= alphaMin; // scale += scaleInc; if (alpha <= 0) { alpha = 0; active = false; } } } public void activate(String text, int x, int y, int spd, int am, int a, int growth) { alphaMin = am; alpha = a; xPos = x; yPos = y; speed = spd; this.text = text; scaleInc = growth; active = true; } }
697
0.634146
0.631277
41
16
14.052168
72
false
false
0
0
0
0
0
0
2.146342
false
false
2
e17d5235d3a10934ed53f91a70c3d2e8089c22b7
14,688,788,199,104
a463f01c7236bd7d50276d66f0f7d8d9b1436e7d
/app/src/main/java/com/elasdka2/zar3tyseller/MyItems.java
e6fca93d834e49997c702cad02abb6029ac1051c
[]
no_license
Karim-Al-Sayed/Zar3tySeller
https://github.com/Karim-Al-Sayed/Zar3tySeller
e01f984a83fe6d98bb57976f4dd93d65144e09b3
425bde6f31aaa570f22cacd88c6e5cb00294643d
refs/heads/master
2020-06-24T20:02:33.059000
2019-08-03T16:08:55
2019-08-03T16:08:55
199,068,390
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.elasdka2.zar3tyseller; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.elasdka2.zar3tyseller.Adapters.ItemsAdapter; import com.elasdka2.zar3tyseller.Model.SellerItems; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link MyItems.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link MyItems#newInstance} factory method to * create an instance of this fragment. */ public class MyItems extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; //--------------------------------------------- Context context; String CurrentUserID; private DatabaseReference Sales_Ref; private FirebaseAuth SalesAuth; ArrayList<SellerItems> sellerlist; @BindView(R.id.seller_recycler_frag) RecyclerView seller_recycler; @BindView(R.id.no_item_img) ImageView no_item_img; @BindView(R.id.no_item_txt) TextView no_item_text; //--------------------------------------------- final int ITEM_LOAD_COUNT = 2; int total_item = 0, last_visible_item; boolean isLoading = false, isMaxData = false; String last_node = "", last_key = ""; ItemsAdapter adapter; //--------------------------------------------- public MyItems() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment MyItems. */ // TODO: Rename and change types and number of parameters public static MyItems newInstance(String param1, String param2) { MyItems fragment = new MyItems(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.my_items_frag, container, false); context = view.getContext(); ButterKnife.bind(this, view); sellerlist = new ArrayList<>(); SalesAuth = FirebaseAuth.getInstance(); Sales_Ref = FirebaseDatabase.getInstance().getReference("Sales"); CurrentUserID = FirebaseAuth.getInstance().getCurrentUser().getUid(); GridLayoutManager linearLayoutManager = new GridLayoutManager(context,2); seller_recycler.setLayoutManager(linearLayoutManager); Sales_Ref.child("Agriculture").orderByChild("User_ID").equalTo(CurrentUserID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { String item_title = dataSnapshot1.child("Item_Title").getValue(String.class); String item_price = dataSnapshot1.child("Item_Price").getValue(String.class); String item_description = dataSnapshot1.child("Item_Description").getValue(String.class); String category = dataSnapshot1.child("Category").getValue(String.class); // String item_quantity = dataSnapshot1.child("Item_Quantity").getValue().toString(); String id = dataSnapshot1.child("User_ID").getValue(String.class); String upload_date = dataSnapshot1.child("Upload_Date").getValue(String.class); String upload_date_show = dataSnapshot1.child("Upload_Date_To_Show").getValue(String.class); String img_uri = dataSnapshot1.child("Img_Uri").getValue(String.class); SellerItems items = new SellerItems(); items.setTitle(item_title); items.setPrice(item_price); items.setDescription(item_description); items.setCategory(category); items.setMaincategory("Agriculture"); items.setId(id); items.setDate(upload_date); items.setDate_to_show(upload_date_show); items.setImg_uri(img_uri); sellerlist.add(items); } ItemsAdapter adapter = new ItemsAdapter(sellerlist,getActivity()); seller_recycler.setAdapter(adapter); } @Override public void onCancelled(DatabaseError databaseError) { } }); Sales_Ref.child("Irrigation").orderByChild("User_ID").equalTo(CurrentUserID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { String item_title = dataSnapshot1.child("Item_Title").getValue(String.class); String item_price = dataSnapshot1.child("Item_Price").getValue(String.class); String item_description = dataSnapshot1.child("Item_Description").getValue(String.class); String category = dataSnapshot1.child("Category").getValue(String.class); // String item_quantity = dataSnapshot1.child("Item_Quantity").getValue().toString(); String id = dataSnapshot1.child("User_ID").getValue(String.class); String upload_date = dataSnapshot1.child("Upload_Date").getValue(String.class); String upload_date_show = dataSnapshot1.child("Upload_Date_To_Show").getValue(String.class); String img_uri = dataSnapshot1.child("Img_Uri").getValue(String.class); SellerItems items = new SellerItems(); items.setTitle(item_title); items.setPrice(item_price); items.setDescription(item_description); items.setCategory(category); items.setMaincategory("Irrigation"); items.setId(id); items.setDate(upload_date); items.setDate_to_show(upload_date_show); items.setImg_uri(img_uri); sellerlist.add(items); } ItemsAdapter adapter = new ItemsAdapter(sellerlist,getActivity()); seller_recycler.setAdapter(adapter); } @Override public void onCancelled(DatabaseError databaseError) { } }); Sales_Ref.child("Industrial_Agriculture").orderByChild("User_ID").equalTo(CurrentUserID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { String item_title = dataSnapshot1.child("Item_Title").getValue(String.class); String item_price = dataSnapshot1.child("Item_Price").getValue(String.class); String item_description = dataSnapshot1.child("Item_Description").getValue(String.class); String category = dataSnapshot1.child("Category").getValue(String.class); // String item_quantity = dataSnapshot1.child("Item_Quantity").getValue().toString(); String id = dataSnapshot1.child("User_ID").getValue(String.class); String upload_date = dataSnapshot1.child("Upload_Date").getValue(String.class); String upload_date_show = dataSnapshot1.child("Upload_Date_To_Show").getValue(String.class); String img_uri = dataSnapshot1.child("Img_Uri").getValue(String.class); SellerItems items = new SellerItems(); items.setTitle(item_title); items.setPrice(item_price); items.setDescription(item_description); items.setCategory(category); items.setMaincategory("Industrial_Agriculture"); items.setId(id); items.setDate(upload_date); items.setDate_to_show(upload_date_show); items.setImg_uri(img_uri); sellerlist.add(items); } ItemsAdapter adapter = new ItemsAdapter(sellerlist,getActivity()); seller_recycler.setAdapter(adapter); } @Override public void onCancelled(DatabaseError databaseError) { } }); /*Thread thread = new Thread(() -> { if (sellerlist.size() == 0){ seller_recycler.setVisibility(View.GONE); no_item_img.setVisibility(View.VISIBLE); no_item_text.setVisibility(View.VISIBLE); }else { seller_recycler.setVisibility(View.VISIBLE); no_item_img.setVisibility(View.GONE); no_item_text.setVisibility(View.GONE); } }); thread.start();*/ return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } @Override public void onResume() { super.onResume(); getView().setFocusableInTouchMode(true); getView().requestFocus(); getView().setOnKeyListener((v, keyCode, event) -> { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { Personal fragment = new Personal(); FragmentTransaction fragmentTransaction1 = getFragmentManager().beginTransaction(); fragmentTransaction1.replace(R.id.Frame_Content, fragment, "Personal"); fragmentTransaction1.commit(); return true; } return false; }); } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Context context) { super.onAttach(context); } @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
UTF-8
Java
13,624
java
MyItems.java
Java
[ { "context": "package com.elasdka2.zar3tyseller;\n\nimport android.content.Context;\nim", "end": 20, "score": 0.6513044238090515, "start": 14, "tag": "USERNAME", "value": "asdka2" }, { "context": "x.recyclerview.widget.RecyclerView;\n\nimport com.elasdka2.zar3tyseller.Adapters.ItemsA...
null
[]
package com.elasdka2.zar3tyseller; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.elasdka2.zar3tyseller.Adapters.ItemsAdapter; import com.elasdka2.zar3tyseller.Model.SellerItems; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link MyItems.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link MyItems#newInstance} factory method to * create an instance of this fragment. */ public class MyItems extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; //--------------------------------------------- Context context; String CurrentUserID; private DatabaseReference Sales_Ref; private FirebaseAuth SalesAuth; ArrayList<SellerItems> sellerlist; @BindView(R.id.seller_recycler_frag) RecyclerView seller_recycler; @BindView(R.id.no_item_img) ImageView no_item_img; @BindView(R.id.no_item_txt) TextView no_item_text; //--------------------------------------------- final int ITEM_LOAD_COUNT = 2; int total_item = 0, last_visible_item; boolean isLoading = false, isMaxData = false; String last_node = "", last_key = ""; ItemsAdapter adapter; //--------------------------------------------- public MyItems() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment MyItems. */ // TODO: Rename and change types and number of parameters public static MyItems newInstance(String param1, String param2) { MyItems fragment = new MyItems(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.my_items_frag, container, false); context = view.getContext(); ButterKnife.bind(this, view); sellerlist = new ArrayList<>(); SalesAuth = FirebaseAuth.getInstance(); Sales_Ref = FirebaseDatabase.getInstance().getReference("Sales"); CurrentUserID = FirebaseAuth.getInstance().getCurrentUser().getUid(); GridLayoutManager linearLayoutManager = new GridLayoutManager(context,2); seller_recycler.setLayoutManager(linearLayoutManager); Sales_Ref.child("Agriculture").orderByChild("User_ID").equalTo(CurrentUserID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { String item_title = dataSnapshot1.child("Item_Title").getValue(String.class); String item_price = dataSnapshot1.child("Item_Price").getValue(String.class); String item_description = dataSnapshot1.child("Item_Description").getValue(String.class); String category = dataSnapshot1.child("Category").getValue(String.class); // String item_quantity = dataSnapshot1.child("Item_Quantity").getValue().toString(); String id = dataSnapshot1.child("User_ID").getValue(String.class); String upload_date = dataSnapshot1.child("Upload_Date").getValue(String.class); String upload_date_show = dataSnapshot1.child("Upload_Date_To_Show").getValue(String.class); String img_uri = dataSnapshot1.child("Img_Uri").getValue(String.class); SellerItems items = new SellerItems(); items.setTitle(item_title); items.setPrice(item_price); items.setDescription(item_description); items.setCategory(category); items.setMaincategory("Agriculture"); items.setId(id); items.setDate(upload_date); items.setDate_to_show(upload_date_show); items.setImg_uri(img_uri); sellerlist.add(items); } ItemsAdapter adapter = new ItemsAdapter(sellerlist,getActivity()); seller_recycler.setAdapter(adapter); } @Override public void onCancelled(DatabaseError databaseError) { } }); Sales_Ref.child("Irrigation").orderByChild("User_ID").equalTo(CurrentUserID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { String item_title = dataSnapshot1.child("Item_Title").getValue(String.class); String item_price = dataSnapshot1.child("Item_Price").getValue(String.class); String item_description = dataSnapshot1.child("Item_Description").getValue(String.class); String category = dataSnapshot1.child("Category").getValue(String.class); // String item_quantity = dataSnapshot1.child("Item_Quantity").getValue().toString(); String id = dataSnapshot1.child("User_ID").getValue(String.class); String upload_date = dataSnapshot1.child("Upload_Date").getValue(String.class); String upload_date_show = dataSnapshot1.child("Upload_Date_To_Show").getValue(String.class); String img_uri = dataSnapshot1.child("Img_Uri").getValue(String.class); SellerItems items = new SellerItems(); items.setTitle(item_title); items.setPrice(item_price); items.setDescription(item_description); items.setCategory(category); items.setMaincategory("Irrigation"); items.setId(id); items.setDate(upload_date); items.setDate_to_show(upload_date_show); items.setImg_uri(img_uri); sellerlist.add(items); } ItemsAdapter adapter = new ItemsAdapter(sellerlist,getActivity()); seller_recycler.setAdapter(adapter); } @Override public void onCancelled(DatabaseError databaseError) { } }); Sales_Ref.child("Industrial_Agriculture").orderByChild("User_ID").equalTo(CurrentUserID).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { String item_title = dataSnapshot1.child("Item_Title").getValue(String.class); String item_price = dataSnapshot1.child("Item_Price").getValue(String.class); String item_description = dataSnapshot1.child("Item_Description").getValue(String.class); String category = dataSnapshot1.child("Category").getValue(String.class); // String item_quantity = dataSnapshot1.child("Item_Quantity").getValue().toString(); String id = dataSnapshot1.child("User_ID").getValue(String.class); String upload_date = dataSnapshot1.child("Upload_Date").getValue(String.class); String upload_date_show = dataSnapshot1.child("Upload_Date_To_Show").getValue(String.class); String img_uri = dataSnapshot1.child("Img_Uri").getValue(String.class); SellerItems items = new SellerItems(); items.setTitle(item_title); items.setPrice(item_price); items.setDescription(item_description); items.setCategory(category); items.setMaincategory("Industrial_Agriculture"); items.setId(id); items.setDate(upload_date); items.setDate_to_show(upload_date_show); items.setImg_uri(img_uri); sellerlist.add(items); } ItemsAdapter adapter = new ItemsAdapter(sellerlist,getActivity()); seller_recycler.setAdapter(adapter); } @Override public void onCancelled(DatabaseError databaseError) { } }); /*Thread thread = new Thread(() -> { if (sellerlist.size() == 0){ seller_recycler.setVisibility(View.GONE); no_item_img.setVisibility(View.VISIBLE); no_item_text.setVisibility(View.VISIBLE); }else { seller_recycler.setVisibility(View.VISIBLE); no_item_img.setVisibility(View.GONE); no_item_text.setVisibility(View.GONE); } }); thread.start();*/ return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } @Override public void onResume() { super.onResume(); getView().setFocusableInTouchMode(true); getView().requestFocus(); getView().setOnKeyListener((v, keyCode, event) -> { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { Personal fragment = new Personal(); FragmentTransaction fragmentTransaction1 = getFragmentManager().beginTransaction(); fragmentTransaction1.replace(R.id.Frame_Content, fragment, "Personal"); fragmentTransaction1.commit(); return true; } return false; }); } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Context context) { super.onAttach(context); } @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
13,624
0.581254
0.576629
310
42.948387
33.546558
162
false
false
0
0
0
0
0
0
0.574194
false
false
2
c0f87a9ff1f399127b4d7a65a7932aa6f1009cb3
31,404,800,909,549
7a1f9972e1d888e291eb820503cded4b3964a022
/controller/src/main/java/com/mic/app/controller/AccountController.java
cdab6d63e32b8c103531bed333389e649ea75053
[]
no_license
wskardelsharpeye/micapp
https://github.com/wskardelsharpeye/micapp
c5961bcf6bdb6096ee85715ca7711105310ebf3b
0f5dcf6310f1d5e1fb7ae3fc06a2c2293bac5aca
refs/heads/master
2021-01-20T04:58:14.898000
2017-09-16T15:18:38
2017-09-16T15:18:38
101,403,074
0
0
null
false
2017-09-16T15:18:39
2017-08-25T12:46:13
2017-08-25T12:58:01
2017-09-16T15:18:39
44
0
0
0
Java
null
null
package com.mic.app.controller; import com.mic.app.service.AccountService; import com.mic.app.model.Account; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping(value = "/account") public class AccountController { @Autowired private AccountService accountService; @RequestMapping(value = "/save" , method = RequestMethod.POST) public Account register(@RequestBody Account account) { return accountService.register(account); } @RequestMapping(value = "/login" , method = RequestMethod.GET) public Account login(@RequestParam(value = "account") String account, @RequestParam(value = "password") String password) { Account aAccount = accountService.login(account,password); if(null == aAccount) return new Account(); else return aAccount; } @RequestMapping(value = "/findAll" , method = RequestMethod.GET) public List<Account> login() { return accountService.findAll(); } }
UTF-8
Java
1,106
java
AccountController.java
Java
[]
null
[]
package com.mic.app.controller; import com.mic.app.service.AccountService; import com.mic.app.model.Account; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping(value = "/account") public class AccountController { @Autowired private AccountService accountService; @RequestMapping(value = "/save" , method = RequestMethod.POST) public Account register(@RequestBody Account account) { return accountService.register(account); } @RequestMapping(value = "/login" , method = RequestMethod.GET) public Account login(@RequestParam(value = "account") String account, @RequestParam(value = "password") String password) { Account aAccount = accountService.login(account,password); if(null == aAccount) return new Account(); else return aAccount; } @RequestMapping(value = "/findAll" , method = RequestMethod.GET) public List<Account> login() { return accountService.findAll(); } }
1,106
0.701627
0.701627
36
29.722221
25.94718
78
false
false
0
0
0
0
0
0
0.472222
false
false
2
a4dcb834cc769f821a96c6aaf0a907956fdfa2e8
33,165,737,496,086
b9c80f1c2e72a08b15a01c1ecab69602a10a33ce
/src/main/java/seedu/address/model/Module.java
2fea3087d0ed599a6cc743520ddbd63a201eb3b7
[ "MIT" ]
permissive
m-aslam-mj2/main
https://github.com/m-aslam-mj2/main
a29c8244d0e23ddf55f0374e4ecc5498b6ecdbaf
3dcfb3b359ea6178beebd280012ad7aba3156e6a
refs/heads/master
2020-03-28T22:37:32.126000
2018-10-03T18:25:54
2018-10-03T18:25:54
149,245,722
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package seedu.address.model; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Represents a module in Trajectory */ @XmlRootElement(name = "module") public class Module { @XmlElement(name = "moduleName", required = true, nillable = true) private String name; @XmlElement(name = "moduleCode", required = true, nillable = true) private String code; public Module() { } public Module(String name, String code) { this.name = name; this.code = code; } public String getModuleName() { return this.name; } public String getModuleCode() { return this.code; } }
UTF-8
Java
692
java
Module.java
Java
[]
null
[]
package seedu.address.model; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Represents a module in Trajectory */ @XmlRootElement(name = "module") public class Module { @XmlElement(name = "moduleName", required = true, nillable = true) private String name; @XmlElement(name = "moduleCode", required = true, nillable = true) private String code; public Module() { } public Module(String name, String code) { this.name = name; this.code = code; } public String getModuleName() { return this.name; } public String getModuleCode() { return this.code; } }
692
0.650289
0.650289
32
20.625
19.889931
70
false
false
0
0
0
0
0
0
0.4375
false
false
2
8b96108b8c68182d80418a76a640fbdd0e7d56ef
31,731,218,418,589
0bf8b32996528305bf6ce81e1d9d6312851f307c
/src/Play.java
59a5d20bf8ab01c146670bb3475771171457ef70
[]
no_license
EminaMuratovic/FlappyBird
https://github.com/EminaMuratovic/FlappyBird
2f24d0a9effc6e7db79e2f638fc08e019b857e2e
8e600a462856ddf2667373da3fe7c2453a90b624
refs/heads/master
2021-03-12T23:40:55.421000
2014-12-30T16:00:33
2014-12-30T16:00:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.JFrame; public class Play { public static void main(String[] args) { JFrame game = new JFrame("JUMPER"); game.setSize(500,500); game.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GameGraphics graphicElements = new GameGraphics(500, 500); game.setContentPane(graphicElements); game.setVisible(true); graphicElements.requestFocus(false); } }
UTF-8
Java
377
java
Play.java
Java
[]
null
[]
import javax.swing.JFrame; public class Play { public static void main(String[] args) { JFrame game = new JFrame("JUMPER"); game.setSize(500,500); game.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GameGraphics graphicElements = new GameGraphics(500, 500); game.setContentPane(graphicElements); game.setVisible(true); graphicElements.requestFocus(false); } }
377
0.755968
0.724138
17
21.17647
19.629616
59
false
false
0
0
0
0
0
0
1.176471
false
false
2
9f030e5a0dbb04aa253b1547e713d31c80549faa
30,391,188,617,794
79a1f4b604f9023afce1744fb79806c7a7356313
/src/app/src/main/java/de/uni/oldenburg/dyspuzzle/layoutGenerator/CellType.java
abf52b3873e217a1b2a60608f4f8fde7b883f8ba
[ "MIT" ]
permissive
NoelleRousselle/DysPuzzle
https://github.com/NoelleRousselle/DysPuzzle
141fc64e7d7ca44fa94dbf72c837d867557033ea
a209a9b4e67d6078a6dd8d6e8a7c9548e0d56daa
refs/heads/master
2020-04-09T05:58:03.271000
2019-07-04T11:08:32
2019-07-04T11:08:32
160,089,076
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.uni.oldenburg.dyspuzzle.layoutGenerator; public enum CellType { START, DESTINATION, SPACER }
UTF-8
Java
117
java
CellType.java
Java
[]
null
[]
package de.uni.oldenburg.dyspuzzle.layoutGenerator; public enum CellType { START, DESTINATION, SPACER }
117
0.726496
0.726496
7
15.714286
16.095379
51
false
false
0
0
0
0
0
0
0.428571
false
false
2
95ee7bab8aca5b2c7f8afba52d8851e94da547e5
26,568,667,738,290
1f334a83ffa3b0120a28d6ef9d822a85c38ae1d5
/Frame Application Framework/src/java/ge/framework/application/frame/core/command/properties/PropertiesCommandBar.java
f1225efcacdff595d7bb5158b5bfca13f3ac1633
[]
no_license
gevison/ApplicationFramework
https://github.com/gevison/ApplicationFramework
b725017c7ad2562321324a8ebc21856a4729e6b7
c481f2a35ec1b40f04112b53ec5d963b33c83f8f
refs/heads/master
2021-01-25T07:28:21.889000
2015-02-12T16:08:22
2015-02-12T16:08:22
12,293,432
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ge.framework.application.frame.core.command.properties; import com.jidesoft.action.DockableBarContext; import ge.framework.application.frame.core.command.ApplicationPropertiesCommandButton; import ge.framework.application.frame.core.ApplicationFrame; import ge.framework.application.frame.core.command.ApplicationCommandBar; import ge.utils.bundle.Resources; /** * Created with IntelliJ IDEA. * User: evison_g * Date: 01/08/13 * Time: 13:29 */ public abstract class PropertiesCommandBar extends ApplicationCommandBar { private static final Resources resources = Resources.getInstance( "ge.framework.frame.core" ); protected ApplicationFrame applicationFrame; private ApplicationPropertiesCommandButton applicationPropertiesCommandButton; public PropertiesCommandBar( ApplicationFrame applicationFrame ) { super( "propertiesCommandBar" ); this.applicationFrame = applicationFrame; } public final void initialise() { setTitle( resources.getResourceString( PropertiesCommandBar.class, "label" ) ); setInitSide( DockableBarContext.DOCK_SIDE_NORTH ); setAllowedDockSides( DockableBarContext.DOCK_SIDE_NORTH ); setFloatable( true ); setHidable( true ); setInitIndex( 1 ); setInitSubindex( 1 ); setChevronAlwaysVisible( false ); setStretch( false ); applicationPropertiesCommandButton = new ApplicationPropertiesCommandButton( applicationFrame ); add( applicationPropertiesCommandButton ); initialisePropertiesCommandBar(); } protected abstract void initialisePropertiesCommandBar(); }
UTF-8
Java
1,667
java
PropertiesCommandBar.java
Java
[ { "context": "rces;\n\n/**\n * Created with IntelliJ IDEA.\n * User: evison_g\n * Date: 01/08/13\n * Time: 13:29\n */\npublic abstr", "end": 421, "score": 0.9996207356452942, "start": 413, "tag": "USERNAME", "value": "evison_g" } ]
null
[]
package ge.framework.application.frame.core.command.properties; import com.jidesoft.action.DockableBarContext; import ge.framework.application.frame.core.command.ApplicationPropertiesCommandButton; import ge.framework.application.frame.core.ApplicationFrame; import ge.framework.application.frame.core.command.ApplicationCommandBar; import ge.utils.bundle.Resources; /** * Created with IntelliJ IDEA. * User: evison_g * Date: 01/08/13 * Time: 13:29 */ public abstract class PropertiesCommandBar extends ApplicationCommandBar { private static final Resources resources = Resources.getInstance( "ge.framework.frame.core" ); protected ApplicationFrame applicationFrame; private ApplicationPropertiesCommandButton applicationPropertiesCommandButton; public PropertiesCommandBar( ApplicationFrame applicationFrame ) { super( "propertiesCommandBar" ); this.applicationFrame = applicationFrame; } public final void initialise() { setTitle( resources.getResourceString( PropertiesCommandBar.class, "label" ) ); setInitSide( DockableBarContext.DOCK_SIDE_NORTH ); setAllowedDockSides( DockableBarContext.DOCK_SIDE_NORTH ); setFloatable( true ); setHidable( true ); setInitIndex( 1 ); setInitSubindex( 1 ); setChevronAlwaysVisible( false ); setStretch( false ); applicationPropertiesCommandButton = new ApplicationPropertiesCommandButton( applicationFrame ); add( applicationPropertiesCommandButton ); initialisePropertiesCommandBar(); } protected abstract void initialisePropertiesCommandBar(); }
1,667
0.742651
0.735453
51
31.686274
29.280582
104
false
false
0
0
0
0
0
0
0.490196
false
false
2
6229c8b15a1d8d08c62f4fee56ae0baaa2b954b5
14,147,622,308,594
7bb52ad1293d5d056262deae39a8d38ae3f24ad3
/app/src/main/java/com/psut/pool/Adapters/OffersAdapter.java
9e7bb93e89c021dc568018e2d396226147ae0a8a
[]
no_license
MrMoon/PSUTPool
https://github.com/MrMoon/PSUTPool
fae3160b4518e671838d960fcbf466b69b07fe94
3776fe50cc258ab43a0fc5baf43f512087b6d69d
refs/heads/master
2023-06-18T05:47:51.485000
2021-07-06T17:46:18
2021-07-06T17:46:18
177,808,663
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.psut.pool.Adapters; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.psut.pool.Models.Offers; import com.psut.pool.R; import java.util.ArrayList; public class OffersAdapter extends ArrayAdapter<Offers> { //Global Variables and Objects: private Context context; private ArrayList<Offers> offers = new ArrayList<>(); public OffersAdapter(Context context, int resource, Context context1, ArrayList<Offers> offers) { super(context, 0, resource); this.context = context1; this.offers = offers; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.layout_listview, parent, false); Offers offer = offers.get(position); ImageView imageView = view.findViewById(R.id.imgListView); imageView.setImageResource(offer.getImageView()); TextView textView = view.findViewById(R.id.txtListView); textView.setText(offer.getTitle()); } return view; } }
UTF-8
Java
1,451
java
OffersAdapter.java
Java
[]
null
[]
package com.psut.pool.Adapters; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.psut.pool.Models.Offers; import com.psut.pool.R; import java.util.ArrayList; public class OffersAdapter extends ArrayAdapter<Offers> { //Global Variables and Objects: private Context context; private ArrayList<Offers> offers = new ArrayList<>(); public OffersAdapter(Context context, int resource, Context context1, ArrayList<Offers> offers) { super(context, 0, resource); this.context = context1; this.offers = offers; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.layout_listview, parent, false); Offers offer = offers.get(position); ImageView imageView = view.findViewById(R.id.imgListView); imageView.setImageResource(offer.getImageView()); TextView textView = view.findViewById(R.id.txtListView); textView.setText(offer.getTitle()); } return view; } }
1,451
0.702963
0.700896
47
29.872341
26.299112
101
false
false
0
0
0
0
0
0
0.744681
false
false
2
7b49147b3fa60ef4d1f15c3081bc912bb4b38c80
180,388,684,963
d4d3fc4fbc3a734081b1f100dd1c98fe011f9b05
/src/java/Assignment2/java/Reciever.java
c7929ee9afc7581fac16be2be7d371b124f2b8a5
[]
no_license
vkunal1996/ServletExamples
https://github.com/vkunal1996/ServletExamples
b359ed8ba8b369cb62d5b948bca7f0b512444638
3a10a3224f1125001965c0b5cf545053ad6711e7
refs/heads/master
2023-04-15T21:15:43.464000
2020-10-14T19:48:48
2020-10-14T19:48:48
103,963,513
0
0
null
false
2021-04-26T17:20:28
2017-09-18T16:24:07
2020-10-14T19:48:56
2021-04-26T17:20:28
288,674
0
0
2
Java
false
false
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import javax.swing.JOptionPane; public class Reciever extends HttpServlet { Connection cn; PreparedStatement st; ResultSet rs; String sql; public void MyConnection() { try { Class.forName("com.mysql.jdbc.Driver"); cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/Assignment2?autoReconnect=true&useSSL=true","scarlet","Lmno1996&&"); }catch(Exception e) { System.exit(0); } } public void Close()throws Exception { cn.close(); } public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { PrintWriter pw; res.setContentType("text/html"); pw=res.getWriter(); pw.print("<html>"); pw.print("<head>"); pw.print("<title>Welcome to Servlet Example</title></head>"); pw.print("<body bgcolor='yellow' text='navy'>"); pw.print("<center>"); pw.print("<h1><B>User Registration Form <B></h1><br>"); pw.print("<table border=2.0 cellspacing=4.0>"); pw.print("<tr>"); pw.print("<th align=left>UserName :"); String un=req.getParameter("username"); pw.print("</th>"); pw.print("<td>"); pw.print("<input type=text value="+un+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Password :"); pw.print("</th>"); pw.print("<td>"); String p=req.getParameter("userpass"); pw.print("<input type=text value="+p+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<td align=left> Sex"); pw.print("</td>"); pw.print("<td>"); String sex=req.getParameter("sex"); pw.print("<input type=text value="+sex+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<td align=left>Marital Status"); pw.print("</td>"); pw.print("<td>"); String status=req.getParameter("status"); pw.print("<input type=text value="+status+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Father Name :"); pw.print("</th>"); pw.print("<td>"); String fname=req.getParameter("fname"); pw.print("<input type=text value="+fname+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Mother Name :"); pw.print("</th>"); pw.print("<td>"); String mname=req.getParameter("mname"); pw.print("<input type=text value="+mname+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr rowspan=5>"); pw.print("<th align=left>Address:"); pw.print("</th>"); pw.print("<td>"); String address=req.getParameter("address"); pw.print("<textarea rows=5 cols=29 placeholder="+address+" disabled></textarea>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Contact Number :"); pw.print("</th>"); pw.print("<td>"); String contact=req.getParameter("contact"); pw.print("<input type=text value="+contact+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<td>"); String options =req.getParameter("options"); pw.print(""+options); pw.print("</td>"); pw.print("<td>"); String hint=req.getParameter("hintpassword"); pw.print("<input type=text value="+hint+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("</table>"); pw.print("</center>"); pw.print("</form>"); MyConnection(); try { sql="select * from UserInfo where Username=?"; st=cn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); st.setString(1,un); rs=st.executeQuery(); rs.last(); if(rs.getRow()==0) { sql="Insert into UserInfo values(?,?,?,?,?,?,?,?,?,?)"; st=cn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); st.setString(1,un); st.setString(2,p); st.setString(3,sex); st.setString(4,status); st.setString(5,fname); st.setString(6,mname); st.setString(7,address); st.setString(8,contact); st.setString(9,options); st.setString(10,hint); st.executeUpdate(); pw.print("<alert type='sucess'>UserDetails Inserted succesfully</alert>"); Close(); } else { pw.print("<alert type='sucess'>UserDetails not Inserted succesfully</alert>"); } }catch(Exception e){} pw.print("</body>"); pw.print("</html>"); } }
UTF-8
Java
7,469
java
Reciever.java
Java
[ { "context": " String un=req.getParameter(\"username\");\r\n pw.print(\"</th>\")", "end": 1428, "score": 0.9993945956230164, "start": 1420, "tag": "USERNAME", "value": "username" } ]
null
[]
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import javax.swing.JOptionPane; public class Reciever extends HttpServlet { Connection cn; PreparedStatement st; ResultSet rs; String sql; public void MyConnection() { try { Class.forName("com.mysql.jdbc.Driver"); cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/Assignment2?autoReconnect=true&useSSL=true","scarlet","Lmno1996&&"); }catch(Exception e) { System.exit(0); } } public void Close()throws Exception { cn.close(); } public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException { PrintWriter pw; res.setContentType("text/html"); pw=res.getWriter(); pw.print("<html>"); pw.print("<head>"); pw.print("<title>Welcome to Servlet Example</title></head>"); pw.print("<body bgcolor='yellow' text='navy'>"); pw.print("<center>"); pw.print("<h1><B>User Registration Form <B></h1><br>"); pw.print("<table border=2.0 cellspacing=4.0>"); pw.print("<tr>"); pw.print("<th align=left>UserName :"); String un=req.getParameter("username"); pw.print("</th>"); pw.print("<td>"); pw.print("<input type=text value="+un+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Password :"); pw.print("</th>"); pw.print("<td>"); String p=req.getParameter("userpass"); pw.print("<input type=text value="+p+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<td align=left> Sex"); pw.print("</td>"); pw.print("<td>"); String sex=req.getParameter("sex"); pw.print("<input type=text value="+sex+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<td align=left>Marital Status"); pw.print("</td>"); pw.print("<td>"); String status=req.getParameter("status"); pw.print("<input type=text value="+status+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Father Name :"); pw.print("</th>"); pw.print("<td>"); String fname=req.getParameter("fname"); pw.print("<input type=text value="+fname+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Mother Name :"); pw.print("</th>"); pw.print("<td>"); String mname=req.getParameter("mname"); pw.print("<input type=text value="+mname+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr rowspan=5>"); pw.print("<th align=left>Address:"); pw.print("</th>"); pw.print("<td>"); String address=req.getParameter("address"); pw.print("<textarea rows=5 cols=29 placeholder="+address+" disabled></textarea>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<th align=left>Contact Number :"); pw.print("</th>"); pw.print("<td>"); String contact=req.getParameter("contact"); pw.print("<input type=text value="+contact+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("<tr>"); pw.print("<td>"); String options =req.getParameter("options"); pw.print(""+options); pw.print("</td>"); pw.print("<td>"); String hint=req.getParameter("hintpassword"); pw.print("<input type=text value="+hint+" size=32 disabled>"); pw.print("</td>"); pw.print("</tr>"); pw.print("</table>"); pw.print("</center>"); pw.print("</form>"); MyConnection(); try { sql="select * from UserInfo where Username=?"; st=cn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); st.setString(1,un); rs=st.executeQuery(); rs.last(); if(rs.getRow()==0) { sql="Insert into UserInfo values(?,?,?,?,?,?,?,?,?,?)"; st=cn.prepareStatement(sql,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); st.setString(1,un); st.setString(2,p); st.setString(3,sex); st.setString(4,status); st.setString(5,fname); st.setString(6,mname); st.setString(7,address); st.setString(8,contact); st.setString(9,options); st.setString(10,hint); st.executeUpdate(); pw.print("<alert type='sucess'>UserDetails Inserted succesfully</alert>"); Close(); } else { pw.print("<alert type='sucess'>UserDetails not Inserted succesfully</alert>"); } }catch(Exception e){} pw.print("</body>"); pw.print("</html>"); } }
7,469
0.369527
0.362967
167
42.736526
24.909225
140
false
false
0
0
0
0
0
0
0.91018
false
false
2
f756aaabc95c8404023c8a88061c18f7da544d36
19,782,619,395,645
ed69f2b780efa78a49396cc2a5ead58cfbde8e45
/src/main/java/com/example/demo/model/response/ListFilmResponse.java
7102f7c1e261ac44781f0dc50eb09568ba548da2
[]
no_license
truongquangkhai99/QuanLyPhim
https://github.com/truongquangkhai99/QuanLyPhim
33fa041be8c42b710f2862f3eb664c3035f2c79c
95cc16cea26cf5117ad86e6935ce9a1b6041f751
refs/heads/main
2023-06-27T11:14:45.335000
2021-07-27T08:50:25
2021-07-27T08:50:25
477,942,178
1
0
null
true
2022-04-05T02:05:24
2022-04-05T02:05:23
2021-07-27T08:50:27
2021-07-27T08:50:25
78
0
0
0
null
false
false
package com.example.demo.model.response; import lombok.Getter; import lombok.Setter; @Getter @Setter public class ListFilmResponse { private Long id; private String name; private String image; }
UTF-8
Java
209
java
ListFilmResponse.java
Java
[]
null
[]
package com.example.demo.model.response; import lombok.Getter; import lombok.Setter; @Getter @Setter public class ListFilmResponse { private Long id; private String name; private String image; }
209
0.751196
0.751196
12
16.416666
12.612549
40
false
false
0
0
0
0
0
0
0.5
false
false
2
19a1716248472edd1aba239a1cb21d7f47fe83f3
25,761,213,857,085
90ca03ff350b89d82991066bd77cfdf0113a9843
/chapter_010/src/main/java/ru/job4j/parser/Writer.java
fb1886a8024c08bb1da2e36304a0c44e16be78bc
[]
no_license
smorozov30/job4j
https://github.com/smorozov30/job4j
05971d359f035d0e6dcee1bc438be7c90d4c89c8
04897f81875782d7541c4596893e3c57bc9a2eba
refs/heads/master
2022-09-24T18:55:31.262000
2021-02-21T17:14:57
2021-02-21T17:14:57
218,499,680
0
0
null
false
2022-09-08T01:06:09
2019-10-30T10:18:40
2021-02-21T17:15:17
2022-09-08T01:06:09
337
0
0
6
Java
false
false
package ru.job4j.parser; import java.io.File; public interface Writer { void saveContent(File file, String content); }
UTF-8
Java
125
java
Writer.java
Java
[]
null
[]
package ru.job4j.parser; import java.io.File; public interface Writer { void saveContent(File file, String content); }
125
0.744
0.736
7
16.857143
16.548014
48
false
false
0
0
0
0
0
0
0.571429
false
false
2
e9588fe38cdab0fdb0e2c5fabf10a04ed6feb1eb
16,930,761,106,110
1b372215ee56a364da9c989f278a88d4ca167b50
/src/main/java/com/michael/service/AdService.java
a006562b24b12e42d47f4353a698a48c9e00bbb3
[]
no_license
ThinWichael/ADService
https://github.com/ThinWichael/ADService
479445c2195cc97d4b0288300f663614c0fa25e5
cbd74c707c3cc34258a1b0a573f3c7dade37a662
refs/heads/master
2020-06-13T08:46:03.446000
2019-07-01T05:22:31
2019-07-01T05:22:31
194,604,438
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.michael.service; import com.michael.beans.DAO.noSql.Advertisment; public interface AdService { void getAdPoolCache(); Advertisment getAdToUser(String userId) throws CloneNotSupportedException; }
UTF-8
Java
214
java
AdService.java
Java
[]
null
[]
package com.michael.service; import com.michael.beans.DAO.noSql.Advertisment; public interface AdService { void getAdPoolCache(); Advertisment getAdToUser(String userId) throws CloneNotSupportedException; }
214
0.813084
0.813084
10
20.4
24.220652
75
false
false
0
0
0
0
0
0
0.7
false
false
2
dee88f693d910f321c8b20fdfe988d5e3a9670d5
17,763,984,770,336
6b44dcf754b9b7f6bb5355da3ceb6aee94968e5c
/src/main/java/com/bandg/uploadfiles/dao/FakeFileUpDataAcces.java
a402c89c3d10bad7addd11b5d602581882572bc8
[]
no_license
b-0n3/uploadFileSpring
https://github.com/b-0n3/uploadFileSpring
c27b75ec8bf6a723bfdb367e5242dbe65a594324
6a0b2abe65469cbcb67a2d3ea154ef7f4d70efbd
refs/heads/master
2023-03-02T18:37:31.956000
2020-07-21T19:47:05
2020-07-21T19:47:05
279,964,331
0
0
null
false
2023-02-22T08:28:40
2020-07-15T19:56:14
2020-07-21T19:47:30
2023-02-22T08:28:40
80
0
0
1
Java
false
false
package com.bandg.uploadfiles.dao; import com.bandg.uploadfiles.models.FileUp; import org.springframework.stereotype.Repository; import java.io.File; import java.nio.file.OpenOption; import java.util.List; import java.util.ArrayList; import java.util.Optional; import java.util.UUID; @Repository public class FakeFileUpDataAcces implements FileUpDao{ private final List<FileUp> files = new ArrayList<>(); @Override public UUID insertFile(UUID id, FileUp file) { FileUp fileUp = new FileUp(id, file.getFileName(), file.getPath(), file.getSize(), file.getOwnerName()); files.add(fileUp); return fileUp.getId(); } @Override public UUID insertFile(FileUp file) { UUID id = UUID.randomUUID(); boolean fi = false; while (fi) { UUID finalId = id; if(!files.stream().filter(p->p.getId().equals(finalId)).findFirst().isPresent()) break; id = UUID.randomUUID(); } FileUp fileUp = new FileUp(id, file.getFileName(), file.getPath(), file.getSize(), file.getOwnerName()); files.add(fileUp); return id; } @Override public int delFileById(UUID id) { Optional<FileUp> op =files .stream() .filter(p-> p.getId().equals(id)) .findFirst(); if(op.isPresent()) { File torem = new File(op.get().getPath()); if(torem.exists()) torem.delete(); files.remove(op.get()); return 1; } return 0; } @Override public FileUp getFileByID(UUID id) { return files .stream() .filter(p-> p.getId().equals(id)) .findFirst().orElse(null); } }
UTF-8
Java
1,928
java
FakeFileUpDataAcces.java
Java
[]
null
[]
package com.bandg.uploadfiles.dao; import com.bandg.uploadfiles.models.FileUp; import org.springframework.stereotype.Repository; import java.io.File; import java.nio.file.OpenOption; import java.util.List; import java.util.ArrayList; import java.util.Optional; import java.util.UUID; @Repository public class FakeFileUpDataAcces implements FileUpDao{ private final List<FileUp> files = new ArrayList<>(); @Override public UUID insertFile(UUID id, FileUp file) { FileUp fileUp = new FileUp(id, file.getFileName(), file.getPath(), file.getSize(), file.getOwnerName()); files.add(fileUp); return fileUp.getId(); } @Override public UUID insertFile(FileUp file) { UUID id = UUID.randomUUID(); boolean fi = false; while (fi) { UUID finalId = id; if(!files.stream().filter(p->p.getId().equals(finalId)).findFirst().isPresent()) break; id = UUID.randomUUID(); } FileUp fileUp = new FileUp(id, file.getFileName(), file.getPath(), file.getSize(), file.getOwnerName()); files.add(fileUp); return id; } @Override public int delFileById(UUID id) { Optional<FileUp> op =files .stream() .filter(p-> p.getId().equals(id)) .findFirst(); if(op.isPresent()) { File torem = new File(op.get().getPath()); if(torem.exists()) torem.delete(); files.remove(op.get()); return 1; } return 0; } @Override public FileUp getFileByID(UUID id) { return files .stream() .filter(p-> p.getId().equals(id)) .findFirst().orElse(null); } }
1,928
0.534751
0.533714
70
26.542856
16.922247
92
false
false
0
0
0
0
0
0
0.528571
false
false
2
725699c283c4808867d4b49b49eaa9e2dd7e6f25
35,459,250,000,591
09a3f3529f539948944c51a4fa502e0f3be5e4cc
/src/pt/upskills/projeto/objects/mobs/BadGuy.java
7a08b277edf90a2bab9c09070938c11caeaddd3a
[ "MIT" ]
permissive
ze-gomes/upskill-roguelike
https://github.com/ze-gomes/upskill-roguelike
a2fea544fb0fc1919907aa469b5a4ccd5854bcd2
89619173422f987338aa3d40b84deac6798b6721
refs/heads/master
2023-02-05T09:12:12.892000
2020-12-23T23:54:44
2020-12-23T23:54:44
311,309,690
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pt.upskills.projeto.objects.mobs; import pt.upskills.projeto.gui.ImageTile; import pt.upskills.projeto.rogue.utils.Position; public class BadGuy extends Enemy implements ImageTile { public BadGuy(Position position) { super(position, 2, 6, 30); } @Override public String getName() { return "BadGuy"; } }
UTF-8
Java
350
java
BadGuy.java
Java
[]
null
[]
package pt.upskills.projeto.objects.mobs; import pt.upskills.projeto.gui.ImageTile; import pt.upskills.projeto.rogue.utils.Position; public class BadGuy extends Enemy implements ImageTile { public BadGuy(Position position) { super(position, 2, 6, 30); } @Override public String getName() { return "BadGuy"; } }
350
0.694286
0.682857
16
20.9375
19.405117
56
false
false
0
0
0
0
0
0
0.5
false
false
2
ac260a8e90f61150168dfcccaa2837e8fe823ef5
9,981,504,050,201
bf5490bf23f2fb522162183ff45c71b29022b13b
/Tablut/build/it/unibo/ai/didattica/competition/tablut/teampallo/util/GameManager.java
e1401f93933a4a467078b7c8451fe0caf7d7b414
[]
no_license
luca-ant/tablutchallenge
https://github.com/luca-ant/tablutchallenge
084c633c1e5fec789f07d0ec1d9e9ddde7871d59
b025bf721c724f04cf8c911b3a20362d9fdde592
refs/heads/master
2020-05-07T13:59:54.157000
2019-05-22T13:22:03
2019-05-22T13:22:03
180,570,310
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.unibo.ai.didattica.competition.tablut.teampallo.util; import java.util.ArrayList; import java.util.List; import it.unibo.ai.didattica.competition.tablut.domain.State; import it.unibo.ai.didattica.competition.tablut.teampallo.domain.MyRules; public class GameManager { /* * Singleton */ private static GameManager instance = null; public final static int MEMORY_LIMIT = 1024; private final static int MAX_DEPTH = 7; private final static int TIMEOUT = 55; private MyRules rules; private String player; private int timeout; private int memoryLimit; private int maxDepth; private int numThread; private List<State> statiVisitati; private GameManager() { this.statiVisitati = new ArrayList<>(); this.timeout = TIMEOUT; this.maxDepth = MAX_DEPTH; this.memoryLimit = MEMORY_LIMIT; this.pedineOnBoard = 25; this.player = ""; } public static GameManager getInstance() { if (instance == null) { instance = new GameManager(); } return instance; } public int getNumThread() { return numThread; } public void setNumThread(int numThread) { this.numThread = numThread; } public void setParameters(int timeout, int maxDepth, String player) { this.timeout = timeout; this.maxDepth = maxDepth; this.player = player; } public MyRules getRules() { return rules; } public void setRules(MyRules rules) { this.rules = rules; } private int pedineOnBoard; public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } public void setPlayer(String player) { this.player = player; } public String getPlayer() { return player; } public void setMaxDepth(int maxDepth) { this.maxDepth = maxDepth; } public int getMaxDepth() { return maxDepth; } public int getMemoryLimit() { return memoryLimit; } public void setMemoryLimit(int memoryLimit) { this.memoryLimit = memoryLimit; } public void clearVisitedStateCache() { this.statiVisitati.clear(); } public void addVisitedState(State state) { this.statiVisitati.add(state.clone()); int num = 0; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (state.getPawn(i, j).equalsPawn("W") || state.getPawn(i, j).equalsPawn("B") || state.getPawn(i, j).equalsPawn("K")) num++; } } if (num < pedineOnBoard) { pedineOnBoard = num; this.clearVisitedStateCache(); } } public boolean contains(State s) { return this.statiVisitati.contains(s); } }
UTF-8
Java
2,500
java
GameManager.java
Java
[]
null
[]
package it.unibo.ai.didattica.competition.tablut.teampallo.util; import java.util.ArrayList; import java.util.List; import it.unibo.ai.didattica.competition.tablut.domain.State; import it.unibo.ai.didattica.competition.tablut.teampallo.domain.MyRules; public class GameManager { /* * Singleton */ private static GameManager instance = null; public final static int MEMORY_LIMIT = 1024; private final static int MAX_DEPTH = 7; private final static int TIMEOUT = 55; private MyRules rules; private String player; private int timeout; private int memoryLimit; private int maxDepth; private int numThread; private List<State> statiVisitati; private GameManager() { this.statiVisitati = new ArrayList<>(); this.timeout = TIMEOUT; this.maxDepth = MAX_DEPTH; this.memoryLimit = MEMORY_LIMIT; this.pedineOnBoard = 25; this.player = ""; } public static GameManager getInstance() { if (instance == null) { instance = new GameManager(); } return instance; } public int getNumThread() { return numThread; } public void setNumThread(int numThread) { this.numThread = numThread; } public void setParameters(int timeout, int maxDepth, String player) { this.timeout = timeout; this.maxDepth = maxDepth; this.player = player; } public MyRules getRules() { return rules; } public void setRules(MyRules rules) { this.rules = rules; } private int pedineOnBoard; public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } public void setPlayer(String player) { this.player = player; } public String getPlayer() { return player; } public void setMaxDepth(int maxDepth) { this.maxDepth = maxDepth; } public int getMaxDepth() { return maxDepth; } public int getMemoryLimit() { return memoryLimit; } public void setMemoryLimit(int memoryLimit) { this.memoryLimit = memoryLimit; } public void clearVisitedStateCache() { this.statiVisitati.clear(); } public void addVisitedState(State state) { this.statiVisitati.add(state.clone()); int num = 0; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (state.getPawn(i, j).equalsPawn("W") || state.getPawn(i, j).equalsPawn("B") || state.getPawn(i, j).equalsPawn("K")) num++; } } if (num < pedineOnBoard) { pedineOnBoard = num; this.clearVisitedStateCache(); } } public boolean contains(State s) { return this.statiVisitati.contains(s); } }
2,500
0.6948
0.6892
131
18.083969
18.294052
82
false
false
0
0
0
0
0
0
1.572519
false
false
2
3d214c7f0df48053ebabf2fd70baab2d727d054d
19,602,230,802,022
0cf3d9bbfa7c1e22ccd2d626c1f3256f296f5a5a
/app/src/main/java/kr/hs/dgsw/libraryproject/fragments/HomeFragment.java
405e20309c2331a6e3db4dfc8fbd8152506ad136
[]
no_license
bjj3036/moblieProgrammingAndroid
https://github.com/bjj3036/moblieProgrammingAndroid
2f6062675ad61c61c15809b5ac517c8a6b2373ff
88177bc3c1f67293daeb054a32a3b8687f4610be
refs/heads/master
2020-05-30T02:22:30.646000
2019-06-05T02:25:37
2019-06-05T02:25:37
189,495,917
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kr.hs.dgsw.libraryproject.fragments; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import kr.hs.dgsw.libraryproject.R; import kr.hs.dgsw.libraryproject.databinding.FragmentHomeBinding; public class HomeFragment extends Fragment { private FragmentHomeBinding binding; public HomeFragment() { // Required empty public constructor } public static HomeFragment newInstance() { HomeFragment fragment = new HomeFragment(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.binding = FragmentHomeBinding.inflate(inflater, container, false); return this.binding.getRoot(); } }
UTF-8
Java
1,058
java
HomeFragment.java
Java
[]
null
[]
package kr.hs.dgsw.libraryproject.fragments; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import kr.hs.dgsw.libraryproject.R; import kr.hs.dgsw.libraryproject.databinding.FragmentHomeBinding; public class HomeFragment extends Fragment { private FragmentHomeBinding binding; public HomeFragment() { // Required empty public constructor } public static HomeFragment newInstance() { HomeFragment fragment = new HomeFragment(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.binding = FragmentHomeBinding.inflate(inflater, container, false); return this.binding.getRoot(); } }
1,058
0.722117
0.721172
39
26.128204
22.729378
79
false
false
0
0
0
0
0
0
0.512821
false
false
2
7681d275b07f2912b153c85e5f15005508110f89
19,602,230,803,096
75c3aaa59541977f8781fbeccf825ef1877b0457
/src/main/java/br/com/playlist/model/Albun.java
6cfed604a0dcf35bf5841c12ca1840f87d7a801d
[ "Apache-2.0" ]
permissive
ander-f-silva/playlist
https://github.com/ander-f-silva/playlist
bb9b8a0dd9abb373ba673ce4665bd2eac45695b7
89eb86133e7db2b3c8aad751443ac001b8c7c622
refs/heads/master
2019-08-01T21:40:29.945000
2016-11-22T17:49:03
2016-11-22T17:49:03
74,399,866
0
0
null
false
2016-11-24T11:38:33
2016-11-21T19:46:48
2016-11-21T19:58:04
2016-11-23T02:33:52
33
0
0
0
Java
null
null
package br.com.playlist.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** * Albun */ @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-11-21T19:42:44.712Z") public class Albun { @JsonProperty("id") private Integer id = null; @JsonProperty("nome") private String nome = null; @JsonProperty("ano") private Integer ano = null; @JsonProperty("gravadora") private String gravadora = null; public Albun id(Integer id) { this.id = id; return this; } /** * Get id * @return id **/ @ApiModelProperty(value = "") public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Albun nome(String nome) { this.nome = nome; return this; } /** * Get nome * @return nome **/ @ApiModelProperty(value = "") public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public Albun ano(Integer ano) { this.ano = ano; return this; } /** * Get ano * @return ano **/ @ApiModelProperty(value = "") public Integer getAno() { return ano; } public void setAno(Integer ano) { this.ano = ano; } public Albun gravadora(String gravadora) { this.gravadora = gravadora; return this; } /** * Get gravadora * @return gravadora **/ @ApiModelProperty(value = "") public String getGravadora() { return gravadora; } public void setGravadora(String gravadora) { this.gravadora = gravadora; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Albun albun = (Albun) o; return Objects.equals(this.id, albun.id) && Objects.equals(this.nome, albun.nome) && Objects.equals(this.ano, albun.ano) && Objects.equals(this.gravadora, albun.gravadora); } @Override public int hashCode() { return Objects.hash(id, nome, ano, gravadora); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Albun {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" nome: ").append(toIndentedString(nome)).append("\n"); sb.append(" ano: ").append(toIndentedString(ano)).append("\n"); sb.append(" gravadora: ").append(toIndentedString(gravadora)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
UTF-8
Java
3,014
java
Albun.java
Java
[]
null
[]
package br.com.playlist.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** * Albun */ @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-11-21T19:42:44.712Z") public class Albun { @JsonProperty("id") private Integer id = null; @JsonProperty("nome") private String nome = null; @JsonProperty("ano") private Integer ano = null; @JsonProperty("gravadora") private String gravadora = null; public Albun id(Integer id) { this.id = id; return this; } /** * Get id * @return id **/ @ApiModelProperty(value = "") public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Albun nome(String nome) { this.nome = nome; return this; } /** * Get nome * @return nome **/ @ApiModelProperty(value = "") public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public Albun ano(Integer ano) { this.ano = ano; return this; } /** * Get ano * @return ano **/ @ApiModelProperty(value = "") public Integer getAno() { return ano; } public void setAno(Integer ano) { this.ano = ano; } public Albun gravadora(String gravadora) { this.gravadora = gravadora; return this; } /** * Get gravadora * @return gravadora **/ @ApiModelProperty(value = "") public String getGravadora() { return gravadora; } public void setGravadora(String gravadora) { this.gravadora = gravadora; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Albun albun = (Albun) o; return Objects.equals(this.id, albun.id) && Objects.equals(this.nome, albun.nome) && Objects.equals(this.ano, albun.ano) && Objects.equals(this.gravadora, albun.gravadora); } @Override public int hashCode() { return Objects.hash(id, nome, ano, gravadora); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Albun {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" nome: ").append(toIndentedString(nome)).append("\n"); sb.append(" ano: ").append(toIndentedString(ano)).append("\n"); sb.append(" gravadora: ").append(toIndentedString(gravadora)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
3,014
0.621765
0.615793
143
20.069929
20.4011
122
false
false
0
0
0
0
0
0
0.363636
false
false
2
a5ea8086386ff9123bf5420c78863ad3cb6c308a
26,714,696,617,386
072cceb489af4d77eec828c4059d893b3925a2bf
/week3-SpringIocDi/bean-autowiring/src/main/java/com/apress/prospring5/ch3/xml/Target.java
4439e96bce1e938b82f46d5d8e6200c48aecd7f0
[]
no_license
nitinsd/spring
https://github.com/nitinsd/spring
9df5cde338618637be543316bb1f232f632f0c69
0dbc4e9712ac9e225ef3bdcb3ce71c6067e924a2
refs/heads/master
2020-03-31T07:13:38.477000
2018-10-08T03:56:53
2018-10-08T03:56:53
152,013,159
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.apress.prospring5.ch3.xml; import org.springframework.context.support.GenericXmlApplicationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Target { private static final Logger logger = LoggerFactory.getLogger(Target.class); private Foo fooOne; private Foo fooTwo; private Bar bar; public Target() { } public Target(Foo foo) { logger.info("Target(Foo) called"); } public Target(Foo foo, Bar bar) { logger.info("Target(Foo, Bar) called"); } public void setFooOne(Foo fooOne) { this.fooOne = fooOne; logger.info("Property fooOne set"); } public void setFooTwo(Foo foo) { this.fooTwo = foo; logger.info("Property fooTwo set"); } public void setBar(Bar bar) { this.bar = bar; logger.info("Property bar set"); } public static void main(String... args) { GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(); ctx.load("classpath:spring/app-context-target.xml"); ctx.refresh(); Target t = null; logger.info("Using byName:\n"); t = (Target) ctx.getBean("targetByName"); logger.info("\nUsing byType:\n"); t = (Target) ctx.getBean("targetByType"); logger.info("\nUsing constructor:\n"); t = (Target) ctx.getBean("targetConstructor"); ctx.close(); } }
UTF-8
Java
1,490
java
Target.java
Java
[]
null
[]
package com.apress.prospring5.ch3.xml; import org.springframework.context.support.GenericXmlApplicationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Target { private static final Logger logger = LoggerFactory.getLogger(Target.class); private Foo fooOne; private Foo fooTwo; private Bar bar; public Target() { } public Target(Foo foo) { logger.info("Target(Foo) called"); } public Target(Foo foo, Bar bar) { logger.info("Target(Foo, Bar) called"); } public void setFooOne(Foo fooOne) { this.fooOne = fooOne; logger.info("Property fooOne set"); } public void setFooTwo(Foo foo) { this.fooTwo = foo; logger.info("Property fooTwo set"); } public void setBar(Bar bar) { this.bar = bar; logger.info("Property bar set"); } public static void main(String... args) { GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(); ctx.load("classpath:spring/app-context-target.xml"); ctx.refresh(); Target t = null; logger.info("Using byName:\n"); t = (Target) ctx.getBean("targetByName"); logger.info("\nUsing byType:\n"); t = (Target) ctx.getBean("targetByType"); logger.info("\nUsing constructor:\n"); t = (Target) ctx.getBean("targetConstructor"); ctx.close(); } }
1,490
0.601342
0.598658
60
23.833334
19.810911
78
false
false
0
0
0
0
0
0
0.566667
false
false
2
3b5e643421fc9f8560f2981b8e28efacde61bf05
10,170,482,591,418
c40ab0b764e08f82fbaa782072b9cd0ffe07d8e1
/leetcodePractice/7-18-2020/双向BFS代码模版.java
d3195df813f66109341d4c1a395e19587f36f186
[]
no_license
MengtaoZhang/project_9527
https://github.com/MengtaoZhang/project_9527
c1d975b6ae52f5aa48f19a4e2bf7ef604c1d61f1
5b22d79c0103e1f45a4323ef3c21f5b80e5c091e
refs/heads/master
2022-11-22T06:25:55.229000
2020-07-30T01:38:46
2020-07-30T01:38:46
268,894,419
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
forward_queue = 所有起点 backward_queue = 所有终点 forward_set = 标记所有起点访问过 backward_set = 标记所有终点访问过 distance = 0 while forward_queue 和 back_queue 非空 distance++ for 所有forward_queue 里的点 拓展出下一层节点加入 forward_queue 并在 forward_set 里标记 如果有在 backward_set 出现则 return distance distance++ for 所有 backward_queue 里的点 拓展出下一层节点加入 backward_queue 并在 backward_set 里标记 如果有在 forward_set 出现则 return distance
UTF-8
Java
597
java
双向BFS代码模版.java
Java
[]
null
[]
forward_queue = 所有起点 backward_queue = 所有终点 forward_set = 标记所有起点访问过 backward_set = 标记所有终点访问过 distance = 0 while forward_queue 和 back_queue 非空 distance++ for 所有forward_queue 里的点 拓展出下一层节点加入 forward_queue 并在 forward_set 里标记 如果有在 backward_set 出现则 return distance distance++ for 所有 backward_queue 里的点 拓展出下一层节点加入 backward_queue 并在 backward_set 里标记 如果有在 forward_set 出现则 return distance
597
0.709977
0.707657
16
26
15.508062
53
false
false
0
0
0
0
0
0
0
false
false
2
22e4125d7553c80a8c194cdd2659c88aee012951
14,946,486,209,310
8be1f84173049dfd1c61f82f8da874ebe31c98d4
/Server/box/box-data-impl/src/main/java/com/wecon/box/data/action/LoginAction.java
bca151b9ff5cf3c1b8680eb8cd40d1475a4c8d7d
[]
no_license
caijinwei/weconProject
https://github.com/caijinwei/weconProject
3e7a6aeb1444c862368d43d4813d84ac3b8eee0a
0c160105ee27a3ba547aa236f4e582504d5d68a7
refs/heads/master
2021-09-06T06:12:23.444000
2018-02-03T01:43:54
2018-02-03T01:43:54
120,048,169
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wecon.box.data.action; import com.wecon.box.action.user.UserBaseAction; import com.wecon.box.param.SigninParam; import com.wecon.restful.annotation.WebApi; import com.wecon.restful.core.Output; import com.wecon.restful.doc.Label; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** * Created by zengzhipeng on 2017/8/2. */ @Label("登录") @RestController public class LoginAction extends UserBaseAction { @Autowired private com.wecon.box.action.user.SigninAction signinAction; @RequestMapping("we-data/login") @WebApi(forceAuth = false, master = true) public Output signin(@Valid SigninParam param) { return signinAction.signin(param); } }
UTF-8
Java
864
java
LoginAction.java
Java
[ { "context": "\nimport javax.validation.Valid;\n\n/**\n * Created by zengzhipeng on 2017/8/2.\n */\n@Label(\"登录\")\n@RestController\npub", "end": 494, "score": 0.9996161460876465, "start": 483, "tag": "USERNAME", "value": "zengzhipeng" } ]
null
[]
package com.wecon.box.data.action; import com.wecon.box.action.user.UserBaseAction; import com.wecon.box.param.SigninParam; import com.wecon.restful.annotation.WebApi; import com.wecon.restful.core.Output; import com.wecon.restful.doc.Label; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** * Created by zengzhipeng on 2017/8/2. */ @Label("登录") @RestController public class LoginAction extends UserBaseAction { @Autowired private com.wecon.box.action.user.SigninAction signinAction; @RequestMapping("we-data/login") @WebApi(forceAuth = false, master = true) public Output signin(@Valid SigninParam param) { return signinAction.signin(param); } }
864
0.774419
0.767442
28
29.678572
21.983847
64
false
false
0
0
0
0
0
0
0.464286
false
false
2
9f7e99a9338aa6d022fd5b1e536d4bd0bb7273a5
23,682,449,738,472
dbb07b2fc31a502643b6b6776b656887dcf0d2fe
/Assignment2/Vehicle/Administration.java
a8646d2648d6b2a7d824f088e18a7a24a3fdacbb
[]
no_license
nicolaswilde/object-oriented-programing
https://github.com/nicolaswilde/object-oriented-programing
268148d75902d1938a501e0fceb9eb177207c885
e7e84171d272fd9e8ee197392941b8778c07d3d0
refs/heads/master
2021-07-09T17:43:39.600000
2017-10-08T17:32:28
2017-10-08T17:32:28
104,030,646
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Administration { public static void main(String[] args) { // TODO 自动生成的方法存根 } int date_register; int id_engine; int license; public void register() { //... } public void inspect() { //... } public void detain() { //... } }
GB18030
Java
306
java
Administration.java
Java
[]
null
[]
public class Administration { public static void main(String[] args) { // TODO 自动生成的方法存根 } int date_register; int id_engine; int license; public void register() { //... } public void inspect() { //... } public void detain() { //... } }
306
0.538194
0.538194
23
10.434783
11.477108
41
false
false
0
0
0
0
0
0
1.043478
false
false
2
a4f0293045a9450a8ea468891849f71856db618d
5,179,730,605,683
67280f5eabc7215db02169004861ccd519de2946
/src/main/java/kr/co/shop/web/promotion/service/CouponService.java
677df3563bcf51a6ec2d31d13dabdcbf210e0a73
[]
no_license
kikikikikinanana/es_backend_sample
https://github.com/kikikikikinanana/es_backend_sample
f0354efcc90c334431b35dc209048e319b0d2844
d8969c2d2255caa24bb9acd85260cbced7e2abcb
refs/heads/master
2022-06-09T08:50:21.190000
2019-09-27T04:58:24
2019-09-27T04:58:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kr.co.shop.web.promotion.service; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import kr.co.shop.common.paging.Page; import kr.co.shop.common.paging.Pageable; import kr.co.shop.common.request.Parameter; import kr.co.shop.common.util.UtilsText; import kr.co.shop.web.member.model.master.MbMemberCoupon; import kr.co.shop.web.member.repository.master.MbMemberCouponDao; import kr.co.shop.web.product.model.master.PageableProduct; import kr.co.shop.web.product.model.master.PdProductCoupon; import kr.co.shop.web.product.model.master.PdProductWrapper; import kr.co.shop.web.product.service.ProductService; import kr.co.shop.web.promotion.model.master.PrCoupon; import kr.co.shop.web.promotion.model.master.PrCouponApplyProduct; import kr.co.shop.web.promotion.model.master.UpperCoupon; import kr.co.shop.web.promotion.repository.master.PrCouponDao; import lombok.extern.slf4j.Slf4j; @Slf4j @Service public class CouponService { @Autowired private PrCouponDao prCouponDao; @Autowired private MbMemberCouponDao mbMemberCouponDao; @Autowired private ProductService productService; /** * @Desc : 다운로드 가능 쿠폰 목록 (서비스 요청서) * @Method Name : getCanDownloadCouponList * @Date : 2019. 4. 23. * @Author : hsjhsj19 * @return * @throws Exception */ public UpperCoupon getCanDownloadCouponList(String memberNo, String cartSeq, String prdtNo, String prdtOptnNo, Integer qty, Integer dscntAmt, String siteNo, String mbshpGradeCode) throws Exception { PrCoupon coupon = new PrCoupon(); coupon.setMemberNo(memberNo); coupon.setCartSeq(cartSeq); coupon.setPrdtNo(prdtNo); coupon.setPrdtOptnNo(prdtOptnNo); coupon.setDscntAmt(dscntAmt); coupon.setSiteNo(siteNo); System.out.println("coupon>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + coupon); // 회원등급은 아직 적용 안함 return this.prCouponDao.memberCouponListAndDownloadCouponList(coupon); } /** * @Desc : 쿠폰 다운로드 기능 (서비스 요청서) * @Method Name : getCanDownloadCouponYn * @Date : 2019. 4. 23. * @Author : hsjhsj19 * @param cnpNo * @param memberNo * @param empYn * @param memberTypeCode * @param siteNo * @return * @throws Exception */ public String getCanDownloadCouponYn(String cpnNo, String memberNo, String empYn, String memberTypeCode, String siteNo) throws Exception { PrCoupon coupon = new PrCoupon(); coupon.setCpnNo(cpnNo); coupon.setMemberNo(memberNo); coupon.setMemberTypeCodeName(memberTypeCode); String result = this.prCouponDao.selectCanDownloadCouponYn(coupon); if (result == null) { result = "False"; } return result; } /** * @Desc : 회원 보유 쿠폰 * @Method Name : getMemberCouponList * @Date : 2019. 4. 30. * @Author : 이지훈 * @param pageable * @return */ public Map<String, Object> getMemberCouponList(Pageable<PrCoupon, PrCoupon> pageable) throws Exception { Map<String, Object> map = new HashMap<>(); int totalCount = prCouponDao.selectMemberCouponCount(pageable); if (totalCount > 0) { List<PrCoupon> memberCouponList = prCouponDao.selectMemberCouponList(pageable); map.put("memberCouponList", memberCouponList); } map.put("totalCount", totalCount); return map; } /** * @Desc : 다운로드 가능 쿠폰 리스트 * @Method Name : getDownloadCouponList * @Date : 2019. 5. 13. * @Author : 이지훈 * @param pageable * @return */ public List<PrCoupon> getDownloadCouponList(PrCoupon prCoupon) throws Exception { List<PrCoupon> ingCouponList = prCouponDao.selectDownloadCouponList(prCoupon); return ingCouponList; } /** * 쿠폰 등록(회원 쿠폰 등록) * * @Desc : 쿠폰 등록(회원 쿠폰 등록) * @Method Name : insertMemberCoupon * @Date : 2019. 3. 6 * @Author : easyhun * @param prCoupon * @throws Exception */ public Map<String, Object> insertMemberCoupon(PrCoupon prCoupon) throws Exception { Map<String, Object> map = new HashMap<>(); boolean checkCpn = true; String memberNo = prCoupon.getMemberNo(); String exceptionType = ""; if (prCoupon.getCpnNos() != null) { for (String cpnNo : prCoupon.getCpnNos()) { prCoupon.setCpnNo(cpnNo); PrCoupon detailPrCoupon = prCouponDao.selectPrCoupon(prCoupon); MbMemberCoupon mbMemberCoupon = new MbMemberCoupon(); mbMemberCoupon.setCpnNo(cpnNo); mbMemberCoupon.setMemberNo(memberNo); mbMemberCoupon.setCpnIssueDtm(new Timestamp(new Date().getTime())); // T : 지정기간 , D : 지정일 if (UtilsText.equals(detailPrCoupon.getValidTermGbnType(), "T")) { mbMemberCoupon.setValidStartDtm(detailPrCoupon.getValidStartDtm()); mbMemberCoupon.setValidEndDtm(detailPrCoupon.getValidEndDtm()); } else { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, +detailPrCoupon.getUseLimitDayCount()); mbMemberCoupon.setValidStartDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setValidEndDtm(new Timestamp(cal.getTime().getTime())); } mbMemberCoupon.setCpnStatCode("10000"); // Const 값으로 변경 TO_DO mbMemberCoupon.setHoldCpnSeq(mbMemberCouponDao.selectMemberCouponHoldSeq(memberNo)); mbMemberCoupon.setRgsterNo(memberNo); mbMemberCoupon.setRgstDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setModerNo(memberNo); mbMemberCoupon.setModDtm(prCoupon.getRgstDtm()); if (!UtilsText.equals(detailPrCoupon.getTotalIssueLimitYn(), "Y")) { if (detailPrCoupon.getTotalIssueCount() >= detailPrCoupon.getTotalIssueLimitCount()) { checkCpn = false; exceptionType = "totalLimit"; } } if (!UtilsText.equals(detailPrCoupon.getPer1psnIssueLimitYn(), "Y")) { if (detailPrCoupon.getMemberCouponCnt() >= detailPrCoupon.getPer1psnMaxIssueCount()) { checkCpn = false; exceptionType = "perMax"; } } if (checkCpn) { mbMemberCouponDao.insert(mbMemberCoupon); // 발급한 count 쿠폰테이블 update detailPrCoupon.setTotalIssueCount(detailPrCoupon.getTotalIssueCount() + 1); prCouponDao.update(detailPrCoupon); } } } map.put("exceptionType", exceptionType); return map; } /** * 쿠폰 지류 등록(회원 쿠폰 등록) * * @Desc : 쿠폰 등록(회원 쿠폰 등록) * @Method Name : insertPaperCoupon * @Date : 2019. 5. 20 * @Author : easyhun * @param prCoupon * @throws Exception */ public Map<String, Object> insertCouponPaper(PrCoupon prCoupon) throws Exception { Map<String, Object> map = new HashMap<>(); String exceptionType = ""; if (UtilsText.isNotBlank(prCoupon.getPaperNoText())) { PrCoupon paperCoupon = prCouponDao.selectCouponPaper(prCoupon); if (paperCoupon != null) { if (UtilsText.equals(paperCoupon.getRgstYn(), "Y") || UtilsText.equals(paperCoupon.getStoreUseYn(), "Y")) { exceptionType = "existCpn"; } else { this.insertCouponWithoutCondition(prCoupon); // 지류 등록 update prCouponDao.updateCouponPaperByCpnNo(paperCoupon.getCpnNo()); } } else { exceptionType = "noneCpn"; } } map.put("exceptionType", exceptionType); return map; } /** * 쿠폰 등록(회원 쿠폰 등록) / 쿠폰 제한 조건 X * * @Desc : 쿠폰 등록(회원 쿠폰 등록) * @Method Name : insertCouponWithoutCondition * @Date : 2019. 5. 22 * @Author : easyhun * @param prCoupon -> cpnNo, memberNo 필수 * @throws Exception */ public void insertCouponWithoutCondition(PrCoupon prCoupon) throws Exception { String cpnNo = prCoupon.getCpnNo(); String memberNo = prCoupon.getMemberNo(); if (UtilsText.isNotBlank(memberNo) && UtilsText.isNotBlank(cpnNo)) { PrCoupon paperCoupon = prCouponDao.selectPrCoupon(prCoupon); MbMemberCoupon mbMemberCoupon = new MbMemberCoupon(); mbMemberCoupon.setCpnNo(cpnNo); mbMemberCoupon.setMemberNo(memberNo); mbMemberCoupon.setCpnIssueDtm(new Timestamp(new Date().getTime())); // T : 지정기간 , D : 지정일 if (UtilsText.equals(paperCoupon.getValidTermGbnType(), "T")) { mbMemberCoupon.setValidStartDtm(paperCoupon.getValidStartDtm()); mbMemberCoupon.setValidEndDtm(paperCoupon.getValidEndDtm()); } else { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, +paperCoupon.getUseLimitDayCount()); mbMemberCoupon.setValidStartDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setValidEndDtm(new Timestamp(cal.getTime().getTime())); } mbMemberCoupon.setCpnStatCode("10000"); // Const 값으로 변경 TO_DO mbMemberCoupon.setHoldCpnSeq(mbMemberCouponDao.selectMemberCouponHoldSeq(memberNo)); mbMemberCoupon.setRgsterNo(memberNo); mbMemberCoupon.setRgstDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setModerNo(memberNo); mbMemberCoupon.setModDtm(prCoupon.getRgstDtm()); mbMemberCouponDao.insert(mbMemberCoupon); // 발급한 count 쿠폰테이블 update paperCoupon.setTotalIssueCount(paperCoupon.getTotalIssueCount() + 1); prCouponDao.update(paperCoupon); } } /** * @Desc : 상품에 해당하는 쿠폰 조회. 혜택이 높은 쿠폰(일반/플러스쿠폰 모두) 순으로 반환. * @Method Name : getCouponByPrdtNo * @Date : 2019. 6. 12. * @Author : tennessee * @param prdtNo * @return * @throws Exception */ public List<PdProductCoupon> getCouponByPrdtNo(String prdtNo) throws Exception { return this.prCouponDao.selectCouponByPrdtNo(prdtNo); } /** * @Desc : 쿠폰 대상 상품 리스트 * @Method Name : getDrawTargetProductList * @Date : 2019. 6. 21. * @Author : 이지훈 * @param getDrawTargetProductList * @return */ public Map<String, Object> getCouponApplyProductList(Parameter<PrCouponApplyProduct> parameter) throws Exception { Map<String, Object> map = new HashMap<>(); PageableProduct<PrCouponApplyProduct, PdProductWrapper> pageable = new PageableProduct<PrCouponApplyProduct, PdProductWrapper>( parameter); pageable.setCondition(parameter.get().getSiteNo(), parameter.get().getChnnlNo()); pageable.setUseTableMapping("PR_COUPON_APPLY_PRODUCT", new LinkedHashMap<String, String>() { { put("cpn_no", parameter.get().getCpnNo()); } }, null); // pageable.setCategoryMapping(parameter.get().getCtgrNo()); String pagingSortType = parameter.get().getPagingSortType() != null ? parameter.get().getPagingSortType() : PageableProduct.PAGING_SORT_TYPE_NEWEST; pageable.setUsePaging(true, pagingSortType, null, null); pageable.setRowsPerPage(parameter.get().getRowsPerPage()); pageable.setPageNum(parameter.get().getPageNum()); Page<PdProductWrapper> productList = this.productService.getDisplayProductList(pageable); map.put("productList", productList); return map; } }
UTF-8
Java
11,315
java
CouponService.java
Java
[ { "context": "ouponList\r\n\t * @Date : 2019. 4. 23.\r\n\t * @Author : hsjhsj19\r\n\t * @return\r\n\t * @throws Exception\r\n\t */\r\n\tpubli", "end": 1520, "score": 0.9917275905609131, "start": 1512, "tag": "USERNAME", "value": "hsjhsj19" }, { "context": "dCouponYn\r\n\t * @Date : 2...
null
[]
package kr.co.shop.web.promotion.service; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import kr.co.shop.common.paging.Page; import kr.co.shop.common.paging.Pageable; import kr.co.shop.common.request.Parameter; import kr.co.shop.common.util.UtilsText; import kr.co.shop.web.member.model.master.MbMemberCoupon; import kr.co.shop.web.member.repository.master.MbMemberCouponDao; import kr.co.shop.web.product.model.master.PageableProduct; import kr.co.shop.web.product.model.master.PdProductCoupon; import kr.co.shop.web.product.model.master.PdProductWrapper; import kr.co.shop.web.product.service.ProductService; import kr.co.shop.web.promotion.model.master.PrCoupon; import kr.co.shop.web.promotion.model.master.PrCouponApplyProduct; import kr.co.shop.web.promotion.model.master.UpperCoupon; import kr.co.shop.web.promotion.repository.master.PrCouponDao; import lombok.extern.slf4j.Slf4j; @Slf4j @Service public class CouponService { @Autowired private PrCouponDao prCouponDao; @Autowired private MbMemberCouponDao mbMemberCouponDao; @Autowired private ProductService productService; /** * @Desc : 다운로드 가능 쿠폰 목록 (서비스 요청서) * @Method Name : getCanDownloadCouponList * @Date : 2019. 4. 23. * @Author : hsjhsj19 * @return * @throws Exception */ public UpperCoupon getCanDownloadCouponList(String memberNo, String cartSeq, String prdtNo, String prdtOptnNo, Integer qty, Integer dscntAmt, String siteNo, String mbshpGradeCode) throws Exception { PrCoupon coupon = new PrCoupon(); coupon.setMemberNo(memberNo); coupon.setCartSeq(cartSeq); coupon.setPrdtNo(prdtNo); coupon.setPrdtOptnNo(prdtOptnNo); coupon.setDscntAmt(dscntAmt); coupon.setSiteNo(siteNo); System.out.println("coupon>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + coupon); // 회원등급은 아직 적용 안함 return this.prCouponDao.memberCouponListAndDownloadCouponList(coupon); } /** * @Desc : 쿠폰 다운로드 기능 (서비스 요청서) * @Method Name : getCanDownloadCouponYn * @Date : 2019. 4. 23. * @Author : hsjhsj19 * @param cnpNo * @param memberNo * @param empYn * @param memberTypeCode * @param siteNo * @return * @throws Exception */ public String getCanDownloadCouponYn(String cpnNo, String memberNo, String empYn, String memberTypeCode, String siteNo) throws Exception { PrCoupon coupon = new PrCoupon(); coupon.setCpnNo(cpnNo); coupon.setMemberNo(memberNo); coupon.setMemberTypeCodeName(memberTypeCode); String result = this.prCouponDao.selectCanDownloadCouponYn(coupon); if (result == null) { result = "False"; } return result; } /** * @Desc : 회원 보유 쿠폰 * @Method Name : getMemberCouponList * @Date : 2019. 4. 30. * @Author : 이지훈 * @param pageable * @return */ public Map<String, Object> getMemberCouponList(Pageable<PrCoupon, PrCoupon> pageable) throws Exception { Map<String, Object> map = new HashMap<>(); int totalCount = prCouponDao.selectMemberCouponCount(pageable); if (totalCount > 0) { List<PrCoupon> memberCouponList = prCouponDao.selectMemberCouponList(pageable); map.put("memberCouponList", memberCouponList); } map.put("totalCount", totalCount); return map; } /** * @Desc : 다운로드 가능 쿠폰 리스트 * @Method Name : getDownloadCouponList * @Date : 2019. 5. 13. * @Author : 이지훈 * @param pageable * @return */ public List<PrCoupon> getDownloadCouponList(PrCoupon prCoupon) throws Exception { List<PrCoupon> ingCouponList = prCouponDao.selectDownloadCouponList(prCoupon); return ingCouponList; } /** * 쿠폰 등록(회원 쿠폰 등록) * * @Desc : 쿠폰 등록(회원 쿠폰 등록) * @Method Name : insertMemberCoupon * @Date : 2019. 3. 6 * @Author : easyhun * @param prCoupon * @throws Exception */ public Map<String, Object> insertMemberCoupon(PrCoupon prCoupon) throws Exception { Map<String, Object> map = new HashMap<>(); boolean checkCpn = true; String memberNo = prCoupon.getMemberNo(); String exceptionType = ""; if (prCoupon.getCpnNos() != null) { for (String cpnNo : prCoupon.getCpnNos()) { prCoupon.setCpnNo(cpnNo); PrCoupon detailPrCoupon = prCouponDao.selectPrCoupon(prCoupon); MbMemberCoupon mbMemberCoupon = new MbMemberCoupon(); mbMemberCoupon.setCpnNo(cpnNo); mbMemberCoupon.setMemberNo(memberNo); mbMemberCoupon.setCpnIssueDtm(new Timestamp(new Date().getTime())); // T : 지정기간 , D : 지정일 if (UtilsText.equals(detailPrCoupon.getValidTermGbnType(), "T")) { mbMemberCoupon.setValidStartDtm(detailPrCoupon.getValidStartDtm()); mbMemberCoupon.setValidEndDtm(detailPrCoupon.getValidEndDtm()); } else { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, +detailPrCoupon.getUseLimitDayCount()); mbMemberCoupon.setValidStartDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setValidEndDtm(new Timestamp(cal.getTime().getTime())); } mbMemberCoupon.setCpnStatCode("10000"); // Const 값으로 변경 TO_DO mbMemberCoupon.setHoldCpnSeq(mbMemberCouponDao.selectMemberCouponHoldSeq(memberNo)); mbMemberCoupon.setRgsterNo(memberNo); mbMemberCoupon.setRgstDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setModerNo(memberNo); mbMemberCoupon.setModDtm(prCoupon.getRgstDtm()); if (!UtilsText.equals(detailPrCoupon.getTotalIssueLimitYn(), "Y")) { if (detailPrCoupon.getTotalIssueCount() >= detailPrCoupon.getTotalIssueLimitCount()) { checkCpn = false; exceptionType = "totalLimit"; } } if (!UtilsText.equals(detailPrCoupon.getPer1psnIssueLimitYn(), "Y")) { if (detailPrCoupon.getMemberCouponCnt() >= detailPrCoupon.getPer1psnMaxIssueCount()) { checkCpn = false; exceptionType = "perMax"; } } if (checkCpn) { mbMemberCouponDao.insert(mbMemberCoupon); // 발급한 count 쿠폰테이블 update detailPrCoupon.setTotalIssueCount(detailPrCoupon.getTotalIssueCount() + 1); prCouponDao.update(detailPrCoupon); } } } map.put("exceptionType", exceptionType); return map; } /** * 쿠폰 지류 등록(회원 쿠폰 등록) * * @Desc : 쿠폰 등록(회원 쿠폰 등록) * @Method Name : insertPaperCoupon * @Date : 2019. 5. 20 * @Author : easyhun * @param prCoupon * @throws Exception */ public Map<String, Object> insertCouponPaper(PrCoupon prCoupon) throws Exception { Map<String, Object> map = new HashMap<>(); String exceptionType = ""; if (UtilsText.isNotBlank(prCoupon.getPaperNoText())) { PrCoupon paperCoupon = prCouponDao.selectCouponPaper(prCoupon); if (paperCoupon != null) { if (UtilsText.equals(paperCoupon.getRgstYn(), "Y") || UtilsText.equals(paperCoupon.getStoreUseYn(), "Y")) { exceptionType = "existCpn"; } else { this.insertCouponWithoutCondition(prCoupon); // 지류 등록 update prCouponDao.updateCouponPaperByCpnNo(paperCoupon.getCpnNo()); } } else { exceptionType = "noneCpn"; } } map.put("exceptionType", exceptionType); return map; } /** * 쿠폰 등록(회원 쿠폰 등록) / 쿠폰 제한 조건 X * * @Desc : 쿠폰 등록(회원 쿠폰 등록) * @Method Name : insertCouponWithoutCondition * @Date : 2019. 5. 22 * @Author : easyhun * @param prCoupon -> cpnNo, memberNo 필수 * @throws Exception */ public void insertCouponWithoutCondition(PrCoupon prCoupon) throws Exception { String cpnNo = prCoupon.getCpnNo(); String memberNo = prCoupon.getMemberNo(); if (UtilsText.isNotBlank(memberNo) && UtilsText.isNotBlank(cpnNo)) { PrCoupon paperCoupon = prCouponDao.selectPrCoupon(prCoupon); MbMemberCoupon mbMemberCoupon = new MbMemberCoupon(); mbMemberCoupon.setCpnNo(cpnNo); mbMemberCoupon.setMemberNo(memberNo); mbMemberCoupon.setCpnIssueDtm(new Timestamp(new Date().getTime())); // T : 지정기간 , D : 지정일 if (UtilsText.equals(paperCoupon.getValidTermGbnType(), "T")) { mbMemberCoupon.setValidStartDtm(paperCoupon.getValidStartDtm()); mbMemberCoupon.setValidEndDtm(paperCoupon.getValidEndDtm()); } else { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, +paperCoupon.getUseLimitDayCount()); mbMemberCoupon.setValidStartDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setValidEndDtm(new Timestamp(cal.getTime().getTime())); } mbMemberCoupon.setCpnStatCode("10000"); // Const 값으로 변경 TO_DO mbMemberCoupon.setHoldCpnSeq(mbMemberCouponDao.selectMemberCouponHoldSeq(memberNo)); mbMemberCoupon.setRgsterNo(memberNo); mbMemberCoupon.setRgstDtm(new Timestamp(new Date().getTime())); mbMemberCoupon.setModerNo(memberNo); mbMemberCoupon.setModDtm(prCoupon.getRgstDtm()); mbMemberCouponDao.insert(mbMemberCoupon); // 발급한 count 쿠폰테이블 update paperCoupon.setTotalIssueCount(paperCoupon.getTotalIssueCount() + 1); prCouponDao.update(paperCoupon); } } /** * @Desc : 상품에 해당하는 쿠폰 조회. 혜택이 높은 쿠폰(일반/플러스쿠폰 모두) 순으로 반환. * @Method Name : getCouponByPrdtNo * @Date : 2019. 6. 12. * @Author : tennessee * @param prdtNo * @return * @throws Exception */ public List<PdProductCoupon> getCouponByPrdtNo(String prdtNo) throws Exception { return this.prCouponDao.selectCouponByPrdtNo(prdtNo); } /** * @Desc : 쿠폰 대상 상품 리스트 * @Method Name : getDrawTargetProductList * @Date : 2019. 6. 21. * @Author : 이지훈 * @param getDrawTargetProductList * @return */ public Map<String, Object> getCouponApplyProductList(Parameter<PrCouponApplyProduct> parameter) throws Exception { Map<String, Object> map = new HashMap<>(); PageableProduct<PrCouponApplyProduct, PdProductWrapper> pageable = new PageableProduct<PrCouponApplyProduct, PdProductWrapper>( parameter); pageable.setCondition(parameter.get().getSiteNo(), parameter.get().getChnnlNo()); pageable.setUseTableMapping("PR_COUPON_APPLY_PRODUCT", new LinkedHashMap<String, String>() { { put("cpn_no", parameter.get().getCpnNo()); } }, null); // pageable.setCategoryMapping(parameter.get().getCtgrNo()); String pagingSortType = parameter.get().getPagingSortType() != null ? parameter.get().getPagingSortType() : PageableProduct.PAGING_SORT_TYPE_NEWEST; pageable.setUsePaging(true, pagingSortType, null, null); pageable.setRowsPerPage(parameter.get().getRowsPerPage()); pageable.setPageNum(parameter.get().getPageNum()); Page<PdProductWrapper> productList = this.productService.getDisplayProductList(pageable); map.put("productList", productList); return map; } }
11,315
0.698832
0.691105
335
30.450747
27.484972
129
false
false
0
0
0
0
0
0
2.256716
false
false
2
54e2f6c47de6566fa86cdd57b7bd7b65dd366f61
687,194,772,527
a9b06405b0c20a1a346019126b56f56c825e3e34
/Project 1/Variable1.java
79ef16adf1ac731a63b51bdfe87bf70d4b7e0f32
[]
no_license
franknemo/For-Class
https://github.com/franknemo/For-Class
7b840c7e42e57c0554308edc05ad65c169dbedf2
63b565388cb1f44e4b8b15b847317698e811e267
refs/heads/main
2023-03-24T12:31:55.268000
2021-03-16T06:52:07
2021-03-16T06:52:07
343,983,496
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; public class Variable1 { public static void main(String[] args) { var mylist = new ArrayList<Integer>(); var endnum = 10; var number = 0; // input for( var number = 0; number < endnum; } }
UTF-8
Java
281
java
Variable1.java
Java
[]
null
[]
import java.util.ArrayList; public class Variable1 { public static void main(String[] args) { var mylist = new ArrayList<Integer>(); var endnum = 10; var number = 0; // input for( var number = 0; number < endnum; } }
281
0.540925
0.523132
20
13.05
16.35688
47
false
false
0
0
0
0
0
0
0.3
false
false
2
4516612ea279d2db0f7dd639d2cd83e459ea00bd
6,390,911,380,056
ea3154f2793a3789d1c81696ae1925908a8fe204
/Microservice-Gift/src/main/java/sensos/gift/bo/GiftEventAnnouncement.java
b636de2e794a77220659b176d7c115f5d00511f5
[]
no_license
valtus/sensos
https://github.com/valtus/sensos
ec100dea5751d6a459c8e6da6472c608341bb36a
f6fc92fd4178b62759e6c0822ce6f1c44c253681
refs/heads/master
2015-08-12T15:47:05.769000
2015-07-09T08:37:46
2015-07-09T08:37:46
22,252,951
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package sensos.gift.bo; import java.sql.Date; import javax.persistence.Id; public class GiftEventAnnouncement { @Id long id; /** The gift registry or wish list for which this announcement is created */ long giftRegistryId; /** The date when announcement was send */ Date sentDate; /** The e-mail address of the sender */ String senderEmail; /** The content of the announcement. */ String message; /** The name of the announcement sender */ String senderName; /** Customizable */ String field1, field2 = null; public long getId() { return id; } public void setId(long id) { this.id = id; } public long getGiftRegistryId() { return giftRegistryId; } public void setGiftRegistryId(long giftRegistryId) { this.giftRegistryId = giftRegistryId; } public Date getSentDate() { return sentDate; } public void setSentDate(Date sentDate) { this.sentDate = sentDate; } public String getSenderEmail() { return senderEmail; } public void setSenderEmail(String senderEmail) { this.senderEmail = senderEmail; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getSenderName() { return senderName; } public void setSenderName(String senderName) { this.senderName = senderName; } public String getField1() { return field1; } public void setField1(String field1) { this.field1 = field1; } public String getField2() { return field2; } public void setField2(String field2) { this.field2 = field2; } @Override public String toString() { return "GiftEventAnnouncement [id=" + id + ", giftRegistryId=" + giftRegistryId + ", sentDate=" + sentDate + ", senderEmail=" + senderEmail + ", message=" + message + ", senderName=" + senderName + ", field1=" + field1 + ", field2=" + field2 + "]"; } }
UTF-8
Java
1,879
java
GiftEventAnnouncement.java
Java
[]
null
[]
package sensos.gift.bo; import java.sql.Date; import javax.persistence.Id; public class GiftEventAnnouncement { @Id long id; /** The gift registry or wish list for which this announcement is created */ long giftRegistryId; /** The date when announcement was send */ Date sentDate; /** The e-mail address of the sender */ String senderEmail; /** The content of the announcement. */ String message; /** The name of the announcement sender */ String senderName; /** Customizable */ String field1, field2 = null; public long getId() { return id; } public void setId(long id) { this.id = id; } public long getGiftRegistryId() { return giftRegistryId; } public void setGiftRegistryId(long giftRegistryId) { this.giftRegistryId = giftRegistryId; } public Date getSentDate() { return sentDate; } public void setSentDate(Date sentDate) { this.sentDate = sentDate; } public String getSenderEmail() { return senderEmail; } public void setSenderEmail(String senderEmail) { this.senderEmail = senderEmail; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getSenderName() { return senderName; } public void setSenderName(String senderName) { this.senderName = senderName; } public String getField1() { return field1; } public void setField1(String field1) { this.field1 = field1; } public String getField2() { return field2; } public void setField2(String field2) { this.field2 = field2; } @Override public String toString() { return "GiftEventAnnouncement [id=" + id + ", giftRegistryId=" + giftRegistryId + ", sentDate=" + sentDate + ", senderEmail=" + senderEmail + ", message=" + message + ", senderName=" + senderName + ", field1=" + field1 + ", field2=" + field2 + "]"; } }
1,879
0.685471
0.675891
103
17.242718
18.626877
77
false
false
0
0
0
0
0
0
1.349515
false
false
2
644a884c7097e34276022af66b9fdf8f821b9efb
12,086,037,977,757
16f726820b7df1aa31acb6d02bd89ecb38ac186d
/util/hack/src/dramaman/runtime/BeatMonitor$BeatGraphPanel.java
0a59eecd786e8d0f4735aeedab63d8569403e034
[]
no_license
donnaken15/Exterieur
https://github.com/donnaken15/Exterieur
c8bcee1e52a57783525547fc0d2c3a3aa34190d5
550435cba73e3ec3252b97bf77cfd172d7a5e449
refs/heads/master
2020-03-16T13:25:47.231000
2018-05-09T02:41:46
2018-05-09T02:41:46
132,690,016
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* */ package dramaman.runtime; /* */ /* */ import java.awt.BasicStroke; /* */ import java.awt.Color; /* */ import java.awt.Dimension; /* */ import java.awt.Graphics; /* */ import java.awt.Graphics2D; /* */ import java.awt.RenderingHints; /* */ import java.awt.geom.AffineTransform; /* */ import java.util.Collection; /* */ import java.util.Hashtable; /* */ import java.util.Vector; /* */ import javax.swing.BorderFactory; /* */ import javax.swing.JPanel; /* */ /* */ /* */ /* */ /* */ /* */ /* */ class BeatMonitor$BeatGraphPanel /* */ extends JPanel /* */ { /* */ private static final int MAX_BEAT = 20; /* */ private static final int MAX_VALUE = 5; /* */ private static final int VALUE_TICK_INCREMENT = 1; /* */ private static final int TICK_LENGTH = 10; /* */ private static final int NUMBER_OF_VALUE_TICKS = 5; /* */ private static final int X_BORDER = 40; /* */ private static final int Y_BORDER = 20; /* */ private static final int MINIMUM_GRAPH_HEIGHT = 40; /* */ private static final int MINIMUM_GRAPH_WIDTH = 70; /* */ private final Color[] colors; /* */ private int xAxisLength; /* */ private int yAxisLength; /* */ private float xTickDistance; /* */ private float yTickDistance; /* */ private float scale; /* */ private StoryTarget[] targets; /* */ private int maxBeats; /* */ Vector actualStoryValues; /* */ int beatCount; /* */ final BeatMonitor this$0; /* */ /* */ private final void jdMethod_this() /* */ { /* 47 */ this.colors = new Color[] { Color.black, Color.red, Color.cyan, Color.green, Color.darkGray, Color.lightGray, Color.magenta, Color.orange, Color.pink, Color.white, Color.yellow }; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public BeatMonitor$BeatGraphPanel(BeatMonitor paramBeatMonitor) /* */ { /* 67 */ jdMethod_this(); /* 68 */ setMinimumSize(new Dimension(110, 60)); /* 69 */ setBorder(BorderFactory.createTitledBorder("Story Arc")); /* */ } /* */ /* */ /* */ /* */ void setStory(Beat[] paramArrayOfBeat, int paramInt, Hashtable paramHashtable) /* */ { /* 76 */ this.targets = ((StoryTarget[])paramHashtable.values().toArray(new StoryTarget[paramHashtable.size()])); /* */ /* 78 */ this.maxBeats = paramInt; /* */ /* 80 */ this.actualStoryValues = new Vector(); /* 81 */ this.actualStoryValues.add(new float[this.targets.length]); /* 82 */ this.beatCount = 0; /* 83 */ for (int i = 0; i < this.targets.length; i++) /* 84 */ ((float[])this.actualStoryValues.get(0))[i] = this.targets[i].getInitialValue(); /* 85 */ repaint(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ void succeedBeat(Beat paramBeat) /* */ { /* 94 */ this.beatCount += 1; /* 95 */ this.actualStoryValues.add(new float[this.targets.length]); /* 96 */ for (int i = 0; i < this.targets.length; i++) { /* 97 */ ((float[])this.actualStoryValues.get(this.beatCount))[i] = DramaManager.getStoryMemory().getStoryValue(this.targets[i].getValueWMEName()); /* */ } /* 99 */ repaint(); /* */ } /* */ /* */ private final void computeAxesInfo(Dimension paramDimension) /* */ { /* 104 */ this.xAxisLength = (paramDimension.width - 40); /* 105 */ this.yAxisLength = (paramDimension.height - 20 - 15); /* 106 */ this.xTickDistance = (this.xAxisLength / 20); /* 107 */ this.yTickDistance = (this.yAxisLength / 5); /* 108 */ this.scale = ((this.xTickDistance + this.yTickDistance) / 2.0F); /* */ } /* */ /* */ /* */ /* */ private final void paintAxes(Graphics2D paramGraphics2D, Dimension paramDimension, AffineTransform paramAffineTransform) /* */ { /* 115 */ Line2DTransform localLine2DTransform1 = new Line2DTransform(0.0F, 0.0F, this.xAxisLength, 0.0F, paramAffineTransform); /* 116 */ paramGraphics2D.draw(localLine2DTransform1); /* 117 */ Line2DTransform localLine2DTransform2 = new Line2DTransform(0.0F, 0.0F, 0.0F, this.yAxisLength, paramAffineTransform); /* 118 */ paramGraphics2D.draw(localLine2DTransform2); /* */ /* */ /* */ /* 122 */ for (int i = 1; i <= 20; i++) { /* 123 */ Line2DTransform localLine2DTransform3 = new Line2DTransform(i * this.xTickDistance, -5.0F, i * this.xTickDistance, 5, paramAffineTransform); /* 124 */ paramGraphics2D.draw(localLine2DTransform3); /* */ } /* */ /* */ /* 128 */ for (int j = 1; j <= 5; j++) { /* 129 */ Line2DTransform localLine2DTransform4 = new Line2DTransform(-5.0F, j * this.yTickDistance, 5, j * this.yTickDistance, paramAffineTransform); /* 130 */ paramGraphics2D.draw(localLine2DTransform4); /* */ } /* */ } /* */ /* */ /* */ /* */ private final Color pickColor(int paramInt) /* */ { /* 138 */ if (paramInt < this.colors.length) { /* 139 */ return this.colors[paramInt]; /* */ } /* 141 */ return this.colors[(paramInt % this.colors.length)]; /* */ } /* */ /* */ /* */ private final void paintTargets(Graphics2D paramGraphics2D, AffineTransform paramAffineTransform) /* */ { /* 147 */ if (this.targets != null) { /* 148 */ for (int i = 0; i < this.targets.length; i++) { /* 149 */ paramGraphics2D.setColor(pickColor(i)); /* 150 */ this.targets[i].drawTarget(paramGraphics2D, this.maxBeats, paramAffineTransform); /* */ } /* */ } /* */ } /* */ /* */ private final void paintActualValues(Graphics2D paramGraphics2D, AffineTransform paramAffineTransform) /* */ { /* 157 */ if (this.beatCount > 0) { /* 158 */ BasicStroke localBasicStroke1 = (BasicStroke)paramGraphics2D.getStroke(); /* 159 */ float[] arrayOfFloat = { 3 }; /* 160 */ BasicStroke localBasicStroke2 = new BasicStroke(localBasicStroke1.getLineWidth(), 0, localBasicStroke1.getLineJoin(), localBasicStroke1.getMiterLimit(), arrayOfFloat, 0.0F); /* */ /* 162 */ paramGraphics2D.setStroke(localBasicStroke2); /* 163 */ for (int i = 0; i < this.targets.length; i++) { /* 164 */ paramGraphics2D.setColor(pickColor(i)); /* */ /* 166 */ for (int j = 1; j <= this.beatCount; j++) /* */ { /* 168 */ Line2DTransform localLine2DTransform = new Line2DTransform(j - 1, ((float[])this.actualStoryValues.get(j - 1))[i], j, ((float[])this.actualStoryValues.get(j))[i], paramAffineTransform); /* */ /* 170 */ paramGraphics2D.draw(localLine2DTransform); /* */ } /* */ } /* 173 */ paramGraphics2D.setStroke(localBasicStroke1); /* */ } /* */ } /* */ /* */ private final void paintCurrentBeatMarker(Graphics2D paramGraphics2D, AffineTransform paramAffineTransform) /* */ { /* 179 */ Color localColor = paramGraphics2D.getColor(); /* 180 */ paramGraphics2D.setColor(Color.blue); /* */ /* 182 */ Line2DTransform localLine2DTransform = new Line2DTransform(this.beatCount + 1, 0.0F, this.beatCount + 1, 100.0F, paramAffineTransform); /* 183 */ paramGraphics2D.draw(localLine2DTransform); /* */ /* 185 */ paramGraphics2D.setColor(localColor); /* */ } /* */ /* */ public void paintComponent(Graphics paramGraphics) /* */ { /* 190 */ super.paintComponent(paramGraphics); /* 191 */ Graphics2D localGraphics2D = (Graphics2D)paramGraphics; /* 192 */ Dimension localDimension = getSize(); /* */ /* 194 */ computeAxesInfo(localDimension); /* */ /* */ /* 197 */ localGraphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); /* 198 */ localGraphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); /* */ /* */ /* 201 */ AffineTransform localAffineTransform1 = new AffineTransform(1.0F, 0.0F, 0.0F, -1.0F, 30.0F, localDimension.height - 20); /* */ /* 203 */ paintAxes(localGraphics2D, localDimension, localAffineTransform1); /* */ /* */ /* 206 */ AffineTransform localAffineTransform2 = new AffineTransform(localAffineTransform1); /* 207 */ localAffineTransform2.scale(this.xTickDistance, this.yTickDistance); /* 208 */ paintTargets(localGraphics2D, localAffineTransform2); /* 209 */ paintActualValues(localGraphics2D, localAffineTransform2); /* 210 */ paintCurrentBeatMarker(localGraphics2D, localAffineTransform2); /* */ } /* */ } /* Location: C:\Program Files (x86)\Extérieur\util\classes\!\dramaman\runtime\BeatMonitor$BeatGraphPanel.class * Java compiler version: 4 (48.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
9,184
java
BeatMonitor$BeatGraphPanel.java
Java
[]
null
[]
/* */ package dramaman.runtime; /* */ /* */ import java.awt.BasicStroke; /* */ import java.awt.Color; /* */ import java.awt.Dimension; /* */ import java.awt.Graphics; /* */ import java.awt.Graphics2D; /* */ import java.awt.RenderingHints; /* */ import java.awt.geom.AffineTransform; /* */ import java.util.Collection; /* */ import java.util.Hashtable; /* */ import java.util.Vector; /* */ import javax.swing.BorderFactory; /* */ import javax.swing.JPanel; /* */ /* */ /* */ /* */ /* */ /* */ /* */ class BeatMonitor$BeatGraphPanel /* */ extends JPanel /* */ { /* */ private static final int MAX_BEAT = 20; /* */ private static final int MAX_VALUE = 5; /* */ private static final int VALUE_TICK_INCREMENT = 1; /* */ private static final int TICK_LENGTH = 10; /* */ private static final int NUMBER_OF_VALUE_TICKS = 5; /* */ private static final int X_BORDER = 40; /* */ private static final int Y_BORDER = 20; /* */ private static final int MINIMUM_GRAPH_HEIGHT = 40; /* */ private static final int MINIMUM_GRAPH_WIDTH = 70; /* */ private final Color[] colors; /* */ private int xAxisLength; /* */ private int yAxisLength; /* */ private float xTickDistance; /* */ private float yTickDistance; /* */ private float scale; /* */ private StoryTarget[] targets; /* */ private int maxBeats; /* */ Vector actualStoryValues; /* */ int beatCount; /* */ final BeatMonitor this$0; /* */ /* */ private final void jdMethod_this() /* */ { /* 47 */ this.colors = new Color[] { Color.black, Color.red, Color.cyan, Color.green, Color.darkGray, Color.lightGray, Color.magenta, Color.orange, Color.pink, Color.white, Color.yellow }; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public BeatMonitor$BeatGraphPanel(BeatMonitor paramBeatMonitor) /* */ { /* 67 */ jdMethod_this(); /* 68 */ setMinimumSize(new Dimension(110, 60)); /* 69 */ setBorder(BorderFactory.createTitledBorder("Story Arc")); /* */ } /* */ /* */ /* */ /* */ void setStory(Beat[] paramArrayOfBeat, int paramInt, Hashtable paramHashtable) /* */ { /* 76 */ this.targets = ((StoryTarget[])paramHashtable.values().toArray(new StoryTarget[paramHashtable.size()])); /* */ /* 78 */ this.maxBeats = paramInt; /* */ /* 80 */ this.actualStoryValues = new Vector(); /* 81 */ this.actualStoryValues.add(new float[this.targets.length]); /* 82 */ this.beatCount = 0; /* 83 */ for (int i = 0; i < this.targets.length; i++) /* 84 */ ((float[])this.actualStoryValues.get(0))[i] = this.targets[i].getInitialValue(); /* 85 */ repaint(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ void succeedBeat(Beat paramBeat) /* */ { /* 94 */ this.beatCount += 1; /* 95 */ this.actualStoryValues.add(new float[this.targets.length]); /* 96 */ for (int i = 0; i < this.targets.length; i++) { /* 97 */ ((float[])this.actualStoryValues.get(this.beatCount))[i] = DramaManager.getStoryMemory().getStoryValue(this.targets[i].getValueWMEName()); /* */ } /* 99 */ repaint(); /* */ } /* */ /* */ private final void computeAxesInfo(Dimension paramDimension) /* */ { /* 104 */ this.xAxisLength = (paramDimension.width - 40); /* 105 */ this.yAxisLength = (paramDimension.height - 20 - 15); /* 106 */ this.xTickDistance = (this.xAxisLength / 20); /* 107 */ this.yTickDistance = (this.yAxisLength / 5); /* 108 */ this.scale = ((this.xTickDistance + this.yTickDistance) / 2.0F); /* */ } /* */ /* */ /* */ /* */ private final void paintAxes(Graphics2D paramGraphics2D, Dimension paramDimension, AffineTransform paramAffineTransform) /* */ { /* 115 */ Line2DTransform localLine2DTransform1 = new Line2DTransform(0.0F, 0.0F, this.xAxisLength, 0.0F, paramAffineTransform); /* 116 */ paramGraphics2D.draw(localLine2DTransform1); /* 117 */ Line2DTransform localLine2DTransform2 = new Line2DTransform(0.0F, 0.0F, 0.0F, this.yAxisLength, paramAffineTransform); /* 118 */ paramGraphics2D.draw(localLine2DTransform2); /* */ /* */ /* */ /* 122 */ for (int i = 1; i <= 20; i++) { /* 123 */ Line2DTransform localLine2DTransform3 = new Line2DTransform(i * this.xTickDistance, -5.0F, i * this.xTickDistance, 5, paramAffineTransform); /* 124 */ paramGraphics2D.draw(localLine2DTransform3); /* */ } /* */ /* */ /* 128 */ for (int j = 1; j <= 5; j++) { /* 129 */ Line2DTransform localLine2DTransform4 = new Line2DTransform(-5.0F, j * this.yTickDistance, 5, j * this.yTickDistance, paramAffineTransform); /* 130 */ paramGraphics2D.draw(localLine2DTransform4); /* */ } /* */ } /* */ /* */ /* */ /* */ private final Color pickColor(int paramInt) /* */ { /* 138 */ if (paramInt < this.colors.length) { /* 139 */ return this.colors[paramInt]; /* */ } /* 141 */ return this.colors[(paramInt % this.colors.length)]; /* */ } /* */ /* */ /* */ private final void paintTargets(Graphics2D paramGraphics2D, AffineTransform paramAffineTransform) /* */ { /* 147 */ if (this.targets != null) { /* 148 */ for (int i = 0; i < this.targets.length; i++) { /* 149 */ paramGraphics2D.setColor(pickColor(i)); /* 150 */ this.targets[i].drawTarget(paramGraphics2D, this.maxBeats, paramAffineTransform); /* */ } /* */ } /* */ } /* */ /* */ private final void paintActualValues(Graphics2D paramGraphics2D, AffineTransform paramAffineTransform) /* */ { /* 157 */ if (this.beatCount > 0) { /* 158 */ BasicStroke localBasicStroke1 = (BasicStroke)paramGraphics2D.getStroke(); /* 159 */ float[] arrayOfFloat = { 3 }; /* 160 */ BasicStroke localBasicStroke2 = new BasicStroke(localBasicStroke1.getLineWidth(), 0, localBasicStroke1.getLineJoin(), localBasicStroke1.getMiterLimit(), arrayOfFloat, 0.0F); /* */ /* 162 */ paramGraphics2D.setStroke(localBasicStroke2); /* 163 */ for (int i = 0; i < this.targets.length; i++) { /* 164 */ paramGraphics2D.setColor(pickColor(i)); /* */ /* 166 */ for (int j = 1; j <= this.beatCount; j++) /* */ { /* 168 */ Line2DTransform localLine2DTransform = new Line2DTransform(j - 1, ((float[])this.actualStoryValues.get(j - 1))[i], j, ((float[])this.actualStoryValues.get(j))[i], paramAffineTransform); /* */ /* 170 */ paramGraphics2D.draw(localLine2DTransform); /* */ } /* */ } /* 173 */ paramGraphics2D.setStroke(localBasicStroke1); /* */ } /* */ } /* */ /* */ private final void paintCurrentBeatMarker(Graphics2D paramGraphics2D, AffineTransform paramAffineTransform) /* */ { /* 179 */ Color localColor = paramGraphics2D.getColor(); /* 180 */ paramGraphics2D.setColor(Color.blue); /* */ /* 182 */ Line2DTransform localLine2DTransform = new Line2DTransform(this.beatCount + 1, 0.0F, this.beatCount + 1, 100.0F, paramAffineTransform); /* 183 */ paramGraphics2D.draw(localLine2DTransform); /* */ /* 185 */ paramGraphics2D.setColor(localColor); /* */ } /* */ /* */ public void paintComponent(Graphics paramGraphics) /* */ { /* 190 */ super.paintComponent(paramGraphics); /* 191 */ Graphics2D localGraphics2D = (Graphics2D)paramGraphics; /* 192 */ Dimension localDimension = getSize(); /* */ /* 194 */ computeAxesInfo(localDimension); /* */ /* */ /* 197 */ localGraphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); /* 198 */ localGraphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); /* */ /* */ /* 201 */ AffineTransform localAffineTransform1 = new AffineTransform(1.0F, 0.0F, 0.0F, -1.0F, 30.0F, localDimension.height - 20); /* */ /* 203 */ paintAxes(localGraphics2D, localDimension, localAffineTransform1); /* */ /* */ /* 206 */ AffineTransform localAffineTransform2 = new AffineTransform(localAffineTransform1); /* 207 */ localAffineTransform2.scale(this.xTickDistance, this.yTickDistance); /* 208 */ paintTargets(localGraphics2D, localAffineTransform2); /* 209 */ paintActualValues(localGraphics2D, localAffineTransform2); /* 210 */ paintCurrentBeatMarker(localGraphics2D, localAffineTransform2); /* */ } /* */ } /* Location: C:\Program Files (x86)\Extérieur\util\classes\!\dramaman\runtime\BeatMonitor$BeatGraphPanel.class * Java compiler version: 4 (48.0) * JD-Core Version: 0.7.1 */
9,184
0.57356
0.533595
218
41.128441
38.595314
205
false
false
0
0
0
0
0
0
0.766055
false
false
2
cad2749fe731d3774747208e42e1b6d21294f9d5
12,086,037,979,662
871c59b3893b12ce055a50f57a069a546f8e990a
/Chapter2/Example2_16.java
82f93c4e6dc102a7c6c242cd02e465556353c066
[]
no_license
joshcv2112/JavaProgramming
https://github.com/joshcv2112/JavaProgramming
43e5cf8664b74f045da60548954e3f82e269ea05
05851b281b0822ab1fbe01ab080fe8cd1758c17b
refs/heads/master
2021-01-22T01:18:22.556000
2016-10-02T19:23:59
2016-10-02T19:23:59
68,780,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.*; public class Example2_16 { public static void main(String[] args) { String str; int num1 = 45; int num2 = 56; int sum; str = "The two numbers are: " + num1 + " and " + num2 + "\n"; sum = num1 + num2; str = str + "The sum of the numbers is: " + sum + "\n"; str = str + "That is all for now!"; JOptionPane.showMessageDialog(null, str, "Summing Numbers", JOptionPane.ERROR_MESSAGE); } }
UTF-8
Java
493
java
Example2_16.java
Java
[]
null
[]
import javax.swing.*; public class Example2_16 { public static void main(String[] args) { String str; int num1 = 45; int num2 = 56; int sum; str = "The two numbers are: " + num1 + " and " + num2 + "\n"; sum = num1 + num2; str = str + "The sum of the numbers is: " + sum + "\n"; str = str + "That is all for now!"; JOptionPane.showMessageDialog(null, str, "Summing Numbers", JOptionPane.ERROR_MESSAGE); } }
493
0.537525
0.511156
20
23.700001
25.946291
95
false
false
0
0
0
0
0
0
0.65
false
false
2
44ee7bc86384243578fb93851f48e756436a0038
1,262,720,414,038
4c6ffc624bb6909aae4d38aa7f25efe314fbfb0a
/Test/Herbinate3.6/src/com/huawei/wanbao/test/App.java
3e4b53addb9bc5160b8fc026b68889722a18c063
[]
no_license
wangbaobisheng/Test
https://github.com/wangbaobisheng/Test
2cc79b78510e76ece34cf3bfa546691e2d1e47d1
efcdebcf315fcc3800b270f8348df71d64e4d95b
refs/heads/master
2021-01-20T00:28:05.824000
2017-04-24T10:13:51
2017-04-24T10:13:51
89,134,743
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huawei.wanbao.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.junit.Test; public class App { private static SessionFactory sessionFactory ; static { Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); sessionFactory = cfg.buildSessionFactory(); } public static void main(String[] args) { //testSave(); testGet(); } /** * 保存 */ public static void testSave() { User user = new User(); user.setName("zhangsan"); Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); session.save(user); tx.commit(); session.close(); } public static void testGet() { Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); User user = (User) session.get(User.class, 1); tx.commit(); System.out.println(user.toString()); } }
UTF-8
Java
1,001
java
App.java
Java
[ { "context": "ve()\n\t{\n\t\tUser user = new User();\n\t\tuser.setName(\"zhangsan\");\n\t\t\n\t\tSession session = sessionFactory.openSess", "end": 594, "score": 0.9934561252593994, "start": 586, "tag": "USERNAME", "value": "zhangsan" } ]
null
[]
package com.huawei.wanbao.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.junit.Test; public class App { private static SessionFactory sessionFactory ; static { Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); sessionFactory = cfg.buildSessionFactory(); } public static void main(String[] args) { //testSave(); testGet(); } /** * 保存 */ public static void testSave() { User user = new User(); user.setName("zhangsan"); Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); session.save(user); tx.commit(); session.close(); } public static void testGet() { Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); User user = (User) session.get(User.class, 1); tx.commit(); System.out.println(user.toString()); } }
1,001
0.703109
0.702106
48
19.770834
17.507427
49
false
false
0
0
0
0
0
0
1.8125
false
false
2
0c5fa9483552a93d306e595083fa63746704b468
28,664,611,782,784
829de87ad529d62ddaef5b46c09d052a865f1b1b
/app/src/main/java/com/kumar/nikhil/popoapp/activity/AddActivity.java
7daaf2f075cc5fb27e42cc2054f77dafabac798e
[]
no_license
NikhilKu/PopoApp
https://github.com/NikhilKu/PopoApp
c38dc5bd30df33c63feaa16013561adc9e15c22d
ce86998b4ac42eff4a78ef66c3a0b57d6790ea3b
refs/heads/master
2020-04-02T07:49:01.552000
2019-01-14T17:36:04
2019-01-14T17:36:04
154,216,445
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kumar.nikhil.popoapp.activity; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlacePicker; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.kumar.nikhil.popoapp.models.PoliceCheck; import com.kumar.nikhil.popoapp.R; import java.util.ArrayList; public class AddActivity extends AppCompatActivity { private EditText mInformation; private Spinner mType; private Button mSelectPlaceButton; private Double mLongitude; private Double mLatitude; private DatabaseReference mDatabaseRef; final int PLACE_PICKER_REQUEST = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); mSelectPlaceButton = findViewById(R.id.SelectBtn); mSelectPlaceButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openPlacePicker(); } }); FloatingActionButton addButton = findViewById(R.id.fab); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mInformation = findViewById(R.id.EditTextInformation); mType = findViewById(R.id.SpinnerType); if(!validateForm()){ return; } PoliceCheck check = new PoliceCheck( mType.getSelectedItem().toString(), mInformation.getText().toString(), mLongitude, mLatitude, System.currentTimeMillis() ); mDatabaseRef = FirebaseDatabase.getInstance().getReference("checks"); String id = mDatabaseRef.push().getKey(); mDatabaseRef.child(id).setValue(check); finish(); Snackbar.make(view, "New police check added", Snackbar.LENGTH_LONG).show(); } }); } /** * * Validates the form to detect empty fields * If a field is empty it shows the error. * * @return boolean form is validated or not */ private boolean validateForm() { ArrayList<String> errors = new ArrayList<String>(); final int MINUMUM_DESCRIPTION_LENGTH = 3; if(mInformation.getText().length() < MINUMUM_DESCRIPTION_LENGTH){ errors.add(String.format("Please add atleast %s characters to the description", MINUMUM_DESCRIPTION_LENGTH)); } if(mLongitude == null || mLatitude == null){ errors.add("Location is required"); } if(errors.size() == 0 ){ return true; }else{ String message = ""; int i = 0; for (String e : errors){ message = i == 0 ? e : (message + " & " + e); i++; } Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); return false; } } @Override public boolean onSupportNavigateUp() { onBackPressed(); return true; } /** * Opens a new intent with a placepicker. */ private void openPlacePicker(){ PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { startActivityForResult(builder.build(AddActivity.this), PLACE_PICKER_REQUEST); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); Log.d("error - placepicker", e + ""); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); Log.d("error - placepicker", e + ""); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(data, this); String toastMsg = String.format("Place: %s", place.getName()); this.mLatitude = place.getLatLng().latitude; this.mLongitude = place.getLatLng().longitude; mSelectPlaceButton.setText(place.getAddress().toString()); mSelectPlaceButton.setTextColor(getResources().getColor(R.color.colorYellow)); } } } }
UTF-8
Java
5,555
java
AddActivity.java
Java
[]
null
[]
package com.kumar.nikhil.popoapp.activity; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.ui.PlacePicker; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.kumar.nikhil.popoapp.models.PoliceCheck; import com.kumar.nikhil.popoapp.R; import java.util.ArrayList; public class AddActivity extends AppCompatActivity { private EditText mInformation; private Spinner mType; private Button mSelectPlaceButton; private Double mLongitude; private Double mLatitude; private DatabaseReference mDatabaseRef; final int PLACE_PICKER_REQUEST = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); mSelectPlaceButton = findViewById(R.id.SelectBtn); mSelectPlaceButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openPlacePicker(); } }); FloatingActionButton addButton = findViewById(R.id.fab); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mInformation = findViewById(R.id.EditTextInformation); mType = findViewById(R.id.SpinnerType); if(!validateForm()){ return; } PoliceCheck check = new PoliceCheck( mType.getSelectedItem().toString(), mInformation.getText().toString(), mLongitude, mLatitude, System.currentTimeMillis() ); mDatabaseRef = FirebaseDatabase.getInstance().getReference("checks"); String id = mDatabaseRef.push().getKey(); mDatabaseRef.child(id).setValue(check); finish(); Snackbar.make(view, "New police check added", Snackbar.LENGTH_LONG).show(); } }); } /** * * Validates the form to detect empty fields * If a field is empty it shows the error. * * @return boolean form is validated or not */ private boolean validateForm() { ArrayList<String> errors = new ArrayList<String>(); final int MINUMUM_DESCRIPTION_LENGTH = 3; if(mInformation.getText().length() < MINUMUM_DESCRIPTION_LENGTH){ errors.add(String.format("Please add atleast %s characters to the description", MINUMUM_DESCRIPTION_LENGTH)); } if(mLongitude == null || mLatitude == null){ errors.add("Location is required"); } if(errors.size() == 0 ){ return true; }else{ String message = ""; int i = 0; for (String e : errors){ message = i == 0 ? e : (message + " & " + e); i++; } Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show(); return false; } } @Override public boolean onSupportNavigateUp() { onBackPressed(); return true; } /** * Opens a new intent with a placepicker. */ private void openPlacePicker(){ PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder(); try { startActivityForResult(builder.build(AddActivity.this), PLACE_PICKER_REQUEST); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); Log.d("error - placepicker", e + ""); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); Log.d("error - placepicker", e + ""); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PLACE_PICKER_REQUEST) { if (resultCode == RESULT_OK) { Place place = PlacePicker.getPlace(data, this); String toastMsg = String.format("Place: %s", place.getName()); this.mLatitude = place.getLatLng().latitude; this.mLongitude = place.getLatLng().longitude; mSelectPlaceButton.setText(place.getAddress().toString()); mSelectPlaceButton.setTextColor(getResources().getColor(R.color.colorYellow)); } } } }
5,555
0.592439
0.591179
158
34.158226
27.080639
124
false
false
0
0
0
0
0
0
0.56962
false
false
2
3c975701599730e9aff1a66f439005be38793790
24,833,500,920,714
8782061b1e1223488a090f9f3f3b8dfe489e054a
/storeMongoDB/projects/ABCD/adaptives_MinesweeperCore/test/8Test.java
da89a6971ab4dba8533b9b4bfbf35e5bb05143e8
[]
no_license
ryosuke-ku/TCS_init
https://github.com/ryosuke-ku/TCS_init
3cb79a46aa217e62d8fff13d600f2a9583df986c
e1207d68bdc9d2f1eed63ef44a672b5a37b45633
refs/heads/master
2020-08-08T18:40:17.929000
2019-10-18T01:06:32
2019-10-18T01:06:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public void testNonMineCoveredSquareForUncover() throws Exception { this.square.setMine(false); this.square.setStatus(Square.STATUS.COVERED); this.square.uncover(); }
UTF-8
Java
180
java
8Test.java
Java
[]
null
[]
public void testNonMineCoveredSquareForUncover() throws Exception { this.square.setMine(false); this.square.setStatus(Square.STATUS.COVERED); this.square.uncover(); }
180
0.755556
0.755556
5
33.799999
21.939919
67
false
false
0
0
0
0
0
0
2
false
false
2
95eb125fe1addd0d95ab896f4c53b3734b5c3b6a
11,269,994,215,991
6a53424d3b00e335e309d83d314b061dd6adc40a
/DP146E_PolygonPerimeter.java
69ec03fab530d652a78aad7e289492b3647bdc70
[]
no_license
brian-rieder/DailyProgrammer
https://github.com/brian-rieder/DailyProgrammer
b09175acc8909988f025a29090626aa05b6c52f5
ad97fb20db5802736e488f635e8a37a5e6ceab7f
refs/heads/master
2016-09-06T02:10:52.044000
2015-10-28T18:21:08
2015-10-28T18:21:08
29,260,249
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Link to reddit: http://www.reddit.com/r/dailyprogrammer/comments/1tixzk/122313_challenge_146_easy_polygon_perimeter/ // Difficulty: Easy //A Polygon is a geometric two-dimensional figure that has n-sides (line segments) that closes to form a loop. // Polygons can be in many different shapes and have many different neat properties, though this challenge is about // Regular Polygons . Our goal is to compute the permitter of an n-sided polygon that has equal-length sides // given the circumradius . This is the distance between the center of the Polygon to any of its vertices; // not to be confused with the apothem! // Input Description // Input will consist of one line on standard console input. This line will contain first an integer N, then // a floating-point number R. They will be space-delimited. The integer N is for the number of sides of the Polygon, // which is between 3 to 100, inclusive. R will be the circumradius, which ranges from 0.01 to 100.0, inclusive. // Output Description // Print the permitter of the given N-sided polygon that has a circumradius of R. Print up to three digits precision. // Sample Inputs & Outputs // Sample Input 1 // 5 3.7 // Sample Output 1 // 21.748 // Sample Input 2 // 100 1.0 // Sample Output 2 // 6.282 import java.util.Scanner; class Polygon { private int numSides; private float circumradius; public Polygon(int givenNumSides, float givenCircumradius) { numSides = givenNumSides; circumradius = givenCircumradius; } public int getNumSides() { return numSides; } public void setNumSides(int newVal) { numSides = newVal; } public float getCircumradius() { return circumradius; } public void setCircumradius(int newVal) { circumradius = newVal; } public float findSideLength() { float angleApothemToCircumradius = 180F / numSides; return 2 * circumradius * ((float) Math.sin(Math.toRadians(angleApothemToCircumradius))); } public float findPerimeter(float sideLength) { return sideLength * numSides; } } public class DP146_PolygonPerimeter { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter arguments as <number of sides> <circumradius>: "); String[] userInput = scan.nextLine().split(" "); Polygon polygon = new Polygon(Integer.parseInt(userInput[0]), Float.parseFloat(userInput[1])); float sideLength = polygon.findSideLength(); float perimeter = polygon.findPerimeter(sideLength); System.out.printf("Perimeter: %.3f\n", perimeter); } }
UTF-8
Java
2,667
java
DP146E_PolygonPerimeter.java
Java
[]
null
[]
// Link to reddit: http://www.reddit.com/r/dailyprogrammer/comments/1tixzk/122313_challenge_146_easy_polygon_perimeter/ // Difficulty: Easy //A Polygon is a geometric two-dimensional figure that has n-sides (line segments) that closes to form a loop. // Polygons can be in many different shapes and have many different neat properties, though this challenge is about // Regular Polygons . Our goal is to compute the permitter of an n-sided polygon that has equal-length sides // given the circumradius . This is the distance between the center of the Polygon to any of its vertices; // not to be confused with the apothem! // Input Description // Input will consist of one line on standard console input. This line will contain first an integer N, then // a floating-point number R. They will be space-delimited. The integer N is for the number of sides of the Polygon, // which is between 3 to 100, inclusive. R will be the circumradius, which ranges from 0.01 to 100.0, inclusive. // Output Description // Print the permitter of the given N-sided polygon that has a circumradius of R. Print up to three digits precision. // Sample Inputs & Outputs // Sample Input 1 // 5 3.7 // Sample Output 1 // 21.748 // Sample Input 2 // 100 1.0 // Sample Output 2 // 6.282 import java.util.Scanner; class Polygon { private int numSides; private float circumradius; public Polygon(int givenNumSides, float givenCircumradius) { numSides = givenNumSides; circumradius = givenCircumradius; } public int getNumSides() { return numSides; } public void setNumSides(int newVal) { numSides = newVal; } public float getCircumradius() { return circumradius; } public void setCircumradius(int newVal) { circumradius = newVal; } public float findSideLength() { float angleApothemToCircumradius = 180F / numSides; return 2 * circumradius * ((float) Math.sin(Math.toRadians(angleApothemToCircumradius))); } public float findPerimeter(float sideLength) { return sideLength * numSides; } } public class DP146_PolygonPerimeter { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter arguments as <number of sides> <circumradius>: "); String[] userInput = scan.nextLine().split(" "); Polygon polygon = new Polygon(Integer.parseInt(userInput[0]), Float.parseFloat(userInput[1])); float sideLength = polygon.findSideLength(); float perimeter = polygon.findPerimeter(sideLength); System.out.printf("Perimeter: %.3f\n", perimeter); } }
2,667
0.703037
0.68354
75
34.560001
36.655602
119
false
false
0
0
0
0
0
0
0.386667
false
false
2
b55b255d156881491f5cbfe67241399530d2af67
16,200,616,709,883
18743ebff906033ee98dfdc5d954ef5e768b77af
/Tienda_Ejercicio7/src/tienda_Ejercicio7/impl/TiendaImpl.java
f915cfdee469396df2ba6d38e0a8b0ca56f836dd
[]
no_license
jausinez/Tienda_Ejercicio7
https://github.com/jausinez/Tienda_Ejercicio7
2b33f5ca3242270a9a32307c0a4125d30c53013f
af1771084474e4415e39f356ad034105d6b4bd1a
refs/heads/master
2020-06-09T05:16:08.513000
2014-05-29T11:06:33
2014-05-29T11:06:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** */ package tienda_Ejercicio7.impl; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import tienda_Ejercicio7.Empleado; import tienda_Ejercicio7.Tienda; import tienda_Ejercicio7.Tienda_Ejercicio7Package; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Tienda</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getIdTienda <em>Id Tienda</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getNombre <em>Nombre</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getCalle <em>Calle</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getCiudad <em>Ciudad</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getCodPostal <em>Cod Postal</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getTelefono <em>Telefono</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getFax <em>Fax</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getTipo <em>Tipo</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getEmpleado <em>Empleado</em>}</li> * </ul> * </p> * * @generated */ public class TiendaImpl extends MinimalEObjectImpl.Container implements Tienda { /** * The default value of the '{@link #getIdTienda() <em>Id Tienda</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdTienda() * @generated * @ordered */ protected static final String ID_TIENDA_EDEFAULT = ""; /** * The cached value of the '{@link #getIdTienda() <em>Id Tienda</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdTienda() * @generated * @ordered */ protected String idTienda = ID_TIENDA_EDEFAULT; /** * The default value of the '{@link #getNombre() <em>Nombre</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNombre() * @generated * @ordered */ protected static final String NOMBRE_EDEFAULT = ""; /** * The cached value of the '{@link #getNombre() <em>Nombre</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNombre() * @generated * @ordered */ protected String nombre = NOMBRE_EDEFAULT; /** * The default value of the '{@link #getCalle() <em>Calle</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCalle() * @generated * @ordered */ protected static final String CALLE_EDEFAULT = null; /** * The cached value of the '{@link #getCalle() <em>Calle</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCalle() * @generated * @ordered */ protected String calle = CALLE_EDEFAULT; /** * The default value of the '{@link #getCiudad() <em>Ciudad</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCiudad() * @generated * @ordered */ protected static final String CIUDAD_EDEFAULT = null; /** * The cached value of the '{@link #getCiudad() <em>Ciudad</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCiudad() * @generated * @ordered */ protected String ciudad = CIUDAD_EDEFAULT; /** * The default value of the '{@link #getCodPostal() <em>Cod Postal</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCodPostal() * @generated * @ordered */ protected static final int COD_POSTAL_EDEFAULT = 0; /** * The cached value of the '{@link #getCodPostal() <em>Cod Postal</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCodPostal() * @generated * @ordered */ protected int codPostal = COD_POSTAL_EDEFAULT; /** * The default value of the '{@link #getTelefono() <em>Telefono</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTelefono() * @generated * @ordered */ protected static final int TELEFONO_EDEFAULT = 0; /** * The cached value of the '{@link #getTelefono() <em>Telefono</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTelefono() * @generated * @ordered */ protected int telefono = TELEFONO_EDEFAULT; /** * The default value of the '{@link #getFax() <em>Fax</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFax() * @generated * @ordered */ protected static final int FAX_EDEFAULT = 0; /** * The cached value of the '{@link #getFax() <em>Fax</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFax() * @generated * @ordered */ protected int fax = FAX_EDEFAULT; /** * The default value of the '{@link #getTipo() <em>Tipo</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTipo() * @generated * @ordered */ protected static final String TIPO_EDEFAULT = null; /** * The cached value of the '{@link #getTipo() <em>Tipo</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTipo() * @generated * @ordered */ protected String tipo = TIPO_EDEFAULT; /** * The cached value of the '{@link #getEmpleado() <em>Empleado</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEmpleado() * @generated * @ordered */ protected EList<Empleado> empleado; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TiendaImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Tienda_Ejercicio7Package.Literals.TIENDA; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getIdTienda() { return idTienda; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIdTienda(String newIdTienda) { String oldIdTienda = idTienda; idTienda = newIdTienda; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__ID_TIENDA, oldIdTienda, idTienda)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getNombre() { return nombre; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setNombre(String newNombre) { String oldNombre = nombre; nombre = newNombre; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__NOMBRE, oldNombre, nombre)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCalle() { return calle; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCalle(String newCalle) { String oldCalle = calle; calle = newCalle; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__CALLE, oldCalle, calle)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCiudad() { return ciudad; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCiudad(String newCiudad) { String oldCiudad = ciudad; ciudad = newCiudad; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__CIUDAD, oldCiudad, ciudad)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getCodPostal() { return codPostal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCodPostal(int newCodPostal) { int oldCodPostal = codPostal; codPostal = newCodPostal; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__COD_POSTAL, oldCodPostal, codPostal)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getTelefono() { return telefono; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTelefono(int newTelefono) { int oldTelefono = telefono; telefono = newTelefono; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__TELEFONO, oldTelefono, telefono)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getFax() { return fax; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setFax(int newFax) { int oldFax = fax; fax = newFax; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__FAX, oldFax, fax)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getTipo() { return tipo; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTipo(String newTipo) { String oldTipo = tipo; tipo = newTipo; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__TIPO, oldTipo, tipo)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Empleado> getEmpleado() { if (empleado == null) { empleado = new EObjectWithInverseResolvingEList.Unsettable.ManyInverse<Empleado>(Empleado.class, this, Tienda_Ejercicio7Package.TIENDA__EMPLEADO, Tienda_Ejercicio7Package.EMPLEADO__TIENDA); } return empleado; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetEmpleado() { if (empleado != null) ((InternalEList.Unsettable<?>)empleado).unset(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetEmpleado() { return empleado != null && ((InternalEList.Unsettable<?>)empleado).isSet(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void insTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void modTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void remTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void visTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return ((InternalEList<InternalEObject>)(InternalEList<?>)getEmpleado()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return ((InternalEList<?>)getEmpleado()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: return getIdTienda(); case Tienda_Ejercicio7Package.TIENDA__NOMBRE: return getNombre(); case Tienda_Ejercicio7Package.TIENDA__CALLE: return getCalle(); case Tienda_Ejercicio7Package.TIENDA__CIUDAD: return getCiudad(); case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: return getCodPostal(); case Tienda_Ejercicio7Package.TIENDA__TELEFONO: return getTelefono(); case Tienda_Ejercicio7Package.TIENDA__FAX: return getFax(); case Tienda_Ejercicio7Package.TIENDA__TIPO: return getTipo(); case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return getEmpleado(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: setIdTienda((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__NOMBRE: setNombre((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__CALLE: setCalle((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__CIUDAD: setCiudad((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: setCodPostal((Integer)newValue); return; case Tienda_Ejercicio7Package.TIENDA__TELEFONO: setTelefono((Integer)newValue); return; case Tienda_Ejercicio7Package.TIENDA__FAX: setFax((Integer)newValue); return; case Tienda_Ejercicio7Package.TIENDA__TIPO: setTipo((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: getEmpleado().clear(); getEmpleado().addAll((Collection<? extends Empleado>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: setIdTienda(ID_TIENDA_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__NOMBRE: setNombre(NOMBRE_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__CALLE: setCalle(CALLE_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__CIUDAD: setCiudad(CIUDAD_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: setCodPostal(COD_POSTAL_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__TELEFONO: setTelefono(TELEFONO_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__FAX: setFax(FAX_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__TIPO: setTipo(TIPO_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: unsetEmpleado(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: return ID_TIENDA_EDEFAULT == null ? idTienda != null : !ID_TIENDA_EDEFAULT.equals(idTienda); case Tienda_Ejercicio7Package.TIENDA__NOMBRE: return NOMBRE_EDEFAULT == null ? nombre != null : !NOMBRE_EDEFAULT.equals(nombre); case Tienda_Ejercicio7Package.TIENDA__CALLE: return CALLE_EDEFAULT == null ? calle != null : !CALLE_EDEFAULT.equals(calle); case Tienda_Ejercicio7Package.TIENDA__CIUDAD: return CIUDAD_EDEFAULT == null ? ciudad != null : !CIUDAD_EDEFAULT.equals(ciudad); case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: return codPostal != COD_POSTAL_EDEFAULT; case Tienda_Ejercicio7Package.TIENDA__TELEFONO: return telefono != TELEFONO_EDEFAULT; case Tienda_Ejercicio7Package.TIENDA__FAX: return fax != FAX_EDEFAULT; case Tienda_Ejercicio7Package.TIENDA__TIPO: return TIPO_EDEFAULT == null ? tipo != null : !TIPO_EDEFAULT.equals(tipo); case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return isSetEmpleado(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case Tienda_Ejercicio7Package.TIENDA___INS_TIENDA: insTienda(); return null; case Tienda_Ejercicio7Package.TIENDA___MOD_TIENDA: modTienda(); return null; case Tienda_Ejercicio7Package.TIENDA___REM_TIENDA: remTienda(); return null; case Tienda_Ejercicio7Package.TIENDA___VIS_TIENDA: visTienda(); return null; } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (idTienda: "); result.append(idTienda); result.append(", nombre: "); result.append(nombre); result.append(", calle: "); result.append(calle); result.append(", ciudad: "); result.append(ciudad); result.append(", codPostal: "); result.append(codPostal); result.append(", telefono: "); result.append(telefono); result.append(", fax: "); result.append(fax); result.append(", tipo: "); result.append(tipo); result.append(')'); return result.toString(); } } //TiendaImpl
UTF-8
Java
18,807
java
TiendaImpl.java
Java
[]
null
[]
/** */ package tienda_Ejercicio7.impl; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import tienda_Ejercicio7.Empleado; import tienda_Ejercicio7.Tienda; import tienda_Ejercicio7.Tienda_Ejercicio7Package; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Tienda</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getIdTienda <em>Id Tienda</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getNombre <em>Nombre</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getCalle <em>Calle</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getCiudad <em>Ciudad</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getCodPostal <em>Cod Postal</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getTelefono <em>Telefono</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getFax <em>Fax</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getTipo <em>Tipo</em>}</li> * <li>{@link tienda_Ejercicio7.impl.TiendaImpl#getEmpleado <em>Empleado</em>}</li> * </ul> * </p> * * @generated */ public class TiendaImpl extends MinimalEObjectImpl.Container implements Tienda { /** * The default value of the '{@link #getIdTienda() <em>Id Tienda</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdTienda() * @generated * @ordered */ protected static final String ID_TIENDA_EDEFAULT = ""; /** * The cached value of the '{@link #getIdTienda() <em>Id Tienda</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdTienda() * @generated * @ordered */ protected String idTienda = ID_TIENDA_EDEFAULT; /** * The default value of the '{@link #getNombre() <em>Nombre</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNombre() * @generated * @ordered */ protected static final String NOMBRE_EDEFAULT = ""; /** * The cached value of the '{@link #getNombre() <em>Nombre</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNombre() * @generated * @ordered */ protected String nombre = NOMBRE_EDEFAULT; /** * The default value of the '{@link #getCalle() <em>Calle</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCalle() * @generated * @ordered */ protected static final String CALLE_EDEFAULT = null; /** * The cached value of the '{@link #getCalle() <em>Calle</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCalle() * @generated * @ordered */ protected String calle = CALLE_EDEFAULT; /** * The default value of the '{@link #getCiudad() <em>Ciudad</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCiudad() * @generated * @ordered */ protected static final String CIUDAD_EDEFAULT = null; /** * The cached value of the '{@link #getCiudad() <em>Ciudad</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCiudad() * @generated * @ordered */ protected String ciudad = CIUDAD_EDEFAULT; /** * The default value of the '{@link #getCodPostal() <em>Cod Postal</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCodPostal() * @generated * @ordered */ protected static final int COD_POSTAL_EDEFAULT = 0; /** * The cached value of the '{@link #getCodPostal() <em>Cod Postal</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCodPostal() * @generated * @ordered */ protected int codPostal = COD_POSTAL_EDEFAULT; /** * The default value of the '{@link #getTelefono() <em>Telefono</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTelefono() * @generated * @ordered */ protected static final int TELEFONO_EDEFAULT = 0; /** * The cached value of the '{@link #getTelefono() <em>Telefono</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTelefono() * @generated * @ordered */ protected int telefono = TELEFONO_EDEFAULT; /** * The default value of the '{@link #getFax() <em>Fax</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFax() * @generated * @ordered */ protected static final int FAX_EDEFAULT = 0; /** * The cached value of the '{@link #getFax() <em>Fax</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getFax() * @generated * @ordered */ protected int fax = FAX_EDEFAULT; /** * The default value of the '{@link #getTipo() <em>Tipo</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTipo() * @generated * @ordered */ protected static final String TIPO_EDEFAULT = null; /** * The cached value of the '{@link #getTipo() <em>Tipo</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTipo() * @generated * @ordered */ protected String tipo = TIPO_EDEFAULT; /** * The cached value of the '{@link #getEmpleado() <em>Empleado</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getEmpleado() * @generated * @ordered */ protected EList<Empleado> empleado; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TiendaImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return Tienda_Ejercicio7Package.Literals.TIENDA; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getIdTienda() { return idTienda; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIdTienda(String newIdTienda) { String oldIdTienda = idTienda; idTienda = newIdTienda; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__ID_TIENDA, oldIdTienda, idTienda)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getNombre() { return nombre; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setNombre(String newNombre) { String oldNombre = nombre; nombre = newNombre; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__NOMBRE, oldNombre, nombre)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCalle() { return calle; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCalle(String newCalle) { String oldCalle = calle; calle = newCalle; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__CALLE, oldCalle, calle)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCiudad() { return ciudad; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCiudad(String newCiudad) { String oldCiudad = ciudad; ciudad = newCiudad; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__CIUDAD, oldCiudad, ciudad)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getCodPostal() { return codPostal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCodPostal(int newCodPostal) { int oldCodPostal = codPostal; codPostal = newCodPostal; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__COD_POSTAL, oldCodPostal, codPostal)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getTelefono() { return telefono; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTelefono(int newTelefono) { int oldTelefono = telefono; telefono = newTelefono; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__TELEFONO, oldTelefono, telefono)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public int getFax() { return fax; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setFax(int newFax) { int oldFax = fax; fax = newFax; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__FAX, oldFax, fax)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getTipo() { return tipo; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTipo(String newTipo) { String oldTipo = tipo; tipo = newTipo; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, Tienda_Ejercicio7Package.TIENDA__TIPO, oldTipo, tipo)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Empleado> getEmpleado() { if (empleado == null) { empleado = new EObjectWithInverseResolvingEList.Unsettable.ManyInverse<Empleado>(Empleado.class, this, Tienda_Ejercicio7Package.TIENDA__EMPLEADO, Tienda_Ejercicio7Package.EMPLEADO__TIENDA); } return empleado; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetEmpleado() { if (empleado != null) ((InternalEList.Unsettable<?>)empleado).unset(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetEmpleado() { return empleado != null && ((InternalEList.Unsettable<?>)empleado).isSet(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void insTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void modTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void remTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void visTienda() { // TODO: implement this method // Ensure that you remove @generated or mark it @generated NOT throw new UnsupportedOperationException(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return ((InternalEList<InternalEObject>)(InternalEList<?>)getEmpleado()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return ((InternalEList<?>)getEmpleado()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: return getIdTienda(); case Tienda_Ejercicio7Package.TIENDA__NOMBRE: return getNombre(); case Tienda_Ejercicio7Package.TIENDA__CALLE: return getCalle(); case Tienda_Ejercicio7Package.TIENDA__CIUDAD: return getCiudad(); case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: return getCodPostal(); case Tienda_Ejercicio7Package.TIENDA__TELEFONO: return getTelefono(); case Tienda_Ejercicio7Package.TIENDA__FAX: return getFax(); case Tienda_Ejercicio7Package.TIENDA__TIPO: return getTipo(); case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return getEmpleado(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: setIdTienda((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__NOMBRE: setNombre((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__CALLE: setCalle((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__CIUDAD: setCiudad((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: setCodPostal((Integer)newValue); return; case Tienda_Ejercicio7Package.TIENDA__TELEFONO: setTelefono((Integer)newValue); return; case Tienda_Ejercicio7Package.TIENDA__FAX: setFax((Integer)newValue); return; case Tienda_Ejercicio7Package.TIENDA__TIPO: setTipo((String)newValue); return; case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: getEmpleado().clear(); getEmpleado().addAll((Collection<? extends Empleado>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: setIdTienda(ID_TIENDA_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__NOMBRE: setNombre(NOMBRE_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__CALLE: setCalle(CALLE_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__CIUDAD: setCiudad(CIUDAD_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: setCodPostal(COD_POSTAL_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__TELEFONO: setTelefono(TELEFONO_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__FAX: setFax(FAX_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__TIPO: setTipo(TIPO_EDEFAULT); return; case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: unsetEmpleado(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case Tienda_Ejercicio7Package.TIENDA__ID_TIENDA: return ID_TIENDA_EDEFAULT == null ? idTienda != null : !ID_TIENDA_EDEFAULT.equals(idTienda); case Tienda_Ejercicio7Package.TIENDA__NOMBRE: return NOMBRE_EDEFAULT == null ? nombre != null : !NOMBRE_EDEFAULT.equals(nombre); case Tienda_Ejercicio7Package.TIENDA__CALLE: return CALLE_EDEFAULT == null ? calle != null : !CALLE_EDEFAULT.equals(calle); case Tienda_Ejercicio7Package.TIENDA__CIUDAD: return CIUDAD_EDEFAULT == null ? ciudad != null : !CIUDAD_EDEFAULT.equals(ciudad); case Tienda_Ejercicio7Package.TIENDA__COD_POSTAL: return codPostal != COD_POSTAL_EDEFAULT; case Tienda_Ejercicio7Package.TIENDA__TELEFONO: return telefono != TELEFONO_EDEFAULT; case Tienda_Ejercicio7Package.TIENDA__FAX: return fax != FAX_EDEFAULT; case Tienda_Ejercicio7Package.TIENDA__TIPO: return TIPO_EDEFAULT == null ? tipo != null : !TIPO_EDEFAULT.equals(tipo); case Tienda_Ejercicio7Package.TIENDA__EMPLEADO: return isSetEmpleado(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { switch (operationID) { case Tienda_Ejercicio7Package.TIENDA___INS_TIENDA: insTienda(); return null; case Tienda_Ejercicio7Package.TIENDA___MOD_TIENDA: modTienda(); return null; case Tienda_Ejercicio7Package.TIENDA___REM_TIENDA: remTienda(); return null; case Tienda_Ejercicio7Package.TIENDA___VIS_TIENDA: visTienda(); return null; } return super.eInvoke(operationID, arguments); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (idTienda: "); result.append(idTienda); result.append(", nombre: "); result.append(nombre); result.append(", calle: "); result.append(calle); result.append(", ciudad: "); result.append(ciudad); result.append(", codPostal: "); result.append(codPostal); result.append(", telefono: "); result.append(telefono); result.append(", fax: "); result.append(fax); result.append(", tipo: "); result.append(tipo); result.append(')'); return result.toString(); } } //TiendaImpl
18,807
0.622162
0.61844
703
24.752489
24.388538
192
false
false
0
0
0
0
0
0
1.732575
false
false
2
0a8307c8104d4df8638b1f8b105165cf405865b6
6,399,501,332,596
1d4d5f6809331cd8aff782f47a9ae6e49a503b59
/src/main/java/com/rpc/common/ProxyInterface.java
52cd3c2da72b97900835ecba44a490ef6969dd14
[]
no_license
xj524598/netty_marshll
https://github.com/xj524598/netty_marshll
c08dae9bb4ec24fc23ad05ea8c2a6aef3e35d552
5496537573e7f52d762fa083e5519f7a09f4b3c6
refs/heads/master
2018-10-23T00:58:54.028000
2018-09-04T08:13:44
2018-09-04T08:13:44
141,786,103
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rpc.common; import com.netty.client.NettyClient; import com.rpc.exchanger.ClientExchanger; import com.rpc.loadbalance.LoadBalance; import com.rpc.registe.RegisterAndFoundServer; import io.netty.util.concurrent.DefaultPromise; import io.netty.util.concurrent.Promise; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; /** * <Description> 专门讲本地的接口包装成代理对象<br> * * @author 徐洁<br> * @version 1.0<br> * @taskId <br> * @CreateDate 2018/8/24 <br> */ @Service public class ProxyInterface { @Autowired private MarshallInvocationHandler marshallInvocationHandler; /** * 包裹对象 * * @param clazz * @param <T> * @return */ public <T> T getProxy(Class clazz) { return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{clazz}, marshallInvocationHandler); } }
UTF-8
Java
1,248
java
ProxyInterface.java
Java
[ { "context": "* <Description> 专门讲本地的接口包装成代理对象<br>\n *\n * @author 徐洁<br>\n * @version 1.0<br>\n * @taskId <br>\n * @Creat", "end": 728, "score": 0.999769389629364, "start": 726, "tag": "NAME", "value": "徐洁" } ]
null
[]
package com.rpc.common; import com.netty.client.NettyClient; import com.rpc.exchanger.ClientExchanger; import com.rpc.loadbalance.LoadBalance; import com.rpc.registe.RegisterAndFoundServer; import io.netty.util.concurrent.DefaultPromise; import io.netty.util.concurrent.Promise; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; /** * <Description> 专门讲本地的接口包装成代理对象<br> * * @author 徐洁<br> * @version 1.0<br> * @taskId <br> * @CreateDate 2018/8/24 <br> */ @Service public class ProxyInterface { @Autowired private MarshallInvocationHandler marshallInvocationHandler; /** * 包裹对象 * * @param clazz * @param <T> * @return */ public <T> T getProxy(Class clazz) { return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{clazz}, marshallInvocationHandler); } }
1,248
0.74461
0.737148
52
22.192308
24.408415
137
false
false
0
0
0
0
0
0
0.403846
false
false
2
2ddb0ba15c6cc9e5df74ad022836991ad8e00f33
20,255,065,830,196
07a7432ee0bc49178b48dea5fb310e815d8ddfc2
/NetBeansProjects/oop/src/FactoryPattem/Circle.java
18583ad03f459bd5ca2192975cb781847083835c
[]
no_license
dangvantu99CM/BaiTap111
https://github.com/dangvantu99CM/BaiTap111
11012ad9167cbb30ede0f9ace1c115cd7e48e935
75a9edf1ec14a77ce06525f100e58305bb72e70c
refs/heads/master
2020-04-27T22:18:53.741000
2019-03-16T13:03:11
2019-03-16T13:03:11
174,731,810
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FactoryPattem; /** * * @author lenovo i3 */ public class Circle implements Shapes { public void print(){ System.out.println("Circle"); } }
UTF-8
Java
168
java
Circle.java
Java
[ { "context": "\npackage FactoryPattem;\n\n/**\n *\n * @author lenovo i3\n */\npublic class Circle implements Shapes {\n p", "end": 52, "score": 0.9966031908988953, "start": 43, "tag": "USERNAME", "value": "lenovo i3" } ]
null
[]
package FactoryPattem; /** * * @author lenovo i3 */ public class Circle implements Shapes { public void print(){ System.out.println("Circle"); } }
168
0.619048
0.613095
11
14.181818
14.095894
39
false
false
0
0
0
0
0
0
0.181818
false
false
2
b05f5e3b5df8ad496a70ddd292420a7380f089b4
27,350,351,800,445
fcc385e01c9216d2824bedd5871fb6b8ffa59a59
/app/src/main/java/com/example/car/Fragments/formFragment3.java
485c81d7ae727ecbae3682a2bccd83d18773a82b
[]
no_license
touahriayacine/Trackify-for-users-mobile-app
https://github.com/touahriayacine/Trackify-for-users-mobile-app
c30e3f6bef49ded39942ece658f8751751ce8cc6
91b3e9573b2c52b3058b6f625ec63d23f9ad83d9
refs/heads/master
2023-06-01T03:45:26.508000
2021-07-05T11:02:04
2021-07-05T11:02:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.car.Fragments; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import static com.example.car.ConstantsUtility.Constants.MARQUE_KEY; import static com.example.car.ConstantsUtility.Constants.MATRICULE_KEY; import static com.example.car.ConstantsUtility.Constants.MODEL_KEY; import com.example.car.R; import com.google.android.material.textfield.TextInputEditText; /** * A simple {@link Fragment} subclass. */ public class formFragment3 extends Fragment { private Button button_annuler ; private Button button_confirmer; private ImageButton button_retour ; private TextInputEditText edtModel; private TextInputEditText edtMarque; private TextInputEditText edtMatricule; private formFragment bottomSheetFragment; private formFragment formFrag; public formFragment3(formFragment formFrag) { // Required empty public constructor this.formFrag = formFrag; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Recuperer l'objet de bottomSheetFragment pour pouvoir utiliser le bouton annuler. Bundle bundle = this.getArguments(); if (bundle != null) { bottomSheetFragment = bundle.getParcelable("this"); // Key } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_form3, container, false); findViews(v); annulerButton(v); confirmerButton(v); retourButton(v); setPrevAttrForMod(); return v; } private void setPrevAttrForMod() { if (formFrag.MARQUE_KEY_MOD != "DEFAULT") edtMarque.setText(formFrag.MARQUE_KEY_MOD); if (formFrag.MODEL_KEY_MOD != "DEFAULT") edtModel.setText(formFrag.MODEL_KEY_MOD); if (formFrag.MATRICULE_KEY_MOD != "DEFAULT") edtMatricule.setText(formFrag.MATRICULE_KEY_MOD); } public void annulerButton (View v) { button_annuler = v.findViewById(R.id.annuler); button_annuler.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bottomSheetFragment.dismiss(); } }); } public void confirmerButton (View v) { button_confirmer = v.findViewById(R.id.confirmer); button_confirmer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // put extra information formFrag.intent.putExtra(MARQUE_KEY,edtMarque.getText().toString()); formFrag.intent.putExtra(MATRICULE_KEY,edtMatricule.getText().toString()); formFrag.intent.putExtra(MODEL_KEY,edtModel.getText().toString()); formFrag.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(formFrag.intent); bottomSheetFragment.dismiss(); } }); } public void retourButton (View v) { button_retour = v.findViewById(R.id.retour2); button_retour.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bottomSheetFragment.setFragment2(formFrag); } }); } private void findViews(View v){ edtModel = v.findViewById(R.id.model); edtMarque = v.findViewById(R.id.marque); edtMatricule = v.findViewById(R.id.matricule); } }
UTF-8
Java
3,813
java
formFragment3.java
Java
[]
null
[]
package com.example.car.Fragments; import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import static com.example.car.ConstantsUtility.Constants.MARQUE_KEY; import static com.example.car.ConstantsUtility.Constants.MATRICULE_KEY; import static com.example.car.ConstantsUtility.Constants.MODEL_KEY; import com.example.car.R; import com.google.android.material.textfield.TextInputEditText; /** * A simple {@link Fragment} subclass. */ public class formFragment3 extends Fragment { private Button button_annuler ; private Button button_confirmer; private ImageButton button_retour ; private TextInputEditText edtModel; private TextInputEditText edtMarque; private TextInputEditText edtMatricule; private formFragment bottomSheetFragment; private formFragment formFrag; public formFragment3(formFragment formFrag) { // Required empty public constructor this.formFrag = formFrag; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Recuperer l'objet de bottomSheetFragment pour pouvoir utiliser le bouton annuler. Bundle bundle = this.getArguments(); if (bundle != null) { bottomSheetFragment = bundle.getParcelable("this"); // Key } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_form3, container, false); findViews(v); annulerButton(v); confirmerButton(v); retourButton(v); setPrevAttrForMod(); return v; } private void setPrevAttrForMod() { if (formFrag.MARQUE_KEY_MOD != "DEFAULT") edtMarque.setText(formFrag.MARQUE_KEY_MOD); if (formFrag.MODEL_KEY_MOD != "DEFAULT") edtModel.setText(formFrag.MODEL_KEY_MOD); if (formFrag.MATRICULE_KEY_MOD != "DEFAULT") edtMatricule.setText(formFrag.MATRICULE_KEY_MOD); } public void annulerButton (View v) { button_annuler = v.findViewById(R.id.annuler); button_annuler.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bottomSheetFragment.dismiss(); } }); } public void confirmerButton (View v) { button_confirmer = v.findViewById(R.id.confirmer); button_confirmer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // put extra information formFrag.intent.putExtra(MARQUE_KEY,edtMarque.getText().toString()); formFrag.intent.putExtra(MATRICULE_KEY,edtMatricule.getText().toString()); formFrag.intent.putExtra(MODEL_KEY,edtModel.getText().toString()); formFrag.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(formFrag.intent); bottomSheetFragment.dismiss(); } }); } public void retourButton (View v) { button_retour = v.findViewById(R.id.retour2); button_retour.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bottomSheetFragment.setFragment2(formFrag); } }); } private void findViews(View v){ edtModel = v.findViewById(R.id.model); edtMarque = v.findViewById(R.id.marque); edtMatricule = v.findViewById(R.id.matricule); } }
3,813
0.659323
0.658012
126
29.269842
27.100464
102
false
false
0
0
0
0
0
0
0.47619
false
false
2
5186fcc6fe36bb7d66abf405497bb46c89e72ea2
11,149,735,106,568
aaf24afdcfecf7a6d0fd576962aa91c3092ea066
/src/package1/arrayexamples.java
8969e5c5bfa36eae59149f14d20a736da2e58203
[]
no_license
admin2507/testproject
https://github.com/admin2507/testproject
f68d2d3c1f47248cba1a46598c5db8bab01416ef
d502c9e9ae43e7122187a6c9322236228d8f0a23
refs/heads/master
2023-08-01T09:16:38.332000
2021-09-10T09:55:00
2021-09-10T09:55:00
405,033,403
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package package1; public class arrayexamples { public static void main(String[] args) { int Id[] = new int[5]; //create an array using new keyword Id[0] = 1; Id[1] = 2; Id[2] = 3; Id[3] = 4; Id[4] = 5; //Id[5] = 6; //error of Array index outofBound System.out.println(Id[2]); // when we use array then we use for loop for(int i =0; i<Id.length;i++) { System.out.println(Id[i]); } String empname[] = {"Pooja","Arjun"}; //2nd way using array literals System.out.println(empname[0]); float empSal[] = {1.3f, 2.4f}; System.out.println(empSal.length); for (int j=0;j<empSal.length;j++) { System.out.println(empSal[j]); } } }
UTF-8
Java
761
java
arrayexamples.java
Java
[ { "context": "tln(Id[i]);\r\n\t\t }\r\n\t\t\r\n\t\t\r\n\t\tString empname[] = {\"Pooja\",\"Arjun\"}; //2nd way using array literals \r\n ", "end": 471, "score": 0.999862015247345, "start": 466, "tag": "NAME", "value": "Pooja" }, { "context": "]);\r\n\t\t }\r\n\t\t\r\n\t\t\r\n\t\t...
null
[]
package package1; public class arrayexamples { public static void main(String[] args) { int Id[] = new int[5]; //create an array using new keyword Id[0] = 1; Id[1] = 2; Id[2] = 3; Id[3] = 4; Id[4] = 5; //Id[5] = 6; //error of Array index outofBound System.out.println(Id[2]); // when we use array then we use for loop for(int i =0; i<Id.length;i++) { System.out.println(Id[i]); } String empname[] = {"Pooja","Arjun"}; //2nd way using array literals System.out.println(empname[0]); float empSal[] = {1.3f, 2.4f}; System.out.println(empSal.length); for (int j=0;j<empSal.length;j++) { System.out.println(empSal[j]); } } }
761
0.534823
0.504599
34
20.382353
19.852419
71
false
false
0
0
0
0
0
0
1.911765
false
false
8
72b30a9185de4f6f2e9865829e9d47b61dc0efb5
11,149,735,107,186
8f9ad43b6f34ba55d24af934c2c8236fc3a70260
/src/com/service/IOrderitemService.java
ccbcd7fe00b17d1b1619c448917f581626e14cd0
[]
no_license
Zephery/czf
https://github.com/Zephery/czf
6604d25afd107d0403f6476bbe4f5ebca933b6af
87285ca21bdf1ac6d398ed4bb37d3dccf6584d21
refs/heads/master
2021-01-01T05:09:35.470000
2016-05-29T07:49:18
2016-05-29T07:49:18
57,223,430
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.service; import java.util.List; import com.models.Orderitem; /** * Created by Zephery on 2016/4/28. */ public interface IOrderitemService { public Orderitem getorderitemhistory(int orderid); }
UTF-8
Java
213
java
IOrderitemService.java
Java
[ { "context": "t;\nimport com.models.Orderitem;\n\n/**\n * Created by Zephery on 2016/4/28.\n */\npublic interface IOrderitemServ", "end": 100, "score": 0.9989981055259705, "start": 93, "tag": "USERNAME", "value": "Zephery" } ]
null
[]
package com.service; import java.util.List; import com.models.Orderitem; /** * Created by Zephery on 2016/4/28. */ public interface IOrderitemService { public Orderitem getorderitemhistory(int orderid); }
213
0.751174
0.71831
11
18.363636
17.618547
54
false
false
0
0
0
0
0
0
0.363636
false
false
8
e2bc126b99fad69ff6c234852c99be13e7347270
13,357,348,299,395
440413f5e6e9d05bb4fe7922d75f8390ca84be15
/src/main/java/com/atmecs/com/practo/report/Extent.java
48e5789bea280d69ce4f8de3338fc49fc32e5f46
[]
no_license
Amrut-Dash/com.practo
https://github.com/Amrut-Dash/com.practo
efdee29013b0caade42d0e1b0db3781669c8c656
9a427c47796db631311350235f72ac486f1a8b23
refs/heads/master
2020-09-03T18:51:44.463000
2019-11-05T14:52:50
2019-11-05T14:52:50
219,538,039
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.atmecs.com.practo.report; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; import com.atmecs.com.practo.constants.FileConstant; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; /** * The class is used for adding the extent report */ public class Extent { public WebDriver driver; public ExtentReports extent; public ExtentTest extenttest; /** * The method is used for starting the report for the test scripts */ @BeforeSuite public void startReport() { extent = new ExtentReports(FileConstant.EXTENT_REPORT_FILE, true); extent.loadConfig(new File(FileConstant.EXTENT_CONFIG)); } /** * The method used for capturing screenshot * @param driver * @param testname * @return * @throws Exception */ public static String getScreenshot(WebDriver driver, String testname) throws Exception { String dateName = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()); TakesScreenshot scrShot = (TakesScreenshot) driver; File source = scrShot.getScreenshotAs(OutputType.FILE); String destination = FileConstant.FAILED_SCREENSHOT_FILE + testname + dateName + ".png"; File finalDestination = new File(destination); FileUtils.copyFile(source, finalDestination); return destination; } /** * The method is used for getting the result of the test * @param result * @throws Exception */ @AfterMethod public void tearDown(ITestResult result) throws Exception { if (result.getStatus() == ITestResult.FAILURE) { extenttest.log(LogStatus.FAIL, "TEST CASE FAILED IS " + result.getName()); // to add name in extent report extenttest.log(LogStatus.FAIL, "TEST CASE FAILED IS " + result.getThrowable()); // to add error/exception in // extent report String screenshotPath = Extent.getScreenshot(driver, result.getName()); extenttest.log(LogStatus.FAIL, extenttest.addScreenCapture(screenshotPath)); // to add screenshot in extent // report // extentTest.log(LogStatus.FAIL, extentTest.addScreencast(screenshotPath)); // //to add screencast/video in extent report } else if (result.getStatus() == ITestResult.SKIP) { extenttest.log(LogStatus.SKIP, "Test Case SKIPPED IS " + result.getName()); } else if (result.getStatus() == ITestResult.SUCCESS) { extenttest.log(LogStatus.PASS, "Test Case PASSED IS " + result.getName()); } extent.endTest(extenttest); } /** * The method is used for writing the result to the report */ @AfterSuite public void endReport() { driver.quit(); extent.flush(); extent.close(); } }
UTF-8
Java
3,010
java
Extent.java
Java
[]
null
[]
package com.atmecs.com.practo.report; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; import com.atmecs.com.practo.constants.FileConstant; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; /** * The class is used for adding the extent report */ public class Extent { public WebDriver driver; public ExtentReports extent; public ExtentTest extenttest; /** * The method is used for starting the report for the test scripts */ @BeforeSuite public void startReport() { extent = new ExtentReports(FileConstant.EXTENT_REPORT_FILE, true); extent.loadConfig(new File(FileConstant.EXTENT_CONFIG)); } /** * The method used for capturing screenshot * @param driver * @param testname * @return * @throws Exception */ public static String getScreenshot(WebDriver driver, String testname) throws Exception { String dateName = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()); TakesScreenshot scrShot = (TakesScreenshot) driver; File source = scrShot.getScreenshotAs(OutputType.FILE); String destination = FileConstant.FAILED_SCREENSHOT_FILE + testname + dateName + ".png"; File finalDestination = new File(destination); FileUtils.copyFile(source, finalDestination); return destination; } /** * The method is used for getting the result of the test * @param result * @throws Exception */ @AfterMethod public void tearDown(ITestResult result) throws Exception { if (result.getStatus() == ITestResult.FAILURE) { extenttest.log(LogStatus.FAIL, "TEST CASE FAILED IS " + result.getName()); // to add name in extent report extenttest.log(LogStatus.FAIL, "TEST CASE FAILED IS " + result.getThrowable()); // to add error/exception in // extent report String screenshotPath = Extent.getScreenshot(driver, result.getName()); extenttest.log(LogStatus.FAIL, extenttest.addScreenCapture(screenshotPath)); // to add screenshot in extent // report // extentTest.log(LogStatus.FAIL, extentTest.addScreencast(screenshotPath)); // //to add screencast/video in extent report } else if (result.getStatus() == ITestResult.SKIP) { extenttest.log(LogStatus.SKIP, "Test Case SKIPPED IS " + result.getName()); } else if (result.getStatus() == ITestResult.SUCCESS) { extenttest.log(LogStatus.PASS, "Test Case PASSED IS " + result.getName()); } extent.endTest(extenttest); } /** * The method is used for writing the result to the report */ @AfterSuite public void endReport() { driver.quit(); extent.flush(); extent.close(); } }
3,010
0.740199
0.740199
94
31.021276
28.057304
111
false
false
0
0
0
0
0
0
1.585106
false
false
8
f22e75f376410c409107d499fa1dd84cb2b4b2d2
33,311,766,356,956
f7e585e2a4ea26848bb6873168284cac57806c78
/src/main/java/gq/rbeat/cashy/Setup.java
96f1bb76b6bbc87176205f9797505a7b41261c3e
[]
no_license
rbeat/cashy
https://github.com/rbeat/cashy
edcf05b70eec61f25464d4002375625015b3ef19
b5a8aca50bbda3bcfd147262a667f82dde4f1dbc
refs/heads/master
2023-01-19T07:23:31.485000
2020-11-02T14:19:28
2020-11-02T14:19:28
316,294,062
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gq.rbeat.cashy; import android.content.Intent; import android.speech.tts.TextToSpeech; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.security.MessageDigest; import java.util.Locale; public class Setup extends AppCompatActivity implements View.OnClickListener { Button ok_name; EditText name, balance, credit; String email; private DatabaseReference mDatabase; @Override protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().hide(); Intent intent = getIntent(); email = intent.getStringExtra("email"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup); ok_name = findViewById(R.id.ok_name); name = findViewById(R.id.name); balance = findViewById(R.id.balance); credit = findViewById(R.id.credit); mDatabase = FirebaseDatabase.getInstance().getReference(); ok_name.setOnClickListener(this); } public void createUser(String name, double balance, double creditBalance) { User user = new User(name, email); user.setPersonalBalance(balance); user.setCreditBalance(creditBalance); mDatabase.child("Users").child(md5(email)).setValue(user); Intent intent = new Intent(Setup.this, Assistant.class); intent.putExtra("email", md5(email)); startActivity(intent); } @Override public void onClick(View v) { if (v == ok_name) { if (TextUtils.isEmpty(name.getText()) || TextUtils.isEmpty(balance.getText()) || TextUtils.isEmpty(credit.getText())) { Toast.makeText(this, getString(R.string.check_fields), Toast.LENGTH_SHORT).show(); } else { createUser(name.getText().toString(), Double.parseDouble(balance.getText().toString()), Double.parseDouble(credit.getText().toString())); } } } public static final String md5(final String toEncrypt) { try { final MessageDigest digest = MessageDigest.getInstance("md5"); digest.update(toEncrypt.getBytes()); final byte[] bytes = digest.digest(); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%02X", bytes[i])); } return sb.toString().toLowerCase(); } catch (Exception exc) { return ""; } } }
UTF-8
Java
2,766
java
Setup.java
Java
[]
null
[]
package gq.rbeat.cashy; import android.content.Intent; import android.speech.tts.TextToSpeech; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.security.MessageDigest; import java.util.Locale; public class Setup extends AppCompatActivity implements View.OnClickListener { Button ok_name; EditText name, balance, credit; String email; private DatabaseReference mDatabase; @Override protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().hide(); Intent intent = getIntent(); email = intent.getStringExtra("email"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup); ok_name = findViewById(R.id.ok_name); name = findViewById(R.id.name); balance = findViewById(R.id.balance); credit = findViewById(R.id.credit); mDatabase = FirebaseDatabase.getInstance().getReference(); ok_name.setOnClickListener(this); } public void createUser(String name, double balance, double creditBalance) { User user = new User(name, email); user.setPersonalBalance(balance); user.setCreditBalance(creditBalance); mDatabase.child("Users").child(md5(email)).setValue(user); Intent intent = new Intent(Setup.this, Assistant.class); intent.putExtra("email", md5(email)); startActivity(intent); } @Override public void onClick(View v) { if (v == ok_name) { if (TextUtils.isEmpty(name.getText()) || TextUtils.isEmpty(balance.getText()) || TextUtils.isEmpty(credit.getText())) { Toast.makeText(this, getString(R.string.check_fields), Toast.LENGTH_SHORT).show(); } else { createUser(name.getText().toString(), Double.parseDouble(balance.getText().toString()), Double.parseDouble(credit.getText().toString())); } } } public static final String md5(final String toEncrypt) { try { final MessageDigest digest = MessageDigest.getInstance("md5"); digest.update(toEncrypt.getBytes()); final byte[] bytes = digest.digest(); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%02X", bytes[i])); } return sb.toString().toLowerCase(); } catch (Exception exc) { return ""; } } }
2,766
0.654013
0.651121
78
34.46154
28.565577
153
false
false
0
0
0
0
0
0
0.807692
false
false
8
410aee368bdcae94727b88f521e83c3575bc0232
695,784,712,562
33022712b87ba91c8d4f0f5e3fe4c42a00d3f6af
/form/form_esb/src/main/java/cn/easthope/modules/esb/core/fun/_09_ct/_01_invbas/_02_page/GetInvBasPageModel.java
70920126c0801505e2b4ae811f4ca6fb4b46fcdd
[]
no_license
janwer/demo
https://github.com/janwer/demo
ddeff5983e3e0c6b5eaada90e481c6cc2d81b260
980150b5de1c0c3e9fda12d97da27b50b3595c83
refs/heads/master
2018-01-09T18:50:00.928000
2017-09-15T07:17:16
2017-09-15T07:17:16
50,840,323
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.easthope.modules.esb.core.fun._09_ct._01_invbas._02_page; /** * 存货基本档案 * @author jiangt * @date 2015年8月4日 上午10:09:39 * @version 1.0 */ public class GetInvBasPageModel implements java.io.Serializable { /** * */ private static final long serialVersionUID = 1L; public String rn; public String asset; public String assistunit; public String autobalancemeas; public String createtime; public String creator; public String def1; public String def10; public String def11; public String def12; public String def13; public String def14; public String def15; public String pk_corp; public String pk_invbasdoc; public String pk_invcl; public String pk_measdoc; public String pk_measdoc1; public String pk_measdoc2; public String pk_measdoc3; public String def16; public String def17; public String def18; public String def19; public String def2; public String def20; public String def3; public String def4; public String def5; public String def6; public String def7; public String def8; public String def9; public String discountflag; public String dr; public String forinvname; public String free1; public String free2; public String free3; public String free4; public String free5; public String graphid; public String height; public String invbarcode; public String invcode; public String invmnecode; public String invname; public String invpinpai; public String invshortname; public String invspec; public String invtype; public String ismngstockbygrswt; public String isretail; public String isstorebyconvert; public String laborflag; public String length; public String memo; public String modifier; public String modifytime; public String pk_assetcategory; public String pk_measdoc5; public String pk_measdoc6; public String pk_prodline; public String pk_taxitems; public String sealflag; public String setpartsflag; public String shipunitnum; public String storeunitnum; public String ts; public String unitvolume; public String unitweight; public String weitunitnum; public String width; public String getRn() { return rn; } public void setRn(String rn) { this.rn = rn; } public String getAsset() { return asset; } public void setAsset(String asset) { this.asset = asset; } public String getAssistunit() { return assistunit; } public void setAssistunit(String assistunit) { this.assistunit = assistunit; } public String getAutobalancemeas() { return autobalancemeas; } public void setAutobalancemeas(String autobalancemeas) { this.autobalancemeas = autobalancemeas; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getDef1() { return def1; } public void setDef1(String def1) { this.def1 = def1; } public String getDef10() { return def10; } public void setDef10(String def10) { this.def10 = def10; } public String getDef11() { return def11; } public void setDef11(String def11) { this.def11 = def11; } public String getDef12() { return def12; } public void setDef12(String def12) { this.def12 = def12; } public String getDef13() { return def13; } public void setDef13(String def13) { this.def13 = def13; } public String getDef14() { return def14; } public void setDef14(String def14) { this.def14 = def14; } public String getDef15() { return def15; } public void setDef15(String def15) { this.def15 = def15; } public String getPk_corp() { return pk_corp; } public void setPk_corp(String pk_corp) { this.pk_corp = pk_corp; } public String getPk_invbasdoc() { return pk_invbasdoc; } public void setPk_invbasdoc(String pk_invbasdoc) { this.pk_invbasdoc = pk_invbasdoc; } public String getPk_invcl() { return pk_invcl; } public void setPk_invcl(String pk_invcl) { this.pk_invcl = pk_invcl; } public String getPk_measdoc() { return pk_measdoc; } public void setPk_measdoc(String pk_measdoc) { this.pk_measdoc = pk_measdoc; } public String getPk_measdoc1() { return pk_measdoc1; } public void setPk_measdoc1(String pk_measdoc1) { this.pk_measdoc1 = pk_measdoc1; } public String getPk_measdoc2() { return pk_measdoc2; } public void setPk_measdoc2(String pk_measdoc2) { this.pk_measdoc2 = pk_measdoc2; } public String getPk_measdoc3() { return pk_measdoc3; } public void setPk_measdoc3(String pk_measdoc3) { this.pk_measdoc3 = pk_measdoc3; } public String getDef16() { return def16; } public void setDef16(String def16) { this.def16 = def16; } public String getDef17() { return def17; } public void setDef17(String def17) { this.def17 = def17; } public String getDef18() { return def18; } public void setDef18(String def18) { this.def18 = def18; } public String getDef19() { return def19; } public void setDef19(String def19) { this.def19 = def19; } public String getDef2() { return def2; } public void setDef2(String def2) { this.def2 = def2; } public String getDef20() { return def20; } public void setDef20(String def20) { this.def20 = def20; } public String getDef3() { return def3; } public void setDef3(String def3) { this.def3 = def3; } public String getDef4() { return def4; } public void setDef4(String def4) { this.def4 = def4; } public String getDef5() { return def5; } public void setDef5(String def5) { this.def5 = def5; } public String getDef6() { return def6; } public void setDef6(String def6) { this.def6 = def6; } public String getDef7() { return def7; } public void setDef7(String def7) { this.def7 = def7; } public String getDef8() { return def8; } public void setDef8(String def8) { this.def8 = def8; } public String getDef9() { return def9; } public void setDef9(String def9) { this.def9 = def9; } public String getDiscountflag() { return discountflag; } public void setDiscountflag(String discountflag) { this.discountflag = discountflag; } public String getDr() { return dr; } public void setDr(String dr) { this.dr = dr; } public String getForinvname() { return forinvname; } public void setForinvname(String forinvname) { this.forinvname = forinvname; } public String getFree1() { return free1; } public void setFree1(String free1) { this.free1 = free1; } public String getFree2() { return free2; } public void setFree2(String free2) { this.free2 = free2; } public String getFree3() { return free3; } public void setFree3(String free3) { this.free3 = free3; } public String getFree4() { return free4; } public void setFree4(String free4) { this.free4 = free4; } public String getFree5() { return free5; } public void setFree5(String free5) { this.free5 = free5; } public String getGraphid() { return graphid; } public void setGraphid(String graphid) { this.graphid = graphid; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getInvbarcode() { return invbarcode; } public void setInvbarcode(String invbarcode) { this.invbarcode = invbarcode; } public String getInvcode() { return invcode; } public void setInvcode(String invcode) { this.invcode = invcode; } public String getInvmnecode() { return invmnecode; } public void setInvmnecode(String invmnecode) { this.invmnecode = invmnecode; } public String getInvname() { return invname; } public void setInvname(String invname) { this.invname = invname; } public String getInvpinpai() { return invpinpai; } public void setInvpinpai(String invpinpai) { this.invpinpai = invpinpai; } public String getInvshortname() { return invshortname; } public void setInvshortname(String invshortname) { this.invshortname = invshortname; } public String getInvspec() { return invspec; } public void setInvspec(String invspec) { this.invspec = invspec; } public String getInvtype() { return invtype; } public void setInvtype(String invtype) { this.invtype = invtype; } public String getIsmngstockbygrswt() { return ismngstockbygrswt; } public void setIsmngstockbygrswt(String ismngstockbygrswt) { this.ismngstockbygrswt = ismngstockbygrswt; } public String getIsretail() { return isretail; } public void setIsretail(String isretail) { this.isretail = isretail; } public String getIsstorebyconvert() { return isstorebyconvert; } public void setIsstorebyconvert(String isstorebyconvert) { this.isstorebyconvert = isstorebyconvert; } public String getLaborflag() { return laborflag; } public void setLaborflag(String laborflag) { this.laborflag = laborflag; } public String getLength() { return length; } public void setLength(String length) { this.length = length; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public String getModifier() { return modifier; } public void setModifier(String modifier) { this.modifier = modifier; } public String getModifytime() { return modifytime; } public void setModifytime(String modifytime) { this.modifytime = modifytime; } public String getPk_assetcategory() { return pk_assetcategory; } public void setPk_assetcategory(String pk_assetcategory) { this.pk_assetcategory = pk_assetcategory; } public String getPk_measdoc5() { return pk_measdoc5; } public void setPk_measdoc5(String pk_measdoc5) { this.pk_measdoc5 = pk_measdoc5; } public String getPk_measdoc6() { return pk_measdoc6; } public void setPk_measdoc6(String pk_measdoc6) { this.pk_measdoc6 = pk_measdoc6; } public String getPk_prodline() { return pk_prodline; } public void setPk_prodline(String pk_prodline) { this.pk_prodline = pk_prodline; } public String getPk_taxitems() { return pk_taxitems; } public void setPk_taxitems(String pk_taxitems) { this.pk_taxitems = pk_taxitems; } public String getSealflag() { return sealflag; } public void setSealflag(String sealflag) { this.sealflag = sealflag; } public String getSetpartsflag() { return setpartsflag; } public void setSetpartsflag(String setpartsflag) { this.setpartsflag = setpartsflag; } public String getShipunitnum() { return shipunitnum; } public void setShipunitnum(String shipunitnum) { this.shipunitnum = shipunitnum; } public String getStoreunitnum() { return storeunitnum; } public void setStoreunitnum(String storeunitnum) { this.storeunitnum = storeunitnum; } public String getTs() { return ts; } public void setTs(String ts) { this.ts = ts; } public String getUnitvolume() { return unitvolume; } public void setUnitvolume(String unitvolume) { this.unitvolume = unitvolume; } public String getUnitweight() { return unitweight; } public void setUnitweight(String unitweight) { this.unitweight = unitweight; } public String getWeitunitnum() { return weitunitnum; } public void setWeitunitnum(String weitunitnum) { this.weitunitnum = weitunitnum; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } }
UTF-8
Java
11,318
java
GetInvBasPageModel.java
Java
[ { "context": "ct._01_invbas._02_page;\n\n\n/**\n * 存货基本档案\n * @author jiangt\n * @date 2015年8月4日 上午10:09:39\n * @version 1.0 \n *", "end": 102, "score": 0.999647319316864, "start": 96, "tag": "USERNAME", "value": "jiangt" } ]
null
[]
package cn.easthope.modules.esb.core.fun._09_ct._01_invbas._02_page; /** * 存货基本档案 * @author jiangt * @date 2015年8月4日 上午10:09:39 * @version 1.0 */ public class GetInvBasPageModel implements java.io.Serializable { /** * */ private static final long serialVersionUID = 1L; public String rn; public String asset; public String assistunit; public String autobalancemeas; public String createtime; public String creator; public String def1; public String def10; public String def11; public String def12; public String def13; public String def14; public String def15; public String pk_corp; public String pk_invbasdoc; public String pk_invcl; public String pk_measdoc; public String pk_measdoc1; public String pk_measdoc2; public String pk_measdoc3; public String def16; public String def17; public String def18; public String def19; public String def2; public String def20; public String def3; public String def4; public String def5; public String def6; public String def7; public String def8; public String def9; public String discountflag; public String dr; public String forinvname; public String free1; public String free2; public String free3; public String free4; public String free5; public String graphid; public String height; public String invbarcode; public String invcode; public String invmnecode; public String invname; public String invpinpai; public String invshortname; public String invspec; public String invtype; public String ismngstockbygrswt; public String isretail; public String isstorebyconvert; public String laborflag; public String length; public String memo; public String modifier; public String modifytime; public String pk_assetcategory; public String pk_measdoc5; public String pk_measdoc6; public String pk_prodline; public String pk_taxitems; public String sealflag; public String setpartsflag; public String shipunitnum; public String storeunitnum; public String ts; public String unitvolume; public String unitweight; public String weitunitnum; public String width; public String getRn() { return rn; } public void setRn(String rn) { this.rn = rn; } public String getAsset() { return asset; } public void setAsset(String asset) { this.asset = asset; } public String getAssistunit() { return assistunit; } public void setAssistunit(String assistunit) { this.assistunit = assistunit; } public String getAutobalancemeas() { return autobalancemeas; } public void setAutobalancemeas(String autobalancemeas) { this.autobalancemeas = autobalancemeas; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getDef1() { return def1; } public void setDef1(String def1) { this.def1 = def1; } public String getDef10() { return def10; } public void setDef10(String def10) { this.def10 = def10; } public String getDef11() { return def11; } public void setDef11(String def11) { this.def11 = def11; } public String getDef12() { return def12; } public void setDef12(String def12) { this.def12 = def12; } public String getDef13() { return def13; } public void setDef13(String def13) { this.def13 = def13; } public String getDef14() { return def14; } public void setDef14(String def14) { this.def14 = def14; } public String getDef15() { return def15; } public void setDef15(String def15) { this.def15 = def15; } public String getPk_corp() { return pk_corp; } public void setPk_corp(String pk_corp) { this.pk_corp = pk_corp; } public String getPk_invbasdoc() { return pk_invbasdoc; } public void setPk_invbasdoc(String pk_invbasdoc) { this.pk_invbasdoc = pk_invbasdoc; } public String getPk_invcl() { return pk_invcl; } public void setPk_invcl(String pk_invcl) { this.pk_invcl = pk_invcl; } public String getPk_measdoc() { return pk_measdoc; } public void setPk_measdoc(String pk_measdoc) { this.pk_measdoc = pk_measdoc; } public String getPk_measdoc1() { return pk_measdoc1; } public void setPk_measdoc1(String pk_measdoc1) { this.pk_measdoc1 = pk_measdoc1; } public String getPk_measdoc2() { return pk_measdoc2; } public void setPk_measdoc2(String pk_measdoc2) { this.pk_measdoc2 = pk_measdoc2; } public String getPk_measdoc3() { return pk_measdoc3; } public void setPk_measdoc3(String pk_measdoc3) { this.pk_measdoc3 = pk_measdoc3; } public String getDef16() { return def16; } public void setDef16(String def16) { this.def16 = def16; } public String getDef17() { return def17; } public void setDef17(String def17) { this.def17 = def17; } public String getDef18() { return def18; } public void setDef18(String def18) { this.def18 = def18; } public String getDef19() { return def19; } public void setDef19(String def19) { this.def19 = def19; } public String getDef2() { return def2; } public void setDef2(String def2) { this.def2 = def2; } public String getDef20() { return def20; } public void setDef20(String def20) { this.def20 = def20; } public String getDef3() { return def3; } public void setDef3(String def3) { this.def3 = def3; } public String getDef4() { return def4; } public void setDef4(String def4) { this.def4 = def4; } public String getDef5() { return def5; } public void setDef5(String def5) { this.def5 = def5; } public String getDef6() { return def6; } public void setDef6(String def6) { this.def6 = def6; } public String getDef7() { return def7; } public void setDef7(String def7) { this.def7 = def7; } public String getDef8() { return def8; } public void setDef8(String def8) { this.def8 = def8; } public String getDef9() { return def9; } public void setDef9(String def9) { this.def9 = def9; } public String getDiscountflag() { return discountflag; } public void setDiscountflag(String discountflag) { this.discountflag = discountflag; } public String getDr() { return dr; } public void setDr(String dr) { this.dr = dr; } public String getForinvname() { return forinvname; } public void setForinvname(String forinvname) { this.forinvname = forinvname; } public String getFree1() { return free1; } public void setFree1(String free1) { this.free1 = free1; } public String getFree2() { return free2; } public void setFree2(String free2) { this.free2 = free2; } public String getFree3() { return free3; } public void setFree3(String free3) { this.free3 = free3; } public String getFree4() { return free4; } public void setFree4(String free4) { this.free4 = free4; } public String getFree5() { return free5; } public void setFree5(String free5) { this.free5 = free5; } public String getGraphid() { return graphid; } public void setGraphid(String graphid) { this.graphid = graphid; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getInvbarcode() { return invbarcode; } public void setInvbarcode(String invbarcode) { this.invbarcode = invbarcode; } public String getInvcode() { return invcode; } public void setInvcode(String invcode) { this.invcode = invcode; } public String getInvmnecode() { return invmnecode; } public void setInvmnecode(String invmnecode) { this.invmnecode = invmnecode; } public String getInvname() { return invname; } public void setInvname(String invname) { this.invname = invname; } public String getInvpinpai() { return invpinpai; } public void setInvpinpai(String invpinpai) { this.invpinpai = invpinpai; } public String getInvshortname() { return invshortname; } public void setInvshortname(String invshortname) { this.invshortname = invshortname; } public String getInvspec() { return invspec; } public void setInvspec(String invspec) { this.invspec = invspec; } public String getInvtype() { return invtype; } public void setInvtype(String invtype) { this.invtype = invtype; } public String getIsmngstockbygrswt() { return ismngstockbygrswt; } public void setIsmngstockbygrswt(String ismngstockbygrswt) { this.ismngstockbygrswt = ismngstockbygrswt; } public String getIsretail() { return isretail; } public void setIsretail(String isretail) { this.isretail = isretail; } public String getIsstorebyconvert() { return isstorebyconvert; } public void setIsstorebyconvert(String isstorebyconvert) { this.isstorebyconvert = isstorebyconvert; } public String getLaborflag() { return laborflag; } public void setLaborflag(String laborflag) { this.laborflag = laborflag; } public String getLength() { return length; } public void setLength(String length) { this.length = length; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public String getModifier() { return modifier; } public void setModifier(String modifier) { this.modifier = modifier; } public String getModifytime() { return modifytime; } public void setModifytime(String modifytime) { this.modifytime = modifytime; } public String getPk_assetcategory() { return pk_assetcategory; } public void setPk_assetcategory(String pk_assetcategory) { this.pk_assetcategory = pk_assetcategory; } public String getPk_measdoc5() { return pk_measdoc5; } public void setPk_measdoc5(String pk_measdoc5) { this.pk_measdoc5 = pk_measdoc5; } public String getPk_measdoc6() { return pk_measdoc6; } public void setPk_measdoc6(String pk_measdoc6) { this.pk_measdoc6 = pk_measdoc6; } public String getPk_prodline() { return pk_prodline; } public void setPk_prodline(String pk_prodline) { this.pk_prodline = pk_prodline; } public String getPk_taxitems() { return pk_taxitems; } public void setPk_taxitems(String pk_taxitems) { this.pk_taxitems = pk_taxitems; } public String getSealflag() { return sealflag; } public void setSealflag(String sealflag) { this.sealflag = sealflag; } public String getSetpartsflag() { return setpartsflag; } public void setSetpartsflag(String setpartsflag) { this.setpartsflag = setpartsflag; } public String getShipunitnum() { return shipunitnum; } public void setShipunitnum(String shipunitnum) { this.shipunitnum = shipunitnum; } public String getStoreunitnum() { return storeunitnum; } public void setStoreunitnum(String storeunitnum) { this.storeunitnum = storeunitnum; } public String getTs() { return ts; } public void setTs(String ts) { this.ts = ts; } public String getUnitvolume() { return unitvolume; } public void setUnitvolume(String unitvolume) { this.unitvolume = unitvolume; } public String getUnitweight() { return unitweight; } public void setUnitweight(String unitweight) { this.unitweight = unitweight; } public String getWeitunitnum() { return weitunitnum; } public void setWeitunitnum(String weitunitnum) { this.weitunitnum = weitunitnum; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } }
11,318
0.718927
0.691661
529
20.353497
14.653974
68
false
false
0
0
0
0
0
0
1.669187
false
false
8
472227010d826b0d688ac572478c4144d46ae67d
5,007,931,877,901
4d87d4ec3c839b61c32b69270b2831b721022bca
/src/cafedetailsinfo/food.java
04aa46faec3e8ace421a76fff6fd85af0d05ff29
[]
no_license
SyamimiRazmin/CafeDetailInfo
https://github.com/SyamimiRazmin/CafeDetailInfo
325a7ec7d454478c61f6e872af1b827134b330af
2b91be275e381e42e58133459ce80a816bd24d52
refs/heads/master
2020-08-23T23:56:16.667000
2019-10-22T05:13:06
2019-10-22T05:13:06
216,727,993
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cafedetailsinfo; public class food { private String foodName; private double foodPrice; private int foodQuantity; private String foodType; food(String foodName, double foodPrice, int foodQuantity, String foodType) { this.foodName = foodName; this.foodPrice = foodPrice; this.foodQuantity = foodQuantity; this.foodType = foodType; } String getfoodName() { return this.foodName; } double getfoodPrice() { return this.foodPrice; } int getfoodQuantity() { return this.foodQuantity; } String getfoodType(){ return this.foodType; } void setfoodPrice() { this.foodPrice = foodPrice; } void setfoodQuantity() { this.foodQuantity = foodQuantity; } }
UTF-8
Java
813
java
food.java
Java
[]
null
[]
package cafedetailsinfo; public class food { private String foodName; private double foodPrice; private int foodQuantity; private String foodType; food(String foodName, double foodPrice, int foodQuantity, String foodType) { this.foodName = foodName; this.foodPrice = foodPrice; this.foodQuantity = foodQuantity; this.foodType = foodType; } String getfoodName() { return this.foodName; } double getfoodPrice() { return this.foodPrice; } int getfoodQuantity() { return this.foodQuantity; } String getfoodType(){ return this.foodType; } void setfoodPrice() { this.foodPrice = foodPrice; } void setfoodQuantity() { this.foodQuantity = foodQuantity; } }
813
0.623616
0.623616
39
19.846153
16.981949
80
false
false
0
0
0
0
0
0
0.461538
false
false
8
389dfe616f573a1f709e498ce82ac900426638fa
7,318,624,282,947
1b404c3de5fcb736219447938731cc5001ff1d9e
/Demo/drawbitmapmesh/src/main/java/com/biggun/drawbitmapmesh/Util/DBUtils.java
327b5c389b4d3b62676a18dad6eabd83732750bb
[]
no_license
sun804336516/Biggun
https://github.com/sun804336516/Biggun
b368d09de397b4cc0332a4f3ff33f5e09cfd99eb
6d2bdd6a87cd1ca330a3eabc9bde01e3994b9489
refs/heads/master
2021-05-04T01:49:04.226000
2017-01-09T02:15:28
2017-01-09T02:15:28
71,226,460
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.biggun.drawbitmapmesh.Util; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteAccessPermException; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; /** * 作者:孙贤武 on 2016/2/17 15:31 * 邮箱:sun91985415@163.com */ public class DBUtils<T> { private DBOpenHelper dbOpenHelper; private static DBUtils dbUtils; private SQLiteDatabase database; public static DBUtils getInstance(Context context) { if (dbUtils == null) { synchronized (DBUtils.class) { if (dbUtils == null) { dbUtils = new DBUtils(context); } } } return dbUtils; } private DBUtils(Context context) { dbOpenHelper = new DBOpenHelper(context.getApplicationContext()); database = dbOpenHelper.getWritableDatabase(); } public void close() { // database.close(); dbOpenHelper.close(); } public void addTAble(List<Object> list) { if (!database.isOpen()) { throw new SQLiteAccessPermException("数据库已关闭"); } if (list == null || list.size() == 0) { return; } for (Object obj:list) { addTAble(obj); } } public void addTAble(Object object) { if (!database.isOpen()) { throw new SQLiteAccessPermException("数据库已关闭"); } String tablename = object.getClass().getSimpleName(); database.execSQL(String.format(SQLConstant.CREATETABLE_SQL,tablename)); Field[] fields = object.getClass().getDeclaredFields(); ContentValues values = new ContentValues(); for (int i = 0, len = fields.length; i < len; i++) { String name = fields[i].getName(); String type = fields[i].getGenericType().toString(); if (name.equals("CREATOR") || type.equals("android.os.Parcelable$Creator<" + tablename + ">")) { continue; } boolean accessible = fields[i].isAccessible(); fields[i].setAccessible(true); try { Object o = fields[i].get(object); values.put(name, o.toString()); if (containsColumn(tablename, name)) { continue; } database.execSQL("alter table " + tablename + " add " + name + " varchar");//增加一列 } catch (IllegalAccessException e) { Utils.LogE("insert error:" + e.getMessage()); e.printStackTrace(); } fields[i].setAccessible(accessible); } Utils.LogE("----" + values.toString()); if (TextUtils.isEmpty(values.toString())) { return; } database.insert(tablename, null, values); } public void readDataBase(T t, List<T> list) throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException { if (!database.isOpen()) { throw new SQLiteAccessPermException("数据库已关闭"); } String databaseName = t.getClass().getSimpleName(); if (!containsTable(databaseName)) { return; } Cursor cursor = database.rawQuery(String.format(SQLConstant.SELECT_SQL,databaseName), null); Object object = null; Method method = null; while (cursor.moveToNext()) { object = t.getClass().newInstance(); for (String name : cursor.getColumnNames()) { if (name.equals("_id")) { continue; } String value = cursor.getString(cursor.getColumnIndex(name)); Utils.LogE(Utils.setSet(name) + ",name:" + name + ",value:" + value); if (Utils.isStringisNum1(value)) { method = t.getClass().getDeclaredMethod(Utils.setSet(name), int.class); method.invoke(object, Integer.parseInt(value)); } else if (Utils.isStringisBoolean(value)) { method = t.getClass().getDeclaredMethod(Utils.setSet(name), boolean.class); method.invoke(object, Utils.isTrue(value)); } else { method = t.getClass().getDeclaredMethod(Utils.setSet(name), String.class); method.invoke(object, value); } // Method getText = t.getClass().getDeclaredMethod("getText"); // getText.invoke(object); } list.add((T) object); } cursor.close(); } /** * 查询表中是否包含此列 * * @param simpleName * @param name * @return */ private boolean containsColumn(String simpleName, String name) { boolean result = false; // Cursor cursor = database.rawQuery("SELECT * FROM " + simpleName+ " LIMIT 0", null); // result = cursor != null && cursor.getColumnIndex(name) != -1; // Utils.LogE("cursor:"+cursor+"=="+cursor.getColumnIndex(name)); Cursor cursor = database.rawQuery(SQLConstant.TABLE_CONTAIN_COLUMN_SQL , new String[]{simpleName, "%" + name + "%"}); result = null != cursor && cursor.moveToFirst(); cursor.close(); return result; } /** * 检查某张表是否存在 * * @param tableName * @return */ public boolean containsTable(String tableName) { Cursor cursor = database.rawQuery(SQLConstant.CONTAIN_TABLE_SQL, null); while (cursor.moveToNext()) { //遍历出表名 String name = cursor.getString(0); if (tableName.equals(name)) { cursor.close(); return true; } Utils.LogE("===" + name); } cursor.close(); return false; // Cursor cursor = db.rawQuery("select name from sqlite_master where type='table';", null); // while(cursor.moveToNext()){ // //遍历出表名 // String name = cursor.getString(0); // Log.i("System.out", name); // SELECT count(*) FROM sqlite_master WHERE type='table' AND name='tableName'; } }
UTF-8
Java
6,524
java
DBUtils.java
Java
[ { "context": "reflect.Method;\nimport java.util.List;\n\n/**\n * 作者:孙贤武 on 2016/2/17 15:31\n * 邮箱:sun91985415@163.com\n */\n", "end": 434, "score": 0.9978351593017578, "start": 431, "tag": "NAME", "value": "孙贤武" }, { "context": "til.List;\n\n/**\n * 作者:孙贤武 on 2016/2/17 15:31\n * 邮箱:s...
null
[]
package com.biggun.drawbitmapmesh.Util; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteAccessPermException; import android.database.sqlite.SQLiteDatabase; import android.text.TextUtils; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; /** * 作者:孙贤武 on 2016/2/17 15:31 * 邮箱:<EMAIL> */ public class DBUtils<T> { private DBOpenHelper dbOpenHelper; private static DBUtils dbUtils; private SQLiteDatabase database; public static DBUtils getInstance(Context context) { if (dbUtils == null) { synchronized (DBUtils.class) { if (dbUtils == null) { dbUtils = new DBUtils(context); } } } return dbUtils; } private DBUtils(Context context) { dbOpenHelper = new DBOpenHelper(context.getApplicationContext()); database = dbOpenHelper.getWritableDatabase(); } public void close() { // database.close(); dbOpenHelper.close(); } public void addTAble(List<Object> list) { if (!database.isOpen()) { throw new SQLiteAccessPermException("数据库已关闭"); } if (list == null || list.size() == 0) { return; } for (Object obj:list) { addTAble(obj); } } public void addTAble(Object object) { if (!database.isOpen()) { throw new SQLiteAccessPermException("数据库已关闭"); } String tablename = object.getClass().getSimpleName(); database.execSQL(String.format(SQLConstant.CREATETABLE_SQL,tablename)); Field[] fields = object.getClass().getDeclaredFields(); ContentValues values = new ContentValues(); for (int i = 0, len = fields.length; i < len; i++) { String name = fields[i].getName(); String type = fields[i].getGenericType().toString(); if (name.equals("CREATOR") || type.equals("android.os.Parcelable$Creator<" + tablename + ">")) { continue; } boolean accessible = fields[i].isAccessible(); fields[i].setAccessible(true); try { Object o = fields[i].get(object); values.put(name, o.toString()); if (containsColumn(tablename, name)) { continue; } database.execSQL("alter table " + tablename + " add " + name + " varchar");//增加一列 } catch (IllegalAccessException e) { Utils.LogE("insert error:" + e.getMessage()); e.printStackTrace(); } fields[i].setAccessible(accessible); } Utils.LogE("----" + values.toString()); if (TextUtils.isEmpty(values.toString())) { return; } database.insert(tablename, null, values); } public void readDataBase(T t, List<T> list) throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException { if (!database.isOpen()) { throw new SQLiteAccessPermException("数据库已关闭"); } String databaseName = t.getClass().getSimpleName(); if (!containsTable(databaseName)) { return; } Cursor cursor = database.rawQuery(String.format(SQLConstant.SELECT_SQL,databaseName), null); Object object = null; Method method = null; while (cursor.moveToNext()) { object = t.getClass().newInstance(); for (String name : cursor.getColumnNames()) { if (name.equals("_id")) { continue; } String value = cursor.getString(cursor.getColumnIndex(name)); Utils.LogE(Utils.setSet(name) + ",name:" + name + ",value:" + value); if (Utils.isStringisNum1(value)) { method = t.getClass().getDeclaredMethod(Utils.setSet(name), int.class); method.invoke(object, Integer.parseInt(value)); } else if (Utils.isStringisBoolean(value)) { method = t.getClass().getDeclaredMethod(Utils.setSet(name), boolean.class); method.invoke(object, Utils.isTrue(value)); } else { method = t.getClass().getDeclaredMethod(Utils.setSet(name), String.class); method.invoke(object, value); } // Method getText = t.getClass().getDeclaredMethod("getText"); // getText.invoke(object); } list.add((T) object); } cursor.close(); } /** * 查询表中是否包含此列 * * @param simpleName * @param name * @return */ private boolean containsColumn(String simpleName, String name) { boolean result = false; // Cursor cursor = database.rawQuery("SELECT * FROM " + simpleName+ " LIMIT 0", null); // result = cursor != null && cursor.getColumnIndex(name) != -1; // Utils.LogE("cursor:"+cursor+"=="+cursor.getColumnIndex(name)); Cursor cursor = database.rawQuery(SQLConstant.TABLE_CONTAIN_COLUMN_SQL , new String[]{simpleName, "%" + name + "%"}); result = null != cursor && cursor.moveToFirst(); cursor.close(); return result; } /** * 检查某张表是否存在 * * @param tableName * @return */ public boolean containsTable(String tableName) { Cursor cursor = database.rawQuery(SQLConstant.CONTAIN_TABLE_SQL, null); while (cursor.moveToNext()) { //遍历出表名 String name = cursor.getString(0); if (tableName.equals(name)) { cursor.close(); return true; } Utils.LogE("===" + name); } cursor.close(); return false; // Cursor cursor = db.rawQuery("select name from sqlite_master where type='table';", null); // while(cursor.moveToNext()){ // //遍历出表名 // String name = cursor.getString(0); // Log.i("System.out", name); // SELECT count(*) FROM sqlite_master WHERE type='table' AND name='tableName'; } }
6,512
0.55965
0.555122
188
33.069149
26.818747
151
false
false
0
0
0
0
0
0
0.617021
false
false
8
32b062c002a38c033eef56baf28c882d7ea3afef
28,097,676,056,009
26aa05f6b222368001191c3cb5df376aed3d32a7
/src/exam/Mook.java
6cbfa162ab4b1c3f3f0b8352a3cd8e56d8a98a10
[]
no_license
olsongrant/ocpjp11-prep
https://github.com/olsongrant/ocpjp11-prep
d3a8c01aacc5d9234e28b267c47b0389abbeb9e1
8d08ff53ab89c59e869fc773fc261ddbb99d3a23
refs/heads/main
2023-01-24T22:55:46.563000
2020-12-04T21:13:00
2020-12-04T21:13:00
318,574,866
2
0
null
false
2020-12-04T21:13:02
2020-12-04T16:34:41
2020-12-04T20:25:14
2020-12-04T21:13:01
31
0
0
0
Java
false
false
package exam; import java.util.function.DoubleSupplier; public class Mook { private String title; private Double price; public Mook(String title, Double price){ this.title = title; this.price = price; } //accessor methods not shown public static void main(String[] args) { Mook b1 = new Mook("Java in 24 hrs", null); DoubleSupplier ds1 = b1::getPrice; System.out.println(b1.getTitle()+" "+ds1.getAsDouble()); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } }
UTF-8
Java
733
java
Mook.java
Java
[]
null
[]
package exam; import java.util.function.DoubleSupplier; public class Mook { private String title; private Double price; public Mook(String title, Double price){ this.title = title; this.price = price; } //accessor methods not shown public static void main(String[] args) { Mook b1 = new Mook("Java in 24 hrs", null); DoubleSupplier ds1 = b1::getPrice; System.out.println(b1.getTitle()+" "+ds1.getAsDouble()); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } }
733
0.619372
0.609823
42
15.452381
16.754818
58
false
false
0
0
0
0
0
0
0.928571
false
false
8
3505f6ec5dc3ad16e54f5e4621bb7f7799700d4c
19,713,899,899,136
80227d0b142c3f3e5e7c597eaa768c3064d19bb8
/app/src/main/java/com/example/harun/bulksms/Fragment/FragmentDeliveredPersons.java
6d02644958e7c226bfbe6176a3c75566717ef08a
[]
no_license
HarunAGCA/BulkSMS
https://github.com/HarunAGCA/BulkSMS
171271fa659e8f733a782d35fc3378c30969a602
cd56d96f70f237c1874f5018c23ec2aa9e985dee
refs/heads/master
2020-04-29T04:25:19
2019-03-24T20:18:29
2019-03-24T20:18:29
175,846,465
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.harun.bulksms.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import com.example.harun.bulksms.R; public class FragmentDeliveredPersons extends Fragment { ListView lvDelivered; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view; view = inflater.inflate(R.layout.fragment_delivered_persons,container,false); lvDelivered = view.findViewById(R.id.lvDelivered); return view; } }
UTF-8
Java
752
java
FragmentDeliveredPersons.java
Java
[]
null
[]
package com.example.harun.bulksms.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import com.example.harun.bulksms.R; public class FragmentDeliveredPersons extends Fragment { ListView lvDelivered; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view; view = inflater.inflate(R.layout.fragment_delivered_persons,container,false); lvDelivered = view.findViewById(R.id.lvDelivered); return view; } }
752
0.761968
0.760638
29
24.931034
28.358458
123
false
false
0
0
0
0
0
0
0.62069
false
false
8
9c7b7dc9126c733e90c0b4b341c61335e827be18
28,346,784,165,933
27b952d415ed8c0e7f15af399bea5eebde17d96f
/statistics-dao/src/main/java/com/jb/statistics/dao/logs/statis/DiviceLogTable.java
c2da020a27fe32d3ff398f252e4fba0f816d0466
[]
no_license
freemanxh/jb_statistics
https://github.com/freemanxh/jb_statistics
740b457513da9a7762df6c03c5c6e3f5867e9a91
b3827593851f89e73ecaf3ff82945406818f176e
refs/heads/master
2021-01-10T11:43:34.464000
2016-02-03T09:00:15
2016-02-03T09:00:15
50,628,486
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jb.statistics.dao.logs.statis; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; import com.jb.statistics.dao.impl.BaseDaoJdbcLogsImpl; @Repository("diviceLog") public class DiviceLogTable extends BaseDaoJdbcLogsImpl implements DiviceLog { /** * 分表,按日 * * @param startTime * @param endTime * @param oldTable * @param newTable */ public boolean divideTable(long startTime, long endTime, String oldTable, String newTable) { String sqlSelect = "select count(*) as theCount from " + oldTable + " where createTime_>=" + startTime + " and createTime_ < " + endTime; System.out.println("sqlSelect:" + sqlSelect); List<?> list = this.jdbcTemplate_logs.query(sqlSelect, new RowMapper() { @Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { // TODO Auto-generated method stub return rs.getInt("theCount"); } }); int count = 0; if (list != null && list.size() > 0) { count = ((Integer) list.get(0)).intValue(); } String sql = "create table " + newTable + " as select * from " + oldTable + " where createTime_>=" + startTime + " and createTime_ < " + endTime; System.out.println("create table sql:" + sql); try { int r = this.jdbcTemplate_logs.update(sql); if (r == count) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } /** * 分表成功后,把之前的旧数据给删除掉 * * @param con * @param startTime * @param endTime * @param table */ public void deleteItem(long startTime, long endTime, String table) { String sql = "delete from " + table + " where createTime_>=" + startTime + " and createTime_ < " + endTime; System.out.println("delete:" + sql); // this.jdbcTemplate_logs.update(sql); } }
UTF-8
Java
1,914
java
DiviceLogTable.java
Java
[]
null
[]
package com.jb.statistics.dao.logs.statis; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; import com.jb.statistics.dao.impl.BaseDaoJdbcLogsImpl; @Repository("diviceLog") public class DiviceLogTable extends BaseDaoJdbcLogsImpl implements DiviceLog { /** * 分表,按日 * * @param startTime * @param endTime * @param oldTable * @param newTable */ public boolean divideTable(long startTime, long endTime, String oldTable, String newTable) { String sqlSelect = "select count(*) as theCount from " + oldTable + " where createTime_>=" + startTime + " and createTime_ < " + endTime; System.out.println("sqlSelect:" + sqlSelect); List<?> list = this.jdbcTemplate_logs.query(sqlSelect, new RowMapper() { @Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { // TODO Auto-generated method stub return rs.getInt("theCount"); } }); int count = 0; if (list != null && list.size() > 0) { count = ((Integer) list.get(0)).intValue(); } String sql = "create table " + newTable + " as select * from " + oldTable + " where createTime_>=" + startTime + " and createTime_ < " + endTime; System.out.println("create table sql:" + sql); try { int r = this.jdbcTemplate_logs.update(sql); if (r == count) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } /** * 分表成功后,把之前的旧数据给删除掉 * * @param con * @param startTime * @param endTime * @param table */ public void deleteItem(long startTime, long endTime, String table) { String sql = "delete from " + table + " where createTime_>=" + startTime + " and createTime_ < " + endTime; System.out.println("delete:" + sql); // this.jdbcTemplate_logs.update(sql); } }
1,914
0.673797
0.672193
65
27.76923
31.936365
147
false
false
0
0
0
0
0
0
1.8
false
false
8
76d20734dc11f981d58ecc059b34de9985fe7d0f
20,727,512,172,629
dcf103eee7862998543c22cb28b206854dac9b72
/src/gupta/chap1131/Hotel.java
4977fe646e776b17258c2d3b76b4c1f355961666
[]
no_license
mbodo/1Z0804
https://github.com/mbodo/1Z0804
834ac88c7dd6363753805bdd3715828f670b2ad2
fd394aaa42c0ea19eb7719a8e20dd50a964ae157
refs/heads/master
2019-07-22T18:58:46.323000
2016-05-31T19:47:02
2016-05-31T19:47:02
43,593,845
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gupta.chap1131; import java.util.ArrayDeque; import java.util.Queue; import java.util.concurrent.Executor; public class Hotel implements Executor { final Queue<Runnable> custQueue = new ArrayDeque<>(); @Override public void execute(Runnable command) { synchronized (custQueue) { custQueue.offer(command); } processEarliestOrder(); } private void processEarliestOrder() { synchronized (custQueue) { Runnable task = custQueue.poll(); new Thread(task).start(); } } public static void main(String[] args) { final Hotel hotel = new Hotel(); Order order1 = new Order("Order-1"); Order order2 = new Order("Order-2"); Order order3 = new Order("Order-3"); hotel.execute(order1); hotel.execute(order2); hotel.execute(order3); } }
UTF-8
Java
933
java
Hotel.java
Java
[]
null
[]
package gupta.chap1131; import java.util.ArrayDeque; import java.util.Queue; import java.util.concurrent.Executor; public class Hotel implements Executor { final Queue<Runnable> custQueue = new ArrayDeque<>(); @Override public void execute(Runnable command) { synchronized (custQueue) { custQueue.offer(command); } processEarliestOrder(); } private void processEarliestOrder() { synchronized (custQueue) { Runnable task = custQueue.poll(); new Thread(task).start(); } } public static void main(String[] args) { final Hotel hotel = new Hotel(); Order order1 = new Order("Order-1"); Order order2 = new Order("Order-2"); Order order3 = new Order("Order-3"); hotel.execute(order1); hotel.execute(order2); hotel.execute(order3); } }
933
0.587353
0.573419
35
24.657143
17.104624
57
false
false
0
0
0
0
0
0
0.457143
false
false
8
06d6c5a58633ab7964606ab6bbca343abb0d4aee
274,877,911,911
83adf67470217757aa0f9af94d25834c654c4d4e
/src/com/itcast/revise/Empl.java
dca904749ec3ae6dfa2c050cf53b5cb21a7ebf7b
[]
no_license
sheep3gold/firsttest
https://github.com/sheep3gold/firsttest
1724b71cdcee78121f1107bd79bf2074b42fad2b
089d4bd1c814080f2bf4b70afacb2aafe55ef3d5
refs/heads/master
2020-04-14T17:19:30.416000
2019-01-03T13:26:07
2019-01-03T13:26:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.itcast.revise; public class Empl { private int salary; public Empl() { } public Empl(int salary) { this.salary = salary; } public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; } @Override public String toString() { return "Empl{" + "salary=" + salary + '}'; } }
UTF-8
Java
439
java
Empl.java
Java
[]
null
[]
package com.itcast.revise; public class Empl { private int salary; public Empl() { } public Empl(int salary) { this.salary = salary; } public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; } @Override public String toString() { return "Empl{" + "salary=" + salary + '}'; } }
439
0.505695
0.505695
27
15.259259
12.793495
39
false
false
0
0
0
0
0
0
0.222222
false
false
8
f1af657c114b83eea383d4f6e802a7220cd8d0bc
9,603,546,887,704
0c30fb917aa278712f3d3cf68dc158afd5e1bbeb
/app/src/main/java/com/kalantos/spitball/engine/Tile.java
9dee7b42a6d2153f4e29842823cb154ef18403aa
[]
no_license
juanmadelboca/spitball-android
https://github.com/juanmadelboca/spitball-android
0382490c06269982e546c430278acbba18ffe510
b5e6a8f09aac8e49cf3c7653457b06e53b371648
refs/heads/master
2023-01-18T19:53:52.844000
2017-10-05T02:28:29
2017-10-05T02:28:29
64,504,050
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kalantos.spitball.engine; import android.app.Activity; import android.util.Log; /* * Class used to make the game board, host the balls and manage battles. * */ public class Tile extends Activity{ private Ball ball; public Tile(){ ball= new Ball(0); } protected void setBall(int size, BallType tipo){ switch(tipo){ case BALLGREEN: this.ball=new BallGreen(size); break; case BALLPINK: this.ball=new BallPink(size); break; default: break; } } protected void removeBall(){ ball=new Ball(0); } public Ball getBall(){ return ball; } protected boolean battle(Ball immigrantBall, boolean limitedMove) { /* * Define which ball will survive when 2 balls enter in one Tile, also redefine the winner * ball size. Returns true if movement can be done. * */ if ((immigrantBall instanceof BallGreen && ball instanceof BallGreen && limitedMove) || (immigrantBall instanceof BallPink && ball instanceof BallPink && limitedMove)) { Log.i("GAME", "You have too little balls to perform that move."); return false; } else { if (immigrantBall.getSize() >= ball.getSize()) { int newSize = ball.getSize() + immigrantBall.getSize(); if (immigrantBall instanceof BallGreen) { ball = new BallGreen(newSize); } if (immigrantBall instanceof BallPink) { ball = new BallPink(newSize); } } else { ball.setSize(ball.getSize() + immigrantBall.getSize()); } return true; } } }
UTF-8
Java
1,469
java
Tile.java
Java
[]
null
[]
package com.kalantos.spitball.engine; import android.app.Activity; import android.util.Log; /* * Class used to make the game board, host the balls and manage battles. * */ public class Tile extends Activity{ private Ball ball; public Tile(){ ball= new Ball(0); } protected void setBall(int size, BallType tipo){ switch(tipo){ case BALLGREEN: this.ball=new BallGreen(size); break; case BALLPINK: this.ball=new BallPink(size); break; default: break; } } protected void removeBall(){ ball=new Ball(0); } public Ball getBall(){ return ball; } protected boolean battle(Ball immigrantBall, boolean limitedMove) { /* * Define which ball will survive when 2 balls enter in one Tile, also redefine the winner * ball size. Returns true if movement can be done. * */ if ((immigrantBall instanceof BallGreen && ball instanceof BallGreen && limitedMove) || (immigrantBall instanceof BallPink && ball instanceof BallPink && limitedMove)) { Log.i("GAME", "You have too little balls to perform that move."); return false; } else { if (immigrantBall.getSize() >= ball.getSize()) { int newSize = ball.getSize() + immigrantBall.getSize(); if (immigrantBall instanceof BallGreen) { ball = new BallGreen(newSize); } if (immigrantBall instanceof BallPink) { ball = new BallPink(newSize); } } else { ball.setSize(ball.getSize() + immigrantBall.getSize()); } return true; } } }
1,469
0.683458
0.681416
61
23.065575
24.654909
90
false
false
0
0
0
0
0
0
2.163934
false
false
8
3aa702d102a6f920a152e93678cfbc1212c2893a
12,317,966,220,128
6127f16e41964204afb281af892dfe8a4a7eb735
/miscroservice-consumer2/src/main/java/springcloud812/Consumer3App.java
12cd7f3d45ded1e5e0a9210a5ba54fc83eba8191
[]
no_license
ZOU8034/detailcloud
https://github.com/ZOU8034/detailcloud
81a01eb866ace1e0eb4da40e14c425fd46f7423a
79594be38c591ebdd6f25a497fe074bfb566b0f7
refs/heads/master
2023-01-03T04:58:02.698000
2020-10-24T11:13:11
2020-10-24T11:13:11
303,388,548
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package springcloud812; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.ribbon.RibbonClient; import springcloud812.robinConfiguration.RobinConfigure; @SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}) @EnableEurekaClient//启用eureka客户端,这样能完成服务发现 //指定这个新的负载算法类给MICROSERVICE-PROVIDER-PRODUCT这个服务用 //这里的name 只服务的名称,如果需要有多个服务提供方,这个时候可以使用@RibbonClients进行配置 //只对服务名为MICROSERVICE-PROVIDER下的服务清单采用RobinConfigure.class中的随机负载均衡方式 @RibbonClient(name ="MICROSERVICE-PROVIDER", configuration = RobinConfigure.class) //如有多个服务要用不同的策略,则采用...@Ribbonclients public class Consumer3App { public static void main(String[] args) { SpringApplication.run(Consumer3App.class, args); } }
UTF-8
Java
1,174
java
Consumer3App.java
Java
[]
null
[]
package springcloud812; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.ribbon.RibbonClient; import springcloud812.robinConfiguration.RobinConfigure; @SpringBootApplication(exclude= {DataSourceAutoConfiguration.class}) @EnableEurekaClient//启用eureka客户端,这样能完成服务发现 //指定这个新的负载算法类给MICROSERVICE-PROVIDER-PRODUCT这个服务用 //这里的name 只服务的名称,如果需要有多个服务提供方,这个时候可以使用@RibbonClients进行配置 //只对服务名为MICROSERVICE-PROVIDER下的服务清单采用RobinConfigure.class中的随机负载均衡方式 @RibbonClient(name ="MICROSERVICE-PROVIDER", configuration = RobinConfigure.class) //如有多个服务要用不同的策略,则采用...@Ribbonclients public class Consumer3App { public static void main(String[] args) { SpringApplication.run(Consumer3App.class, args); } }
1,174
0.845833
0.8375
25
37.439999
28.537806
82
false
false
0
0
0
0
0
0
0.44
false
false
8
42e2ecedb1edda8f68b936ecff6ded5fd98424ae
5,617,817,243,357
beb03269b4b186e379969cb894ac2c3f57222959
/android/apollo/src/main/java/io/muun/apollo/data/db/base/HoustonIdDao.java
18843f709042862b1305b34e5159dd1711e8d78b
[ "MIT" ]
permissive
Tougee/apollo
https://github.com/Tougee/apollo
2a5dd88148d067df60d095e879899161884e3d54
9755559afdcc1aca35c62c15f124ff2190925fd8
refs/heads/master
2023-08-16T01:04:55.964000
2021-09-24T21:18:41
2021-09-24T21:18:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.muun.apollo.data.db.base; import io.muun.apollo.domain.model.base.HoustonIdModel; import android.database.Cursor; import androidx.sqlite.db.SupportSQLiteDatabase; import com.squareup.sqldelight.prerelease.SqlDelightStatement; import io.reactivex.functions.Function; import rx.Observable; import rx.functions.Func2; import javax.validation.constraints.NotNull; public abstract class HoustonIdDao<ModelT extends HoustonIdModel> extends BaseDao<ModelT> { protected HoustonIdDao( String createTableSql, Func2<SupportSQLiteDatabase, ModelT, SqlDelightStatement> inputMapper, Function<Cursor, ModelT> outputMapper, String tableName) { super(createTableSql, inputMapper, outputMapper, tableName); } @Override public Observable<ModelT> store(@NotNull ModelT element) { return Observable.defer(() -> { if (element.getId() != null) { return super.store(element); } final Cursor cursor = briteDb.query( "select id from " + tableName + " where hid = ?", String.valueOf(element.getHid()) ); if (cursor.getCount() == 0) { return super.store(element); } if (cursor.getCount() == 1) { cursor.moveToFirst(); element.setId(cursor.getLong(cursor.getColumnIndex("id"))); return super.store(element); } return Observable.error( new IllegalStateException( "More than one entity with a single hid " + element.getHid() + " found in table " + tableName ) ); }); } }
UTF-8
Java
1,801
java
HoustonIdDao.java
Java
[]
null
[]
package io.muun.apollo.data.db.base; import io.muun.apollo.domain.model.base.HoustonIdModel; import android.database.Cursor; import androidx.sqlite.db.SupportSQLiteDatabase; import com.squareup.sqldelight.prerelease.SqlDelightStatement; import io.reactivex.functions.Function; import rx.Observable; import rx.functions.Func2; import javax.validation.constraints.NotNull; public abstract class HoustonIdDao<ModelT extends HoustonIdModel> extends BaseDao<ModelT> { protected HoustonIdDao( String createTableSql, Func2<SupportSQLiteDatabase, ModelT, SqlDelightStatement> inputMapper, Function<Cursor, ModelT> outputMapper, String tableName) { super(createTableSql, inputMapper, outputMapper, tableName); } @Override public Observable<ModelT> store(@NotNull ModelT element) { return Observable.defer(() -> { if (element.getId() != null) { return super.store(element); } final Cursor cursor = briteDb.query( "select id from " + tableName + " where hid = ?", String.valueOf(element.getHid()) ); if (cursor.getCount() == 0) { return super.store(element); } if (cursor.getCount() == 1) { cursor.moveToFirst(); element.setId(cursor.getLong(cursor.getColumnIndex("id"))); return super.store(element); } return Observable.error( new IllegalStateException( "More than one entity with a single hid " + element.getHid() + " found in table " + tableName ) ); }); } }
1,801
0.582454
0.580233
57
30.596491
25.86799
91
false
false
0
0
0
0
0
0
0.491228
false
false
8
8da915161af045a34aec432a9d4d13604d5d866f
21,706,764,730,657
0e32927d2415355ded3f5d74eebf049ffe7e8a27
/src/main/java/domain/HandyWorker.java
756a5fbc2977f4d71bb6972e2b17a7e242b53995
[]
no_license
Servesus/DP-D03
https://github.com/Servesus/DP-D03
cea72b60c418c326d6d95e7019411fe9d2798ff0
cdc6ffa5cc248560e6e88656c4331bf5959d1a23
refs/heads/master
2020-04-04T20:34:49.944000
2018-11-15T20:34:42
2018-11-15T20:34:42
156,251,764
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package domain; import java.util.Collection; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.validation.Valid; import javax.validation.constraints.NotNull; @Entity @Access(AccessType.PROPERTY) public class HandyWorker extends Actor { //Relationships private Collection<Application> applications; private Collection<Phase> phases; private Curricula curricula; private Collection<Finder> finder; @OneToMany public Collection<Finder> getFinder() { return this.finder; } public void setFinder(final Collection<Finder> finder) { this.finder = finder; } @OneToMany(mappedBy = "handyWorker") public Collection<Application> getApplications() { return this.applications; } public void setApplications(final Collection<Application> applications) { this.applications = applications; } @OneToMany public Collection<Phase> getPhases() { return this.phases; } public void setPhases(final Collection<Phase> phases) { this.phases = phases; } @NotNull @Valid @OneToOne(optional = false) public Curricula getCurricula() { return this.curricula; } public void setCurricula(final Curricula curricula) { this.curricula = curricula; } }
UTF-8
Java
1,317
java
HandyWorker.java
Java
[]
null
[]
package domain; import java.util.Collection; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.validation.Valid; import javax.validation.constraints.NotNull; @Entity @Access(AccessType.PROPERTY) public class HandyWorker extends Actor { //Relationships private Collection<Application> applications; private Collection<Phase> phases; private Curricula curricula; private Collection<Finder> finder; @OneToMany public Collection<Finder> getFinder() { return this.finder; } public void setFinder(final Collection<Finder> finder) { this.finder = finder; } @OneToMany(mappedBy = "handyWorker") public Collection<Application> getApplications() { return this.applications; } public void setApplications(final Collection<Application> applications) { this.applications = applications; } @OneToMany public Collection<Phase> getPhases() { return this.phases; } public void setPhases(final Collection<Phase> phases) { this.phases = phases; } @NotNull @Valid @OneToOne(optional = false) public Curricula getCurricula() { return this.curricula; } public void setCurricula(final Curricula curricula) { this.curricula = curricula; } }
1,317
0.769172
0.769172
62
20.225807
18.87174
74
false
false
0
0
0
0
0
0
1.177419
false
false
8
322fbb53578c98e0b291842cae5e6503b0db4db9
19,971,597,941,480
ca62e472081128aa26f3c4a5854d1bb50f5d327a
/camelscheduler/src/main/java/net/audumla/scheduler/camel/DefaultSchedulerEndpoint.java
aa0d5282d9995725e8a486cb10b354f5d976fcc2
[]
no_license
Audumla/audumla
https://github.com/Audumla/audumla
c5e91789a352dc0681afcfec3d42c76f9b4bed28
382283a3f2a382890ff5cb1f4ee6d02ec69f39bf
refs/heads/master
2021-05-02T10:37:49.129000
2014-03-20T00:38:48
2014-03-20T00:38:48
36,044,793
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.audumla.scheduler.camel; /* * ********************************************************************* * ORGANIZATION : audumla.net * More information about this project can be found at the following locations: * http://www.audumla.net/ * http://audumla.googlecode.com/ * ********************************************************************* * Copyright (C) 2012 - 2013 Audumla.net * Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. * You may not use this file except in compliance with the License located at http://creativecommons.org/licenses/by-nc-nd/3.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. */ import org.apache.camel.Route; import org.apache.camel.component.quartz2.*; import org.apache.camel.util.EndpointHelper; import org.quartz.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Date; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public abstract class DefaultSchedulerEndpoint extends QuartzEndpoint { private static final Logger logger = LoggerFactory.getLogger(DefaultSchedulerEndpoint.class); private Map<String, Object> triggerParameters; private Map<String, Object> jobParameters; // An internal variables to track whether a job has been in scheduler or not, and has it paused or not. private AtomicBoolean jobAdded = new AtomicBoolean(false); public DefaultSchedulerEndpoint(String uri, SchedulerComponent component) { super(uri, component); } public void setTriggerParameters(Map<String, Object> triggerParameters) { this.triggerParameters = triggerParameters; } public Map<String, Object> getTriggerParameters() { return triggerParameters; } public Map<String, Object> getJobParameters() { return jobParameters; } public void setJobParameters(Map<String, Object> jobParameters) { this.jobParameters = jobParameters; } private void addJobInScheduler() throws Exception { // Add or use existing trigger to/from scheduler Scheduler scheduler = getComponent().getScheduler(); JobDetail jobDetail; Trigger trigger = scheduler.getTrigger(getTriggerKey()); if (trigger == null) { Date startTime = new Date(); if (getComponent().getScheduler().isStarted()) { startTime = new Date(System.currentTimeMillis() + getTriggerStartDelay()); } jobDetail = createJobDetail(); trigger = createTrigger(startTime); if (trigger == null) { logger.error("Failed to create trigger - {}",getEndpointUri()); return; } if (getTriggerParameters() != null && getTriggerParameters().size() > 0) { logger.debug("Setting user extra triggerParameters {}", getTriggerParameters()); setProperties(trigger, getTriggerParameters()); } logger.debug("Created trigger={}", trigger); updateJobDataMap(jobDetail); // Schedule it now. Remember that scheduler might not be started it, but we can schedule now. Date nextFireDate = scheduler.scheduleJob(jobDetail, trigger); if (logger.isInfoEnabled()) { logger.info("Job {} (triggerType={}, jobClass={}) is scheduled. Next fire date is {}", new Object[]{trigger.getKey(), trigger.getClass().getSimpleName(), jobDetail.getJobClass().getSimpleName(), nextFireDate}); } } else { ensureNoDupTriggerKey(); } // Increase camel job count for this endpoint AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT); if (number != null) { number.incrementAndGet(); } jobAdded.set(true); } protected abstract Trigger createTrigger(Date startTime); protected void ensureNoDupTriggerKey() { for (Route route : getCamelContext().getRoutes()) { if (route.getEndpoint() instanceof DefaultSchedulerEndpoint) { DefaultSchedulerEndpoint quartzEndpoint = (DefaultSchedulerEndpoint) route.getEndpoint(); TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey(); if (getTriggerKey().equals(checkTriggerKey)) { throw new IllegalArgumentException("Trigger key " + getTriggerKey() + " is already in used by " + quartzEndpoint); } } } } protected void updateJobDataMap(JobDetail jobDetail) { // Store this camelContext name into the job data JobDataMap jobDataMap = jobDetail.getJobDataMap(); String camelContextName = getCamelContext().getManagementName(); String endpointUri = getEndpointUri(); logger.debug("Adding camelContextName={}, endpintUri={} into job data map.", camelContextName, endpointUri); jobDataMap.put(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME, camelContextName); jobDataMap.put(QuartzConstants.QUARTZ_ENDPOINT_URI, endpointUri); } protected void setProperties(Object bean, Map<String, Object> parameters) throws Exception { EndpointHelper.setReferenceProperties(getCamelContext(), bean, parameters); EndpointHelper.setProperties(getCamelContext(), bean, parameters); } protected JobDetail createJobDetail() throws Exception { // Camel endpoint timer will assume one to one for JobDetail and Trigger, so let's use same name as trigger String name = getTriggerKey().getName(); String group = getTriggerKey().getGroup(); Class<? extends Job> jobClass = isStateful() ? StatefulCamelJob.class : CamelJob.class; logger.debug("Creating new {}.", jobClass.getSimpleName()); JobDetail result = JobBuilder.newJob(jobClass) .withIdentity(name, group) .build(); // Let user parameters to further set JobDetail properties. if (getJobParameters() != null && getJobParameters().size() > 0) { logger.debug("Setting user extra jobParameters {}", getJobParameters()); setProperties(result, getJobParameters()); } logger.debug("Created jobDetail={}", result); return result; } @Override protected void doStart() throws Exception { if (isDeleteJob() && isPauseJob()) { throw new IllegalArgumentException("Cannot have both options deleteJob and pauseJob enabled"); } addJobInScheduler(); } @Override protected void doStop() throws Exception { removeJobInScheduler(); } public void onConsumerStart(QuartzConsumer quartzConsumer) throws Exception { getConsumerLoadBalancer().addProcessor(quartzConsumer.getProcessor()); if (!jobAdded.get()) { addJobInScheduler(); } else { resumeTrigger(); } } public void onConsumerStop(QuartzConsumer quartzConsumer) throws Exception { getConsumerLoadBalancer().removeProcessor(quartzConsumer.getProcessor()); if (jobAdded.get()) { pauseTrigger(); } } private void removeJobInScheduler() throws Exception { Scheduler scheduler = getComponent().getScheduler(); if (scheduler == null) { return; } if (isDeleteJob()) { boolean isClustered = scheduler.getMetaData().isJobStoreClustered(); if (!scheduler.isShutdown() && !isClustered) { logger.info("Deleting job {}", getTriggerKey()); scheduler.unscheduleJob(getTriggerKey()); jobAdded.set(false); } } else if (isPauseJob()) { boolean isClustered = scheduler.getMetaData().isJobStoreClustered(); if (!scheduler.isShutdown() && !isClustered) { logger.info("Pausing job {}", getTriggerKey()); scheduler.pauseTrigger(getTriggerKey()); jobAdded.set(false); } } // Decrement camel job count for this endpoint AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT); if (number != null) { number.decrementAndGet(); } } abstract String getParameterPrefix(); }
UTF-8
Java
9,041
java
DefaultSchedulerEndpoint.java
Java
[]
null
[]
package net.audumla.scheduler.camel; /* * ********************************************************************* * ORGANIZATION : audumla.net * More information about this project can be found at the following locations: * http://www.audumla.net/ * http://audumla.googlecode.com/ * ********************************************************************* * Copyright (C) 2012 - 2013 Audumla.net * Licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. * You may not use this file except in compliance with the License located at http://creativecommons.org/licenses/by-nc-nd/3.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. */ import org.apache.camel.Route; import org.apache.camel.component.quartz2.*; import org.apache.camel.util.EndpointHelper; import org.quartz.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Date; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public abstract class DefaultSchedulerEndpoint extends QuartzEndpoint { private static final Logger logger = LoggerFactory.getLogger(DefaultSchedulerEndpoint.class); private Map<String, Object> triggerParameters; private Map<String, Object> jobParameters; // An internal variables to track whether a job has been in scheduler or not, and has it paused or not. private AtomicBoolean jobAdded = new AtomicBoolean(false); public DefaultSchedulerEndpoint(String uri, SchedulerComponent component) { super(uri, component); } public void setTriggerParameters(Map<String, Object> triggerParameters) { this.triggerParameters = triggerParameters; } public Map<String, Object> getTriggerParameters() { return triggerParameters; } public Map<String, Object> getJobParameters() { return jobParameters; } public void setJobParameters(Map<String, Object> jobParameters) { this.jobParameters = jobParameters; } private void addJobInScheduler() throws Exception { // Add or use existing trigger to/from scheduler Scheduler scheduler = getComponent().getScheduler(); JobDetail jobDetail; Trigger trigger = scheduler.getTrigger(getTriggerKey()); if (trigger == null) { Date startTime = new Date(); if (getComponent().getScheduler().isStarted()) { startTime = new Date(System.currentTimeMillis() + getTriggerStartDelay()); } jobDetail = createJobDetail(); trigger = createTrigger(startTime); if (trigger == null) { logger.error("Failed to create trigger - {}",getEndpointUri()); return; } if (getTriggerParameters() != null && getTriggerParameters().size() > 0) { logger.debug("Setting user extra triggerParameters {}", getTriggerParameters()); setProperties(trigger, getTriggerParameters()); } logger.debug("Created trigger={}", trigger); updateJobDataMap(jobDetail); // Schedule it now. Remember that scheduler might not be started it, but we can schedule now. Date nextFireDate = scheduler.scheduleJob(jobDetail, trigger); if (logger.isInfoEnabled()) { logger.info("Job {} (triggerType={}, jobClass={}) is scheduled. Next fire date is {}", new Object[]{trigger.getKey(), trigger.getClass().getSimpleName(), jobDetail.getJobClass().getSimpleName(), nextFireDate}); } } else { ensureNoDupTriggerKey(); } // Increase camel job count for this endpoint AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT); if (number != null) { number.incrementAndGet(); } jobAdded.set(true); } protected abstract Trigger createTrigger(Date startTime); protected void ensureNoDupTriggerKey() { for (Route route : getCamelContext().getRoutes()) { if (route.getEndpoint() instanceof DefaultSchedulerEndpoint) { DefaultSchedulerEndpoint quartzEndpoint = (DefaultSchedulerEndpoint) route.getEndpoint(); TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey(); if (getTriggerKey().equals(checkTriggerKey)) { throw new IllegalArgumentException("Trigger key " + getTriggerKey() + " is already in used by " + quartzEndpoint); } } } } protected void updateJobDataMap(JobDetail jobDetail) { // Store this camelContext name into the job data JobDataMap jobDataMap = jobDetail.getJobDataMap(); String camelContextName = getCamelContext().getManagementName(); String endpointUri = getEndpointUri(); logger.debug("Adding camelContextName={}, endpintUri={} into job data map.", camelContextName, endpointUri); jobDataMap.put(QuartzConstants.QUARTZ_CAMEL_CONTEXT_NAME, camelContextName); jobDataMap.put(QuartzConstants.QUARTZ_ENDPOINT_URI, endpointUri); } protected void setProperties(Object bean, Map<String, Object> parameters) throws Exception { EndpointHelper.setReferenceProperties(getCamelContext(), bean, parameters); EndpointHelper.setProperties(getCamelContext(), bean, parameters); } protected JobDetail createJobDetail() throws Exception { // Camel endpoint timer will assume one to one for JobDetail and Trigger, so let's use same name as trigger String name = getTriggerKey().getName(); String group = getTriggerKey().getGroup(); Class<? extends Job> jobClass = isStateful() ? StatefulCamelJob.class : CamelJob.class; logger.debug("Creating new {}.", jobClass.getSimpleName()); JobDetail result = JobBuilder.newJob(jobClass) .withIdentity(name, group) .build(); // Let user parameters to further set JobDetail properties. if (getJobParameters() != null && getJobParameters().size() > 0) { logger.debug("Setting user extra jobParameters {}", getJobParameters()); setProperties(result, getJobParameters()); } logger.debug("Created jobDetail={}", result); return result; } @Override protected void doStart() throws Exception { if (isDeleteJob() && isPauseJob()) { throw new IllegalArgumentException("Cannot have both options deleteJob and pauseJob enabled"); } addJobInScheduler(); } @Override protected void doStop() throws Exception { removeJobInScheduler(); } public void onConsumerStart(QuartzConsumer quartzConsumer) throws Exception { getConsumerLoadBalancer().addProcessor(quartzConsumer.getProcessor()); if (!jobAdded.get()) { addJobInScheduler(); } else { resumeTrigger(); } } public void onConsumerStop(QuartzConsumer quartzConsumer) throws Exception { getConsumerLoadBalancer().removeProcessor(quartzConsumer.getProcessor()); if (jobAdded.get()) { pauseTrigger(); } } private void removeJobInScheduler() throws Exception { Scheduler scheduler = getComponent().getScheduler(); if (scheduler == null) { return; } if (isDeleteJob()) { boolean isClustered = scheduler.getMetaData().isJobStoreClustered(); if (!scheduler.isShutdown() && !isClustered) { logger.info("Deleting job {}", getTriggerKey()); scheduler.unscheduleJob(getTriggerKey()); jobAdded.set(false); } } else if (isPauseJob()) { boolean isClustered = scheduler.getMetaData().isJobStoreClustered(); if (!scheduler.isShutdown() && !isClustered) { logger.info("Pausing job {}", getTriggerKey()); scheduler.pauseTrigger(getTriggerKey()); jobAdded.set(false); } } // Decrement camel job count for this endpoint AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT); if (number != null) { number.decrementAndGet(); } } abstract String getParameterPrefix(); }
9,041
0.623935
0.622055
218
39.472477
33.902203
134
false
false
0
0
0
0
0
0
0.56422
false
false
8
d72deeebcea036c23c061aebd7216bba7f44ad37
5,050,881,562,782
49f489795ab8d7c0e8e135830b9e690be7f967d8
/src/main/java/com/github/prypurity/xiaviccore/Commands/UserCmds/Essential/Teleport/Tpa/TpaCommand.java
d7354c3c0af40e03e7a3c0e63f93dc85d1e14b28
[]
no_license
PryPurity/XiavicCore
https://github.com/PryPurity/XiavicCore
4a4dc5edef01e149022e35d15c34c85f5730f906
99e5be8cb2d0a687bfaec8603bae4e3bbb2e98b8
refs/heads/master
2021-01-07T07:11:16.436000
2020-05-31T22:32:29
2020-05-31T22:32:29
241,615,666
1
4
null
false
2020-05-07T08:26:28
2020-02-19T12:25:36
2020-05-07T07:22:10
2020-05-07T08:26:28
239
1
3
0
Java
false
false
package com.github.prypurity.xiaviccore.Commands.UserCmds.Essential.Teleport.Tpa; import com.github.prypurity.xiaviccore.Main; import com.github.prypurity.xiaviccore.Utils.Tpa.TpaHandler; import com.github.prypurity.xiaviccore.Utils.Utils; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class TpaCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String label, String[] strings) { if (commandSender instanceof Player) { Player player = (Player) commandSender; if (player.hasPermission(Main.permissions.getString("Tpa")) || player.isOp()) { if (strings.length == 1) { if (!strings[0].equalsIgnoreCase(player.getName())) { if (TpaHandler.canTpa(player)) { try { Player target = Bukkit.getPlayer(strings[0]); int result = TpaHandler.addRequest(player, target); if (result == 2) { Utils.chat(player, Main.messages.getString("TpDisabled").replace("%target%", target.getDisplayName())); } } catch (Exception e) { e.printStackTrace(); Utils.chat(player, Main.messages.getString("PlayerNotFound")); } } } else { Utils.chat(player, Main.messages.getString("TpSelf")); } return true; } else { Utils.chat(player, "You must specify a target!"); } } else { Utils.chat(player, Main.messages.getString("NoPerms")); } return true; } Utils.chat(commandSender, Main.messages.getString("SenderNotPlayer")); return false; } }
UTF-8
Java
2,165
java
TpaCommand.java
Java
[ { "context": "package com.github.prypurity.xiaviccore.Commands.UserCmds.Essential.Teleport.T", "end": 28, "score": 0.9948992729187012, "start": 19, "tag": "USERNAME", "value": "prypurity" }, { "context": "erCmds.Essential.Teleport.Tpa;\n\nimport com.github.prypurity.xiaviccore.Main;\...
null
[]
package com.github.prypurity.xiaviccore.Commands.UserCmds.Essential.Teleport.Tpa; import com.github.prypurity.xiaviccore.Main; import com.github.prypurity.xiaviccore.Utils.Tpa.TpaHandler; import com.github.prypurity.xiaviccore.Utils.Utils; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class TpaCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String label, String[] strings) { if (commandSender instanceof Player) { Player player = (Player) commandSender; if (player.hasPermission(Main.permissions.getString("Tpa")) || player.isOp()) { if (strings.length == 1) { if (!strings[0].equalsIgnoreCase(player.getName())) { if (TpaHandler.canTpa(player)) { try { Player target = Bukkit.getPlayer(strings[0]); int result = TpaHandler.addRequest(player, target); if (result == 2) { Utils.chat(player, Main.messages.getString("TpDisabled").replace("%target%", target.getDisplayName())); } } catch (Exception e) { e.printStackTrace(); Utils.chat(player, Main.messages.getString("PlayerNotFound")); } } } else { Utils.chat(player, Main.messages.getString("TpSelf")); } return true; } else { Utils.chat(player, "You must specify a target!"); } } else { Utils.chat(player, Main.messages.getString("NoPerms")); } return true; } Utils.chat(commandSender, Main.messages.getString("SenderNotPlayer")); return false; } }
2,165
0.537182
0.535335
47
45.063831
30.030767
139
false
false
0
0
0
0
0
0
0.744681
false
false
8
446d2982277d5727cfb10c28f4aa5447a07aa476
26,310,969,675,435
c66750ba174175c3085aebf25dde15110dc66485
/encapsulation/src/main/java/be/course/design/encapsulation/benefits/MetaData.java
13a7f9d674e0ebfe12410c23762cfa3734291f0c
[]
no_license
facet-it/solid-design-code-examples
https://github.com/facet-it/solid-design-code-examples
fe4a393ab1110709c49bcf08589aed1194406151
cd907aae054b47a4f0f1734b6857d8e47206e176
refs/heads/master
2021-09-10T00:49:25.801000
2021-09-05T18:55:47
2021-09-05T18:55:47
139,808,110
0
0
null
false
2020-10-13T18:00:48
2018-07-05T06:59:33
2020-04-23T18:13:35
2020-10-13T18:00:46
128
0
0
1
Java
false
false
package be.course.design.encapsulation.benefits; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MetaData { private String[] headers = new String[]{}; private List<TranslationMapping> allTranslations = new ArrayList<>(); public String[] getHeaders() { return headers; } public List<TranslationMapping> getAllTranslations() { return allTranslations; } public Map<String, Map<String,String>> getTranslationsMapped() { return new HashMap<>(); } }
UTF-8
Java
570
java
MetaData.java
Java
[]
null
[]
package be.course.design.encapsulation.benefits; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class MetaData { private String[] headers = new String[]{}; private List<TranslationMapping> allTranslations = new ArrayList<>(); public String[] getHeaders() { return headers; } public List<TranslationMapping> getAllTranslations() { return allTranslations; } public Map<String, Map<String,String>> getTranslationsMapped() { return new HashMap<>(); } }
570
0.691228
0.691228
24
22.75
22.179665
73
false
false
0
0
0
0
0
0
0.5
false
false
8
59992eaba0e73195cd7c8ab061fb252fa085c9af
22,007,412,440,380
2e8336c191a0e32501bd80cff5de48fe002273be
/com.whd.web.pc/src/main/java/com/ziyue/mvc/mobile/BaseIndexMobile.java
d1c36076b0ccf0eb5eae27caf660df88013ca7b0
[]
no_license
mxcfd/parent-maven
https://github.com/mxcfd/parent-maven
c8081efc2821176c9a80003b3f25d6bcab9e6fb5
2a9fbede7c53ea14a964df6b573bee709a3ea13d
refs/heads/master
2020-11-24T22:15:12.325000
2020-10-26T09:35:01
2020-10-27T00:38:49
228,361,118
0
0
null
false
2021-01-21T00:44:16
2019-12-16T10:26:47
2020-10-27T00:40:44
2021-01-21T00:44:14
15,176
0
0
8
JavaScript
false
false
package com.ziyue.mvc.mobile; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.whd.base.utils.HttpResult; import com.whd.system.domain.BaseMenu; import com.whd.system.domain.BaseUser; import com.whd.system.service.BaseMenuService; @Controller @RequestMapping("/m_/index") public class BaseIndexMobile { @Resource(name = "baseMenuServiceImpl") private BaseMenuService menuservice; @RequestMapping("/menu") public @ResponseBody HttpResult menu(Model model,HttpServletRequest request, String pid) { try{ BaseUser user = (BaseUser)request.getSession().getAttribute("user"); if(null != pid && !"".equals(pid)){ BaseMenu topmenu = menuservice.findMenuById(pid); model.addAttribute("topmenu", topmenu); List<BaseMenu> menus = menuservice.findMenuByUserId(user.getId(),pid); model.addAttribute("menus", menus); boolean hasChild = false; for(BaseMenu menu : menus ){ if(!menu.getPid().equals( topmenu.getId()) ){ hasChild = true ; break; } } model.addAttribute("hasChild", hasChild); } return HttpResult.success(model); }catch(Exception e){ return HttpResult.build("error", e.getMessage()); } } @RequestMapping("/listMain") public ModelAndView listMain(String menuid) { ModelAndView mav = new ModelAndView(); BaseMenu menu = menuservice.findMenuById(menuid); mav.addObject("menu", menu); mav.setViewName("index/list_main"); return mav; } }
UTF-8
Java
1,767
java
BaseIndexMobile.java
Java
[]
null
[]
package com.ziyue.mvc.mobile; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.whd.base.utils.HttpResult; import com.whd.system.domain.BaseMenu; import com.whd.system.domain.BaseUser; import com.whd.system.service.BaseMenuService; @Controller @RequestMapping("/m_/index") public class BaseIndexMobile { @Resource(name = "baseMenuServiceImpl") private BaseMenuService menuservice; @RequestMapping("/menu") public @ResponseBody HttpResult menu(Model model,HttpServletRequest request, String pid) { try{ BaseUser user = (BaseUser)request.getSession().getAttribute("user"); if(null != pid && !"".equals(pid)){ BaseMenu topmenu = menuservice.findMenuById(pid); model.addAttribute("topmenu", topmenu); List<BaseMenu> menus = menuservice.findMenuByUserId(user.getId(),pid); model.addAttribute("menus", menus); boolean hasChild = false; for(BaseMenu menu : menus ){ if(!menu.getPid().equals( topmenu.getId()) ){ hasChild = true ; break; } } model.addAttribute("hasChild", hasChild); } return HttpResult.success(model); }catch(Exception e){ return HttpResult.build("error", e.getMessage()); } } @RequestMapping("/listMain") public ModelAndView listMain(String menuid) { ModelAndView mav = new ModelAndView(); BaseMenu menu = menuservice.findMenuById(menuid); mav.addObject("menu", menu); mav.setViewName("index/list_main"); return mav; } }
1,767
0.73854
0.73854
59
28.949152
21.907682
91
false
false
0
0
0
0
0
0
2.305085
false
false
8
228801b34e4f993a33210625a9a3255301b41392
6,511,170,444,583
1d2fda2245888413e3eef8798a61236822f022db
/org/flywaydb/core/internal/util/StopWatch.java
6b426321d090faa34c36ee198617160d120561eb
[ "IJG" ]
permissive
SynieztroLedPar/Wu
https://github.com/SynieztroLedPar/Wu
3b4391e916f6a5605d60663f800702f3e45d5dfc
5f7daebc2fb430411ddb76a179005eeecde9802b
refs/heads/master
2023-04-29T17:27:08.301000
2020-10-10T22:28:40
2020-10-10T22:28:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.flywaydb.core.internal.util; import java.util.concurrent.TimeUnit; public class StopWatch { private long start; private long stop; public void start() { this.start = System.nanoTime(); } public void stop() { this.stop = System.nanoTime(); } public long getTotalTimeMillis() { return TimeUnit.NANOSECONDS.toMillis(this.stop - this.start); } } /* Location: C:\Games\SteamLibrary\steamapps\common\Wurm Unlimited Dedicated Server\server.jar!\org\flywaydb\core\internal\util\StopWatch.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
628
java
StopWatch.java
Java
[]
null
[]
package org.flywaydb.core.internal.util; import java.util.concurrent.TimeUnit; public class StopWatch { private long start; private long stop; public void start() { this.start = System.nanoTime(); } public void stop() { this.stop = System.nanoTime(); } public long getTotalTimeMillis() { return TimeUnit.NANOSECONDS.toMillis(this.stop - this.start); } } /* Location: C:\Games\SteamLibrary\steamapps\common\Wurm Unlimited Dedicated Server\server.jar!\org\flywaydb\core\internal\util\StopWatch.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
628
0.679936
0.66879
30
19.966667
30.258314
156
false
false
0
0
0
0
0
0
0.233333
false
false
8
1ccd70ca658243aa599fefa89da50798df92c0fd
33,225,867,021,378
8f17bf95d48cc28d8f14ad9bb138327aea3cecdc
/b2c-order-service/b2c-order-service-client/src/main/java/com/jcloud/b2c/order/client/vo/seckill/additem/OrderPopInfoVO.java
59cb138ae50987fbbc42fdd8d4179faed95675ab
[]
no_license
lixiawss/demo
https://github.com/lixiawss/demo
6dc9274a9706d90586c434decc7e0f2f35c55634
e4fa1370a17dada6deac92c8eade80ccee5166a3
refs/heads/master
2019-01-13T03:31:38.403000
2017-06-09T02:10:10
2017-06-09T02:10:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jcloud.b2c.order.client.vo.seckill.additem; /** * Created by dugang3 on 2017/5/10. */ public class OrderPopInfoVO { private int venderId; private String venderName; private int venderType; private int venderColType; private long virtualVenderId; public int getVenderId() { return venderId; } public void setVenderId(int venderId) { this.venderId = venderId; } public String getVenderName() { return venderName; } public void setVenderName(String venderName) { this.venderName = venderName; } public int getVenderType() { return venderType; } public void setVenderType(int venderType) { this.venderType = venderType; } public int getVenderColType() { return venderColType; } public void setVenderColType(int venderColType) { this.venderColType = venderColType; } public long getVirtualVenderId() { return virtualVenderId; } public void setVirtualVenderId(long virtualVenderId) { this.virtualVenderId = virtualVenderId; } }
UTF-8
Java
1,127
java
OrderPopInfoVO.java
Java
[ { "context": "rder.client.vo.seckill.additem;\n\n/**\n * Created by dugang3 on 2017/5/10.\n */\npublic class OrderPopInfoVO {\n ", "end": 82, "score": 0.9996067881584167, "start": 75, "tag": "USERNAME", "value": "dugang3" } ]
null
[]
package com.jcloud.b2c.order.client.vo.seckill.additem; /** * Created by dugang3 on 2017/5/10. */ public class OrderPopInfoVO { private int venderId; private String venderName; private int venderType; private int venderColType; private long virtualVenderId; public int getVenderId() { return venderId; } public void setVenderId(int venderId) { this.venderId = venderId; } public String getVenderName() { return venderName; } public void setVenderName(String venderName) { this.venderName = venderName; } public int getVenderType() { return venderType; } public void setVenderType(int venderType) { this.venderType = venderType; } public int getVenderColType() { return venderColType; } public void setVenderColType(int venderColType) { this.venderColType = venderColType; } public long getVirtualVenderId() { return virtualVenderId; } public void setVirtualVenderId(long virtualVenderId) { this.virtualVenderId = virtualVenderId; } }
1,127
0.65661
0.648625
52
20.673077
18.367741
58
false
false
0
0
0
0
0
0
0.307692
false
false
8
e9d6feb0bffd8dc59e2996153946caf8a65799f6
20,495,583,959,626
572a0140e29e97c060bac7a5aa2660f9365f83f8
/src/Proxy/Series/Main.java
f2d42342422cb420a048a7d6bca8a9d988f46d41
[]
no_license
rodrigo-brasil/DH-BackEnd
https://github.com/rodrigo-brasil/DH-BackEnd
889857625b431a4d543cb588d32329f2022a00d8
9dcb074d294b1e74ba7e1e655c34ece86d1190a2
refs/heads/main
2023-09-04T14:04:30.025000
2021-11-02T13:43:30
2021-11-02T13:43:30
418,962,570
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Proxy.Series; public class Main { public static void main(String[] args) { Usuario usuario = new Usuario(); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("Gotham"); } }
UTF-8
Java
375
java
Main.java
Java
[]
null
[]
package Proxy.Series; public class Main { public static void main(String[] args) { Usuario usuario = new Usuario(); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("See"); usuario.verSerie("Gotham"); } }
375
0.576
0.576
18
19.833334
16.077072
44
false
false
0
0
0
0
0
0
0.5
false
false
8
d7a2e9ba08156afc2b9ea1fb247b16989448e289
28,183,575,419,279
011c8e534ae08f6f14616e7a6080541aa7269165
/src/su/nsk/iae/reflexdt/core/dom/Program.java
712b202afb73329eff886444e764a5658a115228
[]
no_license
magdavius/ReflexDT-old-version
https://github.com/magdavius/ReflexDT-old-version
b4bb2517002f11ae314aeee635bf31c3ddb522a4
222dc070b662954ce0e5e8de06a236e35cb65d2b
refs/heads/master
2015-08-01T13:04:18.857000
2012-08-13T23:39:27
2012-08-13T23:39:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package su.nsk.iae.reflexdt.core.dom; import java.util.ArrayList; import org.antlr.runtime.CommonToken; import org.antlr.runtime.Token; public class Program extends ASTNode { public Program() { super(); // TODO Auto-generated constructor stub } public Program(int type, int startPosition, int length, String text) { super(type, startPosition, length, text); } public Program(ASTNode node) { super(node); // TODO Auto-generated constructor stub } public Program(Token t) { super(t); // TODO Auto-generated constructor stub } @Override public void getContentProposals(ArrayList result) { // TODO Auto-generated method stub } }
UTF-8
Java
671
java
Program.java
Java
[]
null
[]
package su.nsk.iae.reflexdt.core.dom; import java.util.ArrayList; import org.antlr.runtime.CommonToken; import org.antlr.runtime.Token; public class Program extends ASTNode { public Program() { super(); // TODO Auto-generated constructor stub } public Program(int type, int startPosition, int length, String text) { super(type, startPosition, length, text); } public Program(ASTNode node) { super(node); // TODO Auto-generated constructor stub } public Program(Token t) { super(t); // TODO Auto-generated constructor stub } @Override public void getContentProposals(ArrayList result) { // TODO Auto-generated method stub } }
671
0.716841
0.716841
41
15.365853
18.321993
69
false
false
0
0
0
0
0
0
1.219512
false
false
8
6a5f14b6d200c78e2eb912e6e21b4b0b18af836c
25,159,918,440,573
f61a365de440b5003b062c3147a2026717dbbd18
/FractionUnitTests.java
f90b7357dfb763a0282f7de7bc9394690370688d
[]
no_license
lexi-mclaughlin/onelogin-challenge
https://github.com/lexi-mclaughlin/onelogin-challenge
3219833eb7dea404514d6064f30c373776f01356
e2ae5d1b7157afe3232c44a7808d61317b0219cc
refs/heads/main
2023-07-16T12:52:09.270000
2021-09-04T01:38:02
2021-09-04T01:38:02
402,935,842
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.oneloginchallenge; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class FractionUnitTests { private Fraction oneHalf; private Fraction oneFourth; private Fraction one; private Fraction twoThirds; private Fraction twoNinths; private Fraction negativeOneFourth; private Fraction negativeOneHalf; @Before public void setup(){ oneHalf = new Fraction(1, 2); negativeOneHalf = new Fraction(-1, 2); oneFourth = new Fraction(1, 4); negativeOneFourth = new Fraction(-1, 4); one = new Fraction(1, 1); twoThirds = new Fraction(2,3); twoNinths = new Fraction(2,9); } @Test public void testAdd(){ Fraction result = oneHalf.add(oneHalf); assertEquals(one, result); } @Test public void testAdd_reducesCorrectly(){ Fraction result = twoNinths.add(twoThirds); assertEquals(new Fraction(8, 9), result); } @Test public void testAdd_oneNegative(){ Fraction result = oneHalf.add(negativeOneFourth); assertEquals(oneFourth, result); } @Test public void testAdd_twoNegatives(){ Fraction result = negativeOneFourth.add(negativeOneFourth); assertEquals(negativeOneHalf, result); } @Test public void testSubtract(){ Fraction result = oneHalf.subtract(oneFourth); assertEquals(oneFourth, result); } @Test public void testSubtract_reducesCorrectly(){ Fraction result = twoThirds.subtract(twoNinths); assertEquals(new Fraction(4, 9), result); } @Test public void testSubtract_negativeResult(){ Fraction result = oneFourth.subtract(oneHalf); assertEquals(-1, result.numerator); assertEquals(4, result.denominator); } @Test public void testSubtract_negativeNumbers(){ Fraction result = oneHalf.subtract(negativeOneFourth); assertEquals(new Fraction(3, 4), result); } @Test public void testSubtract_equalsZero(){ Fraction result = oneHalf.subtract(oneHalf); assertEquals(0, result.numerator); } @Test public void testMultiply(){ Fraction result = oneHalf.multiply(oneHalf); assertEquals(oneFourth, result); } @Test public void testMultiply_oneNegative(){ Fraction result = negativeOneFourth.multiply(oneFourth); assertEquals(new Fraction(-1, 16), result); } @Test public void testMultiply_twoNegatives(){ Fraction result = negativeOneFourth.multiply(negativeOneFourth); assertEquals(new Fraction(1, 16), result); } @Test public void testMultiply_reducesCorrectly(){ Fraction result = twoThirds.multiply(oneHalf); assertEquals(new Fraction(1, 3), result); } @Test public void testMultiply_oneWholeNumber(){ Fraction result = twoThirds.multiply(one); assertEquals(twoThirds, result); } @Test public void testDivide(){ Fraction result = oneFourth.divide(oneHalf); assertEquals(oneHalf, result); } @Test public void testDivide_oneNegative(){ Fraction result = negativeOneFourth.divide(oneHalf); assertEquals(negativeOneHalf, result); } @Test public void testDivide_twoNegatives(){ Fraction result = negativeOneFourth.divide(negativeOneFourth); assertEquals(one, result); } @Test public void testDivide_reducesCorrectly(){ Fraction result = twoNinths.divide(twoThirds); assertEquals(new Fraction(1, 3), result); } @Test public void testDivide_equalsWholeNumber(){ Fraction result = oneHalf.divide(oneHalf); assertEquals(one, result); } }
UTF-8
Java
3,827
java
FractionUnitTests.java
Java
[]
null
[]
package com.oneloginchallenge; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; public class FractionUnitTests { private Fraction oneHalf; private Fraction oneFourth; private Fraction one; private Fraction twoThirds; private Fraction twoNinths; private Fraction negativeOneFourth; private Fraction negativeOneHalf; @Before public void setup(){ oneHalf = new Fraction(1, 2); negativeOneHalf = new Fraction(-1, 2); oneFourth = new Fraction(1, 4); negativeOneFourth = new Fraction(-1, 4); one = new Fraction(1, 1); twoThirds = new Fraction(2,3); twoNinths = new Fraction(2,9); } @Test public void testAdd(){ Fraction result = oneHalf.add(oneHalf); assertEquals(one, result); } @Test public void testAdd_reducesCorrectly(){ Fraction result = twoNinths.add(twoThirds); assertEquals(new Fraction(8, 9), result); } @Test public void testAdd_oneNegative(){ Fraction result = oneHalf.add(negativeOneFourth); assertEquals(oneFourth, result); } @Test public void testAdd_twoNegatives(){ Fraction result = negativeOneFourth.add(negativeOneFourth); assertEquals(negativeOneHalf, result); } @Test public void testSubtract(){ Fraction result = oneHalf.subtract(oneFourth); assertEquals(oneFourth, result); } @Test public void testSubtract_reducesCorrectly(){ Fraction result = twoThirds.subtract(twoNinths); assertEquals(new Fraction(4, 9), result); } @Test public void testSubtract_negativeResult(){ Fraction result = oneFourth.subtract(oneHalf); assertEquals(-1, result.numerator); assertEquals(4, result.denominator); } @Test public void testSubtract_negativeNumbers(){ Fraction result = oneHalf.subtract(negativeOneFourth); assertEquals(new Fraction(3, 4), result); } @Test public void testSubtract_equalsZero(){ Fraction result = oneHalf.subtract(oneHalf); assertEquals(0, result.numerator); } @Test public void testMultiply(){ Fraction result = oneHalf.multiply(oneHalf); assertEquals(oneFourth, result); } @Test public void testMultiply_oneNegative(){ Fraction result = negativeOneFourth.multiply(oneFourth); assertEquals(new Fraction(-1, 16), result); } @Test public void testMultiply_twoNegatives(){ Fraction result = negativeOneFourth.multiply(negativeOneFourth); assertEquals(new Fraction(1, 16), result); } @Test public void testMultiply_reducesCorrectly(){ Fraction result = twoThirds.multiply(oneHalf); assertEquals(new Fraction(1, 3), result); } @Test public void testMultiply_oneWholeNumber(){ Fraction result = twoThirds.multiply(one); assertEquals(twoThirds, result); } @Test public void testDivide(){ Fraction result = oneFourth.divide(oneHalf); assertEquals(oneHalf, result); } @Test public void testDivide_oneNegative(){ Fraction result = negativeOneFourth.divide(oneHalf); assertEquals(negativeOneHalf, result); } @Test public void testDivide_twoNegatives(){ Fraction result = negativeOneFourth.divide(negativeOneFourth); assertEquals(one, result); } @Test public void testDivide_reducesCorrectly(){ Fraction result = twoNinths.divide(twoThirds); assertEquals(new Fraction(1, 3), result); } @Test public void testDivide_equalsWholeNumber(){ Fraction result = oneHalf.divide(oneHalf); assertEquals(one, result); } }
3,827
0.651685
0.643062
144
25.576389
21.227793
72
false
false
0
0
0
0
0
0
0.631944
false
false
8
7ee1c2ef7fc5c33b77f7cc70f294eb75b22b44ce
18,141,941,860,679
26ac045610373c013e9d4268ab80c2435bd95edd
/src/Follower.java
3aeca63481805eaf2dc6851d92f3b4fcb984d651
[]
no_license
tmshv/iaac16
https://github.com/tmshv/iaac16
077dfa3754f4bceb2b965523945ea64dcccbbd08
0c8a88efdc7a18b034530a591d4a5af55537e93a
refs/heads/master
2021-01-18T22:23:02.772000
2016-07-21T22:01:45
2016-07-21T22:01:45
63,551,927
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import processing.core.PVector; import utils.GeometryUtils; import java.util.ArrayList; import static java.lang.Math.max; import static java.lang.Math.min; /** * Created at 14/07/16 * * @author tmshv */ public class Follower extends Agent{ float r; public float goalDistance = 20; PVector finishPoint; public PVector predictLocation = new PVector(); // public PVector normalLocation = new PVector(); // public PVector targetLocation = new PVector(); float predictMult = 50; float dirMult = 5; private ArrayList<PVector> route; public Follower(String type, float speed, float force, int c) { super(type, speed, force, c); } @Override public void run() { if (finishPoint != null && (location.dist(finishPoint) < goalDistance)) { finishPoint = null; } else { follow(); } super.run(); } public void move(Route route) { this.route = route.bake(); if (this.route.size() > 0) { finishPoint = this.route.get(this.route.size() - 1); this.location.set(this.route.get(0)); } } // This function implements Craig Reynolds' path following algorithm // http://www.red3d.com/cwr/steer/PathFollow.html public void follow() { if(route == null) return; float roadRadius = 10; // Predict location 50 (arbitrary choice) frames ahead // This could be based on speed PVector predict = velocity.copy(); predict.normalize(); predict.mult(predictMult); predictLocation = PVector.add(location, predict); // Now we must find the normal to the path from the predicted location // We look at the normal for each line segment and pick out the closest one PVector normal = null; PVector target = null; float worldRecord = 10000000; // Start with a very high record distance that can easily be beaten PVector normalPoint = new PVector(); // Loop through all points of the path for (int i = 0; i < route.size() - 1; i++) { // Look at a line segment PVector a = route.get(i); PVector b = route.get(i + 1); // Get the normal point to that line // normalPoint = getNormalPoint(predictLocation, a, b); normalPoint = GeometryUtils.projectVertexOnLine(predictLocation, a, b); // Check if normal is on line segment PVector dir = PVector.sub(b, a); // If it's not within the line segment, consider the normal to just be the end of the line segment (point b) //if (da + db > line.mag()+1) { if (normalPoint.x < min(a.x, b.x) || normalPoint.x > max(a.x, b.x) || normalPoint.y < min(a.y, b.y) || normalPoint.y > max(a.y, b.y)) { normalPoint = b.copy(); // If we're at the end we really want the next line segment for looking ahead // a = p.points.get((i+1)%p.points.mass()); // b = p.points.get((i+2)%p.points.mass()); // Path wraps around // dir = PVector.sub(b, a); } // How far away are we from the path? float distance = predictLocation.dist(normalPoint); // Did we beat the record and find the closest line segment? if (distance < worldRecord) { worldRecord = distance; // If so the target we want to steer towards is the normal normal = normalPoint; // Look at the direction of the line segment so we can seek a little bit ahead of the normal // PVector dir = PVector.sub(b, a); dir.normalize(); // This is an oversimplification // Should be based on distance to path & velocity dir.mult(dirMult); target = normal.copy(); target.add(dir); } } // normalLocation = normalPoint; // targetLocation = target; // println("var: "+var); // Only if the distance is greater than the path's radius do we bother to steer // if (worldRecord > roadRadius) { seek(target); // } } }
UTF-8
Java
4,300
java
Follower.java
Java
[ { "context": "ath.min;\n\n/**\n * Created at 14/07/16\n *\n * @author tmshv\n */\npublic class Follower extends Agent{\n floa", "end": 205, "score": 0.9996345043182373, "start": 200, "tag": "USERNAME", "value": "tmshv" } ]
null
[]
import processing.core.PVector; import utils.GeometryUtils; import java.util.ArrayList; import static java.lang.Math.max; import static java.lang.Math.min; /** * Created at 14/07/16 * * @author tmshv */ public class Follower extends Agent{ float r; public float goalDistance = 20; PVector finishPoint; public PVector predictLocation = new PVector(); // public PVector normalLocation = new PVector(); // public PVector targetLocation = new PVector(); float predictMult = 50; float dirMult = 5; private ArrayList<PVector> route; public Follower(String type, float speed, float force, int c) { super(type, speed, force, c); } @Override public void run() { if (finishPoint != null && (location.dist(finishPoint) < goalDistance)) { finishPoint = null; } else { follow(); } super.run(); } public void move(Route route) { this.route = route.bake(); if (this.route.size() > 0) { finishPoint = this.route.get(this.route.size() - 1); this.location.set(this.route.get(0)); } } // This function implements Craig Reynolds' path following algorithm // http://www.red3d.com/cwr/steer/PathFollow.html public void follow() { if(route == null) return; float roadRadius = 10; // Predict location 50 (arbitrary choice) frames ahead // This could be based on speed PVector predict = velocity.copy(); predict.normalize(); predict.mult(predictMult); predictLocation = PVector.add(location, predict); // Now we must find the normal to the path from the predicted location // We look at the normal for each line segment and pick out the closest one PVector normal = null; PVector target = null; float worldRecord = 10000000; // Start with a very high record distance that can easily be beaten PVector normalPoint = new PVector(); // Loop through all points of the path for (int i = 0; i < route.size() - 1; i++) { // Look at a line segment PVector a = route.get(i); PVector b = route.get(i + 1); // Get the normal point to that line // normalPoint = getNormalPoint(predictLocation, a, b); normalPoint = GeometryUtils.projectVertexOnLine(predictLocation, a, b); // Check if normal is on line segment PVector dir = PVector.sub(b, a); // If it's not within the line segment, consider the normal to just be the end of the line segment (point b) //if (da + db > line.mag()+1) { if (normalPoint.x < min(a.x, b.x) || normalPoint.x > max(a.x, b.x) || normalPoint.y < min(a.y, b.y) || normalPoint.y > max(a.y, b.y)) { normalPoint = b.copy(); // If we're at the end we really want the next line segment for looking ahead // a = p.points.get((i+1)%p.points.mass()); // b = p.points.get((i+2)%p.points.mass()); // Path wraps around // dir = PVector.sub(b, a); } // How far away are we from the path? float distance = predictLocation.dist(normalPoint); // Did we beat the record and find the closest line segment? if (distance < worldRecord) { worldRecord = distance; // If so the target we want to steer towards is the normal normal = normalPoint; // Look at the direction of the line segment so we can seek a little bit ahead of the normal // PVector dir = PVector.sub(b, a); dir.normalize(); // This is an oversimplification // Should be based on distance to path & velocity dir.mult(dirMult); target = normal.copy(); target.add(dir); } } // normalLocation = normalPoint; // targetLocation = target; // println("var: "+var); // Only if the distance is greater than the path's radius do we bother to steer // if (worldRecord > roadRadius) { seek(target); // } } }
4,300
0.570465
0.562791
128
32.59375
29.039961
147
false
false
0
0
0
0
0
0
0.617188
false
false
8
33c4dcd82c6f1d19c8aded0a2b51ba5711334a7f
5,927,054,893,090
ffd13248963b11e89612f3a062afad753045dfa9
/app/src/main/java/de/demo/android_project/Formsite.java
9c2c06bfb644edb6c14ebbf628d1186766d3df23
[]
no_license
kawther1234/projetAndroid
https://github.com/kawther1234/projetAndroid
68e74511ddaedcdcdf151f4999f39816df4dace8
9ccd405afc7ae95ef969d751e2508626f7f59f68
refs/heads/master
2023-02-19T02:56:48.046000
2021-01-20T14:05:28
2021-01-20T14:05:28
331,319,101
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.demo.android_project; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import de.demo.android_project.model.Client; import de.demo.android_project.model.Site; public class Formsite extends AppCompatActivity { private EditText codepostale , longitude , latitude, adress , ville , contact , telcontact; private String codepostalsite , longitudesite , latitudesite, adresssite , villesite ,contactsite,telcontactsite; private FirebaseAuth myAuth; private FirebaseDatabase myDatabase; private DatabaseReference myRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_formsite); myAuth = FirebaseAuth.getInstance(); myDatabase = FirebaseDatabase.getInstance(); myRef = myDatabase.getReference(); codepostale= findViewById(R.id.scodepostale); longitude= findViewById(R.id.slongitude); latitude=findViewById(R.id.slatitude); adress=findViewById(R.id.sadress); ville=findViewById(R.id.sville); contact=findViewById(R.id.scontact); telcontact=findViewById(R.id.stelcontact); codepostalsite= codepostale.getText().toString(); longitudesite = longitude.getText().toString(); latitudesite= latitude.getText().toString(); adresssite = adress.getText().toString(); villesite = ville.getText().toString(); contactsite = contact.getText().toString(); telcontactsite= telcontact.getText().toString(); final Button ButtonSite= findViewById(R.id.btnSite); ButtonSite.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { myRef = myRef.child("Site").push(); Site site = new Site(myRef.getKey(),codepostalsite,longitudesite,latitudesite,adresssite,villesite,contactsite,telcontactsite); myRef.setValue(site).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { startActivity(new Intent(Formsite.this,MainActivity.class)); } }); } }); } }
UTF-8
Java
2,748
java
Formsite.java
Java
[]
null
[]
package de.demo.android_project; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import de.demo.android_project.model.Client; import de.demo.android_project.model.Site; public class Formsite extends AppCompatActivity { private EditText codepostale , longitude , latitude, adress , ville , contact , telcontact; private String codepostalsite , longitudesite , latitudesite, adresssite , villesite ,contactsite,telcontactsite; private FirebaseAuth myAuth; private FirebaseDatabase myDatabase; private DatabaseReference myRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_formsite); myAuth = FirebaseAuth.getInstance(); myDatabase = FirebaseDatabase.getInstance(); myRef = myDatabase.getReference(); codepostale= findViewById(R.id.scodepostale); longitude= findViewById(R.id.slongitude); latitude=findViewById(R.id.slatitude); adress=findViewById(R.id.sadress); ville=findViewById(R.id.sville); contact=findViewById(R.id.scontact); telcontact=findViewById(R.id.stelcontact); codepostalsite= codepostale.getText().toString(); longitudesite = longitude.getText().toString(); latitudesite= latitude.getText().toString(); adresssite = adress.getText().toString(); villesite = ville.getText().toString(); contactsite = contact.getText().toString(); telcontactsite= telcontact.getText().toString(); final Button ButtonSite= findViewById(R.id.btnSite); ButtonSite.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { myRef = myRef.child("Site").push(); Site site = new Site(myRef.getKey(),codepostalsite,longitudesite,latitudesite,adresssite,villesite,contactsite,telcontactsite); myRef.setValue(site).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { startActivity(new Intent(Formsite.this,MainActivity.class)); } }); } }); } }
2,748
0.693959
0.693959
71
37.718311
28.270416
143
false
false
0
0
0
0
0
0
0.915493
false
false
8
9c8952d40ffd17b2643478d3dbe50373d7f89bbe
10,883,447,149,988
d029f908a994790c8e8ff2c07d063654a50a8be9
/Constants/Positions.java
db0c8f4ae26b75ee72a4442df8787a312272ab44
[]
no_license
josephbisaillon/LANChaosKiller
https://github.com/josephbisaillon/LANChaosKiller
f544963151d6a983b7a0e000fbb6c347f8b2ff38
78cf27733ec7edeb5d2e8dda32a0ecce2d8dcdae
refs/heads/master
2021-01-12T13:59:03.216000
2016-02-08T22:48:12
2016-02-08T22:48:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package scripts.LANChaosKiller.Constants; import org.tribot.api.General; import org.tribot.api2007.Walking; import org.tribot.api2007.types.RSArea; import org.tribot.api2007.types.RSTile; /** * @author Laniax */ public class Positions { //todo: better implementation for shared variables? public static final RSArea AREA_INSIDE_TOWER = new RSArea(new RSTile(2562, 3356, 0), 2); public static final RSArea AREA_DOWNSTAIRS_TOWER = new RSArea(new RSTile(2561, 9757), new RSTile(2592, 9730)); public static final RSArea AREA_UPSTAIRS_TOWER = new RSArea(new RSTile(2562, 3356, 1), 2); public static final int COORD_X_RIVER = 2600; public static final RSTile POS_BANK_CENTER = new RSTile(2617, 3332, 0); public static final RSTile POS_OBJ_LOG_BANK = new RSTile(2601, 3336, 0); public static final RSTile POS_OBJ_LOG_TOWER = new RSTile(2599, 3336, 0); public static final RSTile POS_OUTSIDE_DRUID_TOWER_DOOR = new RSTile(2565, 3356, 0); public static final RSTile POS_STAIRS_DOWNSTAIRS_TOWER = new RSTile(2563, 9756); public static final RSTile[] PATH_TOWER_TO_LOG = new RSTile[]{ new RSTile(2566, 3356, 0), new RSTile(2573, 3355, 0), new RSTile(2581, 3347, 0), new RSTile(2588, 3340, 0), new RSTile(2595, 3339, 0), new RSTile(2597, 3336, 0) }; public static final RSTile[] PATH_BANK_TO_LOG = Walking.randomizePath(new RSTile[]{ new RSTile(2616, 3332, 0), new RSTile(2613, 3339, 0), new RSTile(2608, 3332, 0), new RSTile(2604, 3333, 0), new RSTile(2602, 3336, 0) }, General.random(0, 3), General.random(0, 3)); public static final RSTile[] PATH_LOG_TO_BANK = Walking.invertPath(PATH_BANK_TO_LOG); public static final RSTile[] PATH_LOG_TO_TOWER = Walking.invertPath(PATH_TOWER_TO_LOG); }
UTF-8
Java
1,849
java
Positions.java
Java
[ { "context": "t org.tribot.api2007.types.RSTile;\n\n/**\n * @author Laniax\n */\npublic class Positions {\n\n //todo: better ", "end": 211, "score": 0.9970046877861023, "start": 205, "tag": "USERNAME", "value": "Laniax" } ]
null
[]
package scripts.LANChaosKiller.Constants; import org.tribot.api.General; import org.tribot.api2007.Walking; import org.tribot.api2007.types.RSArea; import org.tribot.api2007.types.RSTile; /** * @author Laniax */ public class Positions { //todo: better implementation for shared variables? public static final RSArea AREA_INSIDE_TOWER = new RSArea(new RSTile(2562, 3356, 0), 2); public static final RSArea AREA_DOWNSTAIRS_TOWER = new RSArea(new RSTile(2561, 9757), new RSTile(2592, 9730)); public static final RSArea AREA_UPSTAIRS_TOWER = new RSArea(new RSTile(2562, 3356, 1), 2); public static final int COORD_X_RIVER = 2600; public static final RSTile POS_BANK_CENTER = new RSTile(2617, 3332, 0); public static final RSTile POS_OBJ_LOG_BANK = new RSTile(2601, 3336, 0); public static final RSTile POS_OBJ_LOG_TOWER = new RSTile(2599, 3336, 0); public static final RSTile POS_OUTSIDE_DRUID_TOWER_DOOR = new RSTile(2565, 3356, 0); public static final RSTile POS_STAIRS_DOWNSTAIRS_TOWER = new RSTile(2563, 9756); public static final RSTile[] PATH_TOWER_TO_LOG = new RSTile[]{ new RSTile(2566, 3356, 0), new RSTile(2573, 3355, 0), new RSTile(2581, 3347, 0), new RSTile(2588, 3340, 0), new RSTile(2595, 3339, 0), new RSTile(2597, 3336, 0) }; public static final RSTile[] PATH_BANK_TO_LOG = Walking.randomizePath(new RSTile[]{ new RSTile(2616, 3332, 0), new RSTile(2613, 3339, 0), new RSTile(2608, 3332, 0), new RSTile(2604, 3333, 0), new RSTile(2602, 3336, 0) }, General.random(0, 3), General.random(0, 3)); public static final RSTile[] PATH_LOG_TO_BANK = Walking.invertPath(PATH_BANK_TO_LOG); public static final RSTile[] PATH_LOG_TO_TOWER = Walking.invertPath(PATH_TOWER_TO_LOG); }
1,849
0.676041
0.568415
41
44.097561
33.583389
114
false
false
0
0
0
0
0
0
1.731707
false
false
8
d150acd067c8a94b6cb296910a7eacb48dfc57f4
33,629,593,950,262
bd549a8b5f97bc17307a7c28e101b79d65dd4890
/Strategy/src/Libraries/AnalisiSimple.java
e4ddccacbbc8862a3b34e748d61639cd2b501f5f
[]
no_license
GIFO14/DesignPatterns
https://github.com/GIFO14/DesignPatterns
c4e0c6d97e5145b3a68eacf481e6e0a908d0463c
f404c58dc56b2b058a8ac4f6fa4aa44a5efebd64
refs/heads/master
2020-04-01T06:45:29.035000
2018-10-14T10:28:55
2018-10-14T10:28:55
149,857,910
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Libraries; /** * * @author mblan */ public abstract class AnalisiSimple implements IStrategy{ public void analitzar(){ iniciar(); saltarZIP(); finalitzar(); } abstract void iniciar(); abstract void saltarZIP(); abstract void finalitzar(); }
UTF-8
Java
340
java
AnalisiSimple.java
Java
[ { "context": "package Libraries;\n\n/**\n *\n * @author mblan\n */\npublic abstract class AnalisiSimple implement", "end": 43, "score": 0.9995549321174622, "start": 38, "tag": "USERNAME", "value": "mblan" } ]
null
[]
package Libraries; /** * * @author mblan */ public abstract class AnalisiSimple implements IStrategy{ public void analitzar(){ iniciar(); saltarZIP(); finalitzar(); } abstract void iniciar(); abstract void saltarZIP(); abstract void finalitzar(); }
340
0.544118
0.544118
23
13.782609
13.688956
57
false
false
0
0
0
0
0
0
0.304348
false
false
8
3da1e38ac871a019318a156185fdb1d8cc01f56a
30,597,347,041,508
e1c2a7deaf3060ec57295bc81a367da328c6c3e3
/src/main/java/org/broad/igv/maf/MAFTile.java
ece3314d9da1397200a7992b1b02a87f7d918aa3
[ "MIT" ]
permissive
igvteam/igv
https://github.com/igvteam/igv
664963fe18346d99aa76a94e78f9b368eaed4279
a060dab4718611169cbe11340834acfb7ff4dfbe
refs/heads/master
2023-09-04T04:16:55.302000
2023-09-02T00:19:47
2023-09-02T00:19:47
3,416,578
507
539
MIT
false
2023-09-14T20:39:30
2012-02-11T17:30:30
2023-09-06T09:18:30
2023-09-14T20:39:29
433,261
568
372
110
Java
false
false
/* * The MIT License (MIT) * * Copyright (c) 2007-2015 Broad Institute * * 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.broad.igv.maf; //~--- non-JDK imports -------------------------------------------------------- import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * @author jrobinso */ public class MAFTile { int start; int end; MASequence refSeq; int[] gapAdjustedIdx; List<Gap> gaps = new ArrayList(); /** * Map of species id -> aligned sequence */ Map<String, MASequence> alignedSequences; public MAFTile() { } // Constructor for an empty maf tile (no alignments) public MAFTile(int start, int end) { this.start = start; this.end = end; this.alignedSequences = null; this.gapAdjustedIdx = null; } public MAFTile(int start, int end, Map<String, String> bases, int[] gapAdjustedCoordinates) { this(start, end, bases, gapAdjustedCoordinates, "hg18"); } public MAFTile(int start, int end, Map<String, String> bases, int[] gapAdjustedCoordinates, String refSeqId) { this.start = start; this.end = end; this.gapAdjustedIdx = gapAdjustedCoordinates; int expectedGapAdjustedIdx = 0; for (int i = start; i < end; i++) { int idx = i - start; int gapAdjIdx = gapAdjustedIdx[idx]; if (gapAdjIdx != (expectedGapAdjustedIdx)) { gaps.add(new Gap(i, expectedGapAdjustedIdx, gapAdjIdx)); } expectedGapAdjustedIdx = gapAdjIdx + 1; } refSeq = new MASequence(bases.get(refSeqId)); //assert ((refSeq != null) && (refSeq.length() > 0)); //computeCoordinates(); this.alignedSequences = new LinkedHashMap(); for (Map.Entry<String, String> entry : bases.entrySet()) { String spId = entry.getKey(); String b = entry.getValue(); alignedSequences.put(spId, new MASequence(b)); } } /** * @return the gaps */ public List<Gap> getGaps() { return gaps; } /** * Class description * * @author Enter your name here... * @version Enter version here..., 09/01/22 */ public static class Gap { int position; int startIdx; int endIdx; /** * Constructs ... * * @param position * @param startIdx */ public Gap(int position, int startIdx, int endIdx) { this.position = position; this.startIdx = startIdx; this.endIdx = endIdx; } public int getPosition() { return position; } /** * Method description * * @return */ public int getCount() { return endIdx - startIdx; } /** * Method description * * @return */ public String toString() { return position + "(" + (endIdx - startIdx + 1) + ")"; } } public class MASequence { String bases; public MASequence(String bases) { this.bases = bases; } public char getGapAdjustedBase(int refCoord) { int relCoord = refCoord - start; int idx = gapAdjustedIdx[relCoord]; return (idx > 0 && idx < bases.length()) ? bases.charAt(idx) : (char) 0; } public int getStart() { return start; } public int getEnd() { return end; } } }
UTF-8
Java
4,701
java
MAFTile.java
Java
[ { "context": "a.util.List;\nimport java.util.Map;\n\n/**\n * @author jrobinso\n */\npublic class MAFTile {\n\n int start;\n in", "end": 1395, "score": 0.9931221008300781, "start": 1387, "tag": "USERNAME", "value": "jrobinso" } ]
null
[]
/* * The MIT License (MIT) * * Copyright (c) 2007-2015 Broad Institute * * 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.broad.igv.maf; //~--- non-JDK imports -------------------------------------------------------- import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * @author jrobinso */ public class MAFTile { int start; int end; MASequence refSeq; int[] gapAdjustedIdx; List<Gap> gaps = new ArrayList(); /** * Map of species id -> aligned sequence */ Map<String, MASequence> alignedSequences; public MAFTile() { } // Constructor for an empty maf tile (no alignments) public MAFTile(int start, int end) { this.start = start; this.end = end; this.alignedSequences = null; this.gapAdjustedIdx = null; } public MAFTile(int start, int end, Map<String, String> bases, int[] gapAdjustedCoordinates) { this(start, end, bases, gapAdjustedCoordinates, "hg18"); } public MAFTile(int start, int end, Map<String, String> bases, int[] gapAdjustedCoordinates, String refSeqId) { this.start = start; this.end = end; this.gapAdjustedIdx = gapAdjustedCoordinates; int expectedGapAdjustedIdx = 0; for (int i = start; i < end; i++) { int idx = i - start; int gapAdjIdx = gapAdjustedIdx[idx]; if (gapAdjIdx != (expectedGapAdjustedIdx)) { gaps.add(new Gap(i, expectedGapAdjustedIdx, gapAdjIdx)); } expectedGapAdjustedIdx = gapAdjIdx + 1; } refSeq = new MASequence(bases.get(refSeqId)); //assert ((refSeq != null) && (refSeq.length() > 0)); //computeCoordinates(); this.alignedSequences = new LinkedHashMap(); for (Map.Entry<String, String> entry : bases.entrySet()) { String spId = entry.getKey(); String b = entry.getValue(); alignedSequences.put(spId, new MASequence(b)); } } /** * @return the gaps */ public List<Gap> getGaps() { return gaps; } /** * Class description * * @author Enter your name here... * @version Enter version here..., 09/01/22 */ public static class Gap { int position; int startIdx; int endIdx; /** * Constructs ... * * @param position * @param startIdx */ public Gap(int position, int startIdx, int endIdx) { this.position = position; this.startIdx = startIdx; this.endIdx = endIdx; } public int getPosition() { return position; } /** * Method description * * @return */ public int getCount() { return endIdx - startIdx; } /** * Method description * * @return */ public String toString() { return position + "(" + (endIdx - startIdx + 1) + ")"; } } public class MASequence { String bases; public MASequence(String bases) { this.bases = bases; } public char getGapAdjustedBase(int refCoord) { int relCoord = refCoord - start; int idx = gapAdjustedIdx[relCoord]; return (idx > 0 && idx < bases.length()) ? bases.charAt(idx) : (char) 0; } public int getStart() { return start; } public int getEnd() { return end; } } }
4,701
0.579451
0.574771
172
26.331396
25.243479
114
false
false
0
0
0
0
0
0
0.546512
false
false
8
3359cc8d652c11e0cf97fcfa8e8828307e9edadc
4,423,816,339,477
9706d3045cc96071bed93349a27ad318b88ddbf9
/src/main/java/com/cybertek/core/Test.java
b5edf0be2b91c4fc919c1267273f234ddf83f1c4
[]
no_license
ugurcanclk/JDS
https://github.com/ugurcanclk/JDS
1cf53a6b798a9754d5bc0f10a85585e85a84ba34
7488886d04784ed33e90f839be609f92ac4df8f9
refs/heads/main
2023-01-18T19:23:47.101000
2020-10-24T20:04:56
2020-10-24T20:04:56
304,491,469
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cybertek.core; public class Test { public static void main(String[] args) { //ayni package altinda oldugu icin import etmedi yukarda Methods methods= new Methods(); } }
UTF-8
Java
214
java
Test.java
Java
[]
null
[]
package com.cybertek.core; public class Test { public static void main(String[] args) { //ayni package altinda oldugu icin import etmedi yukarda Methods methods= new Methods(); } }
214
0.64486
0.64486
16
12.375
19.630573
64
false
false
0
0
0
0
0
0
0.125
false
false
8
21767289d279d9cdb769ecff2a85716f3d6842f1
13,159,779,819,072
f5ebba10174df05c44912aad4df0fb09477ae803
/src/main/java/net/javaguides/springboot/springsecurity/web/CommandeRegistrationController.java
1ce3f1da27f28693f8a202e326d471ee8e6695bf
[]
no_license
livraisonpfe/GestionLivraisonPfe
https://github.com/livraisonpfe/GestionLivraisonPfe
2c0e86c286c3a5c3389405c71a96a814222b7ccf
9f76de1d916fd8a24b748887277d0706ece9637a
refs/heads/master
2022-10-06T06:40:40.694000
2020-06-02T16:08:31
2020-06-02T16:08:31
263,375,872
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.javaguides.springboot.springsecurity.web; import java.text.DateFormat; import com.google.gson.Gson; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import net.javaguides.springboot.springsecurity.model.Colis; import net.javaguides.springboot.springsecurity.model.Commande; import net.javaguides.springboot.springsecurity.model.EtatCommande; import net.javaguides.springboot.springsecurity.model.VilleDto; import net.javaguides.springboot.springsecurity.model.Marchand; import net.javaguides.springboot.springsecurity.model.Ville; import net.javaguides.springboot.springsecurity.model.VilleColis; import net.javaguides.springboot.springsecurity.repository.UserRepository; import net.javaguides.springboot.springsecurity.service.ColisService; import net.javaguides.springboot.springsecurity.service.CommandeService; import net.javaguides.springboot.springsecurity.service.GouverneratService; import net.javaguides.springboot.springsecurity.service.VilleColisService; import net.javaguides.springboot.springsecurity.service.VilleService; import net.javaguides.springboot.springsecurity.web.dto.CommandeRegistrationDto; @Controller public class CommandeRegistrationController { @Autowired private CommandeService commandeService; @Autowired private ColisService colisSerivce; @Autowired private UserRepository userRepositry; @Autowired private VilleColisService villeColiSer; @Autowired private GouverneratService GouvSer; @Autowired private VilleService VilleSer; @ModelAttribute("colis") public CommandeRegistrationDto commandeRegistrationDto() { return new CommandeRegistrationDto(); } // affichage formulire pour envoyer une commande @GetMapping(value = ("/commande")) public String showcommandeColis(Model model) { model.addAttribute("gouvernerats", GouvSer.getAllGouvernerat()); List<Ville> villes = new ArrayList<Ville>(); model.addAttribute("villes", villes); return "commande"; } // afficher tous les villes de gouverneart choisi @ResponseBody @RequestMapping(value = "/commande/loadStatesByCountry/{id}", method = RequestMethod.GET) public String loadCityByCountry(@PathVariable("id") Long id) { List<VilleDto> result = VilleSer.getAllVilles(id); for (int i = 0; i < result.size(); i++) { System.out.print(result.get(i).getNom()); } Gson gson = new Gson(); System.out.print("hello " + gson.toJson(VilleSer.getAllVilles(id))); return gson.toJson(VilleSer.getAllVilles(id)); } @RequestMapping(value = "/commande", method = RequestMethod.POST) public String commandeRegistrationDto(@ModelAttribute("colis") @Valid CommandeRegistrationDto cmdDto, BindingResult result, Model model) { model.addAttribute("gouvernerats", GouvSer.getAllGouvernerat()); List<Ville> villes = new ArrayList<Ville>(); model.addAttribute("villes", villes); if (result.hasErrors()) { System.out.print("c'est faux hferfbhyer"); return "commande"; } Commande commande = new Commande(); Colis colis = new Colis(); // ce qui concerne le client colis.setAdresse_client(cmdDto.getAdresse_client()); colis.setCode_Postale_client(cmdDto.getCode_Postale_client()); colis.setAdresse_marchand(cmdDto.getAdresse_marchand()); colis.setCode_Postale_marchand(cmdDto.getCode_Postale_marchand()); colis.setDesc_Colis(cmdDto.getDesc_Colis()); colis.setPoids(cmdDto.getPoids()); colis.setNumTel_client(cmdDto.getNumTel_client()); colis.setType_destination(cmdDto.getType_destination()); colis.setNom_client(cmdDto.getNom_client()); colis.setPrenom_client((cmdDto.getPrenom_client())); colis.setRasison_sociale(cmdDto.getRaison_sociale()); // trouver le marchand authentifié Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String username = authentication.getName(); Marchand m = (Marchand) userRepositry.findByEmail(username); commande.setMarchandM(m); commande.addColisCommande(colis); DateFormat format = new SimpleDateFormat("yyyy/MM/dd"); Date date = new Date(); commande.setDateCom(format.format(date)); EtatCommande Ec = new EtatCommande(); Ec.setId(1); commande.setEtatCommandeE(Ec); commandeService.addCommande(commande); colisSerivce.addColis(colis); VilleColis vc = new VilleColis(); // setters (colis)pour villeColis vc.setColis(colis); Ville v = new Ville(); v.setId_ville(Long.parseLong(cmdDto.getVille_client())); //setters (ville)pour villeColis vc.setVille(v); System.out.print("ville client" + cmdDto.getVille_client()); vc.setDescription("Adresse de destination"); if (cmdDto.getVille_client() != null) { villeColiSer.enregistrer(vc); } VilleColis vc1 = new VilleColis(); vc1.setColis(colis); Ville v1 = new Ville(); v1.setId_ville(Long.parseLong(cmdDto.getVille_marchand())); vc1.setVille(v1); vc1.setDescription("Adresse d'expedition"); System.out.print("ville marchand" + cmdDto.getVille_marchand()); if (cmdDto.getVille_marchand() != null) { villeColiSer.enregistrer(vc1); }/* //création de affectation Commande Etat AffectationCommandeEtat AffComEt = new AffectationCommandeEtat(); // setters (commande) pour AffectationCommandeEtat AffComEt.setCommande(com); AffComEt.setDate(format.format(date)); EtatCommande Ec = new EtatCommande(); Ec.setId(1); // setters (commande) pour AffectationCommandeEtat AffComEt.setEtatCommande(Ec); affectationCommandeEtatSer.enregistrer(AffComEt); */ return "redirect:/commande?success"; } }
UTF-8
Java
6,278
java
CommandeRegistrationController.java
Java
[]
null
[]
package net.javaguides.springboot.springsecurity.web; import java.text.DateFormat; import com.google.gson.Gson; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import net.javaguides.springboot.springsecurity.model.Colis; import net.javaguides.springboot.springsecurity.model.Commande; import net.javaguides.springboot.springsecurity.model.EtatCommande; import net.javaguides.springboot.springsecurity.model.VilleDto; import net.javaguides.springboot.springsecurity.model.Marchand; import net.javaguides.springboot.springsecurity.model.Ville; import net.javaguides.springboot.springsecurity.model.VilleColis; import net.javaguides.springboot.springsecurity.repository.UserRepository; import net.javaguides.springboot.springsecurity.service.ColisService; import net.javaguides.springboot.springsecurity.service.CommandeService; import net.javaguides.springboot.springsecurity.service.GouverneratService; import net.javaguides.springboot.springsecurity.service.VilleColisService; import net.javaguides.springboot.springsecurity.service.VilleService; import net.javaguides.springboot.springsecurity.web.dto.CommandeRegistrationDto; @Controller public class CommandeRegistrationController { @Autowired private CommandeService commandeService; @Autowired private ColisService colisSerivce; @Autowired private UserRepository userRepositry; @Autowired private VilleColisService villeColiSer; @Autowired private GouverneratService GouvSer; @Autowired private VilleService VilleSer; @ModelAttribute("colis") public CommandeRegistrationDto commandeRegistrationDto() { return new CommandeRegistrationDto(); } // affichage formulire pour envoyer une commande @GetMapping(value = ("/commande")) public String showcommandeColis(Model model) { model.addAttribute("gouvernerats", GouvSer.getAllGouvernerat()); List<Ville> villes = new ArrayList<Ville>(); model.addAttribute("villes", villes); return "commande"; } // afficher tous les villes de gouverneart choisi @ResponseBody @RequestMapping(value = "/commande/loadStatesByCountry/{id}", method = RequestMethod.GET) public String loadCityByCountry(@PathVariable("id") Long id) { List<VilleDto> result = VilleSer.getAllVilles(id); for (int i = 0; i < result.size(); i++) { System.out.print(result.get(i).getNom()); } Gson gson = new Gson(); System.out.print("hello " + gson.toJson(VilleSer.getAllVilles(id))); return gson.toJson(VilleSer.getAllVilles(id)); } @RequestMapping(value = "/commande", method = RequestMethod.POST) public String commandeRegistrationDto(@ModelAttribute("colis") @Valid CommandeRegistrationDto cmdDto, BindingResult result, Model model) { model.addAttribute("gouvernerats", GouvSer.getAllGouvernerat()); List<Ville> villes = new ArrayList<Ville>(); model.addAttribute("villes", villes); if (result.hasErrors()) { System.out.print("c'est faux hferfbhyer"); return "commande"; } Commande commande = new Commande(); Colis colis = new Colis(); // ce qui concerne le client colis.setAdresse_client(cmdDto.getAdresse_client()); colis.setCode_Postale_client(cmdDto.getCode_Postale_client()); colis.setAdresse_marchand(cmdDto.getAdresse_marchand()); colis.setCode_Postale_marchand(cmdDto.getCode_Postale_marchand()); colis.setDesc_Colis(cmdDto.getDesc_Colis()); colis.setPoids(cmdDto.getPoids()); colis.setNumTel_client(cmdDto.getNumTel_client()); colis.setType_destination(cmdDto.getType_destination()); colis.setNom_client(cmdDto.getNom_client()); colis.setPrenom_client((cmdDto.getPrenom_client())); colis.setRasison_sociale(cmdDto.getRaison_sociale()); // trouver le marchand authentifié Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String username = authentication.getName(); Marchand m = (Marchand) userRepositry.findByEmail(username); commande.setMarchandM(m); commande.addColisCommande(colis); DateFormat format = new SimpleDateFormat("yyyy/MM/dd"); Date date = new Date(); commande.setDateCom(format.format(date)); EtatCommande Ec = new EtatCommande(); Ec.setId(1); commande.setEtatCommandeE(Ec); commandeService.addCommande(commande); colisSerivce.addColis(colis); VilleColis vc = new VilleColis(); // setters (colis)pour villeColis vc.setColis(colis); Ville v = new Ville(); v.setId_ville(Long.parseLong(cmdDto.getVille_client())); //setters (ville)pour villeColis vc.setVille(v); System.out.print("ville client" + cmdDto.getVille_client()); vc.setDescription("Adresse de destination"); if (cmdDto.getVille_client() != null) { villeColiSer.enregistrer(vc); } VilleColis vc1 = new VilleColis(); vc1.setColis(colis); Ville v1 = new Ville(); v1.setId_ville(Long.parseLong(cmdDto.getVille_marchand())); vc1.setVille(v1); vc1.setDescription("Adresse d'expedition"); System.out.print("ville marchand" + cmdDto.getVille_marchand()); if (cmdDto.getVille_marchand() != null) { villeColiSer.enregistrer(vc1); }/* //création de affectation Commande Etat AffectationCommandeEtat AffComEt = new AffectationCommandeEtat(); // setters (commande) pour AffectationCommandeEtat AffComEt.setCommande(com); AffComEt.setDate(format.format(date)); EtatCommande Ec = new EtatCommande(); Ec.setId(1); // setters (commande) pour AffectationCommandeEtat AffComEt.setEtatCommande(Ec); affectationCommandeEtatSer.enregistrer(AffComEt); */ return "redirect:/commande?success"; } }
6,278
0.783142
0.781389
173
35.277458
24.476564
102
false
false
0
0
0
0
0
0
1.774567
false
false
8
208f3e1880b931dc3a1346e6e5eb85e329c9f66e
39,324,720,595,401
877f13d6fbf7311436d3da5cb88ce3d81b81a95a
/trunk/src/net/sf/plantlore/common/StandardAction.java
c0b05b48c36bbecad0435b971979637d1916dfee
[]
no_license
BackupTheBerlios/plantlore-svn
https://github.com/BackupTheBerlios/plantlore-svn
54861497d4d37785f11eec0ab63e967dbb6d3887
86a9f9b592443ef1b465663b3b6fdb178e9379d1
refs/heads/master
2021-01-10T18:49:16.263000
2007-02-17T21:28:03
2007-02-17T21:28:03
40,749,342
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sf.plantlore.common; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import net.sf.plantlore.client.resources.Resource; import net.sf.plantlore.l10n.L10n; /** * Standard Action introduces the extended constructor that can * automatically assign a caption, a short description, * and an image to the button. * * @author kaimu */ public abstract class StandardAction extends AbstractAction { /** * Create a new StandardAction. * * @param text The base string that will be used to obtain the caption, the tooltip text * and an image from the L10N. */ public StandardAction(String text) { putValue(NAME, L10n.getString(text)); putValue(SHORT_DESCRIPTION, L10n.getString(text+"TT")); ImageIcon icon = Resource.createIcon(text+".gif"); if(icon != null) putValue(SMALL_ICON, icon); } }
UTF-8
Java
886
java
StandardAction.java
Java
[ { "context": "\r\n * and an image to the button. \r\n * \r\n * @author kaimu\r\n */\r\npublic abstract class StandardAction extend", "end": 377, "score": 0.9932361245155334, "start": 372, "tag": "USERNAME", "value": "kaimu" } ]
null
[]
package net.sf.plantlore.common; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import net.sf.plantlore.client.resources.Resource; import net.sf.plantlore.l10n.L10n; /** * Standard Action introduces the extended constructor that can * automatically assign a caption, a short description, * and an image to the button. * * @author kaimu */ public abstract class StandardAction extends AbstractAction { /** * Create a new StandardAction. * * @param text The base string that will be used to obtain the caption, the tooltip text * and an image from the L10N. */ public StandardAction(String text) { putValue(NAME, L10n.getString(text)); putValue(SHORT_DESCRIPTION, L10n.getString(text+"TT")); ImageIcon icon = Resource.createIcon(text+".gif"); if(icon != null) putValue(SMALL_ICON, icon); } }
886
0.701357
0.690045
32
25.625
24.537916
89
false
false
0
0
0
0
0
0
0.9375
false
false
8
3d507e984624cf65c33da9f7aff89049b7c53603
5,695,126,664,252
0a9b8297df97ba71df8efa17f2733897f86cb951
/code tutorials/src/main/java/com/josh/repository/users/RegistrationRepository.java
7c53133bacf3276bfd8bfdf67ca7c7e7a68c3e3e
[]
no_license
joshua-preyser/Code-Without-Bother
https://github.com/joshua-preyser/Code-Without-Bother
5d9f15e75eb38919e1d209dd6fce9a81b9cbf5c2
00b82475f1407c88c02e55602c9bc9b7ee282c69
refs/heads/master
2021-07-17T19:01:28.174000
2019-11-11T10:45:44
2019-11-11T10:45:44
219,735,705
0
1
null
false
2020-10-13T17:14:02
2019-11-05T12:06:09
2019-11-11T10:46:15
2020-10-13T17:14:00
105
0
1
1
Java
false
false
package com.josh.repository.users; public interface RegistrationRepository extends IRepository<Registration, String> { Set<Registration> getAll(); }
UTF-8
Java
154
java
RegistrationRepository.java
Java
[]
null
[]
package com.josh.repository.users; public interface RegistrationRepository extends IRepository<Registration, String> { Set<Registration> getAll(); }
154
0.798701
0.798701
5
29.799999
30.221846
83
false
false
0
0
0
0
0
0
0.6
false
false
8
f63eb8ccb1519da5354c9e6a8011ef42099a3211
16,149,077,070,743
4dbb76a6074acc5851f9b9bb792e5c02f077ac50
/app/src/main/java/com/swarm/daryldaryl/swarm_app/models/User.java
ddd2ad9869459be9debfc9d246c0a76d0b7224f4
[]
no_license
daryldaryl/Swarm-app
https://github.com/daryldaryl/Swarm-app
de20f7d39ce2bdebd05518e4a7ee5d7a24023b72
b121300467c94ec524f6b091e5ee2e021a95c5d9
refs/heads/master
2019-06-21T00:38:02.195000
2019-05-21T11:59:23
2019-05-21T11:59:23
100,687,900
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.swarm.daryldaryl.swarm_app.models; import org.parceler.Parcel; /** * Created by liboa on 6/09/2017. */ @Parcel public class User { protected String id; protected String avatar; protected String displayName; protected String reputation; protected String username; protected String email; public User() { } public User(String id, String avatar, String displayName, String reputation) { this.id = id; this.avatar = avatar; this.displayName = displayName; this.reputation = reputation; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getReputation() { return reputation; } public void setReputation(String reputation) { this.reputation = reputation; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
UTF-8
Java
1,465
java
User.java
Java
[ { "context": "s;\n\nimport org.parceler.Parcel;\n\n/**\n * Created by liboa on 6/09/2017.\n */\n\n@Parcel\npublic class User {\n ", "end": 100, "score": 0.9996551871299744, "start": 95, "tag": "USERNAME", "value": "liboa" }, { "context": "\n\n public String getUsername() {\n ...
null
[]
package com.swarm.daryldaryl.swarm_app.models; import org.parceler.Parcel; /** * Created by liboa on 6/09/2017. */ @Parcel public class User { protected String id; protected String avatar; protected String displayName; protected String reputation; protected String username; protected String email; public User() { } public User(String id, String avatar, String displayName, String reputation) { this.id = id; this.avatar = avatar; this.displayName = displayName; this.reputation = reputation; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getReputation() { return reputation; } public void setReputation(String reputation) { this.reputation = reputation; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
1,465
0.615017
0.610239
75
18.533333
17.347687
82
false
false
0
0
0
0
0
0
0.36
false
false
8
3174cfe4f45f0c80629f2c93ff77b755a1608c00
37,426,345,045,699
c134785a108097be1cebed1bd265c09a5f0b2766
/src/test/java/daoTest/UserDaoTest.java
297d214b107dbc8a431fc6846fbc64ce03463d48
[]
no_license
tzh979215144/OAuthServer
https://github.com/tzh979215144/OAuthServer
2295c5d11e8c05a8f4fc3dd0f3326204b5a766d0
27d9297b3d01e983355833b4607f0df6a97c4fdb
refs/heads/master
2022-12-21T12:53:18.477000
2019-07-24T09:44:02
2019-07-24T09:44:02
197,556,149
1
0
null
false
2022-12-16T02:41:53
2019-07-18T09:29:23
2019-07-24T09:44:20
2022-12-16T02:41:51
6,377
1
0
8
JavaScript
false
false
package daoTest; import org.apache.log4j.Logger; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.hoperun.dao.UserMapper; import com.hoperun.domain.User; import baseTest.SpringTestCase; public class UserDaoTest extends SpringTestCase { @Autowired private UserMapper userMapper; Logger logger = Logger.getLogger(UserDaoTest.class); @Test public void test() { // 插入 User user1 = new User(); user1.setUname("testInsert"); user1.setUpassword("testInsert"); userMapper.insertByUser(user1); // 查询 User user2 = userMapper.selectUserByUname("admin"); // 查询测试 System.out.println(user2.getUname()); // 插入测试 User user3 = userMapper.selectUserByUname("testInsert"); System.out.println(user3.getUname() + ":id:" + user3.getUid()); // 删除 userMapper.deleteByPrimaryKey(user3.getUid()); // 删除测试 User user4 = userMapper.selectUserByUname("testInsert"); System.out.println("删除后是否查询到:" + user4); } }
UTF-8
Java
1,083
java
UserDaoTest.java
Java
[ { "context": "r1.setUname(\"testInsert\");\r\n\t\tuser1.setUpassword(\"testInsert\");\r\n\t\tuserMapper.insertByUser(user1);\r\n\r\n\t\t// 查询\r", "end": 542, "score": 0.9823756217956543, "start": 532, "tag": "PASSWORD", "value": "testInsert" } ]
null
[]
package daoTest; import org.apache.log4j.Logger; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.hoperun.dao.UserMapper; import com.hoperun.domain.User; import baseTest.SpringTestCase; public class UserDaoTest extends SpringTestCase { @Autowired private UserMapper userMapper; Logger logger = Logger.getLogger(UserDaoTest.class); @Test public void test() { // 插入 User user1 = new User(); user1.setUname("testInsert"); user1.setUpassword("<PASSWORD>"); userMapper.insertByUser(user1); // 查询 User user2 = userMapper.selectUserByUname("admin"); // 查询测试 System.out.println(user2.getUname()); // 插入测试 User user3 = userMapper.selectUserByUname("testInsert"); System.out.println(user3.getUname() + ":id:" + user3.getUid()); // 删除 userMapper.deleteByPrimaryKey(user3.getUid()); // 删除测试 User user4 = userMapper.selectUserByUname("testInsert"); System.out.println("删除后是否查询到:" + user4); } }
1,083
0.701463
0.68878
44
21.295454
20.854015
65
false
false
0
0
0
0
0
0
1.363636
false
false
8
d69acce5e5d2cbd6d95af2f5a8cd1a94e4e891b0
8,770,323,250,498
c1c7fc05a75bc1667d40adf4394905e102985ee6
/Homework4v5.java
9cc2516a0d1374577a4b32497dead05715b8e071
[]
no_license
NazarPryshlyak/homework4
https://github.com/NazarPryshlyak/homework4
5838d055e9a7303f035bfe5d4c540c1056c67c3b
a66bc327818c922de0332a6c10e1a5fb034e6d8a
refs/heads/master
2020-08-24T16:39:30.819000
2019-10-23T11:17:15
2019-10-23T11:17:15
216,865,765
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Homework4v5 { public static void main(String[] args){ int [] loc = {25, 11, 250, 5}; int max = loc[0]; int min = loc[0]; for(int i = 0; i != loc.length; i ++){ if(loc[i] > max){ max = loc[i]; } if(loc[i] < min){ min = loc[i]; } } System.out.println(" min :" + min + " " + " max : " + max); //Створіть масив, наповніть його даниими в хаотичному порядку, знайдіть найбільше та // найменше значення масиву. } }
WINDOWS-1251
Java
674
java
Homework4v5.java
Java
[]
null
[]
public class Homework4v5 { public static void main(String[] args){ int [] loc = {25, 11, 250, 5}; int max = loc[0]; int min = loc[0]; for(int i = 0; i != loc.length; i ++){ if(loc[i] > max){ max = loc[i]; } if(loc[i] < min){ min = loc[i]; } } System.out.println(" min :" + min + " " + " max : " + max); //Створіть масив, наповніть його даниими в хаотичному порядку, знайдіть найбільше та // найменше значення масиву. } }
674
0.441581
0.419244
21
26.761906
21.425184
87
false
false
0
0
0
0
0
0
0.619048
false
false
8
7bc22bc62d4c94a736bb364bc69fa8f13a49a3a0
23,441,931,527,489
e43f555d4b1af5856a1ea4af1eea0dacc43d6cac
/src/com/farova/includes/Preferences.java
e976ed6334817551867813a11e1d5014f97f5160
[]
no_license
farova/GridMine
https://github.com/farova/GridMine
c51a760b67be7002999df2a27d6feb69edf214ff
d96de432cee6577857c51b0fc6c8d189a2509b3f
refs/heads/master
2016-09-08T00:26:30.188000
2012-11-17T06:27:06
2012-11-17T06:27:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.farova.includes; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Preferences { private SharedPreferences m_manager; private static String m_Pref_Difficulty = "FieldDifficulty"; private static String[] m_Pref_Score = { "Score1", "Score2", "Score3", "Score4", "Score5" }; public Preferences(Context context) { m_manager = PreferenceManager.getDefaultSharedPreferences(context); } public int getDifficulty() { return m_manager.getInt(m_Pref_Difficulty, Difficulty.getDefaultDifficulty()); } public Score[] getScores() { Score[] scores = new Score[m_Pref_Score.length]; for (int i = 0; i < m_Pref_Score.length; i++) { scores[i].setName(m_manager.getString(m_Pref_Score[i], "---")); scores[i].setScore(m_manager.getInt(m_Pref_Score[i], 0)); } return scores; } }
UTF-8
Java
919
java
Preferences.java
Java
[]
null
[]
package com.farova.includes; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Preferences { private SharedPreferences m_manager; private static String m_Pref_Difficulty = "FieldDifficulty"; private static String[] m_Pref_Score = { "Score1", "Score2", "Score3", "Score4", "Score5" }; public Preferences(Context context) { m_manager = PreferenceManager.getDefaultSharedPreferences(context); } public int getDifficulty() { return m_manager.getInt(m_Pref_Difficulty, Difficulty.getDefaultDifficulty()); } public Score[] getScores() { Score[] scores = new Score[m_Pref_Score.length]; for (int i = 0; i < m_Pref_Score.length; i++) { scores[i].setName(m_manager.getString(m_Pref_Score[i], "---")); scores[i].setScore(m_manager.getInt(m_Pref_Score[i], 0)); } return scores; } }
919
0.699674
0.692057
31
27.645161
27.537128
93
false
false
0
0
0
0
0
0
1.580645
false
false
8
095f6cca55d53e6dccac365b86e6d7409820ce24
2,929,167,729,104
029f88fb117cdfa70c9e18ac208e887a822a28e0
/api/src/main/java/org/minecarts/api/entity/LivingEntity.java
263dde91a140b92424e131f055b61eb22ed2df85
[ "MIT" ]
permissive
ProjectMinecarts/Minecarts
https://github.com/ProjectMinecarts/Minecarts
575014303740c51cb979896f430794372efba8a2
764268ecae2f515bb27d0636b0e8c95681e2bc2a
refs/heads/master
2022-06-01T08:12:47.622000
2020-08-15T16:38:18
2020-08-15T16:38:18
141,763,437
1
1
MIT
false
2022-05-20T20:54:30
2018-07-20T22:31:54
2020-08-15T16:39:24
2022-05-20T20:54:29
2,840
0
0
4
Java
false
false
package org.minecarts.api.entity; public interface LivingEntity extends Entity { }
UTF-8
Java
84
java
LivingEntity.java
Java
[]
null
[]
package org.minecarts.api.entity; public interface LivingEntity extends Entity { }
84
0.809524
0.809524
5
16
19.626513
46
false
false
0
0
0
0
0
0
0.2
false
false
8
d199bd06511dc9511b43839bb235286872750c76
10,144,712,794,342
a40783ddfbb5f4d6f5cf1a6604e779da4cbaf2a9
/src/com/busylee/panoramio/ui/SlideFragment.java
5aaedbe996b471e8c5ace43a9102ddd00e0f4652
[]
no_license
busylee999/rmr-assignment
https://github.com/busylee999/rmr-assignment
90aa9fac21d268b7c6c5a389ca839ce5ba1d2f01
06a05d4ab08a953efa8d66afc1a63bdc3daf4839
refs/heads/master
2021-01-01T15:25:04.408000
2014-03-05T07:46:07
2014-03-05T07:46:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.busylee.panoramio.ui; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import android.annotation.SuppressLint; import android.app.ActionBar.LayoutParams; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import android.widget.ViewSwitcher.ViewFactory; import com.busylee.panoramio.R; import com.busylee.panoramio.api.PanoramioAsync; import com.busylee.panoramio.api.PanoramioAsync.ImageLinkListener; import com.busylee.panoramio.utils.SlideManager; @SuppressLint("HandlerLeak") public class SlideFragment extends Fragment implements ImageLinkListener, LocationListener { public final static String ARGUMENT_DURATION = "duration"; public final static String ARGUMENT_COUNT = "count"; public final static int DEF_DURATION = 500; public final static int DEF_COUNT = 5; int mCount = DEF_COUNT, mDuration = DEF_DURATION; // views ImageSwitcher imageSwitcher = null; ProgressBar pbPreloader = null; // other SlideManager mSlideManager = null; PanoramioAsync panoramioApi = null; Timer mLocationTimer = new Timer(); // location LocationManager mLocationManager; Handler uiHandler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.arg1 == SlideManager.SHOW_PRELODER) showProgressBar(); else if (msg.arg1 == SlideManager.OFF_PRELODER) hideProgressBar(); } }; @Override public void onCreate(Bundle save) { super.onCreate(save); setRetainInstance(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View fragmentLayout = inflater.inflate(R.layout.fragment_slide, null); initializeViews(fragmentLayout); if (mSlideManager == null) { Bundle arguments = getArguments(); if (arguments != null) { mCount = arguments.getInt(ARGUMENT_COUNT, DEF_COUNT); mDuration = arguments.getInt(ARGUMENT_DURATION, DEF_DURATION); } getCoords(); } else { mSlideManager.updateImageSwitcher(imageSwitcher); hideProgressBar(); } return fragmentLayout; } @Override public void onDestroy() { super.onDestroy(); mLocationTimer.cancel(); if (mSlideManager != null) mSlideManager.stopSlideShow(); mLocationManager.removeUpdates(this); } public void getCoords() { final int minTime = 1000 * 10; final int minDistance = 10; mLocationManager = (LocationManager) getActivity().getSystemService( Context.LOCATION_SERVICE); if (mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { mLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, minTime, minDistance, this); mLocationTimer.schedule(new TimerTask() { @Override public void run() { if (panoramioApi == null) getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText( getActivity(), getResources().getString( R.string.location_by_network), Toast.LENGTH_SHORT).show(); mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, minTime, minDistance, SlideFragment.this); } }); } }, 10 * 1000); } else if (mLocationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, minTime, minDistance, this); } } private void initializeViews(View layoutView) { pbPreloader = (ProgressBar) layoutView.findViewById(R.id.pbPreloader); imageSwitcher = (ImageSwitcher) layoutView .findViewById(R.id.imageSwitcher); imageSwitcher.setFactory(new ViewFactory() { @Override public View makeView() { ImageView myView = new ImageView(getActivity() .getApplicationContext()); myView.setScaleType(ImageView.ScaleType.FIT_CENTER); myView.setLayoutParams(new ImageSwitcher.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return myView; } }); Animation in = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left); Animation out = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_out_right); imageSwitcher.setInAnimation(in); imageSwitcher.setOutAnimation(out); } @Override public void onLinksGetting(ArrayList<String> imageLinks) { mSlideManager = new SlideManager(imageSwitcher, uiHandler, mDuration); mSlideManager.initImages(imageLinks); mSlideManager.startSlideShow(); } @Override public void onError(Exception e) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), getResources().getString(R.string.error_get_links), Toast.LENGTH_LONG).show(); } }); } public void showProgressBar() { pbPreloader.setVisibility(View.VISIBLE); } public void hideProgressBar() { pbPreloader.setVisibility(View.INVISIBLE); } @Override public void onLocationChanged(Location location) { if (panoramioApi == null) { panoramioApi = new PanoramioAsync(); panoramioApi.getPictures(mCount, location.getLongitude(), location.getLatitude(), this); mLocationManager.removeUpdates(this); } } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }
UTF-8
Java
6,043
java
SlideFragment.java
Java
[]
null
[]
package com.busylee.panoramio.ui; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import android.annotation.SuppressLint; import android.app.ActionBar.LayoutParams; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageSwitcher; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import android.widget.ViewSwitcher.ViewFactory; import com.busylee.panoramio.R; import com.busylee.panoramio.api.PanoramioAsync; import com.busylee.panoramio.api.PanoramioAsync.ImageLinkListener; import com.busylee.panoramio.utils.SlideManager; @SuppressLint("HandlerLeak") public class SlideFragment extends Fragment implements ImageLinkListener, LocationListener { public final static String ARGUMENT_DURATION = "duration"; public final static String ARGUMENT_COUNT = "count"; public final static int DEF_DURATION = 500; public final static int DEF_COUNT = 5; int mCount = DEF_COUNT, mDuration = DEF_DURATION; // views ImageSwitcher imageSwitcher = null; ProgressBar pbPreloader = null; // other SlideManager mSlideManager = null; PanoramioAsync panoramioApi = null; Timer mLocationTimer = new Timer(); // location LocationManager mLocationManager; Handler uiHandler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.arg1 == SlideManager.SHOW_PRELODER) showProgressBar(); else if (msg.arg1 == SlideManager.OFF_PRELODER) hideProgressBar(); } }; @Override public void onCreate(Bundle save) { super.onCreate(save); setRetainInstance(true); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View fragmentLayout = inflater.inflate(R.layout.fragment_slide, null); initializeViews(fragmentLayout); if (mSlideManager == null) { Bundle arguments = getArguments(); if (arguments != null) { mCount = arguments.getInt(ARGUMENT_COUNT, DEF_COUNT); mDuration = arguments.getInt(ARGUMENT_DURATION, DEF_DURATION); } getCoords(); } else { mSlideManager.updateImageSwitcher(imageSwitcher); hideProgressBar(); } return fragmentLayout; } @Override public void onDestroy() { super.onDestroy(); mLocationTimer.cancel(); if (mSlideManager != null) mSlideManager.stopSlideShow(); mLocationManager.removeUpdates(this); } public void getCoords() { final int minTime = 1000 * 10; final int minDistance = 10; mLocationManager = (LocationManager) getActivity().getSystemService( Context.LOCATION_SERVICE); if (mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { mLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, minTime, minDistance, this); mLocationTimer.schedule(new TimerTask() { @Override public void run() { if (panoramioApi == null) getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText( getActivity(), getResources().getString( R.string.location_by_network), Toast.LENGTH_SHORT).show(); mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, minTime, minDistance, SlideFragment.this); } }); } }, 10 * 1000); } else if (mLocationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, minTime, minDistance, this); } } private void initializeViews(View layoutView) { pbPreloader = (ProgressBar) layoutView.findViewById(R.id.pbPreloader); imageSwitcher = (ImageSwitcher) layoutView .findViewById(R.id.imageSwitcher); imageSwitcher.setFactory(new ViewFactory() { @Override public View makeView() { ImageView myView = new ImageView(getActivity() .getApplicationContext()); myView.setScaleType(ImageView.ScaleType.FIT_CENTER); myView.setLayoutParams(new ImageSwitcher.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return myView; } }); Animation in = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left); Animation out = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_out_right); imageSwitcher.setInAnimation(in); imageSwitcher.setOutAnimation(out); } @Override public void onLinksGetting(ArrayList<String> imageLinks) { mSlideManager = new SlideManager(imageSwitcher, uiHandler, mDuration); mSlideManager.initImages(imageLinks); mSlideManager.startSlideShow(); } @Override public void onError(Exception e) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), getResources().getString(R.string.error_get_links), Toast.LENGTH_LONG).show(); } }); } public void showProgressBar() { pbPreloader.setVisibility(View.VISIBLE); } public void hideProgressBar() { pbPreloader.setVisibility(View.INVISIBLE); } @Override public void onLocationChanged(Location location) { if (panoramioApi == null) { panoramioApi = new PanoramioAsync(); panoramioApi.getPictures(mCount, location.getLongitude(), location.getLatitude(), this); mLocationManager.removeUpdates(this); } } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }
6,043
0.739864
0.736389
229
25.388647
20.880865
74
false
false
0
0
0
0
0
0
2.436681
false
false
8
16d3180001bd6b81173908b758ee5769e083a6c2
7,318,624,315,248
684732efc4909172df38ded729c0972349c58b67
/xml/src/main/java/net/sf/ahtutils/xml/qa/Group.java
8a27f7ceb1c4bc954bd680eb485450054aea9960
[]
no_license
aht-group/jeesl
https://github.com/aht-group/jeesl
2c4683e8c1e9d9e9698d044c6a89a611b8dfe1e7
3f4bfca6cf33f60549cac23f3b90bf1218c9daf9
refs/heads/master
2023-08-13T20:06:38.593000
2023-08-12T06:59:51
2023-08-12T06:59:51
39,823,889
0
9
null
false
2022-12-13T18:35:24
2015-07-28T09:06:11
2022-01-07T14:59:23
2022-12-13T18:35:22
32,965
0
6
18
Java
false
false
package net.sf.ahtutils.xml.qa; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import net.sf.ahtutils.xml.status.Description; import org.jeesl.model.xml.system.security.Staff; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{http://ahtutils.aht-group.com/status}description"/&gt; * &lt;element ref="{https://www.jeesl.org/jeesl/xsd/system/security}staff" maxOccurs="unbounded"/&gt; * &lt;/sequence&gt; * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}long" /&gt; * &lt;attribute name="position" type="{http://www.w3.org/2001/XMLSchema}int" /&gt; * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" /&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "description", "staff" }) @XmlRootElement(name = "group") public class Group implements Serializable { private final static long serialVersionUID = 1L; @XmlElement(namespace = "http://ahtutils.aht-group.com/status", required = true) protected Description description; @XmlElement(namespace = "https://www.jeesl.org/jeesl/xsd/system/security", required = true) protected List<Staff> staff; @XmlAttribute(name = "id") protected Long id; @XmlAttribute(name = "position") protected Integer position; @XmlAttribute(name = "name") protected String name; /** * Gets the value of the description property. * * @return * possible object is * {@link Description } * */ public Description getDescription() { return description; } /** * Sets the value of the description property. * * @param value * allowed object is * {@link Description } * */ public void setDescription(Description value) { this.description = value; } public boolean isSetDescription() { return (this.description!= null); } /** * Gets the value of the staff property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the staff property. * * <p> * For example, to add a new item, do as follows: * <pre> * getStaff().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Staff } * * */ public List<Staff> getStaff() { if (staff == null) { staff = new ArrayList<Staff>(); } return this.staff; } public boolean isSetStaff() { return ((this.staff!= null)&&(!this.staff.isEmpty())); } public void unsetStaff() { this.staff = null; } /** * Gets the value of the id property. * * @return * possible object is * {@link Long } * */ public long getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link Long } * */ public void setId(long value) { this.id = value; } public boolean isSetId() { return (this.id!= null); } public void unsetId() { this.id = null; } /** * Gets the value of the position property. * * @return * possible object is * {@link Integer } * */ public int getPosition() { return position; } /** * Sets the value of the position property. * * @param value * allowed object is * {@link Integer } * */ public void setPosition(int value) { this.position = value; } public boolean isSetPosition() { return (this.position!= null); } public void unsetPosition() { this.position = null; } /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } public boolean isSetName() { return (this.name!= null); } }
UTF-8
Java
5,289
java
Group.java
Java
[]
null
[]
package net.sf.ahtutils.xml.qa; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import net.sf.ahtutils.xml.status.Description; import org.jeesl.model.xml.system.security.Staff; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{http://ahtutils.aht-group.com/status}description"/&gt; * &lt;element ref="{https://www.jeesl.org/jeesl/xsd/system/security}staff" maxOccurs="unbounded"/&gt; * &lt;/sequence&gt; * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}long" /&gt; * &lt;attribute name="position" type="{http://www.w3.org/2001/XMLSchema}int" /&gt; * &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" /&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "description", "staff" }) @XmlRootElement(name = "group") public class Group implements Serializable { private final static long serialVersionUID = 1L; @XmlElement(namespace = "http://ahtutils.aht-group.com/status", required = true) protected Description description; @XmlElement(namespace = "https://www.jeesl.org/jeesl/xsd/system/security", required = true) protected List<Staff> staff; @XmlAttribute(name = "id") protected Long id; @XmlAttribute(name = "position") protected Integer position; @XmlAttribute(name = "name") protected String name; /** * Gets the value of the description property. * * @return * possible object is * {@link Description } * */ public Description getDescription() { return description; } /** * Sets the value of the description property. * * @param value * allowed object is * {@link Description } * */ public void setDescription(Description value) { this.description = value; } public boolean isSetDescription() { return (this.description!= null); } /** * Gets the value of the staff property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the staff property. * * <p> * For example, to add a new item, do as follows: * <pre> * getStaff().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Staff } * * */ public List<Staff> getStaff() { if (staff == null) { staff = new ArrayList<Staff>(); } return this.staff; } public boolean isSetStaff() { return ((this.staff!= null)&&(!this.staff.isEmpty())); } public void unsetStaff() { this.staff = null; } /** * Gets the value of the id property. * * @return * possible object is * {@link Long } * */ public long getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link Long } * */ public void setId(long value) { this.id = value; } public boolean isSetId() { return (this.id!= null); } public void unsetId() { this.id = null; } /** * Gets the value of the position property. * * @return * possible object is * {@link Integer } * */ public int getPosition() { return position; } /** * Sets the value of the position property. * * @param value * allowed object is * {@link Integer } * */ public void setPosition(int value) { this.position = value; } public boolean isSetPosition() { return (this.position!= null); } public void unsetPosition() { this.position = null; } /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } public boolean isSetName() { return (this.name!= null); } }
5,289
0.5744
0.570429
218
23.25688
21.522936
110
false
false
0
0
0
0
0
0
0.321101
false
false
8
306ae0c3238b867ad0d6ed7a3878840f23d9fed1
22,892,175,721,350
7332d13f09485b142389716b3e7ed7373d8b2038
/boot-meeting-service/src/main/java/com/xianyuli/dobbo/bootmeetingservice/BootMeetingServiceApplication.java
0f330ee2847c37dc8ef06ca3c87995a3b6c2aee0
[]
no_license
xianyuli/springboot-dubbo
https://github.com/xianyuli/springboot-dubbo
551a503d0743c82e6c29bb3bf986b153b8fc8470
74e903c824822feb452a0c886f7afe9b00fefdf5
refs/heads/master
2021-01-01T00:23:16.445000
2020-02-29T14:56:39
2020-02-29T14:56:39
239,095,887
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xianyuli.dobbo.bootmeetingservice; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class BootMeetingServiceApplication { public static void main(String[] args) { SpringApplication.run(BootMeetingServiceApplication.class, args); } }
UTF-8
Java
366
java
BootMeetingServiceApplication.java
Java
[]
null
[]
package com.xianyuli.dobbo.bootmeetingservice; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class BootMeetingServiceApplication { public static void main(String[] args) { SpringApplication.run(BootMeetingServiceApplication.class, args); } }
366
0.811475
0.811475
13
27.153847
26.840973
73
false
false
0
0
0
0
0
0
0.384615
false
false
8
36bc0e4d71e914ccabc2997605c0d1c22daff562
23,115,514,016,456
450db7c213178ac2726c8d1754c37ea67a2683ef
/RecyclerView/app/src/main/java/com/mxhoa/recyclerview/Adapter.java
988e87f7f5fb3064911a978a2c3c5b5b95788546
[]
no_license
mxhoa/Developing-Android-App
https://github.com/mxhoa/Developing-Android-App
c3883044d96e1b84f036dc4bcbc6371da6d0cebe
4cd46c171ee9995d819a5e576861f81dd1302c4f
refs/heads/master
2020-03-31T12:34:58.795000
2019-01-24T18:52:41
2019-01-24T18:52:41
152,221,780
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mxhoa.recyclerview; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.List; public class Adapter extends RecyclerView.Adapter { // public interface OnItemClickListener { // void onItemClick(ItemDataModel itemDataModel); // } private Context context; private List<ItemDataModel> itemDataModel; private OnItemClickListener onItemClickListener; public Adapter(Context context) { this.context = context; itemDataModel = new ArrayList<>(); } // This method is used to add more items in recyclerview in runtime public void addModels(List<ItemDataModel> itemDataModels) { // This is position of last item we need to get this before adding items to current running // item list to notify recyclerview from which position we have added this items to update // view of recyclerview see notifyItemRangeInserted() line before where I used this position int pos = this.itemDataModel.size(); // Add items to the current running list this.itemDataModel.addAll(itemDataModels); // Notify recyclerview that we have added some items to update its view. notifyItemRangeInserted(pos, itemDataModels.size()); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View row = inflater.inflate(R.layout.custom_row_item, parent, false); return new Adapter.ItemHolder(row); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { // Get current item from list according to position final ItemDataModel mCurrentItem = itemDataModel.get(position); Adapter.ItemHolder itemHolder = (Adapter.ItemHolder) holder; Picasso.with(context).load(mCurrentItem.getImageUrl()).resize(900, 400).into(itemHolder.imageViewThumbnail); itemHolder.textViewTitle.setText(mCurrentItem.getTitle()); itemHolder.textViewDescription.setText(mCurrentItem.getDescription()); final View.OnClickListener listener = new View.OnClickListener(){ @Override public void onClick(View v) { onItemClickListener.onItemClick(mCurrentItem); } }; itemHolder.textViewTitle.setOnClickListener(listener); itemHolder.imageViewThumbnail.setOnClickListener(listener); // itemHolder.textViewDescription.setOnClickListener(listener); } @Override public int getItemCount() { return itemDataModel.size(); } private class ItemHolder extends RecyclerView.ViewHolder { TextView textViewTitle, textViewDescription; ImageView imageViewThumbnail; public ItemHolder(View itemView) { super(itemView); textViewTitle = (TextView)itemView.findViewById(R.id.textViewTitle); textViewDescription = (TextView)itemView.findViewById(R.id.textViewDescription); imageViewThumbnail = (ImageView)itemView.findViewById(R.id.imageViewThumbnail); } } public OnItemClickListener getOnItemClickListener() { return onItemClickListener; } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; } }
UTF-8
Java
3,684
java
Adapter.java
Java
[]
null
[]
package com.mxhoa.recyclerview; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.List; public class Adapter extends RecyclerView.Adapter { // public interface OnItemClickListener { // void onItemClick(ItemDataModel itemDataModel); // } private Context context; private List<ItemDataModel> itemDataModel; private OnItemClickListener onItemClickListener; public Adapter(Context context) { this.context = context; itemDataModel = new ArrayList<>(); } // This method is used to add more items in recyclerview in runtime public void addModels(List<ItemDataModel> itemDataModels) { // This is position of last item we need to get this before adding items to current running // item list to notify recyclerview from which position we have added this items to update // view of recyclerview see notifyItemRangeInserted() line before where I used this position int pos = this.itemDataModel.size(); // Add items to the current running list this.itemDataModel.addAll(itemDataModels); // Notify recyclerview that we have added some items to update its view. notifyItemRangeInserted(pos, itemDataModels.size()); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View row = inflater.inflate(R.layout.custom_row_item, parent, false); return new Adapter.ItemHolder(row); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { // Get current item from list according to position final ItemDataModel mCurrentItem = itemDataModel.get(position); Adapter.ItemHolder itemHolder = (Adapter.ItemHolder) holder; Picasso.with(context).load(mCurrentItem.getImageUrl()).resize(900, 400).into(itemHolder.imageViewThumbnail); itemHolder.textViewTitle.setText(mCurrentItem.getTitle()); itemHolder.textViewDescription.setText(mCurrentItem.getDescription()); final View.OnClickListener listener = new View.OnClickListener(){ @Override public void onClick(View v) { onItemClickListener.onItemClick(mCurrentItem); } }; itemHolder.textViewTitle.setOnClickListener(listener); itemHolder.imageViewThumbnail.setOnClickListener(listener); // itemHolder.textViewDescription.setOnClickListener(listener); } @Override public int getItemCount() { return itemDataModel.size(); } private class ItemHolder extends RecyclerView.ViewHolder { TextView textViewTitle, textViewDescription; ImageView imageViewThumbnail; public ItemHolder(View itemView) { super(itemView); textViewTitle = (TextView)itemView.findViewById(R.id.textViewTitle); textViewDescription = (TextView)itemView.findViewById(R.id.textViewDescription); imageViewThumbnail = (ImageView)itemView.findViewById(R.id.imageViewThumbnail); } } public OnItemClickListener getOnItemClickListener() { return onItemClickListener; } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; } }
3,684
0.716612
0.714441
100
35.84
30.96925
116
false
false
0
0
0
0
0
0
0.5
false
false
8
9d5614e2423d572fa3c91291e1458f22d1981d55
9,749,575,793,047
53e6129857bb01018f351823e21888f7616a024f
/src/main/java/io/axoniq/demo/giftcard/api/command/RedeemCardCommand.java
8336af376bde5eb000a28e4a53364e115a3b2403
[ "Apache-2.0" ]
permissive
azzazzel/giftcard-demo
https://github.com/azzazzel/giftcard-demo
fa6fba801ee1f7300c1a97a1c94873c0db4abb35
39c0c6b628df6e3ff0915a284e991e6554ac81ad
refs/heads/master
2023-04-30T09:00:59.018000
2023-04-14T15:27:32
2023-04-14T15:34:37
288,231,256
0
0
Apache-2.0
true
2020-08-17T16:31:03
2020-08-17T16:31:02
2020-08-14T13:45:04
2020-08-14T13:45:01
218
0
0
0
null
false
false
package io.axoniq.demo.giftcard.api.command; import org.axonframework.modelling.command.TargetAggregateIdentifier; public record RedeemCardCommand( @TargetAggregateIdentifier String id, int amount ) { }
UTF-8
Java
222
java
RedeemCardCommand.java
Java
[]
null
[]
package io.axoniq.demo.giftcard.api.command; import org.axonframework.modelling.command.TargetAggregateIdentifier; public record RedeemCardCommand( @TargetAggregateIdentifier String id, int amount ) { }
222
0.77027
0.77027
10
21.200001
23.633875
69
false
false
0
0
0
0
0
0
0.3
false
false
8
ecabf62bc33c3c0a2be2622ca8c7a565fc8b97ad
34,205,119,601,262
5b43fe6c10f8045b1ea79688684e9350bdbedf10
/Statistics/src/rng/Main.java
da5277bb8333d179184d5883f9ef085b27afdd6b
[]
no_license
Chrish0r/DatabaseCourse
https://github.com/Chrish0r/DatabaseCourse
b1591f7672aa1a1d2838a7a9db8db2fa7ff709b2
3149009e41a98c64a8ec916eae1674a870b776df
refs/heads/master
2023-06-25T15:05:08.540000
2021-07-29T13:01:41
2021-07-29T13:01:41
294,473,734
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rng; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List<Person> list = new ArrayList<>(); Person p1 = new Person(35, "Chris"); int ran = p1.createRandomNumber(); p1.setRandomNumber(ran); Person p2 = new Person(25, "Chrisssa"); int ran2 = p2.createRandomNumber(); p2.setRandomNumber(ran2); Person p3 = new Person(24, "Ava"); int ran3 = p3.createRandomNumber(); p3.setRandomNumber(ran3); Person p4 = new Person(15, "David"); int ran4 = p4.createRandomNumber(); p4.setRandomNumber(ran4); Person p5 = new Person(28, "Mike"); int ran5 = p5.createRandomNumber(); p5.setRandomNumber(ran5); list.add(p1); list.add(p2); list.add(p3); list.add(p4); list.add(p5); for (Person p : list) { System.out.println(p.getName() + " " + p.getAge() + " " + p.getRandomNumber()); } new Main().sortList(list, list.size()); System.out.println(System.lineSeparator() + "Choose 3 of 5:" + System.lineSeparator()); for(int i = 0; i < 3; i++) { System.out.println(list.get(i).getName() + " " + list.get(i).getAge()); } } private static void sortList(List<Person> list, int n) { for(int i = 0; i < n-1; i++) { for(int j = 0; j < n-i-1; j++) { if(list.get(j).getRandomNumber() > list.get(j+1).getRandomNumber()) { Person temp = list.get(j); list.set(j, list.get(j+1)); list.set(j+1, temp); } } } } }
UTF-8
Java
1,751
java
Main.java
Java
[ { "context": "rayList<>();\n\n Person p1 = new Person(35, \"Chris\");\n int ran = p1.createRandomNumber();\n ", "end": 220, "score": 0.9997916221618652, "start": 215, "tag": "NAME", "value": "Chris" }, { "context": "Number(ran);\n\n Person p2 = new Person(25, \...
null
[]
package rng; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { List<Person> list = new ArrayList<>(); Person p1 = new Person(35, "Chris"); int ran = p1.createRandomNumber(); p1.setRandomNumber(ran); Person p2 = new Person(25, "Chrisssa"); int ran2 = p2.createRandomNumber(); p2.setRandomNumber(ran2); Person p3 = new Person(24, "Ava"); int ran3 = p3.createRandomNumber(); p3.setRandomNumber(ran3); Person p4 = new Person(15, "David"); int ran4 = p4.createRandomNumber(); p4.setRandomNumber(ran4); Person p5 = new Person(28, "Mike"); int ran5 = p5.createRandomNumber(); p5.setRandomNumber(ran5); list.add(p1); list.add(p2); list.add(p3); list.add(p4); list.add(p5); for (Person p : list) { System.out.println(p.getName() + " " + p.getAge() + " " + p.getRandomNumber()); } new Main().sortList(list, list.size()); System.out.println(System.lineSeparator() + "Choose 3 of 5:" + System.lineSeparator()); for(int i = 0; i < 3; i++) { System.out.println(list.get(i).getName() + " " + list.get(i).getAge()); } } private static void sortList(List<Person> list, int n) { for(int i = 0; i < n-1; i++) { for(int j = 0; j < n-i-1; j++) { if(list.get(j).getRandomNumber() > list.get(j+1).getRandomNumber()) { Person temp = list.get(j); list.set(j, list.get(j+1)); list.set(j+1, temp); } } } } }
1,751
0.51285
0.484866
60
28.183332
24.242863
95
false
false
0
0
0
0
0
0
0.766667
false
false
8
1aaeef773ae8c73ddeb209740f7c5a707fcf9f68
13,993,003,483,761
c9ce315ad8d94920dc1ef1a6bf2d28d63606256b
/OpenCMS-Java-Spring/src/java/ua/org/smit/opencms/webgui/controller/TestController.java
4e6fe66b07df42f8cda3996c071ccb550ce6e64c
[]
no_license
Zemlaynoy-Akkerman/OpenCMS
https://github.com/Zemlaynoy-Akkerman/OpenCMS
06fbe4bf8e2872bcb8938d4ba3f7ee8bfd43da2e
d1e01b259b09f02e95b516250f20396b36ab4929
refs/heads/master
2021-04-18T19:22:01.781000
2018-05-21T14:50:20
2018-05-21T14:50:20
126,211,281
2
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 ua.org.smit.opencms.webgui.controller; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import ua.org.smit.opencms.content.dao.MaterialEntityCMS; /** * * @author smit */ @Controller public class TestController { @RequestMapping(value= "/test") public ModelAndView test( HttpServletRequest request, HttpServletResponse response){ ModelAndView model = new ModelAndView("test"); Cookie cookie1 = new Cookie("myName","myBody2"); cookie1.setMaxAge(60*60); //1 hour response.addCookie(cookie1); Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("url")) { System.out.println(cookie.getValue()); } } } return model; } }
UTF-8
Java
1,377
java
TestController.java
Java
[ { "context": ".content.dao.MaterialEntityCMS;\n\n/**\n *\n * @author smit\n */\n@Controller\npublic class TestController {\n ", "end": 668, "score": 0.9962268471717834, "start": 664, "tag": "USERNAME", "value": "smit" } ]
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 ua.org.smit.opencms.webgui.controller; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import ua.org.smit.opencms.content.dao.MaterialEntityCMS; /** * * @author smit */ @Controller public class TestController { @RequestMapping(value= "/test") public ModelAndView test( HttpServletRequest request, HttpServletResponse response){ ModelAndView model = new ModelAndView("test"); Cookie cookie1 = new Cookie("myName","myBody2"); cookie1.setMaxAge(60*60); //1 hour response.addCookie(cookie1); Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("url")) { System.out.println(cookie.getValue()); } } } return model; } }
1,377
0.671024
0.664488
46
28.934782
21.902355
79
false
false
0
0
0
0
0
0
0.456522
false
false
8
940b2699f3ba782f0403019ecec851da6dbe97e7
21,251,498,216,642
251254ed7de898e93928294b0f91a64f40eb3482
/Avenged Engine/src/com/megotrevo/avenged/scenes/StateManager.java
cf379d07d087dfc12d94f57f3c001ed002fbac35
[]
no_license
TheVacsoPro/Avenged-Engine
https://github.com/TheVacsoPro/Avenged-Engine
e8637f39cba4aa2abe5e94e7ce47385a9800165a
7b81d12e9e87aba60b320f37546b8c5019db2ff4
refs/heads/master
2016-08-12T11:19:16.481000
2016-04-24T18:22:10
2016-04-24T18:22:10
36,190,618
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.megotrevo.avenged.scenes; import com.megotrevo.avenged.interfaces.Renderable; import com.megotrevo.avenged.interfaces.Updateable; public class StateManager implements Updateable, Renderable { public static State current = null, prevState = null; public static final int TYPE_MENU = 0x1, TYPE_LEVELS = 0x2, TYPE_OTHER = 0x3; public static void setState(State state) { prevState = current; current = state; } public void update() { if(current != null) current.onUpdate(); } public void render() { if(current != null) current.onRender(); } }
UTF-8
Java
578
java
StateManager.java
Java
[]
null
[]
package com.megotrevo.avenged.scenes; import com.megotrevo.avenged.interfaces.Renderable; import com.megotrevo.avenged.interfaces.Updateable; public class StateManager implements Updateable, Renderable { public static State current = null, prevState = null; public static final int TYPE_MENU = 0x1, TYPE_LEVELS = 0x2, TYPE_OTHER = 0x3; public static void setState(State state) { prevState = current; current = state; } public void update() { if(current != null) current.onUpdate(); } public void render() { if(current != null) current.onRender(); } }
578
0.730104
0.719723
24
23.083334
23.802866
78
false
false
0
0
0
0
0
0
1.375
false
false
8
cc857d67d27cb5e63768d8f45b6d113aa932d555
20,289,425,552,293
c1f9f08c89daae86bb5db52db300823de46756db
/src/main/java/cn/datanalyse/web/PoiReadExcel.java
6cd892e1a48931a499a234fa74237cf9f0fce81d
[]
no_license
asnig/datanalyse
https://github.com/asnig/datanalyse
37bc2e8eb9a317f16cfa843a2e761acd17eaa716
b9d4852741e970e8ce5d1c1130f9a8ae51fba0cc
refs/heads/master
2022-12-24T18:13:02.544000
2019-06-09T12:45:02
2019-06-09T12:45:02
190,499,019
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.datanalyse.web; import cn.datanalyse.service.ExcelService; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.springframework.beans.factory.annotation.Autowired; import java.io.File; /** * @author XYQ */ public class PoiReadExcel { public static void main(String[] args) throws InvalidFormatException { } }
UTF-8
Java
364
java
PoiReadExcel.java
Java
[ { "context": "n.Autowired;\n\nimport java.io.File;\n\n/**\n * @author XYQ\n */\npublic class PoiReadExcel {\n\n public stati", "end": 243, "score": 0.9995681047439575, "start": 240, "tag": "USERNAME", "value": "XYQ" } ]
null
[]
package cn.datanalyse.web; import cn.datanalyse.service.ExcelService; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.springframework.beans.factory.annotation.Autowired; import java.io.File; /** * @author XYQ */ public class PoiReadExcel { public static void main(String[] args) throws InvalidFormatException { } }
364
0.766484
0.763736
21
16.333334
23.787418
74
false
false
0
0
0
0
0
0
0.238095
false
false
8
63a816bee9a67514bc945fe4c706e15918ea0f2d
19,275,813,263,949
52bfef34f665966e4ba02a4e7dbb1c2b7bac7414
/src/test/java/com/pixcat/graphics/WindowTest.java
17ecca720959821b72b10b79f92a875087386d7a
[ "Apache-2.0" ]
permissive
PixelCatalyst/OurCraft
https://github.com/PixelCatalyst/OurCraft
dad81ef6847bd03b7322b8765a6d70275362c13c
bf1dd6057be3d4dd0466f056a0e125972059c993
refs/heads/master
2020-04-28T05:28:26.472000
2019-06-12T10:02:34
2019-06-12T10:02:34
175,021,696
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pixcat.graphics; import org.junit.After; import org.junit.Test; import org.lwjgl.glfw.GLFWVidMode; import static org.junit.Assert.*; import static org.lwjgl.glfw.GLFW.*; public class WindowTest { private Window window; @After public void destroyWindow() { window.destroy(); } @Test public void testGetHeightWidth() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(500, 500, "window"); window.bindAsCurrent(); assertEquals(window.getHeight(), 500); assertEquals(window.getWidth(), 500 * window.getAspectRatio(), 0.0001); } @Test public void testAspectRatio() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(160, 100, "window"); window.bindAsCurrent(); assertEquals(window.getAspectRatio(), 1.6, 0.0001); } @Test public void testCenter() { long monitor = glfwGetPrimaryMonitor(); GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(100, 100, "window"); window.bindAsCurrent(); int[] windowXOld = new int[1]; int[] windowYOld = new int[1]; glfwGetWindowPos(window.getHandle(), windowXOld, windowYOld); window.center(); int[] windowXNew = new int[1]; int[] windowYNew = new int[1]; glfwGetWindowPos(window.getHandle(), windowXNew, windowYNew); assertNotEquals(windowXOld[0], windowXNew); assertNotEquals(windowYOld[0], windowYNew); } @Test public void testValidCreation() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(200, 100, "window"); window.bindAsCurrent(); assertTrue(window.isOpen()); assertTrue(window.getHandle() != 0); assertTrue(window.getHeight() == 100); assertTrue((float) window.getWidth() == (window.getHeight() * window.getAspectRatio())); } @Test public void testActiveWindow() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(100, 100, "window"); long x = glfwGetCurrentContext(); assertEquals(x, 0); window.bindAsCurrent(); long y = glfwGetCurrentContext(); assertNotEquals(x, y); } }
UTF-8
Java
2,602
java
WindowTest.java
Java
[]
null
[]
package com.pixcat.graphics; import org.junit.After; import org.junit.Test; import org.lwjgl.glfw.GLFWVidMode; import static org.junit.Assert.*; import static org.lwjgl.glfw.GLFW.*; public class WindowTest { private Window window; @After public void destroyWindow() { window.destroy(); } @Test public void testGetHeightWidth() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(500, 500, "window"); window.bindAsCurrent(); assertEquals(window.getHeight(), 500); assertEquals(window.getWidth(), 500 * window.getAspectRatio(), 0.0001); } @Test public void testAspectRatio() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(160, 100, "window"); window.bindAsCurrent(); assertEquals(window.getAspectRatio(), 1.6, 0.0001); } @Test public void testCenter() { long monitor = glfwGetPrimaryMonitor(); GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(100, 100, "window"); window.bindAsCurrent(); int[] windowXOld = new int[1]; int[] windowYOld = new int[1]; glfwGetWindowPos(window.getHandle(), windowXOld, windowYOld); window.center(); int[] windowXNew = new int[1]; int[] windowYNew = new int[1]; glfwGetWindowPos(window.getHandle(), windowXNew, windowYNew); assertNotEquals(windowXOld[0], windowXNew); assertNotEquals(windowYOld[0], windowYNew); } @Test public void testValidCreation() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(200, 100, "window"); window.bindAsCurrent(); assertTrue(window.isOpen()); assertTrue(window.getHandle() != 0); assertTrue(window.getHeight() == 100); assertTrue((float) window.getWidth() == (window.getHeight() * window.getAspectRatio())); } @Test public void testActiveWindow() { if (glfwInit() == false) throw new RuntimeException("Unable to initialize GLFW"); window = new Window(100, 100, "window"); long x = glfwGetCurrentContext(); assertEquals(x, 0); window.bindAsCurrent(); long y = glfwGetCurrentContext(); assertNotEquals(x, y); } }
2,602
0.616833
0.594158
80
31.525
22.406458
96
false
false
0
0
0
0
0
0
0.85
false
false
8
93a766240d9f061de9114d716e93655257b51a92
38,036,230,400,593
86493fe1d2b3c38fd3caabfa0668d4fbf57264da
/Character.java
0abfd8e1c4a611ac49e0505ad3bb161236f38637
[]
no_license
louisforestier/game
https://github.com/louisforestier/game
d7ee8851164b564dde508a81ab0f0f6655a45248
ff0efec1618257e610063830d5a4564dc15b4426
refs/heads/master
2023-01-28T21:13:09.388000
2020-12-10T20:45:42
2020-12-10T20:45:42
315,674,138
0
0
null
false
2020-11-24T16:09:59
2020-11-24T15:28:43
2020-11-24T15:58:51
2020-11-24T16:09:59
0
0
0
0
Java
false
false
package game; import java.util.*; public abstract class Character extends Interaction implements Attackable, Attacker { private final static int MIN_DICE = 1; private final static int MAX_DICE = 20; private final static int DEFAULT_ARMOR_CLASS = 10; private final static int DEFAULT_ATTACK_POWER = 2; private final String name; private Place place; private final Map<String, Item> inventory = new HashMap<>(); private boolean alive = true; private int currentHealthPoints; private int maxHealthPoints; private int armorClass = Character.DEFAULT_ARMOR_CLASS; private int attackPower = Character.DEFAULT_ATTACK_POWER; private int attackBonus; private int damageBonus; private Armor armor = null; private Weapon weapon = null; private final Random dice = new Random(); public Character(String name, String description, int maxHealthPoints, int attackBonus, int damageBonus) { super(description); this.name = name; this.maxHealthPoints = maxHealthPoints; this.currentHealthPoints = maxHealthPoints; this.attackBonus = attackBonus; this.damageBonus = damageBonus; } public String getName() { return this.name; } public boolean isAlive() { return this.alive; } public void setAlive(boolean alive) { this.alive = alive; } public int getCurrentHealthPoints() { return this.currentHealthPoints; } public void setCurrentHealthPoints(int currentHealthPoints) { this.currentHealthPoints = currentHealthPoints; } public int getMaxHealthPoints() { return this.maxHealthPoints; } public void setMaxHealthPoints(int maxHealthPoints) { this.maxHealthPoints = maxHealthPoints; } public int getAttackBonus() { return this.attackBonus; } public void setAttackBonus(int attackBonus) { this.attackBonus = attackBonus; } public Place getPlace() { return this.place; } public Armor getArmor() { return armor; } public Weapon getWeapon() { return weapon; } public int getArmorClass() { return armorClass; } public int getAttackPower() { return attackPower; } public void setPlace(Place p) { if (this.place != null) this.freePlace(); this.place = p; p.addCharacter(this.name, this); } public Map<String, Item> getInventory() { return inventory; } public void freePlace() { this.place.freeCharacter(this.name); this.place = null; } public boolean isInInventory(String name) { return this.getInventory().containsKey(name); } public void printInventory() { System.out.println("You have :"); if (!(this.inventory.isEmpty())) this.inventory.forEach((k, v) -> System.out.println(k)); else { System.out.println("nothing J.S."); } } @Override public void isAttacked(int attackRoll, int damage) { if (attackRoll >= this.armorClass) { this.currentHealthPoints -= damage; System.out.println(" hit " + this.name + "."); System.out.println(this.name + " takes " + damage + " points of damage."); if (this.currentHealthPoints <= 0) { this.currentHealthPoints = 0; this.alive = false; System.out.println(this.name + " is dead."); } } else System.out.println(" miss " + this.name + "."); } @Override public void attack(Attackable attackable) { int attackRoll = this.dice.nextInt(Character.MAX_DICE) + Character.MIN_DICE; int damageRoll = this.dice.nextInt(this.attackPower) + Character.MIN_DICE; System.out.print(this.name); attackable.isAttacked(attackRoll + this.attackBonus, damageRoll + this.damageBonus); } public void equipArmor(Armor armor) { if (this.armor != null) { this.inventory.put(this.armor.getName(), this.armor); } this.armor = armor; this.armorClass = armor.getArmorClass(); this.inventory.remove(armor.getName()); } public void equipWeapon(Weapon weapon) { if (this.weapon != null) { this.inventory.put(this.weapon.getName(), this.weapon); } this.weapon = weapon; this.attackPower = weapon.getAttackPower(); this.inventory.remove(weapon.getName()); } @Override public void print() { super.print(); if (!this.alive) System.out.println("But now he's dead."); } }
UTF-8
Java
4,720
java
Character.java
Java
[]
null
[]
package game; import java.util.*; public abstract class Character extends Interaction implements Attackable, Attacker { private final static int MIN_DICE = 1; private final static int MAX_DICE = 20; private final static int DEFAULT_ARMOR_CLASS = 10; private final static int DEFAULT_ATTACK_POWER = 2; private final String name; private Place place; private final Map<String, Item> inventory = new HashMap<>(); private boolean alive = true; private int currentHealthPoints; private int maxHealthPoints; private int armorClass = Character.DEFAULT_ARMOR_CLASS; private int attackPower = Character.DEFAULT_ATTACK_POWER; private int attackBonus; private int damageBonus; private Armor armor = null; private Weapon weapon = null; private final Random dice = new Random(); public Character(String name, String description, int maxHealthPoints, int attackBonus, int damageBonus) { super(description); this.name = name; this.maxHealthPoints = maxHealthPoints; this.currentHealthPoints = maxHealthPoints; this.attackBonus = attackBonus; this.damageBonus = damageBonus; } public String getName() { return this.name; } public boolean isAlive() { return this.alive; } public void setAlive(boolean alive) { this.alive = alive; } public int getCurrentHealthPoints() { return this.currentHealthPoints; } public void setCurrentHealthPoints(int currentHealthPoints) { this.currentHealthPoints = currentHealthPoints; } public int getMaxHealthPoints() { return this.maxHealthPoints; } public void setMaxHealthPoints(int maxHealthPoints) { this.maxHealthPoints = maxHealthPoints; } public int getAttackBonus() { return this.attackBonus; } public void setAttackBonus(int attackBonus) { this.attackBonus = attackBonus; } public Place getPlace() { return this.place; } public Armor getArmor() { return armor; } public Weapon getWeapon() { return weapon; } public int getArmorClass() { return armorClass; } public int getAttackPower() { return attackPower; } public void setPlace(Place p) { if (this.place != null) this.freePlace(); this.place = p; p.addCharacter(this.name, this); } public Map<String, Item> getInventory() { return inventory; } public void freePlace() { this.place.freeCharacter(this.name); this.place = null; } public boolean isInInventory(String name) { return this.getInventory().containsKey(name); } public void printInventory() { System.out.println("You have :"); if (!(this.inventory.isEmpty())) this.inventory.forEach((k, v) -> System.out.println(k)); else { System.out.println("nothing J.S."); } } @Override public void isAttacked(int attackRoll, int damage) { if (attackRoll >= this.armorClass) { this.currentHealthPoints -= damage; System.out.println(" hit " + this.name + "."); System.out.println(this.name + " takes " + damage + " points of damage."); if (this.currentHealthPoints <= 0) { this.currentHealthPoints = 0; this.alive = false; System.out.println(this.name + " is dead."); } } else System.out.println(" miss " + this.name + "."); } @Override public void attack(Attackable attackable) { int attackRoll = this.dice.nextInt(Character.MAX_DICE) + Character.MIN_DICE; int damageRoll = this.dice.nextInt(this.attackPower) + Character.MIN_DICE; System.out.print(this.name); attackable.isAttacked(attackRoll + this.attackBonus, damageRoll + this.damageBonus); } public void equipArmor(Armor armor) { if (this.armor != null) { this.inventory.put(this.armor.getName(), this.armor); } this.armor = armor; this.armorClass = armor.getArmorClass(); this.inventory.remove(armor.getName()); } public void equipWeapon(Weapon weapon) { if (this.weapon != null) { this.inventory.put(this.weapon.getName(), this.weapon); } this.weapon = weapon; this.attackPower = weapon.getAttackPower(); this.inventory.remove(weapon.getName()); } @Override public void print() { super.print(); if (!this.alive) System.out.println("But now he's dead."); } }
4,720
0.616525
0.61483
168
27.101191
23.270828
110
false
false
0
0
0
0
0
0
0.494048
false
false
8
fff331641cb55b22dda3fa9141d9217fdf975cd1
6,906,307,458,978
2de58ba58e3cc8a354dded7524d9f1d071334caa
/src/com/gwt/hris/client/service/admin/projectinfo/BudgetResourcesGroupInterfaceAsync.java
8bc7eb9fd95f7141f1e672c0c3b862b945e51d1f
[]
no_license
achmadamri/hris
https://github.com/achmadamri/hris
cbc0b6f0e71c0870a3283b063ef651e891d42759
9e6ae118fe793682e301b3244b49f62ea21847f2
refs/heads/master
2022-06-28T13:24:52.674000
2022-06-15T16:25:56
2022-06-15T16:25:56
226,839,286
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gwt.hris.client.service.admin.projectinfo; import com.extjs.gxt.ui.client.data.PagingLoadConfig; import com.extjs.gxt.ui.client.data.PagingLoadResult; import com.google.gwt.user.client.rpc.AsyncCallback; import com.gwt.hris.client.service.bean.ReturnBean; import com.gwt.hris.client.service.bean.TbBudgetResourcesGroupBeanModel; public interface BudgetResourcesGroupInterfaceAsync { void submitBudgetResourcesGroup(TbBudgetResourcesGroupBeanModel TbBudgetResourcesGroupBeanModel, AsyncCallback<ReturnBean> callback); void getBudgetResourcesGroup(int tbesId, AsyncCallback<TbBudgetResourcesGroupBeanModel> callback); void deleteBudgetResourcesGroup(Integer tbesId, AsyncCallback<ReturnBean> callback); void deleteBulkBudgetResourcesGroup(Integer tbesIds[], AsyncCallback<ReturnBean> callback); void getBudgetResourcesGroupPaging(PagingLoadConfig config, String searchBy, String searchValue, AsyncCallback<PagingLoadResult<TbBudgetResourcesGroupBeanModel>> callback); }
UTF-8
Java
1,010
java
BudgetResourcesGroupInterfaceAsync.java
Java
[]
null
[]
package com.gwt.hris.client.service.admin.projectinfo; import com.extjs.gxt.ui.client.data.PagingLoadConfig; import com.extjs.gxt.ui.client.data.PagingLoadResult; import com.google.gwt.user.client.rpc.AsyncCallback; import com.gwt.hris.client.service.bean.ReturnBean; import com.gwt.hris.client.service.bean.TbBudgetResourcesGroupBeanModel; public interface BudgetResourcesGroupInterfaceAsync { void submitBudgetResourcesGroup(TbBudgetResourcesGroupBeanModel TbBudgetResourcesGroupBeanModel, AsyncCallback<ReturnBean> callback); void getBudgetResourcesGroup(int tbesId, AsyncCallback<TbBudgetResourcesGroupBeanModel> callback); void deleteBudgetResourcesGroup(Integer tbesId, AsyncCallback<ReturnBean> callback); void deleteBulkBudgetResourcesGroup(Integer tbesIds[], AsyncCallback<ReturnBean> callback); void getBudgetResourcesGroupPaging(PagingLoadConfig config, String searchBy, String searchValue, AsyncCallback<PagingLoadResult<TbBudgetResourcesGroupBeanModel>> callback); }
1,010
0.845545
0.845545
19
51.157894
48.926651
173
false
false
0
0
0
0
0
0
1.210526
false
false
8
e937bdfa323bcb7b328f781754d897fe7ca1ba9c
28,278,064,723,783
4b0022435c16bc0678fc911103263471e050d80b
/trunk/shop/src/main/java/com/framework/loippi/service/impl/activity/ShopActivityServiceImpl.java
9fb8b4f6da49e531506cf188542d894e6f9f47fa
[]
no_license
leanshi2018/b2c
https://github.com/leanshi2018/b2c
4cc92aa7d0fc9010277e37becb1e146f771510f7
039ee965d05e15f38374bf8b03ecea961a5a3463
refs/heads/master
2022-12-21T05:45:18.423000
2021-03-16T03:25:13
2021-03-16T03:25:13
196,949,258
3
3
null
false
2022-12-16T05:16:28
2019-07-15T07:40:36
2021-03-16T07:17:18
2022-12-16T05:16:24
8,036
2
2
35
Java
false
false
package com.framework.loippi.service.impl.activity; import lombok.extern.slf4j.Slf4j; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.framework.loippi.dao.activity.ShopActivityDao; import com.framework.loippi.dao.activity.ShopActivityGoodsDao; import com.framework.loippi.dao.activity.ShopActivityGoodsSpecDao; import com.framework.loippi.dao.activity.ShopActivityPromotionRuleDao; import com.framework.loippi.entity.activity.ShopActivity; import com.framework.loippi.entity.activity.ShopActivityPromotionRule; import com.framework.loippi.enus.ActivityRuleTypeEnus; import com.framework.loippi.enus.ActivityStatusTypeEnus; import com.framework.loippi.enus.ActivityTypeEnus; import com.framework.loippi.service.TwiterIdService; import com.framework.loippi.service.activity.ShopActivityService; import com.framework.loippi.service.impl.GenericServiceImpl; import com.framework.loippi.utils.Paramap; /** * 促销活动基本信息ServiceImpl * * @author kwg * @version 2016-09-01 */ @Service @Slf4j public class ShopActivityServiceImpl extends GenericServiceImpl<ShopActivity, Long> implements ShopActivityService { /** * 促销活动基本信息DAO接口 */ @Resource private ShopActivityDao shopActivityDao; @Resource private ShopActivityPromotionRuleDao shopActivityPromotionRuleDao; @Resource private ShopActivityGoodsDao shopActivityGoodsDao; @Resource private ShopActivityGoodsSpecDao shopActivityGoodsSpecDao; @Resource private TwiterIdService twiterIdService; /** * 通过id删除促销活动基本信息数据 * * @param id */ @Override public void deleteShopActivityById(Long id) { //删除商品相关信息 // activityObjectDao.deleteShopActivityObjectByActivityId(id); //删除活动基础数据 shopActivityDao.delete(id); shopActivityGoodsDao.deleteShopActivityGoodsByActivityId(id); shopActivityGoodsSpecDao.deleteShopActivityGoodsSpecByActivityId(id); //删除 优惠券与优化规则的绑定关系 // shopActivityPromotionRuleDao.deleteShopActivityPromotionRuleByActivityId(id); } //查询活动转map @Override public Map<Long, ShopActivity> findMapActivity(List<Long> idList) { if (idList.size() == 0) { return new HashMap<>(); } List<ShopActivity> shopActivities = shopActivityDao.findByParams(Paramap.create().put("ids", idList)); Map<Long, ShopActivity> shopActivityMap = new HashMap<>(); for (ShopActivity itemActivity : shopActivities) { shopActivityMap.put(itemActivity.getId(), itemActivity); } return shopActivityMap; } //更新活动开始状态 @Override public void updateShopActivityStartStatus(Long currentTime) { shopActivityDao.updateShopActivityStartStatus(currentTime); } //更新活动结束状态 @Override public void updateShopActivityEndStatus(Long currentTime) { shopActivityDao.updateShopActivityEndStatus(currentTime); } /** * 通过id提交审核 * * @param id */ @Override public void submitAudit(Long id) { ShopActivity shopActivity = shopActivityDao.find(id); List<ShopActivityPromotionRule> shopActivityPromotionRuleList = shopActivityPromotionRuleDao.findShopActivityPromotionRuleByActivityId(id); String activityType = ActivityTypeEnus.activitTypeEnumMap.get(shopActivity.getActivityType()); if (shopActivityPromotionRuleList.size() == 0 && ("manjian".equals(activityType) || "mansong".equals(activityType) || "coupon".equals(activityType) || "manmianyou".equals(activityType) || "tuangou".equals(activityType))) { throw new RuntimeException("请先添加活动规则"); } shopActivity.setAuditStatus(10); shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); } /** * 审核活动 * * @param id */ @Override public ShopActivity audit(Long id, Integer auditStatus) { ShopActivity shopActivity = shopActivityDao.find(id); if (shopActivity.getAuditStatus() == 10 && (auditStatus == 20 || auditStatus == 40)) { shopActivity.setAuditStatus(auditStatus); shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); } else { throw new RuntimeException("审核失败,该活动无法审核"); } return shopActivity; } /** * 获取店铺下面指定条件满即送条数 * * @param paramMap * @return */ @Override public int findByEndTimeCount(Map paramMap) { return shopActivityDao.findByEndTimeCount(paramMap); } //停止活动 public void stopShopActivityById(Long id) { shopActivityDao.stopShopActivityById(id); shopActivityGoodsDao.stopShopActivityGoodsByAcId(id); } /** * 管理员通过id提交发布信息 * * @param id */ @Override public void submitAuditByAdminFaBu(Long id) { ShopActivity shopActivity = shopActivityDao.find(id); List<ShopActivityPromotionRule> shopActivityPromotionRuleList = shopActivityPromotionRuleDao.findShopActivityPromotionRuleByActivityId(id); String activityType = ActivityTypeEnus.activitTypeEnumMap.get(shopActivity.getActivityType()); if (shopActivityPromotionRuleList.size() == 0 && ("manjian".equals(activityType) || "mansong".equals(activityType) || "coupon".equals(activityType) || "manmianyou".equals(activityType))) { throw new RuntimeException("请先添加活动规则"); } shopActivity.setAuditStatus(20); shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); } //批量更新活动审核状态 public void updateActivityBatch(Map<String, Object> map) { shopActivityDao.updateActivityBatch(map); } /** * 处理活动信息的保存 * * @param shopActivity * @param storeId * @param storeName * @param isSeller 识别商家与平台 true 平台 false商家 */ public Map<String, String> handleSaveActivity(ShopActivity shopActivity, String activityType, Long storeId, String storeName, boolean isSeller) { Map<String, String> resultMap = new HashMap<>(); resultMap.put("code", "0"); String errorMsg = ""; resultMap.put("msg", errorMsg); //活动状态 Date today = new Date(); if (today.before(shopActivity.getStartTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.unstarted.getValue()); } else if (today.before(shopActivity.getEndTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.inactivity.getValue()); } else { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.ended.getValue()); } //save or update if (shopActivity.getId() != null) { shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); if ("coupon".equals(activityType)) { //TODO 更新促销规则 ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.updateShopActivityPromotionRule(shopActivityPromotionRule); } } else { shopActivity.setId(twiterIdService.getTwiterId()); shopActivity.setCreateTime(new Date()); shopActivity.setUpdateTime(new Date()); // shopActivity.setPromotionRuleId(twiterIdService.getTwiterId()); shopActivityDao.insert(shopActivity); if ("coupon".equals(activityType)) { //添加促销规则 ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.saveShopActivityPromotionRule(shopActivityPromotionRule); } } // //处理秒杀、团购 // if (activityType.equals("tuangou") || activityType.equals("xianshiqiang")) { // // } // // //处理促销活动 // if (activityType.equals("zhuanchang")) { // // } // resultMap.put("code", "1"); return resultMap; } /** * 处理优惠券活动信息的保存 * * @param shopActivity * @param storeId * @param storeName * @param isSeller 识别商家与平台 true 平台 false商家 */ public Map<String, String> handleSaveCouponActivity(ShopActivity shopActivity, Long storeId, String storeName, boolean isSeller) { Map<String, String> resultMap = new HashMap<>(); resultMap.put("code", "0"); String errorMsg = ""; resultMap.put("msg", errorMsg); //活动状态 Date today = new Date(); if (today.before(shopActivity.getStartTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.unstarted.getValue()); } else if (today.before(shopActivity.getEndTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.inactivity.getValue()); } else { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.ended.getValue()); } //save or update if (shopActivity.getId() != null) { shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); //TODO 更新促销规则 /*ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.updateShopActivityPromotionRule(shopActivityPromotionRule);*/ } else { shopActivity.setId(twiterIdService.getTwiterId()); shopActivity.setCreateTime(new Date()); shopActivity.setUpdateTime(new Date()); // shopActivity.setPromotionRuleId(twiterIdService.getTwiterId()); shopActivityDao.insert(shopActivity); //添加促销规则 /*ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.saveShopActivityPromotionRule(shopActivityPromotionRule);*/ } resultMap.put("code", "1"); return resultMap; } @Override public List<ShopActivity> findErrorStatusData() { return shopActivityDao.findErrorStatusData(); } //获取正在进行中的活动 @Override public ShopActivity findInstanceActivity(Integer type, Long classId) { Map<String, Object> params = Paramap.create().put("activityClassId", classId) .put("activityType", type) .put("activityStatus", ActivityStatusTypeEnus.EnumType.inactivity.getValue()); List<ShopActivity> shopActivities = shopActivityDao.findByParams(params); if (shopActivities.size() == 0) { return null; } return shopActivities.get(0); } }
UTF-8
Java
14,690
java
ShopActivityServiceImpl.java
Java
[ { "context": "Paramap;\n\n/**\n * 促销活动基本信息ServiceImpl\n *\n * @author kwg\n * @version 2016-09-01\n */\n@Service\n@Slf4j\npublic", "end": 1085, "score": 0.9996218085289001, "start": 1082, "tag": "USERNAME", "value": "kwg" } ]
null
[]
package com.framework.loippi.service.impl.activity; import lombok.extern.slf4j.Slf4j; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.framework.loippi.dao.activity.ShopActivityDao; import com.framework.loippi.dao.activity.ShopActivityGoodsDao; import com.framework.loippi.dao.activity.ShopActivityGoodsSpecDao; import com.framework.loippi.dao.activity.ShopActivityPromotionRuleDao; import com.framework.loippi.entity.activity.ShopActivity; import com.framework.loippi.entity.activity.ShopActivityPromotionRule; import com.framework.loippi.enus.ActivityRuleTypeEnus; import com.framework.loippi.enus.ActivityStatusTypeEnus; import com.framework.loippi.enus.ActivityTypeEnus; import com.framework.loippi.service.TwiterIdService; import com.framework.loippi.service.activity.ShopActivityService; import com.framework.loippi.service.impl.GenericServiceImpl; import com.framework.loippi.utils.Paramap; /** * 促销活动基本信息ServiceImpl * * @author kwg * @version 2016-09-01 */ @Service @Slf4j public class ShopActivityServiceImpl extends GenericServiceImpl<ShopActivity, Long> implements ShopActivityService { /** * 促销活动基本信息DAO接口 */ @Resource private ShopActivityDao shopActivityDao; @Resource private ShopActivityPromotionRuleDao shopActivityPromotionRuleDao; @Resource private ShopActivityGoodsDao shopActivityGoodsDao; @Resource private ShopActivityGoodsSpecDao shopActivityGoodsSpecDao; @Resource private TwiterIdService twiterIdService; /** * 通过id删除促销活动基本信息数据 * * @param id */ @Override public void deleteShopActivityById(Long id) { //删除商品相关信息 // activityObjectDao.deleteShopActivityObjectByActivityId(id); //删除活动基础数据 shopActivityDao.delete(id); shopActivityGoodsDao.deleteShopActivityGoodsByActivityId(id); shopActivityGoodsSpecDao.deleteShopActivityGoodsSpecByActivityId(id); //删除 优惠券与优化规则的绑定关系 // shopActivityPromotionRuleDao.deleteShopActivityPromotionRuleByActivityId(id); } //查询活动转map @Override public Map<Long, ShopActivity> findMapActivity(List<Long> idList) { if (idList.size() == 0) { return new HashMap<>(); } List<ShopActivity> shopActivities = shopActivityDao.findByParams(Paramap.create().put("ids", idList)); Map<Long, ShopActivity> shopActivityMap = new HashMap<>(); for (ShopActivity itemActivity : shopActivities) { shopActivityMap.put(itemActivity.getId(), itemActivity); } return shopActivityMap; } //更新活动开始状态 @Override public void updateShopActivityStartStatus(Long currentTime) { shopActivityDao.updateShopActivityStartStatus(currentTime); } //更新活动结束状态 @Override public void updateShopActivityEndStatus(Long currentTime) { shopActivityDao.updateShopActivityEndStatus(currentTime); } /** * 通过id提交审核 * * @param id */ @Override public void submitAudit(Long id) { ShopActivity shopActivity = shopActivityDao.find(id); List<ShopActivityPromotionRule> shopActivityPromotionRuleList = shopActivityPromotionRuleDao.findShopActivityPromotionRuleByActivityId(id); String activityType = ActivityTypeEnus.activitTypeEnumMap.get(shopActivity.getActivityType()); if (shopActivityPromotionRuleList.size() == 0 && ("manjian".equals(activityType) || "mansong".equals(activityType) || "coupon".equals(activityType) || "manmianyou".equals(activityType) || "tuangou".equals(activityType))) { throw new RuntimeException("请先添加活动规则"); } shopActivity.setAuditStatus(10); shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); } /** * 审核活动 * * @param id */ @Override public ShopActivity audit(Long id, Integer auditStatus) { ShopActivity shopActivity = shopActivityDao.find(id); if (shopActivity.getAuditStatus() == 10 && (auditStatus == 20 || auditStatus == 40)) { shopActivity.setAuditStatus(auditStatus); shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); } else { throw new RuntimeException("审核失败,该活动无法审核"); } return shopActivity; } /** * 获取店铺下面指定条件满即送条数 * * @param paramMap * @return */ @Override public int findByEndTimeCount(Map paramMap) { return shopActivityDao.findByEndTimeCount(paramMap); } //停止活动 public void stopShopActivityById(Long id) { shopActivityDao.stopShopActivityById(id); shopActivityGoodsDao.stopShopActivityGoodsByAcId(id); } /** * 管理员通过id提交发布信息 * * @param id */ @Override public void submitAuditByAdminFaBu(Long id) { ShopActivity shopActivity = shopActivityDao.find(id); List<ShopActivityPromotionRule> shopActivityPromotionRuleList = shopActivityPromotionRuleDao.findShopActivityPromotionRuleByActivityId(id); String activityType = ActivityTypeEnus.activitTypeEnumMap.get(shopActivity.getActivityType()); if (shopActivityPromotionRuleList.size() == 0 && ("manjian".equals(activityType) || "mansong".equals(activityType) || "coupon".equals(activityType) || "manmianyou".equals(activityType))) { throw new RuntimeException("请先添加活动规则"); } shopActivity.setAuditStatus(20); shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); } //批量更新活动审核状态 public void updateActivityBatch(Map<String, Object> map) { shopActivityDao.updateActivityBatch(map); } /** * 处理活动信息的保存 * * @param shopActivity * @param storeId * @param storeName * @param isSeller 识别商家与平台 true 平台 false商家 */ public Map<String, String> handleSaveActivity(ShopActivity shopActivity, String activityType, Long storeId, String storeName, boolean isSeller) { Map<String, String> resultMap = new HashMap<>(); resultMap.put("code", "0"); String errorMsg = ""; resultMap.put("msg", errorMsg); //活动状态 Date today = new Date(); if (today.before(shopActivity.getStartTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.unstarted.getValue()); } else if (today.before(shopActivity.getEndTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.inactivity.getValue()); } else { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.ended.getValue()); } //save or update if (shopActivity.getId() != null) { shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); if ("coupon".equals(activityType)) { //TODO 更新促销规则 ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.updateShopActivityPromotionRule(shopActivityPromotionRule); } } else { shopActivity.setId(twiterIdService.getTwiterId()); shopActivity.setCreateTime(new Date()); shopActivity.setUpdateTime(new Date()); // shopActivity.setPromotionRuleId(twiterIdService.getTwiterId()); shopActivityDao.insert(shopActivity); if ("coupon".equals(activityType)) { //添加促销规则 ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.saveShopActivityPromotionRule(shopActivityPromotionRule); } } // //处理秒杀、团购 // if (activityType.equals("tuangou") || activityType.equals("xianshiqiang")) { // // } // // //处理促销活动 // if (activityType.equals("zhuanchang")) { // // } // resultMap.put("code", "1"); return resultMap; } /** * 处理优惠券活动信息的保存 * * @param shopActivity * @param storeId * @param storeName * @param isSeller 识别商家与平台 true 平台 false商家 */ public Map<String, String> handleSaveCouponActivity(ShopActivity shopActivity, Long storeId, String storeName, boolean isSeller) { Map<String, String> resultMap = new HashMap<>(); resultMap.put("code", "0"); String errorMsg = ""; resultMap.put("msg", errorMsg); //活动状态 Date today = new Date(); if (today.before(shopActivity.getStartTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.unstarted.getValue()); } else if (today.before(shopActivity.getEndTime())) { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.inactivity.getValue()); } else { shopActivity.setActivityStatus(ActivityStatusTypeEnus.EnumType.ended.getValue()); } //save or update if (shopActivity.getId() != null) { shopActivity.setUpdateTime(new Date()); shopActivityDao.update(shopActivity); //TODO 更新促销规则 /*ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.updateShopActivityPromotionRule(shopActivityPromotionRule);*/ } else { shopActivity.setId(twiterIdService.getTwiterId()); shopActivity.setCreateTime(new Date()); shopActivity.setUpdateTime(new Date()); // shopActivity.setPromotionRuleId(twiterIdService.getTwiterId()); shopActivityDao.insert(shopActivity); //添加促销规则 /*ShopActivityPromotionRule shopActivityPromotionRule = new ShopActivityPromotionRule(); shopActivityPromotionRule.setId(shopActivity.getPromotionRuleId()); shopActivityPromotionRule.setCouponSource(shopActivity.getCouponSource()); shopActivityPromotionRule.setLimitWhere(shopActivity.getLimitWhere()); Integer ruleType = shopActivity.getRuleType(); if (ruleType != null && ruleType == ActivityRuleTypeEnus.EnumType.manjian.getValue()) {//满减 shopActivityPromotionRule.setLimitType(10);//限制类型--购买金额10,购买数量20,无限制30 } else if (shopActivityPromotionRule != null && ruleType.intValue() == ActivityRuleTypeEnus.EnumType.zhekou.getValue()) { shopActivityPromotionRule.setLimitType(30); } shopActivityPromotionRule.setRuleType(ruleType); shopActivityPromotionRuleDao.saveShopActivityPromotionRule(shopActivityPromotionRule);*/ } resultMap.put("code", "1"); return resultMap; } @Override public List<ShopActivity> findErrorStatusData() { return shopActivityDao.findErrorStatusData(); } //获取正在进行中的活动 @Override public ShopActivity findInstanceActivity(Integer type, Long classId) { Map<String, Object> params = Paramap.create().put("activityClassId", classId) .put("activityType", type) .put("activityStatus", ActivityStatusTypeEnus.EnumType.inactivity.getValue()); List<ShopActivity> shopActivities = shopActivityDao.findByParams(params); if (shopActivities.size() == 0) { return null; } return shopActivities.get(0); } }
14,690
0.671298
0.66631
348
39.33046
36.82925
230
false
false
0
0
0
0
0
0
0.551724
false
false
8
9937f4375390ee71b56bb0cd4badda6e714254b4
15,719,580,339,028
b291010ea4bcb91b6625412c3486e6bd01e882fd
/src/main/java/ua/edu/ucu/tries/collections/immutable/ImmutableLinkedList.java
d7ebe598c80228bd2fe7b5b23f6cccae2373bf28
[]
no_license
kantsirsolomia/apps19kantsir-hw4
https://github.com/kantsirsolomia/apps19kantsir-hw4
fbad6f1043c238901b1aaf835fb220cab624470e
8633bdc6e5da6a0e1a10fe6317e6105d70fe6cd3
refs/heads/master
2021-08-03T19:11:13.497000
2019-11-25T12:17:55
2019-11-25T12:17:55
223,742,078
0
0
null
false
2020-10-13T17:42:21
2019-11-24T12:40:34
2019-11-25T12:18:04
2020-10-13T17:42:20
43
0
0
1
Java
false
false
package ua.edu.ucu.tries.collections.immutable; public class ImmutableLinkedList implements ImmutableList { public Node<Object> head; public Node<Object> tail; public int length; public ImmutableLinkedList() { this.head = null; this.tail = null; this.length = 0; } public ImmutableLinkedList(Node<Object> head, Node<Object> tail) { this.head = head; this.tail = tail; } public ImmutableLinkedList(Object[] elements) { head = new Node<>(elements[0]); Node<Object> curNode = head; for(int i = 1; i<elements.length;i++){ curNode.setNext(new Node<>(elements[i])); curNode = curNode.getNext(); } } public Node getHead(){ return head; } @Override public ImmutableLinkedList add(Object e) { return add(size(), e); } @Override public ImmutableLinkedList add(int index, Object e) { ImmutableLinkedList newInstance = newList(); newInstance.length =length; Node<Object> curNode = newInstance.head; if (index == 0) { newInstance.head = new Node<>(e); newInstance.head.setNext(curNode); newInstance.length++; } else { if (index > size()) { throw new IllegalArgumentException(); } for (int i = 0; i < (index - 1); i++) { curNode = curNode.getNext(); } Node<Object> previous = curNode; Node<Object> oldNext = previous.getNext(); previous.setNext(new Node<>(e)); Node<Object> a= previous.getNext(); a.setNext(oldNext); newInstance.length++; } return newInstance; } @Override public ImmutableLinkedList addAll(Object[] c) { return addAll(size(),c); } @Override public ImmutableLinkedList addAll(int index, Object[] c) { // додає масив елементів починаючи з з ImmutableLinkedList newInstance = newList(); if (newInstance.size() ==0){ newInstance.length =c.length; return new ImmutableLinkedList(c); } if (index>=(newInstance.length+1)){ throw new IllegalArgumentException(); } Node curNode = newInstance.head; if(index==0){ for(int i = 0;i<length;i++){ curNode = new Node(c[i]); curNode = curNode.getNext(); } } else { int i = 0; while (i != index - 1) { curNode = curNode.getNext(); i++; } Node<Object> oldNext = curNode.getNext(); int k = 0; while (k != c.length) { curNode.setNext(new Node(c[k])); curNode = curNode.getNext(); k++; } Node<Object> a = curNode.getNext(); curNode.setNext(oldNext); newInstance.length += c.length; } return newInstance; } public ImmutableLinkedList addFirst(Object e) { return add(0, e); } public ImmutableLinkedList addLast(Object e) { return add(e); } public Object getFirst() { return get(0); } public Object getLast() { return get(size() - 1); } public ImmutableLinkedList removeFirst() { return remove(0); } public ImmutableLinkedList removeLast() { return remove(size() - 1); } public int size() { int listSize = 0; Node<Object> current = head; while (current != null) { listSize++; current = current.getNext(); } return listSize; } public boolean isEmpty() { return head == null; } public Object get(int index) { //повертає елемент за індексом, та кидає виключну ситуацію, якщо індекс виходить за межі колекції int currentIndex = 0; Node<Object> cur = head; if (index <= size()) { while (index != currentIndex) { currentIndex++; cur = cur.getNext(); } return cur.getData(); } throw new IllegalArgumentException(); } @Override public ImmutableLinkedList remove(int index) { ImmutableLinkedList newInst = newList(); Node curNode = newInst.head; if(index==0){ newInst.head = curNode.getNext(); newInst.length--; return newInst; } for(int i = 1; i<newInst.length;i++){ if(i==index){ curNode.setNext(curNode.getNext().getNext()); newInst.length--; return newInst; } else{ curNode = curNode.getNext();} } throw new IllegalArgumentException(); } @Override public ImmutableLinkedList set(int index, Object e) { if (index >= size()) { throw new IllegalArgumentException(); } ImmutableLinkedList newInst = newList(); Node currentElem = newInst.head; for (int i = 0; i < newInst.length; i++) { if (index == i) { currentElem.setData(e); break; } currentElem = currentElem.getNext(); } return newInst; } public int indexOf(Object e) { //шукає індекс елемента (повертає індекс першого який знайшов, або -1 у випадку відсутності) int curIndex = 0; Node<Object> curNode = head; while (head != null) { if (curNode.getData().equals(e)) { return curIndex; } else { curIndex++; curNode = curNode.getNext(); } } return -1; } public ImmutableLinkedList clear() { return new ImmutableLinkedList(); } public ImmutableLinkedList newList() { ImmutableLinkedList newList = new ImmutableLinkedList(); if (size() == 0) { return newList; } newList.length = size(); newList.head = new Node(head.getData()); Node curNode = head.getNext(); Node newNode = newList.head; while(curNode!=null){ newNode.setNext(new Node(curNode.getData())); newNode = newNode.getNext(); curNode = curNode.getNext(); } return newList; } public Object[] toArray() { Object[] arr = new Object[size()]; Node<Object> curElement = head; int i = 0; while (i != size()) { arr[i] = curElement.getData(); curElement = curElement.getNext(); i++; } return arr; } public String toString() { String strList = ""; Node<Object> current = head; while (current != null) { strList += current.getData() + ", "; current = current.getNext(); } return strList; } public class Node<T> { public T data; public Node<T> next; public Node() { } public Node(T data) { this.data = data; } public Node(T data, Node<T> next) { this.data = data; this.next = next; } public T getData() { return data; } public void setData(T data) { this.data = data; } public Node<T> getNext() { return next; } public void setNext(Node<T> next) { this.next = next; } } }
UTF-8
Java
7,882
java
ImmutableLinkedList.java
Java
[]
null
[]
package ua.edu.ucu.tries.collections.immutable; public class ImmutableLinkedList implements ImmutableList { public Node<Object> head; public Node<Object> tail; public int length; public ImmutableLinkedList() { this.head = null; this.tail = null; this.length = 0; } public ImmutableLinkedList(Node<Object> head, Node<Object> tail) { this.head = head; this.tail = tail; } public ImmutableLinkedList(Object[] elements) { head = new Node<>(elements[0]); Node<Object> curNode = head; for(int i = 1; i<elements.length;i++){ curNode.setNext(new Node<>(elements[i])); curNode = curNode.getNext(); } } public Node getHead(){ return head; } @Override public ImmutableLinkedList add(Object e) { return add(size(), e); } @Override public ImmutableLinkedList add(int index, Object e) { ImmutableLinkedList newInstance = newList(); newInstance.length =length; Node<Object> curNode = newInstance.head; if (index == 0) { newInstance.head = new Node<>(e); newInstance.head.setNext(curNode); newInstance.length++; } else { if (index > size()) { throw new IllegalArgumentException(); } for (int i = 0; i < (index - 1); i++) { curNode = curNode.getNext(); } Node<Object> previous = curNode; Node<Object> oldNext = previous.getNext(); previous.setNext(new Node<>(e)); Node<Object> a= previous.getNext(); a.setNext(oldNext); newInstance.length++; } return newInstance; } @Override public ImmutableLinkedList addAll(Object[] c) { return addAll(size(),c); } @Override public ImmutableLinkedList addAll(int index, Object[] c) { // додає масив елементів починаючи з з ImmutableLinkedList newInstance = newList(); if (newInstance.size() ==0){ newInstance.length =c.length; return new ImmutableLinkedList(c); } if (index>=(newInstance.length+1)){ throw new IllegalArgumentException(); } Node curNode = newInstance.head; if(index==0){ for(int i = 0;i<length;i++){ curNode = new Node(c[i]); curNode = curNode.getNext(); } } else { int i = 0; while (i != index - 1) { curNode = curNode.getNext(); i++; } Node<Object> oldNext = curNode.getNext(); int k = 0; while (k != c.length) { curNode.setNext(new Node(c[k])); curNode = curNode.getNext(); k++; } Node<Object> a = curNode.getNext(); curNode.setNext(oldNext); newInstance.length += c.length; } return newInstance; } public ImmutableLinkedList addFirst(Object e) { return add(0, e); } public ImmutableLinkedList addLast(Object e) { return add(e); } public Object getFirst() { return get(0); } public Object getLast() { return get(size() - 1); } public ImmutableLinkedList removeFirst() { return remove(0); } public ImmutableLinkedList removeLast() { return remove(size() - 1); } public int size() { int listSize = 0; Node<Object> current = head; while (current != null) { listSize++; current = current.getNext(); } return listSize; } public boolean isEmpty() { return head == null; } public Object get(int index) { //повертає елемент за індексом, та кидає виключну ситуацію, якщо індекс виходить за межі колекції int currentIndex = 0; Node<Object> cur = head; if (index <= size()) { while (index != currentIndex) { currentIndex++; cur = cur.getNext(); } return cur.getData(); } throw new IllegalArgumentException(); } @Override public ImmutableLinkedList remove(int index) { ImmutableLinkedList newInst = newList(); Node curNode = newInst.head; if(index==0){ newInst.head = curNode.getNext(); newInst.length--; return newInst; } for(int i = 1; i<newInst.length;i++){ if(i==index){ curNode.setNext(curNode.getNext().getNext()); newInst.length--; return newInst; } else{ curNode = curNode.getNext();} } throw new IllegalArgumentException(); } @Override public ImmutableLinkedList set(int index, Object e) { if (index >= size()) { throw new IllegalArgumentException(); } ImmutableLinkedList newInst = newList(); Node currentElem = newInst.head; for (int i = 0; i < newInst.length; i++) { if (index == i) { currentElem.setData(e); break; } currentElem = currentElem.getNext(); } return newInst; } public int indexOf(Object e) { //шукає індекс елемента (повертає індекс першого який знайшов, або -1 у випадку відсутності) int curIndex = 0; Node<Object> curNode = head; while (head != null) { if (curNode.getData().equals(e)) { return curIndex; } else { curIndex++; curNode = curNode.getNext(); } } return -1; } public ImmutableLinkedList clear() { return new ImmutableLinkedList(); } public ImmutableLinkedList newList() { ImmutableLinkedList newList = new ImmutableLinkedList(); if (size() == 0) { return newList; } newList.length = size(); newList.head = new Node(head.getData()); Node curNode = head.getNext(); Node newNode = newList.head; while(curNode!=null){ newNode.setNext(new Node(curNode.getData())); newNode = newNode.getNext(); curNode = curNode.getNext(); } return newList; } public Object[] toArray() { Object[] arr = new Object[size()]; Node<Object> curElement = head; int i = 0; while (i != size()) { arr[i] = curElement.getData(); curElement = curElement.getNext(); i++; } return arr; } public String toString() { String strList = ""; Node<Object> current = head; while (current != null) { strList += current.getData() + ", "; current = current.getNext(); } return strList; } public class Node<T> { public T data; public Node<T> next; public Node() { } public Node(T data) { this.data = data; } public Node(T data, Node<T> next) { this.data = data; this.next = next; } public T getData() { return data; } public void setData(T data) { this.data = data; } public Node<T> getNext() { return next; } public void setNext(Node<T> next) { this.next = next; } } }
7,882
0.506429
0.502793
302
24.496689
20.13592
135
false
false
0
0
0
0
0
0
0.480132
false
false
8
9eb659b69e1d760f3dcc9589d24ed3dfd907fab5
26,843,545,640,593
e6e29fd45d24e23ef689f11d4101c16591e211db
/app/src/main/java/box/challenge/boxdeveloperchallenge/MainViewModel.java
4b8db88ad1e5320427d430d5b76883d5045791ad
[]
no_license
Virus1908/BoxDeveloperChallenge
https://github.com/Virus1908/BoxDeveloperChallenge
5d173cf053c2112b2c00fe9b10d6cf3485a96acf
ec50a272e62e10e9a824c7aad35b4899a6fd0208
refs/heads/master
2020-03-26T20:13:42.320000
2018-08-19T14:55:29
2018-08-19T14:55:29
145,311,925
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package box.challenge.boxdeveloperchallenge; import android.app.Application; import android.arch.lifecycle.AndroidViewModel; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.MutableLiveData; import android.support.annotation.NonNull; import android.text.TextUtils; import java.util.LinkedList; import java.util.List; import box.challenge.boxdeveloperchallenge.model.BoxColor; import box.challenge.boxdeveloperchallenge.model.BoxSize; import box.challenge.boxdeveloperchallenge.model.MainActivityError; import box.challenge.boxdeveloperchallenge.model.MainActivityEvent; import box.challenge.boxdeveloperchallenge.model.UserProfile; import box.challenge.boxdeveloperchallenge.network.NetworkCallback; import box.challenge.boxdeveloperchallenge.network.UserProfileApi; import box.challenge.boxdeveloperchallenge.tools.BoxProvider; import box.challenge.boxdeveloperchallenge.tools.ErrorParser; import box.challenge.boxdeveloperchallenge.tools.InputUtils; import box.challenge.boxdeveloperchallenge.tools.JsonTranslator; public class MainViewModel extends AndroidViewModel { private MutableLiveData<List<BoxColor>> boxColors; private MutableLiveData<MainActivityEvent> mainActivityEvent; private MutableLiveData<List<MainActivityError>> mainActivityErrors; private MutableLiveData<Boolean> isSignUpEnabled; private UserProfileApi userProfileApi; private ErrorParser errorParser; private BoxProvider boxProvider; public MainViewModel(@NonNull Application application) { super(application); boxColors = new MutableLiveData<>(); mainActivityEvent = new MutableLiveData<>(); mainActivityErrors = new MutableLiveData<>(); userProfileApi = new UserProfileApi(); errorParser = new ErrorParser(); isSignUpEnabled = new MutableLiveData<>(); isSignUpEnabled.setValue(true); boxProvider = new BoxProvider(); } public LiveData<MainActivityEvent> getMainActivityEvent() { return mainActivityEvent; } public LiveData<List<MainActivityError>> getMainActivityErrors() { return mainActivityErrors; } public LiveData<List<BoxColor>> getBoxColors() { return boxColors; } public LiveData<Boolean> getIsSignUpEnabled() { return isSignUpEnabled; } public BoxSize[] getBoxSizes() { return boxProvider.getAvailableBoxSizes(); } public void onBoxSizeSelected(int position) { boxColors.setValue(boxProvider.getBoxColorsForSelectedSize(getBoxSizes()[position].getId())); } public void onBoxSizeUnselected() { throw new IllegalStateException("box size can't be unselected"); } public void signUp(String name, String email, BoxSize boxSize, BoxColor boxColor, boolean printName) { UserProfile userProfile = new UserProfile(name, email, boxSize.getId(), boxColor.getId(), printName); if (!isProfileValid(userProfile)) { mainActivityErrors.setValue(getProfileErrors(userProfile)); return; } isSignUpEnabled.setValue(false); mainActivityEvent.setValue(MainActivityEvent.SHOW_PROGRESS_BAR); userProfileApi.signUp(JsonTranslator.userProfileToJson(userProfile), new NetworkCallback() { @Override public void onSuccess() { mainActivityEvent.setValue(MainActivityEvent.SUCCESSFUL_SIGN_UP); isSignUpEnabled.setValue(true); mainActivityEvent.setValue(MainActivityEvent.HIDE_PROGRESS_BAR); } @Override public void onFail(String message) { mainActivityEvent.setValue(MainActivityEvent.SIGN_UP_ERROR); mainActivityErrors.setValue(errorParser.parseSignUpError(message)); isSignUpEnabled.setValue(true); mainActivityEvent.setValue(MainActivityEvent.HIDE_PROGRESS_BAR); } }); } private boolean isProfileValid(UserProfile userProfile) { return !TextUtils.isEmpty(userProfile.getUserName()) && !TextUtils.isEmpty(userProfile.getEmail()) && InputUtils.isNameValid(userProfile.getUserName()) && InputUtils.isEmailValid(userProfile.getEmail()); } private List<MainActivityError> getProfileErrors(UserProfile userProfile) { List<MainActivityError> errors = new LinkedList<>(); if (TextUtils.isEmpty(userProfile.getUserName())) { errors.add(MainActivityError.MISSING_NAME); } else { if (!InputUtils.isNameValid(userProfile.getUserName())) { errors.add(MainActivityError.WRONG_NAME); } } if (TextUtils.isEmpty(userProfile.getEmail())) { errors.add(MainActivityError.MISSING_EMAIL); } else { if (!InputUtils.isEmailValid(userProfile.getEmail())) { errors.add(MainActivityError.WRONG_EMAIL); } } return errors; } }
UTF-8
Java
4,995
java
MainViewModel.java
Java
[]
null
[]
package box.challenge.boxdeveloperchallenge; import android.app.Application; import android.arch.lifecycle.AndroidViewModel; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.MutableLiveData; import android.support.annotation.NonNull; import android.text.TextUtils; import java.util.LinkedList; import java.util.List; import box.challenge.boxdeveloperchallenge.model.BoxColor; import box.challenge.boxdeveloperchallenge.model.BoxSize; import box.challenge.boxdeveloperchallenge.model.MainActivityError; import box.challenge.boxdeveloperchallenge.model.MainActivityEvent; import box.challenge.boxdeveloperchallenge.model.UserProfile; import box.challenge.boxdeveloperchallenge.network.NetworkCallback; import box.challenge.boxdeveloperchallenge.network.UserProfileApi; import box.challenge.boxdeveloperchallenge.tools.BoxProvider; import box.challenge.boxdeveloperchallenge.tools.ErrorParser; import box.challenge.boxdeveloperchallenge.tools.InputUtils; import box.challenge.boxdeveloperchallenge.tools.JsonTranslator; public class MainViewModel extends AndroidViewModel { private MutableLiveData<List<BoxColor>> boxColors; private MutableLiveData<MainActivityEvent> mainActivityEvent; private MutableLiveData<List<MainActivityError>> mainActivityErrors; private MutableLiveData<Boolean> isSignUpEnabled; private UserProfileApi userProfileApi; private ErrorParser errorParser; private BoxProvider boxProvider; public MainViewModel(@NonNull Application application) { super(application); boxColors = new MutableLiveData<>(); mainActivityEvent = new MutableLiveData<>(); mainActivityErrors = new MutableLiveData<>(); userProfileApi = new UserProfileApi(); errorParser = new ErrorParser(); isSignUpEnabled = new MutableLiveData<>(); isSignUpEnabled.setValue(true); boxProvider = new BoxProvider(); } public LiveData<MainActivityEvent> getMainActivityEvent() { return mainActivityEvent; } public LiveData<List<MainActivityError>> getMainActivityErrors() { return mainActivityErrors; } public LiveData<List<BoxColor>> getBoxColors() { return boxColors; } public LiveData<Boolean> getIsSignUpEnabled() { return isSignUpEnabled; } public BoxSize[] getBoxSizes() { return boxProvider.getAvailableBoxSizes(); } public void onBoxSizeSelected(int position) { boxColors.setValue(boxProvider.getBoxColorsForSelectedSize(getBoxSizes()[position].getId())); } public void onBoxSizeUnselected() { throw new IllegalStateException("box size can't be unselected"); } public void signUp(String name, String email, BoxSize boxSize, BoxColor boxColor, boolean printName) { UserProfile userProfile = new UserProfile(name, email, boxSize.getId(), boxColor.getId(), printName); if (!isProfileValid(userProfile)) { mainActivityErrors.setValue(getProfileErrors(userProfile)); return; } isSignUpEnabled.setValue(false); mainActivityEvent.setValue(MainActivityEvent.SHOW_PROGRESS_BAR); userProfileApi.signUp(JsonTranslator.userProfileToJson(userProfile), new NetworkCallback() { @Override public void onSuccess() { mainActivityEvent.setValue(MainActivityEvent.SUCCESSFUL_SIGN_UP); isSignUpEnabled.setValue(true); mainActivityEvent.setValue(MainActivityEvent.HIDE_PROGRESS_BAR); } @Override public void onFail(String message) { mainActivityEvent.setValue(MainActivityEvent.SIGN_UP_ERROR); mainActivityErrors.setValue(errorParser.parseSignUpError(message)); isSignUpEnabled.setValue(true); mainActivityEvent.setValue(MainActivityEvent.HIDE_PROGRESS_BAR); } }); } private boolean isProfileValid(UserProfile userProfile) { return !TextUtils.isEmpty(userProfile.getUserName()) && !TextUtils.isEmpty(userProfile.getEmail()) && InputUtils.isNameValid(userProfile.getUserName()) && InputUtils.isEmailValid(userProfile.getEmail()); } private List<MainActivityError> getProfileErrors(UserProfile userProfile) { List<MainActivityError> errors = new LinkedList<>(); if (TextUtils.isEmpty(userProfile.getUserName())) { errors.add(MainActivityError.MISSING_NAME); } else { if (!InputUtils.isNameValid(userProfile.getUserName())) { errors.add(MainActivityError.WRONG_NAME); } } if (TextUtils.isEmpty(userProfile.getEmail())) { errors.add(MainActivityError.MISSING_EMAIL); } else { if (!InputUtils.isEmailValid(userProfile.getEmail())) { errors.add(MainActivityError.WRONG_EMAIL); } } return errors; } }
4,995
0.710911
0.710911
125
38.959999
29.537609
120
false
false
0
0
0
0
0
0
0.576
false
false
8
5ae7cf5fbed9af4f47a9ff4a426fc46e8e8ab79c
26,345,329,437,850
b882c548d6ed73d2e70d690381f06ab44d3e7daf
/src/main/java/nht/els/service/TwitterSentimentService.java
10f35480d39d514669de4de74aab46221dd89d9c
[]
no_license
nhthai2207/TwitterElasticRiver
https://github.com/nhthai2207/TwitterElasticRiver
877e6b53a5627a5519f75b5f85b47408675d7e89
1562f3148b38a509e0ed1b6ba30afe4eda1d1888
refs/heads/master
2021-09-28T06:20:32.100000
2014-10-30T17:39:31
2014-10-30T17:39:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nht.els.service; public interface TwitterSentimentService { void updateUnFinishTwitter(); }
UTF-8
Java
104
java
TwitterSentimentService.java
Java
[]
null
[]
package nht.els.service; public interface TwitterSentimentService { void updateUnFinishTwitter(); }
104
0.798077
0.798077
7
13.857142
16.461458
42
false
false
0
0
0
0
0
0
0.428571
false
false
8
785ec9e50afa45fa1687f575442b5de82d79cd06
15,676,630,679,520
76ea972c52e16fb3ad1b872e6792ac38ea78c766
/src/main/java/com/exam/service/impl/StudentServiceImpl.java
30a68fa40dbe6ba41da4f676a83973be0939dfbf
[]
no_license
Cqc1/cqcExam
https://github.com/Cqc1/cqcExam
467b364f8410a6b489dc186e0cffed80ad859e88
895ca2725d1073b29c2d83472955790f2d4476bc
refs/heads/master
2021-04-18T01:30:04.233000
2020-05-29T10:07:08
2020-05-29T10:07:08
249,493,200
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.exam.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.exam.dao.StudentDao; import com.exam.entity.Student; import com.exam.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * (Student)表服务实现类 * * @author chenqiancheng * @since 2020-03-12 20:53:27 */ @Service public class StudentServiceImpl implements StudentService { @Autowired private StudentDao studentDao; @Override public List<Student> findByName(String studentName) { return studentDao.findByName(studentName); } @Override public IPage<Student> findAll(Page page) { return studentDao.findAll(page); } @Override public List<Student> selectAll() { return studentDao.findAll(); } @Override public Student queryById(Integer studentid) { return studentDao.queryById(studentid); } @Override public List<Student> queryByClazzId(Integer clazzid) { return studentDao.queryByClazzId(clazzid); } @Override public List<Student> queryAllByLimit(int offset, int limit) { return studentDao.queryAllByLimit(offset, limit); } @Override public int insert(Student student) { return studentDao.insert(student); } @Override public int update(Student student) { return studentDao.update(student); } @Override public int updatePwd(Student student) { return studentDao.updatePwd(student); } @Override public int deleteById(Integer studentid) { return studentDao.deleteById(studentid); } }
UTF-8
Java
1,778
java
StudentServiceImpl.java
Java
[ { "context": "a.util.List;\n\n/**\n * (Student)表服务实现类\n *\n * @author chenqiancheng\n * @since 2020-03-12 20:53:27\n */\n@Service\npublic", "end": 441, "score": 0.994679868221283, "start": 428, "tag": "USERNAME", "value": "chenqiancheng" } ]
null
[]
package com.exam.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.exam.dao.StudentDao; import com.exam.entity.Student; import com.exam.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * (Student)表服务实现类 * * @author chenqiancheng * @since 2020-03-12 20:53:27 */ @Service public class StudentServiceImpl implements StudentService { @Autowired private StudentDao studentDao; @Override public List<Student> findByName(String studentName) { return studentDao.findByName(studentName); } @Override public IPage<Student> findAll(Page page) { return studentDao.findAll(page); } @Override public List<Student> selectAll() { return studentDao.findAll(); } @Override public Student queryById(Integer studentid) { return studentDao.queryById(studentid); } @Override public List<Student> queryByClazzId(Integer clazzid) { return studentDao.queryByClazzId(clazzid); } @Override public List<Student> queryAllByLimit(int offset, int limit) { return studentDao.queryAllByLimit(offset, limit); } @Override public int insert(Student student) { return studentDao.insert(student); } @Override public int update(Student student) { return studentDao.update(student); } @Override public int updatePwd(Student student) { return studentDao.updatePwd(student); } @Override public int deleteById(Integer studentid) { return studentDao.deleteById(studentid); } }
1,778
0.702152
0.694224
74
22.878378
21.082176
66
false
false
0
0
0
0
0
0
0.297297
false
false
8
35c6cc33e2113fdb94b571e6e0d0ccb9a212e90c
25,494,925,931,236
2f4a058ab684068be5af77fea0bf07665b675ac0
/app/com/facebook/graphql/GraphQlQueryRecommendedApplicationsFeedUnit.java
088f3892d52eca424fcd4dce800b242d5a6993f2
[]
no_license
cengizgoren/facebook_apk_crack
https://github.com/cengizgoren/facebook_apk_crack
ee812a57c746df3c28fb1f9263ae77190f08d8d2
a112d30542b9f0bfcf17de0b3a09c6e6cfe1273b
refs/heads/master
2021-05-26T14:44:04.092000
2013-01-16T08:39:00
2013-01-16T08:39:00
8,321,708
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.facebook.graphql; public final class GraphQlQueryRecommendedApplicationsFeedUnit extends GraphQlQueryBaseObjectImpl implements GraphQlQueryItemListFeedUnit { } /* Location: /data1/software/jd-gui/com.facebook.katana_2.0_liqucn.com-dex2jar.jar * Qualified Name: com.facebook.graphql.GraphQlQueryRecommendedApplicationsFeedUnit * JD-Core Version: 0.6.0 */
UTF-8
Java
389
java
GraphQlQueryRecommendedApplicationsFeedUnit.java
Java
[]
null
[]
package com.facebook.graphql; public final class GraphQlQueryRecommendedApplicationsFeedUnit extends GraphQlQueryBaseObjectImpl implements GraphQlQueryItemListFeedUnit { } /* Location: /data1/software/jd-gui/com.facebook.katana_2.0_liqucn.com-dex2jar.jar * Qualified Name: com.facebook.graphql.GraphQlQueryRecommendedApplicationsFeedUnit * JD-Core Version: 0.6.0 */
389
0.794344
0.77635
11
34.454544
37.78014
97
false
false
0
0
0
0
0
0
0.090909
false
false
8
2914ec0e635fc5691fdd8c76c304feb5b73d999f
23,167,053,647,409
9a245c5e1853a9928f3ecdc016c03c81bbab855c
/src/main/java/com/example/TcApp/dao/CmaRepository.java
1b3401f843f552191260c6557d39659b155196b3
[]
no_license
KhansaH/TransactionCoordinator
https://github.com/KhansaH/TransactionCoordinator
c5825dbdf588b0ccdd5e88efac109bf85428142b
64e577bd88b95036a14cf2e5852d22c2524b997c
refs/heads/master
2020-03-09T15:19:36.730000
2018-04-10T01:51:32
2018-04-10T01:51:32
128,856,130
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.TcApp.dao; import org.springframework.data.jpa.repository.JpaRepository; import com.example.TcApp.entities.Cma; public interface CmaRepository extends JpaRepository<Cma, Integer>{ }
UTF-8
Java
207
java
CmaRepository.java
Java
[]
null
[]
package com.example.TcApp.dao; import org.springframework.data.jpa.repository.JpaRepository; import com.example.TcApp.entities.Cma; public interface CmaRepository extends JpaRepository<Cma, Integer>{ }
207
0.816425
0.816425
9
22
26.528811
68
false
false
0
0
0
0
0
0
0.444444
false
false
8
44ace86f8736c6987a12f78f3593aee80f422a66
19,043,885,048,610
b1c84c6ef478e3bb5ad2a1d742ea5b029498fac2
/test/de/jbee/spider/test/Missing.java
eeca1adcd3f40a68366cf5ad1524ec5d31295c24
[]
no_license
jbee/spider
https://github.com/jbee/spider
61dc7ddee1195591f6b75c8287611a5633bfe33d
7a0bc5b9479f06d640307415c1e3e7cb1d2de685
refs/heads/master
2016-09-05T23:48:49.092000
2013-09-22T15:11:51
2013-09-22T15:11:51
2,499,106
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.jbee.spider.test; public class Missing { }
UTF-8
Java
56
java
Missing.java
Java
[]
null
[]
package de.jbee.spider.test; public class Missing { }
56
0.732143
0.732143
5
10.2
12.237647
28
false
false
0
0
0
0
0
0
0.2
false
false
8