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
sequence
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
sequence
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
022b17ebf716944dc6e49481c940a504052ef1e3
2,138,893,727,689
d2eae5c36e4fee8ef73e698c708f523f90e77441
/src/main/java/me/bluper/cavehopper/entity/EntityPos.java
d59ea488949172648c7bf0893d7bec26beeb5f4d
[]
no_license
Blooperman949/Cavehopper
https://github.com/Blooperman949/Cavehopper
88409740afba1ce09b290f25fcbc490cad1a2488
4b3d84f86caae81ffa1ba75995a57ab851fe8c19
refs/heads/main
2023-07-19T16:43:37.780000
2021-09-21T21:07:15
2021-09-21T21:07:15
349,568,755
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.bluper.cavehopper.entity; //import com.sun.javafx.geom.Vec2f; // //import me.bluper.cavehopper.level.BlockPos; // public class EntityPos //extends Vec2f { // public EntityPos(float x, float y) // { // this.x = x; // this.y = y; // } // // public EntityPos() // { // this(0, 0); // } // // public Vec2f getPosOnScreen(int w, int h, float orX, float orY, int res) // { // return new Vec2f(getXYOnScreen(this.x, w, orX, res), getXYOnScreen(this.y, h, orY, res)); // } // // public static float getXYOnScreen(float xy, int wh, float orXY, int res) // { // return ((xy - orXY) * res + wh/2); // } // // public EntityPos offset(float x, float y) // { // return new EntityPos(this.x + x, this.y + y); // } // // public BlockPos getBlockPos() // { // return new BlockPos((int) Math.floor(this.x), (int) Math.floor(this.y)); // } }
UTF-8
Java
886
java
EntityPos.java
Java
[]
null
[]
package me.bluper.cavehopper.entity; //import com.sun.javafx.geom.Vec2f; // //import me.bluper.cavehopper.level.BlockPos; // public class EntityPos //extends Vec2f { // public EntityPos(float x, float y) // { // this.x = x; // this.y = y; // } // // public EntityPos() // { // this(0, 0); // } // // public Vec2f getPosOnScreen(int w, int h, float orX, float orY, int res) // { // return new Vec2f(getXYOnScreen(this.x, w, orX, res), getXYOnScreen(this.y, h, orY, res)); // } // // public static float getXYOnScreen(float xy, int wh, float orXY, int res) // { // return ((xy - orXY) * res + wh/2); // } // // public EntityPos offset(float x, float y) // { // return new EntityPos(this.x + x, this.y + y); // } // // public BlockPos getBlockPos() // { // return new BlockPos((int) Math.floor(this.x), (int) Math.floor(this.y)); // } }
886
0.586907
0.579007
39
20.717949
25.044523
93
false
false
0
0
0
0
0
0
1.692308
false
false
14
0df0c39fd3e0ef1eeec6b5b56813754de70e0cc0
103,079,229,484
eacc685b7a13b0a5b5f151adf62324325b6978f4
/object-orientation-basic-3/src/object/orientation/basic/Secretary.java
67f21563732c44d227d7a877e117bb5def6c7b7f
[]
no_license
DiegoAndreColli/object-orientation-basic-3
https://github.com/DiegoAndreColli/object-orientation-basic-3
614ce514d18908bc47689c60f43afd9309f2e719
e625c993a36e8d650d2f77d85a1ab9f862caa76f
refs/heads/master
2021-05-10T17:25:56.846000
2018-03-09T18:04:59
2018-03-09T18:04:59
118,609,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package object.orientation.basic; /** * * @author User */ public class Secretary extends Employee { @Override public Double getBonus() { return this.salary * 0.15; } }
UTF-8
Java
194
java
Secretary.java
Java
[ { "context": "ckage object.orientation.basic;\n\n/**\n *\n * @author User\n */\npublic class Secretary extends Employee {\n\n ", "end": 57, "score": 0.6005923748016357, "start": 53, "tag": "USERNAME", "value": "User" } ]
null
[]
package object.orientation.basic; /** * * @author User */ public class Secretary extends Employee { @Override public Double getBonus() { return this.salary * 0.15; } }
194
0.623711
0.608247
14
12.857142
14.525137
41
false
false
0
0
0
0
0
0
0.142857
false
false
14
24e2ee201abd9d2850a6e1ed26346ee69945fd82
197,568,515,198
d61b4871ed778b5a7df932ea47a493eff886c18c
/71. Simplify Path.java
04d4fc4522853525bdc5010f261f16b7fc151181
[]
no_license
Laura1112/YanGu
https://github.com/Laura1112/YanGu
065d53b490650ce36f6cd2378cf6589e0c852742
cfb2c3888f11d9041538f04a445053906749de4f
refs/heads/master
2021-01-21T10:05:02.894000
2017-03-31T08:24:10
2017-03-31T08:24:10
83,374,879
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Stack; //题意:简化文件路径,如:gy/Laura/.././px/...//Alan/ ->/gy/px/.../Alan, /.. -> /, /. ->/ //去掉开头的'/',结尾处加上'/',然后遍历path,遇到'/'的时候就对这个子串做处理,具体如下 //最后在堆栈中一个一个取出子串,连成最终的结果,并对一些特殊情况做处理 public class Solution { public String simplifyPath(String path) { if(path.length()==0) return "/"; if(path.charAt(0)=='/'&&path.length()>1) path = path.substring(1,path.length()); if(path.charAt(path.length()-1)!='/') path = path+'/'; char[] ch = path.toCharArray(); Stack<StringBuilder> s = new Stack<>(); StringBuilder tmp = new StringBuilder(); int len = path.length(); for(int i=0;i<len;i++){ tmp.append(ch[i]); if(ch[i]=='/'){ switch(tmp.toString()){ case "./": break; case "/": break; case "../": if(!s.isEmpty()) s.pop(); break; default: s.push(tmp); } tmp = new StringBuilder(); } } String rst = ""; while(!s.isEmpty()) rst = s.pop().toString()+rst; //特殊情况 if(rst.equals("")) rst = "/"; else rst = '/'+rst; if(rst.length()>1) rst = rst.substring(0,rst.length()-1); return rst; } }
UTF-8
Java
1,695
java
71. Simplify Path.java
Java
[]
null
[]
import java.util.Stack; //题意:简化文件路径,如:gy/Laura/.././px/...//Alan/ ->/gy/px/.../Alan, /.. -> /, /. ->/ //去掉开头的'/',结尾处加上'/',然后遍历path,遇到'/'的时候就对这个子串做处理,具体如下 //最后在堆栈中一个一个取出子串,连成最终的结果,并对一些特殊情况做处理 public class Solution { public String simplifyPath(String path) { if(path.length()==0) return "/"; if(path.charAt(0)=='/'&&path.length()>1) path = path.substring(1,path.length()); if(path.charAt(path.length()-1)!='/') path = path+'/'; char[] ch = path.toCharArray(); Stack<StringBuilder> s = new Stack<>(); StringBuilder tmp = new StringBuilder(); int len = path.length(); for(int i=0;i<len;i++){ tmp.append(ch[i]); if(ch[i]=='/'){ switch(tmp.toString()){ case "./": break; case "/": break; case "../": if(!s.isEmpty()) s.pop(); break; default: s.push(tmp); } tmp = new StringBuilder(); } } String rst = ""; while(!s.isEmpty()) rst = s.pop().toString()+rst; //特殊情况 if(rst.equals("")) rst = "/"; else rst = '/'+rst; if(rst.length()>1) rst = rst.substring(0,rst.length()-1); return rst; } }
1,695
0.396721
0.39082
49
29.163265
15.062247
77
false
false
0
0
0
0
0
0
0.734694
false
false
14
51fbd3f35b0d415de2fe9a8dcca4dbfd1c3017eb
24,524,263,275,546
22bff10f70ddbe1e8e6a2ef2d3d4272c15b010ed
/src/proxy/news/MainClass.java
9d73b282d36641bc1099708630676f8ab37fac6a
[]
no_license
yydsyzc/design
https://github.com/yydsyzc/design
95a1621c65d065a39d211c86269ff9707aa87007
e1e47a020a2866f3a924817162ac8bd2cca484c1
refs/heads/master
2021-09-21T09:53:09.820000
2018-08-24T03:49:52
2018-08-24T03:49:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package proxy.news; import java.lang.reflect.Proxy; /** * Created with IntelliJ IDEA. * Description: * * @Author: yangzhicheng * @Date: 2018/8/1 15:20 */ public class MainClass { public static void main(String[] args) { RealSubject realSubject=new RealSubject(); MyHandler myHandler=new MyHandler(); myHandler.setRealSubject(realSubject); Subject subject =(Subject) Proxy.newProxyInstance(RealSubject.class.getClassLoader(), realSubject.getClass().getInterfaces(), myHandler); subject.sailBook(); } }
UTF-8
Java
570
java
MainClass.java
Java
[ { "context": "with IntelliJ IDEA.\n * Description:\n *\n * @Author: yangzhicheng\n * @Date: 2018/8/1 15:20\n */\npublic class MainCla", "end": 132, "score": 0.8460743427276611, "start": 120, "tag": "USERNAME", "value": "yangzhicheng" } ]
null
[]
package proxy.news; import java.lang.reflect.Proxy; /** * Created with IntelliJ IDEA. * Description: * * @Author: yangzhicheng * @Date: 2018/8/1 15:20 */ public class MainClass { public static void main(String[] args) { RealSubject realSubject=new RealSubject(); MyHandler myHandler=new MyHandler(); myHandler.setRealSubject(realSubject); Subject subject =(Subject) Proxy.newProxyInstance(RealSubject.class.getClassLoader(), realSubject.getClass().getInterfaces(), myHandler); subject.sailBook(); } }
570
0.677193
0.659649
26
20.923077
30.262852
146
false
false
0
0
0
0
0
0
0.346154
false
false
14
95743f5b5294b1fee381bf1ff2225e3eb02f4de7
27,839,978,053,079
d3af994bc1b305a55be3e12535fd2cb4d00ab522
/src/main/java/com/simbest/boot/wxma/security/WxmaMiniAuthenticationProvider.java
63d7724e436fe056c07da1fd4daa744d736bdd71
[ "Apache-2.0" ]
permissive
simbest/simbest-boot-wxma
https://github.com/simbest/simbest-boot-wxma
8ec41992e7eca692ebe3d46e09f028097cda3db6
38c04bf01823d3fb4019e858ad5ac3b3c8de6fcb
refs/heads/master
2020-06-27T12:23:25.173000
2020-06-08T04:01:14
2020-06-08T04:01:14
199,954,217
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 版权所有 © 北京晟壁科技有限公司 2008-2027。保留一切权利! */ package com.simbest.boot.wxma.security; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import com.simbest.boot.constants.ApplicationConstants; import com.simbest.boot.security.IAuthService; import com.simbest.boot.security.IUser; import com.simbest.boot.security.auth.authentication.SsoUsernameAuthentication; import com.simbest.boot.security.auth.authentication.principal.KeyTypePrincipal; import com.simbest.boot.security.auth.authentication.wxma.WxmaAuthenticationCredentials; import com.simbest.boot.security.auth.authentication.wxma.WxmaMiniAuthenticationToken; import com.simbest.boot.security.auth.provider.CustomAbstractAuthenticationProvider; import com.simbest.boot.security.auth.provider.GenericAuthenticationChecker; import com.simbest.boot.wxma.wechat.config.WxMaConfiguration; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; import java.security.Principal; import static com.simbest.boot.security.auth.oauth2.CustomOauthException.OAUTH2_LOGIN_ERROR; import static com.simbest.boot.security.auth.oauth2.CustomOauthException.OAUTH2_MINI_ERROR; /** * 用途:微信小程序认证提供者 * 作者: lishuyi * 时间: 2018/8/2 22:48 */ @Slf4j @Component public class WxmaMiniAuthenticationProvider implements CustomAbstractAuthenticationProvider { @Autowired private IAuthService authService; @Autowired private GenericAuthenticationChecker genericAuthenticationChecker; /** * 抛出的异常将在WxmaMiniTokenGranter进行处理 * @param authentication * @return * @throws AuthenticationException */ @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String appid = authentication.getPrincipal().toString(); WxmaAuthenticationCredentials credentials = (WxmaAuthenticationCredentials) authentication.getCredentials(); log.debug("历史用户使用微信Code【{}】获取身份信息", credentials.getWxcode()); WxMaService wxService = null; WxMaJscode2SessionResult wxSession = null; WxMaPhoneNumberInfo phoneNoInfo = null; try { wxService = WxMaConfiguration.getMaService(appid); wxSession = wxService.getUserService().getSessionInfo(credentials.getWxcode()); } catch (WxErrorException wxe) { log.error("通过code读取用户session时,微信服务器通讯异常,异常信息如下:【{}】", wxe.getMessage()); throw new BadCredentialsException("微信服务器通讯异常".concat(ApplicationConstants.VERTICAL).concat(OAUTH2_LOGIN_ERROR)); } // 解密用户信息 try{ phoneNoInfo = wxService.getUserService().getPhoneNoInfo(wxSession.getSessionKey(), credentials.getEncryptedData(), credentials.getIv()); } catch (Exception e) { log.error("解析微信用户信息异常【{}】", e.getMessage()); throw new BadCredentialsException("解析微信用户信息异常".concat(ApplicationConstants.VERTICAL).concat(OAUTH2_LOGIN_ERROR)); } IUser iUser = authService.findByKey(phoneNoInfo.getPurePhoneNumber(), IAuthService.KeyType.preferredMobile); if(null == iUser) { if(!credentials.getForceCreate()) { throw new BadCredentialsException("微信手机号码未登记".concat(ApplicationConstants.VERTICAL).concat(OAUTH2_MINI_ERROR)); } }else{ //绑定用户手机号和openid authService.updateUserOpenidAndUnionid(phoneNoInfo.getPurePhoneNumber(), wxSession.getOpenid(), wxSession.getUnionid(), credentials.getAppcode()); } //通过openid或者unionid构建Principal到框架进行统一认证 // Principal principal; // if(StringUtils.isNotEmpty(wxSession.getUnionid())){ // principal = KeyTypePrincipal.builder().keyword(wxSession.getUnionid()).keyType(IAuthService.KeyType.unionid).build(); // } else { // principal = KeyTypePrincipal.builder().keyword(wxSession.getOpenid()).keyType(IAuthService.KeyType.openid).build(); // } //通过preferredMobile构建Principal到框架进行统一认证 Principal principal = KeyTypePrincipal.builder().keyword(phoneNoInfo.getPurePhoneNumber()).keyType(IAuthService.KeyType.preferredMobile).build(); SsoUsernameAuthentication ssoUsernameAuthentication = new SsoUsernameAuthentication(principal, credentials.getAppcode()); ssoUsernameAuthentication.setDetails(wxSession); return genericAuthenticationChecker.authChek(ssoUsernameAuthentication, credentials.getAppcode()); } @Override public boolean supports(Class<?> authentication) { return authentication.equals(WxmaMiniAuthenticationToken.class); } }
UTF-8
Java
5,383
java
WxmaMiniAuthenticationProvider.java
Java
[ { "context": "on.OAUTH2_MINI_ERROR;\n\n/**\n * 用途:微信小程序认证提供者\n * 作者: lishuyi\n * 时间: 2018/8/2 22:48\n */\n@Slf4j\n@Component\npubl", "end": 1617, "score": 0.9993909001350403, "start": 1610, "tag": "USERNAME", "value": "lishuyi" } ]
null
[]
/* * 版权所有 © 北京晟壁科技有限公司 2008-2027。保留一切权利! */ package com.simbest.boot.wxma.security; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import com.simbest.boot.constants.ApplicationConstants; import com.simbest.boot.security.IAuthService; import com.simbest.boot.security.IUser; import com.simbest.boot.security.auth.authentication.SsoUsernameAuthentication; import com.simbest.boot.security.auth.authentication.principal.KeyTypePrincipal; import com.simbest.boot.security.auth.authentication.wxma.WxmaAuthenticationCredentials; import com.simbest.boot.security.auth.authentication.wxma.WxmaMiniAuthenticationToken; import com.simbest.boot.security.auth.provider.CustomAbstractAuthenticationProvider; import com.simbest.boot.security.auth.provider.GenericAuthenticationChecker; import com.simbest.boot.wxma.wechat.config.WxMaConfiguration; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; import java.security.Principal; import static com.simbest.boot.security.auth.oauth2.CustomOauthException.OAUTH2_LOGIN_ERROR; import static com.simbest.boot.security.auth.oauth2.CustomOauthException.OAUTH2_MINI_ERROR; /** * 用途:微信小程序认证提供者 * 作者: lishuyi * 时间: 2018/8/2 22:48 */ @Slf4j @Component public class WxmaMiniAuthenticationProvider implements CustomAbstractAuthenticationProvider { @Autowired private IAuthService authService; @Autowired private GenericAuthenticationChecker genericAuthenticationChecker; /** * 抛出的异常将在WxmaMiniTokenGranter进行处理 * @param authentication * @return * @throws AuthenticationException */ @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String appid = authentication.getPrincipal().toString(); WxmaAuthenticationCredentials credentials = (WxmaAuthenticationCredentials) authentication.getCredentials(); log.debug("历史用户使用微信Code【{}】获取身份信息", credentials.getWxcode()); WxMaService wxService = null; WxMaJscode2SessionResult wxSession = null; WxMaPhoneNumberInfo phoneNoInfo = null; try { wxService = WxMaConfiguration.getMaService(appid); wxSession = wxService.getUserService().getSessionInfo(credentials.getWxcode()); } catch (WxErrorException wxe) { log.error("通过code读取用户session时,微信服务器通讯异常,异常信息如下:【{}】", wxe.getMessage()); throw new BadCredentialsException("微信服务器通讯异常".concat(ApplicationConstants.VERTICAL).concat(OAUTH2_LOGIN_ERROR)); } // 解密用户信息 try{ phoneNoInfo = wxService.getUserService().getPhoneNoInfo(wxSession.getSessionKey(), credentials.getEncryptedData(), credentials.getIv()); } catch (Exception e) { log.error("解析微信用户信息异常【{}】", e.getMessage()); throw new BadCredentialsException("解析微信用户信息异常".concat(ApplicationConstants.VERTICAL).concat(OAUTH2_LOGIN_ERROR)); } IUser iUser = authService.findByKey(phoneNoInfo.getPurePhoneNumber(), IAuthService.KeyType.preferredMobile); if(null == iUser) { if(!credentials.getForceCreate()) { throw new BadCredentialsException("微信手机号码未登记".concat(ApplicationConstants.VERTICAL).concat(OAUTH2_MINI_ERROR)); } }else{ //绑定用户手机号和openid authService.updateUserOpenidAndUnionid(phoneNoInfo.getPurePhoneNumber(), wxSession.getOpenid(), wxSession.getUnionid(), credentials.getAppcode()); } //通过openid或者unionid构建Principal到框架进行统一认证 // Principal principal; // if(StringUtils.isNotEmpty(wxSession.getUnionid())){ // principal = KeyTypePrincipal.builder().keyword(wxSession.getUnionid()).keyType(IAuthService.KeyType.unionid).build(); // } else { // principal = KeyTypePrincipal.builder().keyword(wxSession.getOpenid()).keyType(IAuthService.KeyType.openid).build(); // } //通过preferredMobile构建Principal到框架进行统一认证 Principal principal = KeyTypePrincipal.builder().keyword(phoneNoInfo.getPurePhoneNumber()).keyType(IAuthService.KeyType.preferredMobile).build(); SsoUsernameAuthentication ssoUsernameAuthentication = new SsoUsernameAuthentication(principal, credentials.getAppcode()); ssoUsernameAuthentication.setDetails(wxSession); return genericAuthenticationChecker.authChek(ssoUsernameAuthentication, credentials.getAppcode()); } @Override public boolean supports(Class<?> authentication) { return authentication.equals(WxmaMiniAuthenticationToken.class); } }
5,383
0.752086
0.746126
108
45.611111
41.102814
158
false
false
0
0
0
0
0
0
0.564815
false
false
14
600bbbcb1ae4e776e4b13789b90985fb90775e94
5,574,867,570,372
33a3fd297cf28615ddc41d87fb63d422948753dc
/src/Evaluate.java
25b2e71aac588bb3b8c167d702380713536ee849
[]
no_license
saikrishna-kanneti/Database-systems
https://github.com/saikrishna-kanneti/Database-systems
1e1f56c83649c6e8cfd6bd2745f77e78a1890a3f
28af27e93db55a9db28a2df95ded1af4438c5099
refs/heads/master
2020-03-22T13:45:38.265000
2018-07-08T02:53:58
2018-07-08T02:53:58
140,130,115
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.buffalo.www.cse4562; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.List; import net.sf.jsqlparser.eval.Eval; import net.sf.jsqlparser.expression.DateValue; import net.sf.jsqlparser.expression.DoubleValue; import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.PrimitiveValue; import net.sf.jsqlparser.expression.StringValue; import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.schema.PrimitiveType; import net.sf.jsqlparser.statement.create.table.ColumnDefinition; public class Evaluate extends Eval { public static String STRING = "string"; public String[] tuple; public List<String> columnNames; public List<ColumnDefinition> columnDefinitions; public Evaluate(String[] tuple, List<String> columnNames, List<ColumnDefinition> columnDefinitions) { this.tuple = tuple; this.columnNames = columnNames; this.columnDefinitions = columnDefinitions; } @Override public PrimitiveValue eval(Column col) throws SQLException { int index = columnNames.indexOf(col.getColumnName()); String value = tuple[index]; if (PrimitiveType.fromString(columnDefinitions.get(index).getColDataType().getDataType()) .equals(PrimitiveType.DOUBLE)) { return new DoubleValue(value); } else if (PrimitiveType.fromString(columnDefinitions.get(index).getColDataType().getDataType()) .equals(PrimitiveType.LONG)) { return new LongValue(value); } else if (PrimitiveType.fromString(columnDefinitions.get(index).getColDataType().getDataType()) .equals(PrimitiveType.DATE)) { return new DateValue(value); } else { return new StringValue(value.toString()); } } public static boolean isDouble(String s) { return s != null && s.matches("[-+]?\\d*\\.?\\d+"); } public static boolean isLong(String s) { return s != null && s.matches("[-+]?[0-9]*"); } public static boolean isValidDate(String s) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { df.parse(s); return true; } catch (java.text.ParseException e) { return false; } } }
UTF-8
Java
2,148
java
Evaluate.java
Java
[]
null
[]
package edu.buffalo.www.cse4562; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.List; import net.sf.jsqlparser.eval.Eval; import net.sf.jsqlparser.expression.DateValue; import net.sf.jsqlparser.expression.DoubleValue; import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.PrimitiveValue; import net.sf.jsqlparser.expression.StringValue; import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.schema.PrimitiveType; import net.sf.jsqlparser.statement.create.table.ColumnDefinition; public class Evaluate extends Eval { public static String STRING = "string"; public String[] tuple; public List<String> columnNames; public List<ColumnDefinition> columnDefinitions; public Evaluate(String[] tuple, List<String> columnNames, List<ColumnDefinition> columnDefinitions) { this.tuple = tuple; this.columnNames = columnNames; this.columnDefinitions = columnDefinitions; } @Override public PrimitiveValue eval(Column col) throws SQLException { int index = columnNames.indexOf(col.getColumnName()); String value = tuple[index]; if (PrimitiveType.fromString(columnDefinitions.get(index).getColDataType().getDataType()) .equals(PrimitiveType.DOUBLE)) { return new DoubleValue(value); } else if (PrimitiveType.fromString(columnDefinitions.get(index).getColDataType().getDataType()) .equals(PrimitiveType.LONG)) { return new LongValue(value); } else if (PrimitiveType.fromString(columnDefinitions.get(index).getColDataType().getDataType()) .equals(PrimitiveType.DATE)) { return new DateValue(value); } else { return new StringValue(value.toString()); } } public static boolean isDouble(String s) { return s != null && s.matches("[-+]?\\d*\\.?\\d+"); } public static boolean isLong(String s) { return s != null && s.matches("[-+]?[0-9]*"); } public static boolean isValidDate(String s) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { df.parse(s); return true; } catch (java.text.ParseException e) { return false; } } }
2,148
0.726257
0.723464
65
31.046154
25.625967
102
false
false
0
0
0
0
0
0
1.753846
false
false
14
e53e00cbf6ab74a7d8b92cafe11471cb41df6779
3,281,355,077,652
708d4bc2919fcab7c74d2e0c40e0f36c9be2ace2
/week-19/REST API/src/main/java/com/greenfox/restapi/services/LogService.java
ccaa9bd3108c2bcc795d4531bff26957fb71d1db
[]
no_license
Pavel-Chotebor/JAVA-SPRING
https://github.com/Pavel-Chotebor/JAVA-SPRING
5fdb5104c0a39ec7fb7b179e03f28e7de60871da
5b0b1fb1c799c3473e44d63574a166f141a03a19
refs/heads/master
2023-04-09T19:23:48.960000
2021-04-13T14:25:55
2021-04-13T14:25:55
357,577,265
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.greenfox.restapi.services; import com.greenfox.restapi.models.Log; import org.springframework.stereotype.Service; import java.util.List; @Service public interface LogService { void saveLog(Log log); List<Log> getAllLogs(); String getAllLogsLikeString(); }
UTF-8
Java
288
java
LogService.java
Java
[]
null
[]
package com.greenfox.restapi.services; import com.greenfox.restapi.models.Log; import org.springframework.stereotype.Service; import java.util.List; @Service public interface LogService { void saveLog(Log log); List<Log> getAllLogs(); String getAllLogsLikeString(); }
288
0.753472
0.753472
18
15
16.636641
46
false
false
0
0
0
0
0
0
0.388889
false
false
14
163567ec4e48514e52a6de741b71d30bdbdadac0
6,322,191,925,434
92f7c57b96f6c7bd1399cf15427bc1ed21950859
/src/com/bohechina/iotsystem/controller/TroubleController.java
8014394cf822f215cc1cc9c5bce64ad7e2c9a8c0
[]
no_license
jeffddjt/IOTSystem
https://github.com/jeffddjt/IOTSystem
3517386645354dabf2976c4df321343814c3fb58
f180bb314dd6c6d735df78b186c6ab51dc973a12
refs/heads/master
2021-01-22T23:33:39.403000
2017-09-06T12:49:02
2017-09-06T12:49:02
102,423,922
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bohechina.iotsystem.controller; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; 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.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.bohechina.iotsystem.model.Trouble; import com.bohechina.iotsystem.service.TroubleService; import com.bohechina.iotsystem.utils.BHUtils; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @Controller public class TroubleController { @Resource(name="troubleService") private TroubleService troubleService; @RequestMapping("/Teacher/TroubleManage") public String troubleManage(String pageNo,Model model){ if(pageNo==null) pageNo="1"; Page<?> page=PageHelper.startPage(Integer.parseInt(pageNo),20); List<Trouble> troubleList=troubleService.getTroubleList(); int pageCount=page.getPages(); model.addAttribute("troubleList",troubleList); model.addAttribute("pageNo",pageNo); model.addAttribute("pageCount",pageCount); return "Teacher/Trouble/TroubleManage"; } @RequestMapping("/Student/TroubleView") public String troubleView(String pageNo,Model model){ if(pageNo==null) pageNo="1"; Page<?> page=PageHelper.startPage(Integer.parseInt(pageNo),20); List<Trouble> troubleList=troubleService.getTroubleList(); int pageCount=page.getPages(); int no=(Integer.parseInt(pageNo)-1)*20+1; for(Trouble t : troubleList){ t.setNo(no++); } model.addAttribute("troubleList",troubleList); model.addAttribute("pageNo",pageNo); model.addAttribute("pageCount",pageCount); return "Student/Trouble/TroubleView"; } @RequestMapping("/Student/TroubleStudy") public String troubleStudy(int id,int type,Model model){ Trouble trouble=troubleService.getTroubleById(id); String url="NoVideo"; String title="值班故障处理--"+trouble.getName()+"--"; if(type==1){ url=trouble.getStudy_console(); title+="操作间学习"; } if(type==2){ url=trouble.getStudy_scene(); title+="现场学习"; } model.addAttribute("url",url); model.addAttribute("title",title); return "Student/Trouble/VideoPlayer"; } @RequestMapping("/Student/TroubleVrp") public String troubleVrp(int id,int type,Model model){ Trouble trouble=troubleService.getTroubleById(id); String url="NoVideo"; String title="值班故障处理--"+trouble.getName()+"--"; if(type==1){ url=trouble.getTest_console(); title+="操作间训练"; } if(type==2){ url=trouble.getTest_scene(); title+="现场训练"; } if(type==3){ url=trouble.getExam_console(); title+="操作间测试"; } if(type==4){ url=trouble.getExam_scene(); title+="现场测试"; } if(url==null||url.equals("")) url="NoVrp"; model.addAttribute("url",url); model.addAttribute("title",title); return "Student/Trouble/VrpPlayer"; } @RequestMapping("/Student/TroubleRepairVrp") public String troubleRepairVrp(Model model){ model.addAttribute("url","res/Trouble/Vrp/daxiu/daxiu.htm"); model.addAttribute("title","检修准备虚拟工厂"); return "Student/Trouble/VrpPlayer"; } @RequestMapping(value="/Teacher/TroubleUpdate",method=RequestMethod.GET) public String troubleUpdate(int id,Model model){ Trouble trouble=troubleService.getTroubleById(id); model.addAttribute("trouble",trouble); return "Teacher/Trouble/TroubleUpdate"; } @RequestMapping(value="/Teacher/TroubleUpdate",method=RequestMethod.POST,produces="text/html;charset=utf-8") @ResponseBody public String troubleUpdate(Trouble trouble){ int result=troubleService.updateTrouble(trouble); String str=result==0?"修改失败!":"Teacher/TroubleManage"; return result+"|"+str; } @RequestMapping(value="/Teacher/TroubleAdd",method=RequestMethod.GET) public String troubleAdd(Model model){ Trouble trouble=new Trouble(); model.addAttribute("trouble",trouble); return "Teacher/Trouble/TroubleAdd"; } @RequestMapping(value="/Teacher/TroubleAdd",method=RequestMethod.POST,produces="text/html;charset=utf-8") @ResponseBody public String troubleAdd(Trouble trouble){ int result=troubleService.insertTrouble(trouble); String str=result==0?"添加失败!":"Teacher/TroubleManage"; return result+"|"+str; } @RequestMapping(value="/Teacher/TroubleDelete",method=RequestMethod.POST,produces="text/html;charset=utf-8") @ResponseBody public String troubleDelete(String selected){ if(selected==null) return "0|请选择要删除的故障信息!"; Map<String,Object> map=new HashMap<String,Object>(); map.put("ids", selected.split(",")); int result=troubleService.deleteTrouble(map); String str=result==0?"故障删除失败!":result+"条故障信息被删除!"; return result+"|"+str; } @RequestMapping(value = "/Teacher/TroubleManage/UpVideoFile", method = RequestMethod.POST, produces = "text/html;charset=utf-8") @ResponseBody public String upVideoFile(MultipartFile file, HttpServletRequest request) { if (file.getSize() == 0) return "0|请确定上传的文件不为空!"; String path = request.getServletContext().getRealPath( "res/Trouble/Video"); String fileName = file.getOriginalFilename(); String extName = fileName.substring(fileName.lastIndexOf("."), fileName.length()); fileName = UUID.randomUUID().toString() + extName; File targetFile = new File(path, fileName); if (!targetFile.exists()) targetFile.mkdirs(); try { file.transferTo(targetFile); } catch (Exception e) { } return "1|上传成功!|res/Trouble/Video/" + fileName; } @RequestMapping(value = "/Teacher/TroubleManage/UpVrpFile", method = RequestMethod.POST, produces = "text/html;charset=utf-8") @ResponseBody public String upVRPFile(MultipartFile file, HttpServletRequest request) { if (file.getSize() == 0) { return "0|请确定上传的文件不为空!"; } String path = request.getServletContext().getRealPath( "res/Trouble/Vrp"); String fileName = file.getOriginalFilename(); // String extName = fileName.substring(fileName.lastIndexOf("."), // fileName.length()); // fileName = UUID.randomUUID().toString() + extName; File targetFile = new File(path, fileName); if (!targetFile.exists()) targetFile.mkdirs(); String resPath = "res/Trouble/Vrp/" + fileName.substring(0, fileName.lastIndexOf(".")); String res = ""; try { file.transferTo(targetFile); res = resPath + "/" + BHUtils.unZip(path + "\\" + fileName); } catch (Exception e) { } return "1|上传成功!|" + res; } }
UTF-8
Java
6,839
java
TroubleController.java
Java
[]
null
[]
package com.bohechina.iotsystem.controller; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; 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.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.bohechina.iotsystem.model.Trouble; import com.bohechina.iotsystem.service.TroubleService; import com.bohechina.iotsystem.utils.BHUtils; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @Controller public class TroubleController { @Resource(name="troubleService") private TroubleService troubleService; @RequestMapping("/Teacher/TroubleManage") public String troubleManage(String pageNo,Model model){ if(pageNo==null) pageNo="1"; Page<?> page=PageHelper.startPage(Integer.parseInt(pageNo),20); List<Trouble> troubleList=troubleService.getTroubleList(); int pageCount=page.getPages(); model.addAttribute("troubleList",troubleList); model.addAttribute("pageNo",pageNo); model.addAttribute("pageCount",pageCount); return "Teacher/Trouble/TroubleManage"; } @RequestMapping("/Student/TroubleView") public String troubleView(String pageNo,Model model){ if(pageNo==null) pageNo="1"; Page<?> page=PageHelper.startPage(Integer.parseInt(pageNo),20); List<Trouble> troubleList=troubleService.getTroubleList(); int pageCount=page.getPages(); int no=(Integer.parseInt(pageNo)-1)*20+1; for(Trouble t : troubleList){ t.setNo(no++); } model.addAttribute("troubleList",troubleList); model.addAttribute("pageNo",pageNo); model.addAttribute("pageCount",pageCount); return "Student/Trouble/TroubleView"; } @RequestMapping("/Student/TroubleStudy") public String troubleStudy(int id,int type,Model model){ Trouble trouble=troubleService.getTroubleById(id); String url="NoVideo"; String title="值班故障处理--"+trouble.getName()+"--"; if(type==1){ url=trouble.getStudy_console(); title+="操作间学习"; } if(type==2){ url=trouble.getStudy_scene(); title+="现场学习"; } model.addAttribute("url",url); model.addAttribute("title",title); return "Student/Trouble/VideoPlayer"; } @RequestMapping("/Student/TroubleVrp") public String troubleVrp(int id,int type,Model model){ Trouble trouble=troubleService.getTroubleById(id); String url="NoVideo"; String title="值班故障处理--"+trouble.getName()+"--"; if(type==1){ url=trouble.getTest_console(); title+="操作间训练"; } if(type==2){ url=trouble.getTest_scene(); title+="现场训练"; } if(type==3){ url=trouble.getExam_console(); title+="操作间测试"; } if(type==4){ url=trouble.getExam_scene(); title+="现场测试"; } if(url==null||url.equals("")) url="NoVrp"; model.addAttribute("url",url); model.addAttribute("title",title); return "Student/Trouble/VrpPlayer"; } @RequestMapping("/Student/TroubleRepairVrp") public String troubleRepairVrp(Model model){ model.addAttribute("url","res/Trouble/Vrp/daxiu/daxiu.htm"); model.addAttribute("title","检修准备虚拟工厂"); return "Student/Trouble/VrpPlayer"; } @RequestMapping(value="/Teacher/TroubleUpdate",method=RequestMethod.GET) public String troubleUpdate(int id,Model model){ Trouble trouble=troubleService.getTroubleById(id); model.addAttribute("trouble",trouble); return "Teacher/Trouble/TroubleUpdate"; } @RequestMapping(value="/Teacher/TroubleUpdate",method=RequestMethod.POST,produces="text/html;charset=utf-8") @ResponseBody public String troubleUpdate(Trouble trouble){ int result=troubleService.updateTrouble(trouble); String str=result==0?"修改失败!":"Teacher/TroubleManage"; return result+"|"+str; } @RequestMapping(value="/Teacher/TroubleAdd",method=RequestMethod.GET) public String troubleAdd(Model model){ Trouble trouble=new Trouble(); model.addAttribute("trouble",trouble); return "Teacher/Trouble/TroubleAdd"; } @RequestMapping(value="/Teacher/TroubleAdd",method=RequestMethod.POST,produces="text/html;charset=utf-8") @ResponseBody public String troubleAdd(Trouble trouble){ int result=troubleService.insertTrouble(trouble); String str=result==0?"添加失败!":"Teacher/TroubleManage"; return result+"|"+str; } @RequestMapping(value="/Teacher/TroubleDelete",method=RequestMethod.POST,produces="text/html;charset=utf-8") @ResponseBody public String troubleDelete(String selected){ if(selected==null) return "0|请选择要删除的故障信息!"; Map<String,Object> map=new HashMap<String,Object>(); map.put("ids", selected.split(",")); int result=troubleService.deleteTrouble(map); String str=result==0?"故障删除失败!":result+"条故障信息被删除!"; return result+"|"+str; } @RequestMapping(value = "/Teacher/TroubleManage/UpVideoFile", method = RequestMethod.POST, produces = "text/html;charset=utf-8") @ResponseBody public String upVideoFile(MultipartFile file, HttpServletRequest request) { if (file.getSize() == 0) return "0|请确定上传的文件不为空!"; String path = request.getServletContext().getRealPath( "res/Trouble/Video"); String fileName = file.getOriginalFilename(); String extName = fileName.substring(fileName.lastIndexOf("."), fileName.length()); fileName = UUID.randomUUID().toString() + extName; File targetFile = new File(path, fileName); if (!targetFile.exists()) targetFile.mkdirs(); try { file.transferTo(targetFile); } catch (Exception e) { } return "1|上传成功!|res/Trouble/Video/" + fileName; } @RequestMapping(value = "/Teacher/TroubleManage/UpVrpFile", method = RequestMethod.POST, produces = "text/html;charset=utf-8") @ResponseBody public String upVRPFile(MultipartFile file, HttpServletRequest request) { if (file.getSize() == 0) { return "0|请确定上传的文件不为空!"; } String path = request.getServletContext().getRealPath( "res/Trouble/Vrp"); String fileName = file.getOriginalFilename(); // String extName = fileName.substring(fileName.lastIndexOf("."), // fileName.length()); // fileName = UUID.randomUUID().toString() + extName; File targetFile = new File(path, fileName); if (!targetFile.exists()) targetFile.mkdirs(); String resPath = "res/Trouble/Vrp/" + fileName.substring(0, fileName.lastIndexOf(".")); String res = ""; try { file.transferTo(targetFile); res = resPath + "/" + BHUtils.unZip(path + "\\" + fileName); } catch (Exception e) { } return "1|上传成功!|" + res; } }
6,839
0.732124
0.727286
203
31.586206
24.03684
129
false
false
0
0
0
0
0
0
2.463054
false
false
14
4414bee23a439e7d3e4228eb20e0dc7ea75b27b2
26,594,437,520,527
cf76a900fbf54ea45dc43e67239698865da37b0d
/src/cn/rock/y2020/m05/d25/Solution9.java
5c5dd3d817613940ca7cf721cf910db06f849057
[ "Apache-2.0" ]
permissive
kingrockw/leetcode2020
https://github.com/kingrockw/leetcode2020
71fe72a80361508ae0e926303a8bb79858147a46
cf2060271e936b81ba74eeace5c2a02f3cb22fe0
refs/heads/master
2022-09-29T08:58:24.161000
2020-06-07T08:22:59
2020-06-07T08:22:59
266,496,049
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.rock.y2020.m05.d25; /** * * @author wjl48511 * @create 2020/5/25-19:20 **/ public class Solution9 { /** 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出: false 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 示例 3: 输入: 10 输出: false 解释: 从右向左读, 为 01 。因此它不是一个回文数。 进阶: 你能不将整数转为字符串来解决这个问题吗? 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/palindrome-number 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ public boolean isPalindrome(int x) { if (x<0){ return false; } int initX = x; int r = 0; int temp; while(x > 0){ temp = x%10; r = r*10 + temp; x = x/10; } return r == initX; } public static void main(String []args){ Solution9 solution9 = new Solution9(); boolean palindrome = solution9.isPalindrome(121); System.out.println(palindrome); } }
UTF-8
Java
1,391
java
Solution9.java
Java
[ { "context": "package cn.rock.y2020.m05.d25;\n\n/**\n *\n * @author wjl48511\n * @create 2020/5/25-19:20\n **/\npublic class Solu", "end": 58, "score": 0.9995943903923035, "start": 50, "tag": "USERNAME", "value": "wjl48511" } ]
null
[]
package cn.rock.y2020.m05.d25; /** * * @author wjl48511 * @create 2020/5/25-19:20 **/ public class Solution9 { /** 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出: false 解释: 从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。 示例 3: 输入: 10 输出: false 解释: 从右向左读, 为 01 。因此它不是一个回文数。 进阶: 你能不将整数转为字符串来解决这个问题吗? 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/palindrome-number 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ public boolean isPalindrome(int x) { if (x<0){ return false; } int initX = x; int r = 0; int temp; while(x > 0){ temp = x%10; r = r*10 + temp; x = x/10; } return r == initX; } public static void main(String []args){ Solution9 solution9 = new Solution9(); boolean palindrome = solution9.isPalindrome(121); System.out.println(palindrome); } }
1,391
0.523077
0.465385
54
18.25926
15.842027
58
false
false
0
0
0
0
0
0
0.277778
false
false
14
118117f5830659c01a95539e560cdbd6cf099002
26,594,437,519,549
c107b6160a807853c250a98c26cdc06d98566d6b
/src/main/java/com/example/shanggmiqr/bean/AllocateTransferUploadFlagBean.java
99324bc5aaa22241f5693883e089527bff335e2a
[]
no_license
faithcoco/sunmi
https://github.com/faithcoco/sunmi
cd2adcc38a8605db2f9070926a422ada2a6a77ef
8713dafb1e6849a959f9eaf05cbd85dafd82f5dc
refs/heads/master
2020-04-28T14:24:08.823000
2019-11-07T01:36:50
2019-11-07T01:36:50
175,337,827
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.shanggmiqr.bean; /** * Created by weiyt.jiang on 2018/9/18. */ public class AllocateTransferUploadFlagBean { /** * vbillcode : 0 * vcooporderbcode_b : 查询成功 * prodcutcode : 1 */ public String billno; public String itempk; public String prodcutcode; public String getBillno() { return billno; } public void setBillno(String billno) { this.billno = billno; } public void setItempk(String itempk) { this.itempk = itempk; } public void setProdcutcode(String prodcutcode) { this.prodcutcode = prodcutcode; } public String getItempk() { return itempk; } public String getProdcutcode() { return prodcutcode; } }
UTF-8
Java
776
java
AllocateTransferUploadFlagBean.java
Java
[ { "context": "ge com.example.shanggmiqr.bean;\n\n/**\n * Created by weiyt.jiang on 2018/9/18.\n */\n\npublic class AllocateT", "end": 59, "score": 0.719027042388916, "start": 56, "tag": "NAME", "value": "wei" }, { "context": "om.example.shanggmiqr.bean;\n\n/**\n * Created by weiyt.jiang on 2018/9/18.\n */\n\npublic class AllocateTransferU", "end": 67, "score": 0.5697706341743469, "start": 59, "tag": "USERNAME", "value": "yt.jiang" } ]
null
[]
package com.example.shanggmiqr.bean; /** * Created by weiyt.jiang on 2018/9/18. */ public class AllocateTransferUploadFlagBean { /** * vbillcode : 0 * vcooporderbcode_b : 查询成功 * prodcutcode : 1 */ public String billno; public String itempk; public String prodcutcode; public String getBillno() { return billno; } public void setBillno(String billno) { this.billno = billno; } public void setItempk(String itempk) { this.itempk = itempk; } public void setProdcutcode(String prodcutcode) { this.prodcutcode = prodcutcode; } public String getItempk() { return itempk; } public String getProdcutcode() { return prodcutcode; } }
776
0.613281
0.601563
42
17.285715
16.113121
52
false
false
0
0
0
0
0
0
0.238095
false
false
14
7a189453f1bcb50a300543fba0d64d1fe295633e
23,794,118,856,586
f30fe64756aef582db5eaf0e7e77cb4f57325869
/CS221-HW4/UnorderedListTester.java
3690e5a236c73e485f936c83cc62d2c6d3e1da75
[]
no_license
themickeynick/CompSci2SchoolWork
https://github.com/themickeynick/CompSci2SchoolWork
b37040ba7496094d9903e5bed880235a7ffae017
0c316cf670ba1103d31788ec102b295eb9b389dc
refs/heads/master
2020-04-29T09:14:09.177000
2015-02-04T01:53:03
2015-02-04T01:53:04
24,994,043
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Iterator; import java.util.NoSuchElementException; /** * A unit test class for UnorderedListADT. This is a set of black box tests that * should work for any implementation of UnorderedListADT. * * NOTE: One set of example tests is given for the scenario of a creating a new, * empty list to get you started. * * Method newList() returns one of two (or more) alternate implementations to * all tests, so you don't have to do a search and replace on constructor calls * in every test. * * @author mvail: testing framework and empty list scenario */ public class UnorderedListTester { private int passes = 0; private int failures = 0; private int total = 0; /** * @param args * not used */ public static void main(String[] args) { // to avoid every method being static UnorderedListTester tester = new UnorderedListTester(); tester.runTests(); } /** * Returns an UnorderedListADT so the implementation can be changed in this * one location rather than in every test. * * @return a new UnorderedListADT */ private UnorderedListADT<Integer> newList() { // TODO: enable only one of the two following // lines or add a new implementation to test return new GoodUnorderedList<Integer>(); // return new BadUnorderedList<Integer>(); } private UnorderedListADT<Integer> newListRemoveEmpty() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.remove(new Integer(1)); return someList; } private UnorderedListADT<Integer> newListRemoveFirstEmpty() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.removeFirst(); return someList; } private UnorderedListADT<Integer> newListRemoveLastEmpty() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.removeFirst(); return someList; } private UnorderedListADT<Integer> newListAddToFrontOne() { UnorderedListADT<Integer> someList = newList(); someList.addToFront(new Integer(1)); return someList; } private UnorderedListADT<Integer> newListOneElement() { UnorderedListADT<Integer> someList = newList(); someList.addToFront(new Integer(1)); return someList; } private UnorderedListADT<Integer> newListAddToRearTwoElement() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.addToRear(new Integer(2)); return someList; } private UnorderedListADT<Integer> newListAddToFrontThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addToFront(new Integer(3)); return someList; } private UnorderedListADT<Integer> newListAddAfterFirstElementThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addAfter(new Integer(3), new Integer(1)); return someList; } private UnorderedListADT<Integer> newListAddAfterSecondElementThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addAfter(new Integer(3), new Integer(2)); return someList; } private UnorderedListADT<Integer> newListAddToRearThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addToRear(new Integer(3)); return someList; } /** * Print test results in a consistent format * * @param testDesc * description of the test * @param result * indicates if the test passed or failed */ private void printTest(String testDesc, boolean result) { total++; if (result) { passes++; } else { failures++; } System.out.printf("%-46s\t%s\n", testDesc, (result ? " PASS" : "***FAIL***")); } /** Print a final summary */ private void printFinalSummary() { System.out.printf("\nTotal Tests: %d, Passed: %d, Failed: %d\n", total, passes, failures); } /** * Run tests to confirm required functionality from list constructors and * methods */ private void runTests() { // TESTS ON A NEW, EMPTY LIST printTest("testAddToFrontOnNewList", testAddToFrontOnNewList()); printTest("testAddToRearOnNewList", testAddToRearOnNewList()); printTest("testAddAfterOnNewList", testAddAfterOnNewList()); printTest("testRemoveFirstOnNewList", testRemoveFirstOnNewList()); printTest("testRemoveLastOnNewList", testRemoveLastOnNewList()); printTest("testRemoveElementOnNewList", testRemoveElementOnNewList()); printTest("testFirstOnNewList", testFirstOnNewList()); printTest("testLastOnNewList", testLastOnNewList()); printTest("testContainsOnNewList", testContainsOnNewList()); printTest("testIsEmptyOnNewList", testIsEmptyOnNewList()); printTest("testSizeOnNewList", testSizeOnNewList()); printTest("testIteratorOnNewList", testIteratorOnNewList()); printTest("testToStringOnNewList", testToStringOnNewList()); // TESTS ON AN EMPTY LIST THAT HAD REMOVE(integer) CALLED printTest("testAddToFrontOnRemoveEmpty", testAddToFrontOnRemoveEmpty()); printTest("testAddToRearOnRemoveEmpty", testAddToRearOnRemoveEmpty()); printTest("testAddAfterOnRemoveEmpty", testAddAfterOnRemoveEmpty()); printTest("testRemoveFirstOnRemoveEmpty", testRemoveFirstOnRemoveEmpty()); printTest("testRemoveLastOnRemoveEmpty", testRemoveLastOnRemoveEmpty()); printTest("testRemoveElementOnRemoveEmpty", testRemoveElementOnRemoveEmpty()); printTest("testFirstOnRemoveEmpty", testFirstOnRemoveEmpty()); printTest("testLastOnRemoveEmpty", testLastOnRemoveEmpty()); printTest("testContainsOnRemoveEmpty", testContainsOnRemoveEmpty()); printTest("testIsEmptyOnRemoveEmpty", testIsEmptyOnRemoveEmpty()); printTest("testSizeOnRemoveEmpty", testSizeOnRemoveEmpty()); printTest("testIteratorOnRemoveEmpty", testIteratorOnRemoveEmpty()); printTest("testToStringOnRemoveEmpty", testToStringOnRemoveEmpty()); // TESTS ON AN EMPTY LIST FROM REMOVELAST() printTest("testAddToFrontOnRemoveLastEmpty", testAddToFrontOnRemoveLastEmpty()); printTest("testAddToRearOnRemoveLastEmpty", testAddToRearOnRemoveLastEmpty()); printTest("testAddAfterOnRemoveLastEmpty", testAddAfterOnRemoveLastEmpty()); printTest("testRemoveFirstOnRemoveLastEmpty", testRemoveFirstOnRemoveLastEmpty()); printTest("testRemoveLastOnRemoveLastEmpty", testRemoveLastOnRemoveLastEmpty()); printTest("testRemoveElementOnRemoveLastEmpty", testRemoveElementOnRemoveLastEmpty()); printTest("testFirstOnRemoveLastEmpty", testFirstOnRemoveLastEmpty()); printTest("testLastOnRemoveLastEmpty", testLastOnRemoveLastEmpty()); printTest("testContainsOnRemoveLastEmpty", testContainsOnRemoveLastEmpty()); printTest("testIsEmptyOnRemoveLastEmpty", testIsEmptyOnRemoveLastEmpty()); printTest("testSizeOnRemoveLastEmpty", testSizeOnRemoveLastEmpty()); printTest("testIteratorOnRemoveLastEmpty", testIteratorOnRemoveLastEmpty()); printTest("testToStringOnRemoveLastEmpty", testToStringOnRemoveLastEmpty()); // TESTS ON AN EMPTY LIST THAT HAD REMOVEFIRST() CALLED printTest("testAddToFrontOnRemoveFirstEmpty", testAddToFrontOnRemoveFirstEmpty()); printTest("testAddToRearOnRemoveFirstEmpty", testAddToRearOnRemoveFirstEmpty()); printTest("testAddAfterOnRemoveFirstEmpty", testAddAfterOnRemoveFirstEmpty()); printTest("testRemoveFirstOnRemoveFirstEmpty", testRemoveFirstOnRemoveFirstEmpty()); printTest("testRemoveLastOnRemoveFirstEmpty", testRemoveLastOnRemoveFirstEmpty()); printTest("testRemoveElementOnRemoveFirstEmpty", testRemoveElementOnRemoveFirstEmpty()); printTest("testFirstOnRemoveFirstEmpty", testFirstOnRemoveFirstEmpty()); printTest("testLastOnRemoveFirstEmpty", testLastOnRemoveFirstEmpty()); printTest("testContainsOnRemoveFirstEmpty", testContainsOnRemoveFirstEmpty()); printTest("testIsEmptyOnRemoveFirstEmpty", testIsEmptyOnRemoveFirstEmpty()); printTest("testSizeOnRemoveFirstEmpty", testSizeOnRemoveFirstEmpty()); printTest("testIteratorOnRemoveFirstEmpty", testIteratorOnRemoveFirstEmpty()); printTest("testToStringOnRemoveFirstEmpty", testToStringOnRemoveFirstEmpty()); // TESTS ON A LIST WITH ONE VALUE, AFTER ADDTOFRONT() printTest("testAddToFrontOnAddToFrontOne", testAddToFrontOnAddToFrontOne()); printTest("testAddToRearOnAddToFrontOne", testAddToRearOnAddToFrontOne()); printTest("testAddAfterOnAddToFrontOneValid", testAddAfterOnAddToFrontOneValid()); printTest("testAddAfterOnAddToFrontOneInvalid", testAddAfterOnAddToFrontOneInvalid()); printTest("testRemoveFirstOnAddToFrontOne", testRemoveFirstOnAddToFrontOne()); printTest("testRemoveLastOnAddToFrontOne", testRemoveLastOnAddToFrontOne()); printTest("testRemoveElementOnAddToFrontOneValid", testRemoveElementOnAddToFrontOneValid()); printTest("testRemoveElementOnAddToFrontOneInvalid", testRemoveElementOnAddToFrontOneInvalid()); printTest("testFirstOnAddToFrontOne", testFirstOnAddToFrontOne()); printTest("testLastOnAddToFrontOne", testLastOnAddToFrontOne()); printTest("testContainsOnAddToFrontOneValid", testContainsOnAddToFrontOneValid()); printTest("testContainsOnAddToFrontOneInvalid", testContainsOnAddToFrontOneInvalid()); printTest("testIsEmptyOnAddToFrontOne", testIsEmptyOnAddToFrontOne()); printTest("testSizeOnAddToFrontOne", testSizeOnAddToFrontOne()); printTest("testIteratorOnAddToFrontOne", testIteratorOnAddToFrontOne()); printTest("testToStringOnAddToFrontOne", testToStringOnAddToFrontOne()); // TESTS ON A LIST WITH ONE VALUE, AFTER ADDTOREAR() printTest("testAddToFrontOnAddToRearOne", testAddToFrontOnAddToRearOne()); printTest("testAddToRearOnAddToRearOne", testAddToRearOnAddToRearOne()); printTest("testAddAfterOnAddToRearOneValid", testAddAfterOnAddToRearOneValid()); printTest("testAddAfterOnAddToRearOneInvalid", testAddAfterOnAddToRearOneInvalid()); printTest("testRemoveFirstOnAddToRearOne", testRemoveFirstOnAddToRearOne()); printTest("testRemoveLastOnAddToRearOne", testRemoveLastOnAddToRearOne()); printTest("testRemoveElementOnAddToRearOneValid", testRemoveElementOnAddToRearOneValid()); printTest("testRemoveElementOnAddToRearOneInvalid", testRemoveElementOnAddToRearOneInvalid()); printTest("testFirstOnAddToRearOne", testFirstOnAddToRearOne()); printTest("testLastOnAddToRearOne", testLastOnAddToRearOne()); printTest("testContainsOnAddToRearOneValid", testContainsOnAddToRearOneValid()); printTest("testContainsOnAddToRearOneInvalid", testContainsOnAddToRearOneInvalid()); printTest("testIsEmptyOnAddToRearOne", testIsEmptyOnAddToRearOne()); printTest("testSizeOnAddToRearOne", testSizeOnAddToRearOne()); printTest("testIteratorOnAddToRearOne", testIteratorOnAddToRearOne()); printTest("testToStringOnAddToRearOne", testToStringOnAddToRearOne()); // TESTS ON A ONE-ELEMENT LIST THAT HAD REMOVE() CALLED TODO // TEST ON A LIST WITH TWO VALUES, AFTER ADDTOFRONT() printTest("testAddToFrontOnAddToFrontTwo", testAddToFrontOnAddToFrontTwo()); printTest("testAddToRearOnAddToFrontTwo", testAddToRearOnAddToFrontTwo()); printTest("testAddAfterOnAddToFrontTwoValid", testAddAfterOnAddToFrontTwoValid()); printTest("testAddAfterOnAddToFrontTwoInvalid", testAddAfterOnAddToFrontTwoInvalid()); printTest("testRemoveFirstOnAddToFrontTwo", testRemoveFirstOnAddToFrontTwo()); printTest("testRemoveLastOnAddToFrontTwo", testRemoveLastOnAddToFrontTwo()); printTest("testRemoveFirstElementOnAddToFrontTwoValid", testRemoveFirstElementOnAddToFrontTwoValid()); printTest("testRemoveSecondElementOnAddToFrontTwoValid", testRemoveSecondElementOnAddToFrontTwoValid()); printTest("testRemoveElementOnAddToFrontTwoInvalid", testRemoveElementOnAddToFrontTwoInvalid()); printTest("testFirstOnAddToFrontTwo", testFirstOnAddToFrontTwo()); printTest("testLastOnAddToFrontTwo", testLastOnAddToFrontTwo()); printTest("testContainsOnAddToFrontTwoValid", testContainsOnAddToFrontTwoValid()); printTest("testContainsOnAddToFrontTwoInvalid", testContainsOnAddToFrontTwoInvalid()); printTest("testIsEmptyOnAddToFrontTwo", testIsEmptyOnAddToFrontTwo()); printTest("testSizeOnAddToFrontTwo", testSizeOnAddToFrontTwo()); printTest("testIteratorOnAddToFrontTwo", testIteratorOnAddToFrontTwo()); printTest("testToStringOnAddToFrontTwo", testToStringOnAddToFrontTwo()); // TESTS ON A LIST WITH TWO VALUES, ADDTOREAR() printTest("testAddToFrontOnAddToRearTwo", testAddToFrontOnAddToRearTwo()); printTest("testAddToRearOnAddToRearTwo", testAddToRearOnAddToRearTwo()); printTest("testAddAfterOnAddToRearTwoValid", testAddAfterOnAddToRearTwoValid()); printTest("testAddAfterOnAddToRearTwoInvalid", testAddAfterOnAddToRearTwoInvalid()); printTest("testRemoveFirstOnAddToRearTwo", testRemoveFirstOnAddToRearTwo()); printTest("testRemoveLastOnAddToRearTwo", testRemoveLastOnAddToRearTwo()); printTest("testRemoveFirstElementOnAddToRearTwoValid", testRemoveFirstElementOnAddToRearTwoValid()); printTest("testRemoveSecondElementOnAddToRearTwoValid", testRemoveSecondElementOnAddToRearTwoValid()); printTest("testRemoveElementOnAddToRearTwoInvalid", testRemoveElementOnAddToRearTwoInvalid()); printTest("testFirstOnAddToRearTwo", testFirstOnAddToRearTwo()); printTest("testLastOnAddToRearTwo", testLastOnAddToRearTwo()); printTest("testContainsFirstElementOnAddToRearTwoValid", testContainsFirstElementOnAddToRearTwoValid()); printTest("testContainsSecondElementOnAddToRearTwoValid", testContainsSecondElementOnAddToRearTwoValid()); printTest("testContainsOnAddToRearTwoInvalid", testContainsOnAddToRearTwoInvalid()); printTest("testIsEmptyOnAddToRearTwo", testIsEmptyOnAddToRearTwo()); printTest("testSizeOnAddToRearTwo", testSizeOnAddToRearTwo()); printTest("testIteratorOnAddToRearTwo", testIteratorOnAddToRearTwo()); printTest("testToStringOnAddToRearTwo", testToStringOnAddToRearTwo()); // TESTS ON A LIST WITH TWO VALUES, ADDAFTER() printTest("testAddToFrontOnAddAfterTwo", testAddToFrontOnAddAfterTwo()); printTest("testAddToRearOnAddAfterTwo", testAddToRearOnAddAfterTwo()); printTest("testAddAfterOnAddAfterTwoValid", testAddAfterOnAddAfterTwoValid()); printTest("testAddAfterOnAddAfterTwoInvalid", testAddAfterOnAddAfterTwoInvalid()); printTest("testRemoveFirstOnAddAfterTwo", testRemoveFirstOnAddAfterTwo()); printTest("testRemoveLastOnAddAfterTwo", testRemoveLastOnAddAfterTwo()); printTest("testRemoveFirstElementOnAddAfterTwoValid", testRemoveFirstElementOnAddAfterTwoValid()); printTest("testRemoveSecondElementOnAddAfterTwoValid", testRemoveSecondElementOnAddAfterTwoValid()); printTest("testRemoveElementOnAddAfterTwoInvalid", testRemoveElementOnAddAfterTwoInvalid()); printTest("testFirstOnAddAfterTwo", testFirstOnAddAfterTwo()); printTest("testLastOnAddAfterTwo", testLastOnAddAfterTwo()); printTest("testContainsFirstElementOnAddAfterTwoValid", testContainsFirstElementOnAddAfterTwoValid()); printTest("testContainsSecondElementOnAddAfterTwoValid", testContainsSecondElementOnAddAfterTwoValid()); printTest("testContainsOnAddAfterTwoInvalid", testContainsOnAddAfterTwoInvalid()); printTest("testIsEmptyOnAddAfterTwo", testIsEmptyOnAddAfterTwo()); printTest("testSizeOnAddAfterTwo", testSizeOnAddAfterTwo()); printTest("testIteratorOnAddAfterTwo", testIteratorOnAddAfterTwo()); printTest("testToStringOnAddAfterTwo", testToStringOnAddAfterTwo()); // TESTS ON A TWO-ELEMENT LIST THAT HAD REMOVE() CALLED TODO // TESTS ON A LIST WITH THREE VALUES, ADDTOFRONT() printTest("testAddToFrontOnAddToFrontThree", testAddToFrontOnAddToFrontThree()); printTest("testAddToRearOnAddToFrontThree", testAddToRearOnAddToFrontThree()); printTest("testAddAfterFirstElementOnAddToFrontThreeValid", testAddAfterFirstElementOnAddToFrontThreeValid()); printTest("testAddAfterSecondElementOnAddToFrontThreeValid", testAddAfterSecondElementOnAddToFrontThreeValid()); printTest("testAddAfterThirdElementOnAddToFrontThreeValid", testAddAfterThirdElementOnAddToFrontThreeValid()); printTest("testAddAfterOnAddToFrontThreeInvalid", testAddAfterOnAddToFrontThreeInvalid()); printTest("testRemoveFirstOnAddToFrontThree", testRemoveFirstOnAddToFrontThree()); printTest("testRemoveLastOnAddToFrontThree", testRemoveLastOnAddToFrontThree()); printTest("testRemoveFirstElementOnAddToFrontThreeValid", testRemoveFirstElementOnAddToFrontThreeValid()); printTest("testRemoveSecondElementOnAddToFrontThreeValid", testRemoveSecondElementOnAddToFrontThreeValid()); printTest("testRemoveSecondElementOnAddToFrontThreeValid", testRemoveThirdElementOnAddToFrontThreeValid()); printTest("testRemoveElementOnAddToFrontThreeInvalid", testRemoveElementOnAddToFrontThreeInvalid()); printTest("testFirstOnAddToFrontThree", testFirstOnAddToFrontThree()); printTest("testLastOnAddToFrontThree", testLastOnAddToFrontThree()); printTest("testContainsFirstElementOnAddToFrontThreeValid", testContainsFirstElementOnAddToFrontThreeValid()); printTest("testContainsSecondElementOnAddToFrontThreeValid", testContainsSecondElementOnAddToFrontThreeValid()); printTest("testContainsThirdElementOnAddToFrontThreeValid", testContainsThirdElementOnAddToFrontThreeValid()); printTest("testContainsOnAddToFrontThreeInvalid", testContainsOnAddToFrontThreeInvalid()); printTest("testIsEmptyOnAddToFrontThree", testIsEmptyOnAddToFrontThree()); printTest("testSizeOnAddToFrontThree", testSizeOnAddToFrontThree()); printTest("testIteratorOnAddToFrontThree", testIteratorOnAddToFrontThree()); printTest("testToStringOnAddToFrontThree", testToStringOnAddToFrontThree()); // TESTS ON A LIST WITH THREE VALUES, ADDAFTER() FIRST ELEMENT printTest("testAddToFrontOnAddAfterFirstElementThree", testAddToFrontOnAddAfterFirstElementThree()); printTest("testAddToRearOnAddAfterFirstElementThree", testAddToRearOnAddAfterFirstElementThree()); printTest("testAddAfterFirstElementOnAddAfterFirstElementThreeValid", testAddAfterFirstElementOnAddAfterFirstElementThreeValid()); printTest("testAddAfterSecondElementOnAddAfterFirstElementThreeValid", testAddAfterSecondElementOnAddAfterFirstElementThreeValid()); printTest("testAddAfterThirdElementOnAddAfterFirstElementThreeValid", testAddAfterThirdElementOnAddAfterFirstElementThreeValid()); printTest("testAddAfterOnAddAfterFirstElementThreeInvalid", testAddAfterOnAddAfterFirstElementThreeInvalid()); printTest("testRemoveFirstOnAddAfterFirstElementThree", testRemoveFirstOnAddAfterFirstElementThree()); printTest("testRemoveLastOnAddAfterFirstElementThree", testRemoveLastOnAddAfterFirstElementThree()); printTest("testRemoveFirstElementOnAddAfterFirstElementThreeValid", testRemoveFirstElementOnAddAfterFirstElementThreeValid()); printTest("testRemoveSecondElementOnAddAfterFirstElementThreeValid", testRemoveSecondElementOnAddAfterFirstElementThreeValid()); printTest("testRemoveThirdElementOnAddAfterFirstElementThreeValid", testRemoveThirdElementOnAddAfterFirstElementThreeValid()); printTest("testRemoveElementOnAddAfterFirstElementThreeInvalid", testRemoveElementOnAddAfterFirstElementThreeInvalid()); printTest("testFirstOnAddAfterFirstElementThree", testFirstOnAddAfterFirstElementThree()); printTest("testLastOnAddAfterFirstElementThree", testLastOnAddAfterFirstElementThree()); printTest("testContainsFirstElementOnAddAfterFirstElementThreeValid", testContainsFirstElementOnAddAfterFirstElementThreeValid()); printTest("testContainsSecondElementOnAddAfterFirstElementThreeValid", testContainsSecondElementOnAddAfterFirstElementThreeValid()); printTest("testContainsThirdElementOnAddAfterFirstElementThreeValid", testContainsThirdElementOnAddAfterFirstElementThreeValid()); printTest("testContainsOnAddAfterFirstElementThreeInvalid", testContainsOnAddAfterFirstElementThreeInvalid()); printTest("testIsEmptyOnAddAfterFirstElementThree", testIsEmptyOnAddAfterFirstElementThree()); printTest("testSizeOnAddAfterFirstElementThree", testSizeOnAddAfterFirstElementThree()); printTest("testIteratorOnAddAfterFirstElementThree", testIteratorOnAddAfterFirstElementThree()); printTest("testToStringOnAddAfterFirstElementThree", testToStringOnAddAfterFirstElementThree()); // TESTS ON A LIST WITH THREE VALUES, ADDAFTER() SECOND ELEMENT printTest("testAddToFrontOnAddAfterSecondElementThree", testAddToFrontOnAddAfterSecondElementThree()); printTest("testAddToRearOnAddAfterSecondElementThree", testAddToRearOnAddAfterSecondElementThree()); printTest("testAddAfterFirstElementOnAddAfterSecondElementThreeValid", testAddAfterFirstElementOnAddAfterSecondElementThreeValid()); printTest("testAddAfterSecondElementOnAddAfterSecondElementThreeValid", testAddAfterSecondElementOnAddAfterSecondElementThreeValid()); printTest("testAddAfterThirdElementOnAddAfterSecondElementThreeValid", testAddAfterThirdElementOnAddAfterSecondElementThreeValid()); printTest("testAddAfterOnAddAfterSecondElementThreeInvalid", testAddAfterOnAddAfterSecondElementThreeInvalid()); printTest("testRemoveFirstOnAddAfterSecondElementThree", testRemoveFirstOnAddAfterSecondElementThree()); printTest("testRemoveLastOnAddAfterSecondElementThree", testRemoveLastOnAddAfterSecondElementThree()); printTest("testRemoveFirstElementOnAddAfterSecondElementThreeValid", testRemoveFirstElementOnAddAfterSecondElementThreeValid()); printTest("testRemoveSecondElementOnAddAfterSecondElementThreeValid", testRemoveSecondElementOnAddAfterSecondElementThreeValid()); printTest("testRemoveThirdElementOnAddAfterSecondElementThreeValid", testRemoveThirdElementOnAddAfterSecondElementThreeValid()); printTest("testRemoveElementOnAddAfterSecondElementThreeInvalid", testRemoveElementOnAddAfterSecondElementThreeInvalid()); printTest("testFirstOnAddAfterSecondElementThree", testFirstOnAddAfterSecondElementThree()); printTest("testLastOnAddAfterSecondElementThree", testLastOnAddAfterSecondElementThree()); printTest("testContainsFirstElementOnAddAfterSecondElementThreeValid", testContainsFirstElementOnAddAfterSecondElementThreeValid()); printTest("testContainsSecondElementOnAddAfterSecondElementThreeValid", testContainsSecondElementOnAddAfterSecondElementThreeValid()); printTest("testContainsThirdElementOnAddAfterSecondElementThreeValid", testContainsThirdElementOnAddAfterSecondElementThreeValid()); printTest("testContainsOnAddAfterSecondElementThreeInvalid", testContainsOnAddAfterSecondElementThreeInvalid()); printTest("testIsEmptyOnAddAfterSecondElementThree", testIsEmptyOnAddAfterSecondElementThree()); printTest("testSizeOnAddAfterSecondElementThree", testSizeOnAddAfterSecondElementThree()); printTest("testIteratorOnAddAfterSecondElementThree", testIteratorOnAddAfterSecondElementThree()); printTest("testToStringOnAddAfterSecondElementThree", testToStringOnAddAfterSecondElementThree()); // TESTS ON A LIST WITH THREE VALUES, ADDTOREAR() printTest("testAddToFrontOnAddToRearThree", testAddToFrontOnAddToRearThree()); printTest("testAddToRearOnAddToRearThree", testAddToRearOnAddToRearThree()); printTest("testAddAfterFirstElementOnAddToRearThreeValid", testAddAfterFirstElementOnAddToRearThreeValid()); printTest("testAddAfterSecondElementOnAddToRearThreeValid", testAddAfterSecondElementOnAddToRearThreeValid()); printTest("testAddAfterThirdElementOnAddToRearThreeValid", testAddAfterThirdElementOnAddToRearThreeValid()); printTest("testAddAfterOnAddToRearThreeInvalid", testAddAfterOnAddToRearThreeInvalid()); printTest("testRemoveFirstOnAddToRearThree", testRemoveFirstOnAddToRearThree()); printTest("testRemoveLastOnAddToRearThree", testRemoveLastOnAddToRearThree()); printTest("testRemoveFirstElementOnAddToRearThreeValid", testRemoveFirstElementOnAddToRearThreeValid()); printTest("testRemoveSecondElementOnAddToRearThreeValid", testRemoveSecondElementOnAddToRearThreeValid()); printTest("testRemoveThirdElementOnAddToRearThreeValid", testRemoveThirdElementOnAddToRearThreeValid()); printTest("testRemoveElementOnAddToRearThreeInvalid", testRemoveElementOnAddToRearThreeInvalid()); printTest("testFirstOnAddToRearThree", testFirstOnAddToRearThree()); printTest("testLastOnAddToRearThree", testLastOnAddToRearThree()); printTest("testContainsFirstElementOnAddToRearThreeValid", testContainsFirstElementOnAddToRearThreeValid()); printTest("testContainsSecondElementOnAddToRearThreeValid", testContainsSecondElementOnAddToRearThreeValid()); printTest("testContainsThirdElementOnAddToRearThreeValid", testContainsThirdElementOnAddToRearThreeValid()); printTest("testContainsOnAddToRearThreeInvalid", testContainsOnAddToRearThreeInvalid()); printTest("testIsEmptyOnAddToRearThree", testIsEmptyOnAddToRearThree()); printTest("testSizeOnAddToRearThree", testSizeOnAddToRearThree()); printTest("testIteratorOnAddToRearThree", testIteratorOnAddToRearThree()); printTest("testToStringOnAddToRearThree", testToStringOnAddToRearThree()); // /////////////// // final verdict // /////////////// printFinalSummary(); } // ////////////////////////// // SCENARIO: NEW, EMPTY LIST TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnNewList() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnNewList", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnNewList() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnNewList", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnNewList() { UnorderedListADT<Integer> list = newList(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnNewList", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnNewList() { UnorderedListADT<Integer> list = newList(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnNewList", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnNewList() { UnorderedListADT<Integer> list = newList(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnNewList", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnNewList() { UnorderedListADT<Integer> list = newList(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnNewList", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnNewList() { UnorderedListADT<Integer> list = newList(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: Removed an element from List, now empty TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnRemoveEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnRemoveEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnRemoveEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnRemoveEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnRemoveEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnRemoveEmpty", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnRemoveEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnRemoveEmpty", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: empty List, removeFirst()TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnRemoveFirstEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnRemoveFirstEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnRemoveFirstEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnRemoveFirstEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnRemoveFirstEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnRemoveFirstEmpty", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnRemoveFirstEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnRemoveFirstEmpty", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: empty List, removeLast()TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnRemoveLastEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnRemoveLastEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnRemoveLastEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnRemoveLastEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnRemoveLastEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnRemoveLastEmpty", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnRemoveLastEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnRemoveLastEmpty", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: One-Element, addAfter() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToFrontOne() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToFront(new Integer(1)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToFrontOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); Integer i = new Integer(1); try { list.addToFront(new Integer(1)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToFrontOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(1)); list.addAfter(new Integer(2), new Integer(1)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontOneValid", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontOneInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.removeFirst().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnAddToFrontOne", "no Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.removeLast().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnAddToFrontOne", "no Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToFrontOneValid", "no Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontOneInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.remove(new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToFrontOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.first().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnAddToFrontOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.last().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnAddToFrontOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testContainsOnAddToFrontOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontOneValid", e.toString()); return false; } } private boolean testContainsOnAddToFrontOneInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.contains(new Integer(2)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontOneInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToFrontOne", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.size() == 1); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToFrontOne", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToFrontOne", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToFrontOne() { UnorderedListADT<Integer> list = newList(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: One-Element, addToRear() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToRear(new Integer(1)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToRearOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToRear(new Integer(1)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToRearOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearOneValid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); list.addAfter(new Integer(2), new Integer(1)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearOneValid", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearOneInvalid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.removeFirst().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.removeLast().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearOneValid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearOneValid", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearOneInvalid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); list.remove(new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.first().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.last().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testContainsOnAddToRearOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearOneValid", e.toString()); return false; } } private boolean testContainsOnAddToRearOneInvalid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.contains(new Integer(2)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearOneInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToRearOne", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.size() == 1); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToRearOne", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToRearOne", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // //////////////////////// // SCENARIO: Two-Element, after addToFront() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); Integer i = new Integer(3); try { list.addToFront(new Integer(2)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToFrontTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); Integer i = new Integer(3); try { list.addToFront(new Integer(2)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToFrontTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); list.addAfter(new Integer(3), new Integer(2)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontTwoValid", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontTwoInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); list.addAfter(new Integer(1), new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.removeFirst().equals(new Integer(2))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.removeLast().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstElementOnAddToFrontTwoValid", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveSecondElementOnAddToFrontTwoValid", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontTwoInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToFrontTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.first().equals(new Integer(2))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.last().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testContainsOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontTwoValid", e.toString()); return false; } } private boolean testContainsOnAddToFrontTwoInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontTwoInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToFrontTwo", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.size() == 2); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToFrontTwo", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToFrontTwo", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // //////////////////////// // SCENARIO: Two-Element, after addToRear() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addToRear(new Integer(2)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToRearTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addToRear(new Integer(2)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToRearTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); list.addAfter(new Integer(3), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterOnAddToRearTwoValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); list.addAfter(new Integer(1), new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddToRearTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddToRearTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddToRearTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddToRearTwoValid", e.toString()); return false; } } private boolean testContainsOnAddToRearTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearTwoInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.size() == 2); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToRearTwo", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // //////////////////////// // SCENARIO: Two-Element, after addAfter() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addAfter(new Integer(2), new Integer(1)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddAfterTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addAfter(new Integer(2), new Integer(1)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddAfterTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); list.addAfter(new Integer(3), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterOnAddAfterTwoValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); list.addAfter(new Integer(1), new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddAfterTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddAfterTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddAfterTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddAfterTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddAfterTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddAfterTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddAfterTwoValid", e.toString()); return false; } } private boolean testContainsOnAddAfterTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddAfterTwoInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.size() == 2); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddAfterTwo", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // ////////////////////// // SCENARIO: Three-Element, after addToFront() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToFrontThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToFrontThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToFrontThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToFrontThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddToFrontThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(4), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddToFrontThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.removeFirst().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.first().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddToFrontThreeValid", e.toString()); return false; } } private boolean testContainsOnAddToFrontThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToFrontThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // /////////////////////////// // SCENARIO: Three-Element, after addAfter() first Element TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddAfterFirstElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddAfterFirstElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddAfterFirstElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddAfterFirstElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterFirstElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterFirstElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddAfterFirstElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddAfterFirstElementThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } private boolean testContainsOnAddAfterFirstElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddAfterFirstElementThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddAfterFirstElementThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // /////////////////////////// // SCENARIO: Three-Element, after addAfter() first Element TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddAfterSecondElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddAfterSecondElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddAfterSecondElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddAfterSecondElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterFirstElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterSecondElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.removeLast().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddAfterSecondElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddAfterSecondElementThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.last().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } private boolean testContainsOnAddAfterSecondElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddAfterSecondElementThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddAfterSecondElementThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // /////////////////////////// // SCENARIO: Three-Element, after addToRear() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToRearThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToRearThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToRearThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToRearThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterFirstElementOnAddToRearThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddToRearThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(4), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddToRearThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.removeLast().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.last().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddToRearThreeValid", e.toString()); return false; } } private boolean testContainsOnAddToRearThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToRearThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } }// end class UnorderedListTester
UTF-8
Java
125,330
java
UnorderedListTester.java
Java
[ { "context": "constructor calls\n * in every test.\n * \n * @author mvail: testing framework and empty list scenario\n */\npu", "end": 532, "score": 0.9975882768630981, "start": 527, "tag": "USERNAME", "value": "mvail" } ]
null
[]
import java.util.Iterator; import java.util.NoSuchElementException; /** * A unit test class for UnorderedListADT. This is a set of black box tests that * should work for any implementation of UnorderedListADT. * * NOTE: One set of example tests is given for the scenario of a creating a new, * empty list to get you started. * * Method newList() returns one of two (or more) alternate implementations to * all tests, so you don't have to do a search and replace on constructor calls * in every test. * * @author mvail: testing framework and empty list scenario */ public class UnorderedListTester { private int passes = 0; private int failures = 0; private int total = 0; /** * @param args * not used */ public static void main(String[] args) { // to avoid every method being static UnorderedListTester tester = new UnorderedListTester(); tester.runTests(); } /** * Returns an UnorderedListADT so the implementation can be changed in this * one location rather than in every test. * * @return a new UnorderedListADT */ private UnorderedListADT<Integer> newList() { // TODO: enable only one of the two following // lines or add a new implementation to test return new GoodUnorderedList<Integer>(); // return new BadUnorderedList<Integer>(); } private UnorderedListADT<Integer> newListRemoveEmpty() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.remove(new Integer(1)); return someList; } private UnorderedListADT<Integer> newListRemoveFirstEmpty() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.removeFirst(); return someList; } private UnorderedListADT<Integer> newListRemoveLastEmpty() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.removeFirst(); return someList; } private UnorderedListADT<Integer> newListAddToFrontOne() { UnorderedListADT<Integer> someList = newList(); someList.addToFront(new Integer(1)); return someList; } private UnorderedListADT<Integer> newListOneElement() { UnorderedListADT<Integer> someList = newList(); someList.addToFront(new Integer(1)); return someList; } private UnorderedListADT<Integer> newListAddToRearTwoElement() { UnorderedListADT<Integer> someList = newListAddToFrontOne(); someList.addToRear(new Integer(2)); return someList; } private UnorderedListADT<Integer> newListAddToFrontThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addToFront(new Integer(3)); return someList; } private UnorderedListADT<Integer> newListAddAfterFirstElementThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addAfter(new Integer(3), new Integer(1)); return someList; } private UnorderedListADT<Integer> newListAddAfterSecondElementThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addAfter(new Integer(3), new Integer(2)); return someList; } private UnorderedListADT<Integer> newListAddToRearThree() { UnorderedListADT<Integer> someList = newListAddToRearTwoElement(); someList.addToRear(new Integer(3)); return someList; } /** * Print test results in a consistent format * * @param testDesc * description of the test * @param result * indicates if the test passed or failed */ private void printTest(String testDesc, boolean result) { total++; if (result) { passes++; } else { failures++; } System.out.printf("%-46s\t%s\n", testDesc, (result ? " PASS" : "***FAIL***")); } /** Print a final summary */ private void printFinalSummary() { System.out.printf("\nTotal Tests: %d, Passed: %d, Failed: %d\n", total, passes, failures); } /** * Run tests to confirm required functionality from list constructors and * methods */ private void runTests() { // TESTS ON A NEW, EMPTY LIST printTest("testAddToFrontOnNewList", testAddToFrontOnNewList()); printTest("testAddToRearOnNewList", testAddToRearOnNewList()); printTest("testAddAfterOnNewList", testAddAfterOnNewList()); printTest("testRemoveFirstOnNewList", testRemoveFirstOnNewList()); printTest("testRemoveLastOnNewList", testRemoveLastOnNewList()); printTest("testRemoveElementOnNewList", testRemoveElementOnNewList()); printTest("testFirstOnNewList", testFirstOnNewList()); printTest("testLastOnNewList", testLastOnNewList()); printTest("testContainsOnNewList", testContainsOnNewList()); printTest("testIsEmptyOnNewList", testIsEmptyOnNewList()); printTest("testSizeOnNewList", testSizeOnNewList()); printTest("testIteratorOnNewList", testIteratorOnNewList()); printTest("testToStringOnNewList", testToStringOnNewList()); // TESTS ON AN EMPTY LIST THAT HAD REMOVE(integer) CALLED printTest("testAddToFrontOnRemoveEmpty", testAddToFrontOnRemoveEmpty()); printTest("testAddToRearOnRemoveEmpty", testAddToRearOnRemoveEmpty()); printTest("testAddAfterOnRemoveEmpty", testAddAfterOnRemoveEmpty()); printTest("testRemoveFirstOnRemoveEmpty", testRemoveFirstOnRemoveEmpty()); printTest("testRemoveLastOnRemoveEmpty", testRemoveLastOnRemoveEmpty()); printTest("testRemoveElementOnRemoveEmpty", testRemoveElementOnRemoveEmpty()); printTest("testFirstOnRemoveEmpty", testFirstOnRemoveEmpty()); printTest("testLastOnRemoveEmpty", testLastOnRemoveEmpty()); printTest("testContainsOnRemoveEmpty", testContainsOnRemoveEmpty()); printTest("testIsEmptyOnRemoveEmpty", testIsEmptyOnRemoveEmpty()); printTest("testSizeOnRemoveEmpty", testSizeOnRemoveEmpty()); printTest("testIteratorOnRemoveEmpty", testIteratorOnRemoveEmpty()); printTest("testToStringOnRemoveEmpty", testToStringOnRemoveEmpty()); // TESTS ON AN EMPTY LIST FROM REMOVELAST() printTest("testAddToFrontOnRemoveLastEmpty", testAddToFrontOnRemoveLastEmpty()); printTest("testAddToRearOnRemoveLastEmpty", testAddToRearOnRemoveLastEmpty()); printTest("testAddAfterOnRemoveLastEmpty", testAddAfterOnRemoveLastEmpty()); printTest("testRemoveFirstOnRemoveLastEmpty", testRemoveFirstOnRemoveLastEmpty()); printTest("testRemoveLastOnRemoveLastEmpty", testRemoveLastOnRemoveLastEmpty()); printTest("testRemoveElementOnRemoveLastEmpty", testRemoveElementOnRemoveLastEmpty()); printTest("testFirstOnRemoveLastEmpty", testFirstOnRemoveLastEmpty()); printTest("testLastOnRemoveLastEmpty", testLastOnRemoveLastEmpty()); printTest("testContainsOnRemoveLastEmpty", testContainsOnRemoveLastEmpty()); printTest("testIsEmptyOnRemoveLastEmpty", testIsEmptyOnRemoveLastEmpty()); printTest("testSizeOnRemoveLastEmpty", testSizeOnRemoveLastEmpty()); printTest("testIteratorOnRemoveLastEmpty", testIteratorOnRemoveLastEmpty()); printTest("testToStringOnRemoveLastEmpty", testToStringOnRemoveLastEmpty()); // TESTS ON AN EMPTY LIST THAT HAD REMOVEFIRST() CALLED printTest("testAddToFrontOnRemoveFirstEmpty", testAddToFrontOnRemoveFirstEmpty()); printTest("testAddToRearOnRemoveFirstEmpty", testAddToRearOnRemoveFirstEmpty()); printTest("testAddAfterOnRemoveFirstEmpty", testAddAfterOnRemoveFirstEmpty()); printTest("testRemoveFirstOnRemoveFirstEmpty", testRemoveFirstOnRemoveFirstEmpty()); printTest("testRemoveLastOnRemoveFirstEmpty", testRemoveLastOnRemoveFirstEmpty()); printTest("testRemoveElementOnRemoveFirstEmpty", testRemoveElementOnRemoveFirstEmpty()); printTest("testFirstOnRemoveFirstEmpty", testFirstOnRemoveFirstEmpty()); printTest("testLastOnRemoveFirstEmpty", testLastOnRemoveFirstEmpty()); printTest("testContainsOnRemoveFirstEmpty", testContainsOnRemoveFirstEmpty()); printTest("testIsEmptyOnRemoveFirstEmpty", testIsEmptyOnRemoveFirstEmpty()); printTest("testSizeOnRemoveFirstEmpty", testSizeOnRemoveFirstEmpty()); printTest("testIteratorOnRemoveFirstEmpty", testIteratorOnRemoveFirstEmpty()); printTest("testToStringOnRemoveFirstEmpty", testToStringOnRemoveFirstEmpty()); // TESTS ON A LIST WITH ONE VALUE, AFTER ADDTOFRONT() printTest("testAddToFrontOnAddToFrontOne", testAddToFrontOnAddToFrontOne()); printTest("testAddToRearOnAddToFrontOne", testAddToRearOnAddToFrontOne()); printTest("testAddAfterOnAddToFrontOneValid", testAddAfterOnAddToFrontOneValid()); printTest("testAddAfterOnAddToFrontOneInvalid", testAddAfterOnAddToFrontOneInvalid()); printTest("testRemoveFirstOnAddToFrontOne", testRemoveFirstOnAddToFrontOne()); printTest("testRemoveLastOnAddToFrontOne", testRemoveLastOnAddToFrontOne()); printTest("testRemoveElementOnAddToFrontOneValid", testRemoveElementOnAddToFrontOneValid()); printTest("testRemoveElementOnAddToFrontOneInvalid", testRemoveElementOnAddToFrontOneInvalid()); printTest("testFirstOnAddToFrontOne", testFirstOnAddToFrontOne()); printTest("testLastOnAddToFrontOne", testLastOnAddToFrontOne()); printTest("testContainsOnAddToFrontOneValid", testContainsOnAddToFrontOneValid()); printTest("testContainsOnAddToFrontOneInvalid", testContainsOnAddToFrontOneInvalid()); printTest("testIsEmptyOnAddToFrontOne", testIsEmptyOnAddToFrontOne()); printTest("testSizeOnAddToFrontOne", testSizeOnAddToFrontOne()); printTest("testIteratorOnAddToFrontOne", testIteratorOnAddToFrontOne()); printTest("testToStringOnAddToFrontOne", testToStringOnAddToFrontOne()); // TESTS ON A LIST WITH ONE VALUE, AFTER ADDTOREAR() printTest("testAddToFrontOnAddToRearOne", testAddToFrontOnAddToRearOne()); printTest("testAddToRearOnAddToRearOne", testAddToRearOnAddToRearOne()); printTest("testAddAfterOnAddToRearOneValid", testAddAfterOnAddToRearOneValid()); printTest("testAddAfterOnAddToRearOneInvalid", testAddAfterOnAddToRearOneInvalid()); printTest("testRemoveFirstOnAddToRearOne", testRemoveFirstOnAddToRearOne()); printTest("testRemoveLastOnAddToRearOne", testRemoveLastOnAddToRearOne()); printTest("testRemoveElementOnAddToRearOneValid", testRemoveElementOnAddToRearOneValid()); printTest("testRemoveElementOnAddToRearOneInvalid", testRemoveElementOnAddToRearOneInvalid()); printTest("testFirstOnAddToRearOne", testFirstOnAddToRearOne()); printTest("testLastOnAddToRearOne", testLastOnAddToRearOne()); printTest("testContainsOnAddToRearOneValid", testContainsOnAddToRearOneValid()); printTest("testContainsOnAddToRearOneInvalid", testContainsOnAddToRearOneInvalid()); printTest("testIsEmptyOnAddToRearOne", testIsEmptyOnAddToRearOne()); printTest("testSizeOnAddToRearOne", testSizeOnAddToRearOne()); printTest("testIteratorOnAddToRearOne", testIteratorOnAddToRearOne()); printTest("testToStringOnAddToRearOne", testToStringOnAddToRearOne()); // TESTS ON A ONE-ELEMENT LIST THAT HAD REMOVE() CALLED TODO // TEST ON A LIST WITH TWO VALUES, AFTER ADDTOFRONT() printTest("testAddToFrontOnAddToFrontTwo", testAddToFrontOnAddToFrontTwo()); printTest("testAddToRearOnAddToFrontTwo", testAddToRearOnAddToFrontTwo()); printTest("testAddAfterOnAddToFrontTwoValid", testAddAfterOnAddToFrontTwoValid()); printTest("testAddAfterOnAddToFrontTwoInvalid", testAddAfterOnAddToFrontTwoInvalid()); printTest("testRemoveFirstOnAddToFrontTwo", testRemoveFirstOnAddToFrontTwo()); printTest("testRemoveLastOnAddToFrontTwo", testRemoveLastOnAddToFrontTwo()); printTest("testRemoveFirstElementOnAddToFrontTwoValid", testRemoveFirstElementOnAddToFrontTwoValid()); printTest("testRemoveSecondElementOnAddToFrontTwoValid", testRemoveSecondElementOnAddToFrontTwoValid()); printTest("testRemoveElementOnAddToFrontTwoInvalid", testRemoveElementOnAddToFrontTwoInvalid()); printTest("testFirstOnAddToFrontTwo", testFirstOnAddToFrontTwo()); printTest("testLastOnAddToFrontTwo", testLastOnAddToFrontTwo()); printTest("testContainsOnAddToFrontTwoValid", testContainsOnAddToFrontTwoValid()); printTest("testContainsOnAddToFrontTwoInvalid", testContainsOnAddToFrontTwoInvalid()); printTest("testIsEmptyOnAddToFrontTwo", testIsEmptyOnAddToFrontTwo()); printTest("testSizeOnAddToFrontTwo", testSizeOnAddToFrontTwo()); printTest("testIteratorOnAddToFrontTwo", testIteratorOnAddToFrontTwo()); printTest("testToStringOnAddToFrontTwo", testToStringOnAddToFrontTwo()); // TESTS ON A LIST WITH TWO VALUES, ADDTOREAR() printTest("testAddToFrontOnAddToRearTwo", testAddToFrontOnAddToRearTwo()); printTest("testAddToRearOnAddToRearTwo", testAddToRearOnAddToRearTwo()); printTest("testAddAfterOnAddToRearTwoValid", testAddAfterOnAddToRearTwoValid()); printTest("testAddAfterOnAddToRearTwoInvalid", testAddAfterOnAddToRearTwoInvalid()); printTest("testRemoveFirstOnAddToRearTwo", testRemoveFirstOnAddToRearTwo()); printTest("testRemoveLastOnAddToRearTwo", testRemoveLastOnAddToRearTwo()); printTest("testRemoveFirstElementOnAddToRearTwoValid", testRemoveFirstElementOnAddToRearTwoValid()); printTest("testRemoveSecondElementOnAddToRearTwoValid", testRemoveSecondElementOnAddToRearTwoValid()); printTest("testRemoveElementOnAddToRearTwoInvalid", testRemoveElementOnAddToRearTwoInvalid()); printTest("testFirstOnAddToRearTwo", testFirstOnAddToRearTwo()); printTest("testLastOnAddToRearTwo", testLastOnAddToRearTwo()); printTest("testContainsFirstElementOnAddToRearTwoValid", testContainsFirstElementOnAddToRearTwoValid()); printTest("testContainsSecondElementOnAddToRearTwoValid", testContainsSecondElementOnAddToRearTwoValid()); printTest("testContainsOnAddToRearTwoInvalid", testContainsOnAddToRearTwoInvalid()); printTest("testIsEmptyOnAddToRearTwo", testIsEmptyOnAddToRearTwo()); printTest("testSizeOnAddToRearTwo", testSizeOnAddToRearTwo()); printTest("testIteratorOnAddToRearTwo", testIteratorOnAddToRearTwo()); printTest("testToStringOnAddToRearTwo", testToStringOnAddToRearTwo()); // TESTS ON A LIST WITH TWO VALUES, ADDAFTER() printTest("testAddToFrontOnAddAfterTwo", testAddToFrontOnAddAfterTwo()); printTest("testAddToRearOnAddAfterTwo", testAddToRearOnAddAfterTwo()); printTest("testAddAfterOnAddAfterTwoValid", testAddAfterOnAddAfterTwoValid()); printTest("testAddAfterOnAddAfterTwoInvalid", testAddAfterOnAddAfterTwoInvalid()); printTest("testRemoveFirstOnAddAfterTwo", testRemoveFirstOnAddAfterTwo()); printTest("testRemoveLastOnAddAfterTwo", testRemoveLastOnAddAfterTwo()); printTest("testRemoveFirstElementOnAddAfterTwoValid", testRemoveFirstElementOnAddAfterTwoValid()); printTest("testRemoveSecondElementOnAddAfterTwoValid", testRemoveSecondElementOnAddAfterTwoValid()); printTest("testRemoveElementOnAddAfterTwoInvalid", testRemoveElementOnAddAfterTwoInvalid()); printTest("testFirstOnAddAfterTwo", testFirstOnAddAfterTwo()); printTest("testLastOnAddAfterTwo", testLastOnAddAfterTwo()); printTest("testContainsFirstElementOnAddAfterTwoValid", testContainsFirstElementOnAddAfterTwoValid()); printTest("testContainsSecondElementOnAddAfterTwoValid", testContainsSecondElementOnAddAfterTwoValid()); printTest("testContainsOnAddAfterTwoInvalid", testContainsOnAddAfterTwoInvalid()); printTest("testIsEmptyOnAddAfterTwo", testIsEmptyOnAddAfterTwo()); printTest("testSizeOnAddAfterTwo", testSizeOnAddAfterTwo()); printTest("testIteratorOnAddAfterTwo", testIteratorOnAddAfterTwo()); printTest("testToStringOnAddAfterTwo", testToStringOnAddAfterTwo()); // TESTS ON A TWO-ELEMENT LIST THAT HAD REMOVE() CALLED TODO // TESTS ON A LIST WITH THREE VALUES, ADDTOFRONT() printTest("testAddToFrontOnAddToFrontThree", testAddToFrontOnAddToFrontThree()); printTest("testAddToRearOnAddToFrontThree", testAddToRearOnAddToFrontThree()); printTest("testAddAfterFirstElementOnAddToFrontThreeValid", testAddAfterFirstElementOnAddToFrontThreeValid()); printTest("testAddAfterSecondElementOnAddToFrontThreeValid", testAddAfterSecondElementOnAddToFrontThreeValid()); printTest("testAddAfterThirdElementOnAddToFrontThreeValid", testAddAfterThirdElementOnAddToFrontThreeValid()); printTest("testAddAfterOnAddToFrontThreeInvalid", testAddAfterOnAddToFrontThreeInvalid()); printTest("testRemoveFirstOnAddToFrontThree", testRemoveFirstOnAddToFrontThree()); printTest("testRemoveLastOnAddToFrontThree", testRemoveLastOnAddToFrontThree()); printTest("testRemoveFirstElementOnAddToFrontThreeValid", testRemoveFirstElementOnAddToFrontThreeValid()); printTest("testRemoveSecondElementOnAddToFrontThreeValid", testRemoveSecondElementOnAddToFrontThreeValid()); printTest("testRemoveSecondElementOnAddToFrontThreeValid", testRemoveThirdElementOnAddToFrontThreeValid()); printTest("testRemoveElementOnAddToFrontThreeInvalid", testRemoveElementOnAddToFrontThreeInvalid()); printTest("testFirstOnAddToFrontThree", testFirstOnAddToFrontThree()); printTest("testLastOnAddToFrontThree", testLastOnAddToFrontThree()); printTest("testContainsFirstElementOnAddToFrontThreeValid", testContainsFirstElementOnAddToFrontThreeValid()); printTest("testContainsSecondElementOnAddToFrontThreeValid", testContainsSecondElementOnAddToFrontThreeValid()); printTest("testContainsThirdElementOnAddToFrontThreeValid", testContainsThirdElementOnAddToFrontThreeValid()); printTest("testContainsOnAddToFrontThreeInvalid", testContainsOnAddToFrontThreeInvalid()); printTest("testIsEmptyOnAddToFrontThree", testIsEmptyOnAddToFrontThree()); printTest("testSizeOnAddToFrontThree", testSizeOnAddToFrontThree()); printTest("testIteratorOnAddToFrontThree", testIteratorOnAddToFrontThree()); printTest("testToStringOnAddToFrontThree", testToStringOnAddToFrontThree()); // TESTS ON A LIST WITH THREE VALUES, ADDAFTER() FIRST ELEMENT printTest("testAddToFrontOnAddAfterFirstElementThree", testAddToFrontOnAddAfterFirstElementThree()); printTest("testAddToRearOnAddAfterFirstElementThree", testAddToRearOnAddAfterFirstElementThree()); printTest("testAddAfterFirstElementOnAddAfterFirstElementThreeValid", testAddAfterFirstElementOnAddAfterFirstElementThreeValid()); printTest("testAddAfterSecondElementOnAddAfterFirstElementThreeValid", testAddAfterSecondElementOnAddAfterFirstElementThreeValid()); printTest("testAddAfterThirdElementOnAddAfterFirstElementThreeValid", testAddAfterThirdElementOnAddAfterFirstElementThreeValid()); printTest("testAddAfterOnAddAfterFirstElementThreeInvalid", testAddAfterOnAddAfterFirstElementThreeInvalid()); printTest("testRemoveFirstOnAddAfterFirstElementThree", testRemoveFirstOnAddAfterFirstElementThree()); printTest("testRemoveLastOnAddAfterFirstElementThree", testRemoveLastOnAddAfterFirstElementThree()); printTest("testRemoveFirstElementOnAddAfterFirstElementThreeValid", testRemoveFirstElementOnAddAfterFirstElementThreeValid()); printTest("testRemoveSecondElementOnAddAfterFirstElementThreeValid", testRemoveSecondElementOnAddAfterFirstElementThreeValid()); printTest("testRemoveThirdElementOnAddAfterFirstElementThreeValid", testRemoveThirdElementOnAddAfterFirstElementThreeValid()); printTest("testRemoveElementOnAddAfterFirstElementThreeInvalid", testRemoveElementOnAddAfterFirstElementThreeInvalid()); printTest("testFirstOnAddAfterFirstElementThree", testFirstOnAddAfterFirstElementThree()); printTest("testLastOnAddAfterFirstElementThree", testLastOnAddAfterFirstElementThree()); printTest("testContainsFirstElementOnAddAfterFirstElementThreeValid", testContainsFirstElementOnAddAfterFirstElementThreeValid()); printTest("testContainsSecondElementOnAddAfterFirstElementThreeValid", testContainsSecondElementOnAddAfterFirstElementThreeValid()); printTest("testContainsThirdElementOnAddAfterFirstElementThreeValid", testContainsThirdElementOnAddAfterFirstElementThreeValid()); printTest("testContainsOnAddAfterFirstElementThreeInvalid", testContainsOnAddAfterFirstElementThreeInvalid()); printTest("testIsEmptyOnAddAfterFirstElementThree", testIsEmptyOnAddAfterFirstElementThree()); printTest("testSizeOnAddAfterFirstElementThree", testSizeOnAddAfterFirstElementThree()); printTest("testIteratorOnAddAfterFirstElementThree", testIteratorOnAddAfterFirstElementThree()); printTest("testToStringOnAddAfterFirstElementThree", testToStringOnAddAfterFirstElementThree()); // TESTS ON A LIST WITH THREE VALUES, ADDAFTER() SECOND ELEMENT printTest("testAddToFrontOnAddAfterSecondElementThree", testAddToFrontOnAddAfterSecondElementThree()); printTest("testAddToRearOnAddAfterSecondElementThree", testAddToRearOnAddAfterSecondElementThree()); printTest("testAddAfterFirstElementOnAddAfterSecondElementThreeValid", testAddAfterFirstElementOnAddAfterSecondElementThreeValid()); printTest("testAddAfterSecondElementOnAddAfterSecondElementThreeValid", testAddAfterSecondElementOnAddAfterSecondElementThreeValid()); printTest("testAddAfterThirdElementOnAddAfterSecondElementThreeValid", testAddAfterThirdElementOnAddAfterSecondElementThreeValid()); printTest("testAddAfterOnAddAfterSecondElementThreeInvalid", testAddAfterOnAddAfterSecondElementThreeInvalid()); printTest("testRemoveFirstOnAddAfterSecondElementThree", testRemoveFirstOnAddAfterSecondElementThree()); printTest("testRemoveLastOnAddAfterSecondElementThree", testRemoveLastOnAddAfterSecondElementThree()); printTest("testRemoveFirstElementOnAddAfterSecondElementThreeValid", testRemoveFirstElementOnAddAfterSecondElementThreeValid()); printTest("testRemoveSecondElementOnAddAfterSecondElementThreeValid", testRemoveSecondElementOnAddAfterSecondElementThreeValid()); printTest("testRemoveThirdElementOnAddAfterSecondElementThreeValid", testRemoveThirdElementOnAddAfterSecondElementThreeValid()); printTest("testRemoveElementOnAddAfterSecondElementThreeInvalid", testRemoveElementOnAddAfterSecondElementThreeInvalid()); printTest("testFirstOnAddAfterSecondElementThree", testFirstOnAddAfterSecondElementThree()); printTest("testLastOnAddAfterSecondElementThree", testLastOnAddAfterSecondElementThree()); printTest("testContainsFirstElementOnAddAfterSecondElementThreeValid", testContainsFirstElementOnAddAfterSecondElementThreeValid()); printTest("testContainsSecondElementOnAddAfterSecondElementThreeValid", testContainsSecondElementOnAddAfterSecondElementThreeValid()); printTest("testContainsThirdElementOnAddAfterSecondElementThreeValid", testContainsThirdElementOnAddAfterSecondElementThreeValid()); printTest("testContainsOnAddAfterSecondElementThreeInvalid", testContainsOnAddAfterSecondElementThreeInvalid()); printTest("testIsEmptyOnAddAfterSecondElementThree", testIsEmptyOnAddAfterSecondElementThree()); printTest("testSizeOnAddAfterSecondElementThree", testSizeOnAddAfterSecondElementThree()); printTest("testIteratorOnAddAfterSecondElementThree", testIteratorOnAddAfterSecondElementThree()); printTest("testToStringOnAddAfterSecondElementThree", testToStringOnAddAfterSecondElementThree()); // TESTS ON A LIST WITH THREE VALUES, ADDTOREAR() printTest("testAddToFrontOnAddToRearThree", testAddToFrontOnAddToRearThree()); printTest("testAddToRearOnAddToRearThree", testAddToRearOnAddToRearThree()); printTest("testAddAfterFirstElementOnAddToRearThreeValid", testAddAfterFirstElementOnAddToRearThreeValid()); printTest("testAddAfterSecondElementOnAddToRearThreeValid", testAddAfterSecondElementOnAddToRearThreeValid()); printTest("testAddAfterThirdElementOnAddToRearThreeValid", testAddAfterThirdElementOnAddToRearThreeValid()); printTest("testAddAfterOnAddToRearThreeInvalid", testAddAfterOnAddToRearThreeInvalid()); printTest("testRemoveFirstOnAddToRearThree", testRemoveFirstOnAddToRearThree()); printTest("testRemoveLastOnAddToRearThree", testRemoveLastOnAddToRearThree()); printTest("testRemoveFirstElementOnAddToRearThreeValid", testRemoveFirstElementOnAddToRearThreeValid()); printTest("testRemoveSecondElementOnAddToRearThreeValid", testRemoveSecondElementOnAddToRearThreeValid()); printTest("testRemoveThirdElementOnAddToRearThreeValid", testRemoveThirdElementOnAddToRearThreeValid()); printTest("testRemoveElementOnAddToRearThreeInvalid", testRemoveElementOnAddToRearThreeInvalid()); printTest("testFirstOnAddToRearThree", testFirstOnAddToRearThree()); printTest("testLastOnAddToRearThree", testLastOnAddToRearThree()); printTest("testContainsFirstElementOnAddToRearThreeValid", testContainsFirstElementOnAddToRearThreeValid()); printTest("testContainsSecondElementOnAddToRearThreeValid", testContainsSecondElementOnAddToRearThreeValid()); printTest("testContainsThirdElementOnAddToRearThreeValid", testContainsThirdElementOnAddToRearThreeValid()); printTest("testContainsOnAddToRearThreeInvalid", testContainsOnAddToRearThreeInvalid()); printTest("testIsEmptyOnAddToRearThree", testIsEmptyOnAddToRearThree()); printTest("testSizeOnAddToRearThree", testSizeOnAddToRearThree()); printTest("testIteratorOnAddToRearThree", testIteratorOnAddToRearThree()); printTest("testToStringOnAddToRearThree", testToStringOnAddToRearThree()); // /////////////// // final verdict // /////////////// printFinalSummary(); } // ////////////////////////// // SCENARIO: NEW, EMPTY LIST TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnNewList() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnNewList", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnNewList() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnNewList", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnNewList() { UnorderedListADT<Integer> list = newList(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnNewList", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnNewList() { UnorderedListADT<Integer> list = newList(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnNewList", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnNewList() { UnorderedListADT<Integer> list = newList(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnNewList", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnNewList() { UnorderedListADT<Integer> list = newList(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnNewList", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnNewList() { UnorderedListADT<Integer> list = newList(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnNewList", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnNewList() { UnorderedListADT<Integer> list = newList(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: Removed an element from List, now empty TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnRemoveEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnRemoveEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnRemoveEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnRemoveEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnRemoveEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnRemoveEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnRemoveEmpty", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnRemoveEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnRemoveEmpty", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnRemoveEmpty() { UnorderedListADT<Integer> list = newListRemoveEmpty(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: empty List, removeFirst()TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnRemoveFirstEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnRemoveFirstEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnRemoveFirstEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnRemoveFirstEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnRemoveFirstEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnRemoveFirstEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnRemoveFirstEmpty", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnRemoveFirstEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnRemoveFirstEmpty", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnRemoveFirstEmpty() { UnorderedListADT<Integer> list = newListRemoveFirstEmpty(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: empty List, removeLast()TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); Integer i = new Integer(1); try { list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnRemoveLastEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); Integer i = new Integer(1); try { list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnRemoveLastEmpty", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnRemoveLastEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.removeFirst(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveLastOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.removeLast(); } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveElementOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnRemoveLastEmpty", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.first(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testLastOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { list.last(); // exception expected } catch (EmptyCollectionException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnRemoveLastEmpty", "EmptyCollectionException", e.toString()); return false; } return false; } /** @return test success */ private boolean testContainsOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnRemoveLastEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { return (list.isEmpty() == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnRemoveLastEmpty", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { return (list.size() == 0); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnRemoveLastEmpty", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return false; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnRemoveLastEmpty", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnRemoveLastEmpty() { UnorderedListADT<Integer> list = newListRemoveLastEmpty(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); if (str.length() == 0) { return false; } char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: One-Element, addAfter() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToFrontOne() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToFront(new Integer(1)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToFrontOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); Integer i = new Integer(1); try { list.addToFront(new Integer(1)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToFrontOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(1)); list.addAfter(new Integer(2), new Integer(1)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontOneValid", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontOneInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.removeFirst().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnAddToFrontOne", "no Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.removeLast().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnAddToFrontOne", "no Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToFrontOneValid", "no Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontOneInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.remove(new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToFrontOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.first().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnAddToFrontOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.last().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnAddToFrontOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testContainsOnAddToFrontOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontOneValid", e.toString()); return false; } } private boolean testContainsOnAddToFrontOneInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.contains(new Integer(2)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontOneInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToFrontOne", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.size() == 1); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToFrontOne", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToFrontOne() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToFrontOne", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToFrontOne() { UnorderedListADT<Integer> list = newList(); try { String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // ////////////////////////// // SCENARIO: One-Element, addToRear() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToRear(new Integer(1)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToRearOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); Integer i = new Integer(1); try { list.addToRear(new Integer(1)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToRearOne", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearOneValid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); list.addAfter(new Integer(2), new Integer(1)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearOneValid", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearOneInvalid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); list.addAfter(new Integer(1), new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.removeFirst().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.removeLast().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearOneValid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearOneValid", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearOneInvalid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); list.remove(new Integer(2)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearOneInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.first().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.last().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnAddToRearOne", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testContainsOnAddToRearOneValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearOneValid", e.toString()); return false; } } private boolean testContainsOnAddToRearOneInvalid() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.contains(new Integer(2)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearOneInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToRearOne", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); return (list.size() == 1); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToRearOne", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToRearOne", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToRearOne() { UnorderedListADT<Integer> list = newList(); try { list.addToRear(new Integer(1)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // //////////////////////// // SCENARIO: Two-Element, after addToFront() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); Integer i = new Integer(3); try { list.addToFront(new Integer(2)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToFrontTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); Integer i = new Integer(3); try { list.addToFront(new Integer(2)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToFrontTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); list.addAfter(new Integer(3), new Integer(2)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontTwoValid", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontTwoInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); list.addAfter(new Integer(1), new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToFrontTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.removeFirst().equals(new Integer(2))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.removeLast().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveLastOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveFirstElementOnAddToFrontTwoValid", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (ElementNotFoundException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveSecondElementOnAddToFrontTwoValid", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontTwoInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToFrontTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.first().equals(new Integer(2))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testFirstOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.last().equals(new Integer(1))); } catch (EmptyCollectionException e) { return false; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testLastOnAddToFrontTwo", "No Exception", e.toString()); return false; } } /** @return test success */ private boolean testContainsOnAddToFrontTwoValid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontTwoValid", e.toString()); return false; } } private boolean testContainsOnAddToFrontTwoInvalid() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontTwoInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToFrontTwo", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); return (list.size() == 2); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToFrontTwo", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToFrontTwo", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToFrontTwo() { UnorderedListADT<Integer> list = newListAddToFrontOne(); try { list.addToFront(new Integer(2)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // //////////////////////// // SCENARIO: Two-Element, after addToRear() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addToRear(new Integer(2)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToRearTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addToRear(new Integer(2)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToRearTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); list.addAfter(new Integer(3), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterOnAddToRearTwoValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); list.addAfter(new Integer(1), new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddToRearTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddToRearTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddToRearTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddToRearTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddToRearTwoValid", e.toString()); return false; } } private boolean testContainsOnAddToRearTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearTwoInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); return (list.size() == 2); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToRearTwo", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToRearTwo", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToRearTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addToRear(new Integer(2)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // //////////////////////// // SCENARIO: Two-Element, after addAfter() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addAfter(new Integer(2), new Integer(1)); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddAfterTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); Integer i = new Integer(3); try { list.addAfter(new Integer(2), new Integer(1)); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddAfterTwo", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); list.addAfter(new Integer(3), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterOnAddAfterTwoValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); list.addAfter(new Integer(1), new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddAfterTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddAfterTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddAfterTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddAfterTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); list.remove(new Integer(3)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddAfterTwoInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddAfterTwoValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddAfterTwoValid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddAfterTwoValid", e.toString()); return false; } } private boolean testContainsOnAddAfterTwoInvalid() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.contains(new Integer(3)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddAfterTwoInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); return (list.size() == 2); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddAfterTwo", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddAfterTwo", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddAfterTwo() { UnorderedListADT<Integer> list = newListOneElement(); try { list.addAfter(new Integer(2), new Integer(1)); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // ////////////////////// // SCENARIO: Three-Element, after addToFront() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToFrontThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToFrontThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToFrontThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToFrontThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "No Exception", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddToFrontThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(4), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddToFrontThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToFrontThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.removeFirst().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToFrontThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.first().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddToFrontThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddToFrontThreeValid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddToFrontThreeValid", e.toString()); return false; } } private boolean testContainsOnAddToFrontThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToFrontThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToFrontThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToFrontThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToFrontThree() { try { UnorderedListADT<Integer> list = newListAddToFrontThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // /////////////////////////// // SCENARIO: Three-Element, after addAfter() first Element TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddAfterFirstElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddAfterFirstElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddAfterFirstElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddAfterFirstElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterFirstElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterFirstElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.removeLast().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddAfterFirstElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddAfterFirstElementThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.last().equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddAfterFirstElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddAfterFirstElementThreeValid", e.toString()); return false; } } private boolean testContainsOnAddAfterFirstElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddAfterFirstElementThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddAfterFirstElementThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddAfterFirstElementThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddAfterFirstElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterFirstElementThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // /////////////////////////// // SCENARIO: Three-Element, after addAfter() first Element TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddAfterSecondElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddAfterSecondElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddAfterSecondElementThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddAfterSecondElementThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterFirstElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddAfterSecondElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnNewList", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.removeLast().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddAfterSecondElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddAfterSecondElementThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.last().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddAfterSecondElementThreeValid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddAfterSecondElementThreeValid", e.toString()); return false; } } private boolean testContainsOnAddAfterSecondElementThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddAfterSecondElementThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddAfterSecondElementThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddAfterSecondElementThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddAfterSecondElementThree() { try { UnorderedListADT<Integer> list = newListAddAfterSecondElementThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } // /////////////////////////// // SCENARIO: Three-Element, after addToRear() TODO // ////////////////////////// /** @return test success */ private boolean testAddToFrontOnAddToRearThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addToFront(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToFrontOnAddToRearThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddToRearOnAddToRearThree() { Integer i = new Integer(4); try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addToRear(i); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddToRearOnAddToRearThree", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterFirstElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(4), new Integer(3)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterFirstElementOnAddToRearThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterSecondElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(4), new Integer(1)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterSecondElementOnAddToRearThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterThirdElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(4), new Integer(2)); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testAddAfterThirdElementOnAddToRearThreeValid", e.toString()); return false; } return true; } /** @return test success */ private boolean testAddAfterOnAddToRearThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.addAfter(new Integer(5), new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testAddAfterOnAddToRearThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testRemoveFirstOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.removeFirst().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveLastOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.removeLast().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveLastOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testRemoveFirstElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.remove(new Integer(3)).equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveFirstElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveSecondElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.remove(new Integer(1)).equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveSecondElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveThirdElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.remove(new Integer(2)).equals(new Integer(2))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testRemoveThirdElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testRemoveElementOnAddToRearThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); list.remove(new Integer(4)); } catch (ElementNotFoundException e) { return true; } catch (Exception e) { System.out.printf("%s expected %s, caught %s\n", "testRemoveElementOnAddToRearThreeInvalid", "ElementNotFoundException", e.toString()); return false; } return false; } /** @return test success */ private boolean testFirstOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.first().equals(new Integer(1))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testFirstOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testLastOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.last().equals(new Integer(3))); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testLastOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testContainsFirstElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(3)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsFirstElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsSecondElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(1)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsSecondElementOnAddToRearThreeValid", e.toString()); return false; } } /** @return test success */ private boolean testContainsThirdElementOnAddToRearThreeValid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(2)) == true); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsThirdElementOnAddToRearThreeValid", e.toString()); return false; } } private boolean testContainsOnAddToRearThreeInvalid() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.contains(new Integer(4)) == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testContainsOnAddToRearThreeInvalid", e.toString()); return false; } } /** @return test success */ private boolean testIsEmptyOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.isEmpty() == false); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testIsEmptyOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testSizeOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); return (list.size() == 3); } catch (Exception e) { System.out.printf("%s caught unexpected %s\n", "testSizeOnAddToRearThree", e.toString()); return false; } } /** @return test success */ private boolean testIteratorOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); Iterator<Integer> it = list.iterator(); if (it.hasNext() == true) { // should be false return true; } try { it.next(); // NoSuchElementException expected } catch (NoSuchElementException e) { // iterator() returned an Iterator<Integer>, // hasNext() returned false, // and next() threw a NoSuchElementException return true; } // next() did not throw an exception return false; } catch (Exception e) { // iterator() returned null or another invalid type System.out.printf("%s caught unexpected %s\n", "testIteratorOnAddToRearThree", e.toString()); return false; } } /** * toString() is difficult to test - would like to confirm that the default * address output has been overridden * * @return test success */ private boolean testToStringOnAddToRearThree() { try { UnorderedListADT<Integer> list = newListAddToRearThree(); String str = list.toString(); System.out.println("toString() output:\n" + str); char lastChar = str.charAt(str.length() - 1); if (str.contains("@") && !str.contains(" ") && Character.isLetter(str.charAt(0)) && (Character.isDigit(lastChar) || (lastChar >= 'a' && lastChar <= 'f'))) { return false; // looks like default toString() } if (str.length() != 0) { return true; } } catch (Exception e) { return false; } return true; } }// end class UnorderedListTester
125,330
0.717219
0.71433
3,556
34.244656
32.8451
159
false
false
0
0
0
0
0
0
2.646513
false
false
14
d65ae387e3e297b1423fac17ac72c0b6332e1258
16,252,156,310,661
77cc1bf27318f5d02faca6321c300ab80f372315
/.svn/pristine/04/04af9420042df9d75bb0740e0ce35c03448a7d53.svn-base
4f0f3691ca7c7a871f8a11bb68e30537aece1c8d
[]
no_license
rohanshah25/Spring-Hibernate-Graduate-Application-
https://github.com/rohanshah25/Spring-Hibernate-Graduate-Application-
8f58c2f93fe1fa02d7f1cb5f8a20e7d47b875570
1bc60ebed79553c2ea7c8a7de5bce76ea4cc9edf
refs/heads/master
2021-01-22T10:37:00.551000
2017-02-15T05:40:26
2017-02-15T05:40:26
82,023,433
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gapp.model.dao; import gapp.model.Department; import java.util.List; public interface DepartmentDAO { public List<Department> getDepartments(); public Department getDepartmentById(int departmentid); Department addDepartment(Department department); Department saveDepartment(Department department); }
UTF-8
Java
322
04af9420042df9d75bb0740e0ce35c03448a7d53.svn-base
Java
[]
null
[]
package gapp.model.dao; import gapp.model.Department; import java.util.List; public interface DepartmentDAO { public List<Department> getDepartments(); public Department getDepartmentById(int departmentid); Department addDepartment(Department department); Department saveDepartment(Department department); }
322
0.804348
0.804348
14
22
21.027193
56
false
false
0
0
0
0
0
0
0.857143
false
false
14
1bb29a3da80fc434b97577e9a4d341db8fdf1a71
10,934,986,761,168
e3d0f7f75e4356413d05ba78e14c484f8555b2b5
/azure-resourcemanager-hybrid/src/main/java/com/azure/resourcemanager/hybrid/appservice/implementation/AppServicePlanImpl.java
347000228898e63bcf55d87112f63acfd7e5a693
[ "MIT" ]
permissive
weidongxu-microsoft/azure-stack-java-samples
https://github.com/weidongxu-microsoft/azure-stack-java-samples
1df227502c367f128916f121ccc0f5bc77b045e5
afdfd0ed220f2f8a603c6fa5e16311a7842eb31c
refs/heads/main
2023-04-04T12:24:07.405000
2021-04-07T08:06:00
2021-04-07T08:06:00
337,593,216
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.hybrid.appservice.implementation; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.util.Context; import com.azure.resourcemanager.hybrid.appservice.fluent.models.AppServicePlanInner; import com.azure.resourcemanager.hybrid.appservice.models.AppServicePlan; import com.azure.resourcemanager.hybrid.appservice.models.AppServicePlanPatchResource; import com.azure.resourcemanager.hybrid.appservice.models.HostingEnvironmentProfile; import com.azure.resourcemanager.hybrid.appservice.models.ProvisioningState; import com.azure.resourcemanager.hybrid.appservice.models.SkuDescription; import com.azure.resourcemanager.hybrid.appservice.models.StatusOptions; import java.time.OffsetDateTime; import java.util.Collections; import java.util.Map; public final class AppServicePlanImpl implements AppServicePlan, AppServicePlan.Definition, AppServicePlan.Update { private AppServicePlanInner innerObject; private final com.azure.resourcemanager.hybrid.appservice.AppServiceManager serviceManager; public String id() { return this.innerModel().id(); } public String name() { return this.innerModel().name(); } public String type() { return this.innerModel().type(); } public String location() { return this.innerModel().location(); } public Map<String, String> tags() { Map<String, String> inner = this.innerModel().tags(); if (inner != null) { return Collections.unmodifiableMap(inner); } else { return Collections.emptyMap(); } } public SkuDescription sku() { return this.innerModel().sku(); } public String workerTierName() { return this.innerModel().workerTierName(); } public StatusOptions status() { return this.innerModel().status(); } public String subscription() { return this.innerModel().subscription(); } public HostingEnvironmentProfile hostingEnvironmentProfile() { return this.innerModel().hostingEnvironmentProfile(); } public Integer maximumNumberOfWorkers() { return this.innerModel().maximumNumberOfWorkers(); } public String geoRegion() { return this.innerModel().geoRegion(); } public Boolean perSiteScaling() { return this.innerModel().perSiteScaling(); } public Integer maximumElasticWorkerCount() { return this.innerModel().maximumElasticWorkerCount(); } public Integer numberOfSites() { return this.innerModel().numberOfSites(); } public Boolean isSpot() { return this.innerModel().isSpot(); } public OffsetDateTime spotExpirationTime() { return this.innerModel().spotExpirationTime(); } public OffsetDateTime freeOfferExpirationTime() { return this.innerModel().freeOfferExpirationTime(); } public String resourceGroup() { return this.innerModel().resourceGroup(); } public Boolean reserved() { return this.innerModel().reserved(); } public Boolean isXenon() { return this.innerModel().isXenon(); } public Boolean hyperV() { return this.innerModel().hyperV(); } public Integer targetWorkerCount() { return this.innerModel().targetWorkerCount(); } public Integer targetWorkerSizeId() { return this.innerModel().targetWorkerSizeId(); } public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } public String kind() { return this.innerModel().kind(); } public Region region() { return Region.fromName(this.regionName()); } public String regionName() { return this.location(); } public AppServicePlanInner innerModel() { return this.innerObject; } private com.azure.resourcemanager.hybrid.appservice.AppServiceManager manager() { return this.serviceManager; } private String resourceGroupName; private String name; private AppServicePlanPatchResource updateAppServicePlan; public AppServicePlanImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; return this; } public AppServicePlan create() { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .createOrUpdate(resourceGroupName, name, this.innerModel(), Context.NONE); return this; } public AppServicePlan create(Context context) { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .createOrUpdate(resourceGroupName, name, this.innerModel(), context); return this; } AppServicePlanImpl(String name, com.azure.resourcemanager.hybrid.appservice.AppServiceManager serviceManager) { this.innerObject = new AppServicePlanInner(); this.serviceManager = serviceManager; this.name = name; } public AppServicePlanImpl update() { this.updateAppServicePlan = new AppServicePlanPatchResource(); return this; } public AppServicePlan apply() { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .updateWithResponse(resourceGroupName, name, updateAppServicePlan, Context.NONE) .getValue(); return this; } public AppServicePlan apply(Context context) { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .updateWithResponse(resourceGroupName, name, updateAppServicePlan, context) .getValue(); return this; } AppServicePlanImpl( AppServicePlanInner innerObject, com.azure.resourcemanager.hybrid.appservice.AppServiceManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); this.name = Utils.getValueFromIdByName(innerObject.id(), "serverfarms"); } public AppServicePlan refresh() { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE) .getValue(); return this; } public AppServicePlan refresh(Context context) { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .getByResourceGroupWithResponse(resourceGroupName, name, context) .getValue(); return this; } public void restartWebApps() { serviceManager.appServicePlans().restartWebApps(resourceGroupName, name); } public Response<Void> restartWebAppsWithResponse(Boolean softRestart, Context context) { return serviceManager .appServicePlans() .restartWebAppsWithResponse(resourceGroupName, name, softRestart, context); } public AppServicePlanImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; } public AppServicePlanImpl withRegion(String location) { this.innerModel().withLocation(location); return this; } public AppServicePlanImpl withTags(Map<String, String> tags) { this.innerModel().withTags(tags); return this; } public AppServicePlanImpl withSku(SkuDescription sku) { this.innerModel().withSku(sku); return this; } public AppServicePlanImpl withWorkerTierName(String workerTierName) { if (isInCreateMode()) { this.innerModel().withWorkerTierName(workerTierName); return this; } else { this.updateAppServicePlan.withWorkerTierName(workerTierName); return this; } } public AppServicePlanImpl withHostingEnvironmentProfile(HostingEnvironmentProfile hostingEnvironmentProfile) { this.innerModel().withHostingEnvironmentProfile(hostingEnvironmentProfile); return this; } public AppServicePlanImpl withPerSiteScaling(Boolean perSiteScaling) { if (isInCreateMode()) { this.innerModel().withPerSiteScaling(perSiteScaling); return this; } else { this.updateAppServicePlan.withPerSiteScaling(perSiteScaling); return this; } } public AppServicePlanImpl withMaximumElasticWorkerCount(Integer maximumElasticWorkerCount) { if (isInCreateMode()) { this.innerModel().withMaximumElasticWorkerCount(maximumElasticWorkerCount); return this; } else { this.updateAppServicePlan.withMaximumElasticWorkerCount(maximumElasticWorkerCount); return this; } } public AppServicePlanImpl withIsSpot(Boolean isSpot) { if (isInCreateMode()) { this.innerModel().withIsSpot(isSpot); return this; } else { this.updateAppServicePlan.withIsSpot(isSpot); return this; } } public AppServicePlanImpl withSpotExpirationTime(OffsetDateTime spotExpirationTime) { if (isInCreateMode()) { this.innerModel().withSpotExpirationTime(spotExpirationTime); return this; } else { this.updateAppServicePlan.withSpotExpirationTime(spotExpirationTime); return this; } } public AppServicePlanImpl withFreeOfferExpirationTime(OffsetDateTime freeOfferExpirationTime) { if (isInCreateMode()) { this.innerModel().withFreeOfferExpirationTime(freeOfferExpirationTime); return this; } else { this.updateAppServicePlan.withFreeOfferExpirationTime(freeOfferExpirationTime); return this; } } public AppServicePlanImpl withReserved(Boolean reserved) { this.innerModel().withReserved(reserved); return this; } public AppServicePlanImpl withIsXenon(Boolean isXenon) { this.innerModel().withIsXenon(isXenon); return this; } public AppServicePlanImpl withHyperV(Boolean hyperV) { this.innerModel().withHyperV(hyperV); return this; } public AppServicePlanImpl withTargetWorkerCount(Integer targetWorkerCount) { if (isInCreateMode()) { this.innerModel().withTargetWorkerCount(targetWorkerCount); return this; } else { this.updateAppServicePlan.withTargetWorkerCount(targetWorkerCount); return this; } } public AppServicePlanImpl withTargetWorkerSizeId(Integer targetWorkerSizeId) { if (isInCreateMode()) { this.innerModel().withTargetWorkerSizeId(targetWorkerSizeId); return this; } else { this.updateAppServicePlan.withTargetWorkerSizeId(targetWorkerSizeId); return this; } } public AppServicePlanImpl withKind(String kind) { if (isInCreateMode()) { this.innerModel().withKind(kind); return this; } else { this.updateAppServicePlan.withKind(kind); return this; } } private boolean isInCreateMode() { return this.innerModel().id() == null; } }
UTF-8
Java
11,884
java
AppServicePlanImpl.java
Java
[]
null
[]
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.hybrid.appservice.implementation; import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.util.Context; import com.azure.resourcemanager.hybrid.appservice.fluent.models.AppServicePlanInner; import com.azure.resourcemanager.hybrid.appservice.models.AppServicePlan; import com.azure.resourcemanager.hybrid.appservice.models.AppServicePlanPatchResource; import com.azure.resourcemanager.hybrid.appservice.models.HostingEnvironmentProfile; import com.azure.resourcemanager.hybrid.appservice.models.ProvisioningState; import com.azure.resourcemanager.hybrid.appservice.models.SkuDescription; import com.azure.resourcemanager.hybrid.appservice.models.StatusOptions; import java.time.OffsetDateTime; import java.util.Collections; import java.util.Map; public final class AppServicePlanImpl implements AppServicePlan, AppServicePlan.Definition, AppServicePlan.Update { private AppServicePlanInner innerObject; private final com.azure.resourcemanager.hybrid.appservice.AppServiceManager serviceManager; public String id() { return this.innerModel().id(); } public String name() { return this.innerModel().name(); } public String type() { return this.innerModel().type(); } public String location() { return this.innerModel().location(); } public Map<String, String> tags() { Map<String, String> inner = this.innerModel().tags(); if (inner != null) { return Collections.unmodifiableMap(inner); } else { return Collections.emptyMap(); } } public SkuDescription sku() { return this.innerModel().sku(); } public String workerTierName() { return this.innerModel().workerTierName(); } public StatusOptions status() { return this.innerModel().status(); } public String subscription() { return this.innerModel().subscription(); } public HostingEnvironmentProfile hostingEnvironmentProfile() { return this.innerModel().hostingEnvironmentProfile(); } public Integer maximumNumberOfWorkers() { return this.innerModel().maximumNumberOfWorkers(); } public String geoRegion() { return this.innerModel().geoRegion(); } public Boolean perSiteScaling() { return this.innerModel().perSiteScaling(); } public Integer maximumElasticWorkerCount() { return this.innerModel().maximumElasticWorkerCount(); } public Integer numberOfSites() { return this.innerModel().numberOfSites(); } public Boolean isSpot() { return this.innerModel().isSpot(); } public OffsetDateTime spotExpirationTime() { return this.innerModel().spotExpirationTime(); } public OffsetDateTime freeOfferExpirationTime() { return this.innerModel().freeOfferExpirationTime(); } public String resourceGroup() { return this.innerModel().resourceGroup(); } public Boolean reserved() { return this.innerModel().reserved(); } public Boolean isXenon() { return this.innerModel().isXenon(); } public Boolean hyperV() { return this.innerModel().hyperV(); } public Integer targetWorkerCount() { return this.innerModel().targetWorkerCount(); } public Integer targetWorkerSizeId() { return this.innerModel().targetWorkerSizeId(); } public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } public String kind() { return this.innerModel().kind(); } public Region region() { return Region.fromName(this.regionName()); } public String regionName() { return this.location(); } public AppServicePlanInner innerModel() { return this.innerObject; } private com.azure.resourcemanager.hybrid.appservice.AppServiceManager manager() { return this.serviceManager; } private String resourceGroupName; private String name; private AppServicePlanPatchResource updateAppServicePlan; public AppServicePlanImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; return this; } public AppServicePlan create() { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .createOrUpdate(resourceGroupName, name, this.innerModel(), Context.NONE); return this; } public AppServicePlan create(Context context) { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .createOrUpdate(resourceGroupName, name, this.innerModel(), context); return this; } AppServicePlanImpl(String name, com.azure.resourcemanager.hybrid.appservice.AppServiceManager serviceManager) { this.innerObject = new AppServicePlanInner(); this.serviceManager = serviceManager; this.name = name; } public AppServicePlanImpl update() { this.updateAppServicePlan = new AppServicePlanPatchResource(); return this; } public AppServicePlan apply() { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .updateWithResponse(resourceGroupName, name, updateAppServicePlan, Context.NONE) .getValue(); return this; } public AppServicePlan apply(Context context) { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .updateWithResponse(resourceGroupName, name, updateAppServicePlan, context) .getValue(); return this; } AppServicePlanImpl( AppServicePlanInner innerObject, com.azure.resourcemanager.hybrid.appservice.AppServiceManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); this.name = Utils.getValueFromIdByName(innerObject.id(), "serverfarms"); } public AppServicePlan refresh() { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE) .getValue(); return this; } public AppServicePlan refresh(Context context) { this.innerObject = serviceManager .serviceClient() .getAppServicePlans() .getByResourceGroupWithResponse(resourceGroupName, name, context) .getValue(); return this; } public void restartWebApps() { serviceManager.appServicePlans().restartWebApps(resourceGroupName, name); } public Response<Void> restartWebAppsWithResponse(Boolean softRestart, Context context) { return serviceManager .appServicePlans() .restartWebAppsWithResponse(resourceGroupName, name, softRestart, context); } public AppServicePlanImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; } public AppServicePlanImpl withRegion(String location) { this.innerModel().withLocation(location); return this; } public AppServicePlanImpl withTags(Map<String, String> tags) { this.innerModel().withTags(tags); return this; } public AppServicePlanImpl withSku(SkuDescription sku) { this.innerModel().withSku(sku); return this; } public AppServicePlanImpl withWorkerTierName(String workerTierName) { if (isInCreateMode()) { this.innerModel().withWorkerTierName(workerTierName); return this; } else { this.updateAppServicePlan.withWorkerTierName(workerTierName); return this; } } public AppServicePlanImpl withHostingEnvironmentProfile(HostingEnvironmentProfile hostingEnvironmentProfile) { this.innerModel().withHostingEnvironmentProfile(hostingEnvironmentProfile); return this; } public AppServicePlanImpl withPerSiteScaling(Boolean perSiteScaling) { if (isInCreateMode()) { this.innerModel().withPerSiteScaling(perSiteScaling); return this; } else { this.updateAppServicePlan.withPerSiteScaling(perSiteScaling); return this; } } public AppServicePlanImpl withMaximumElasticWorkerCount(Integer maximumElasticWorkerCount) { if (isInCreateMode()) { this.innerModel().withMaximumElasticWorkerCount(maximumElasticWorkerCount); return this; } else { this.updateAppServicePlan.withMaximumElasticWorkerCount(maximumElasticWorkerCount); return this; } } public AppServicePlanImpl withIsSpot(Boolean isSpot) { if (isInCreateMode()) { this.innerModel().withIsSpot(isSpot); return this; } else { this.updateAppServicePlan.withIsSpot(isSpot); return this; } } public AppServicePlanImpl withSpotExpirationTime(OffsetDateTime spotExpirationTime) { if (isInCreateMode()) { this.innerModel().withSpotExpirationTime(spotExpirationTime); return this; } else { this.updateAppServicePlan.withSpotExpirationTime(spotExpirationTime); return this; } } public AppServicePlanImpl withFreeOfferExpirationTime(OffsetDateTime freeOfferExpirationTime) { if (isInCreateMode()) { this.innerModel().withFreeOfferExpirationTime(freeOfferExpirationTime); return this; } else { this.updateAppServicePlan.withFreeOfferExpirationTime(freeOfferExpirationTime); return this; } } public AppServicePlanImpl withReserved(Boolean reserved) { this.innerModel().withReserved(reserved); return this; } public AppServicePlanImpl withIsXenon(Boolean isXenon) { this.innerModel().withIsXenon(isXenon); return this; } public AppServicePlanImpl withHyperV(Boolean hyperV) { this.innerModel().withHyperV(hyperV); return this; } public AppServicePlanImpl withTargetWorkerCount(Integer targetWorkerCount) { if (isInCreateMode()) { this.innerModel().withTargetWorkerCount(targetWorkerCount); return this; } else { this.updateAppServicePlan.withTargetWorkerCount(targetWorkerCount); return this; } } public AppServicePlanImpl withTargetWorkerSizeId(Integer targetWorkerSizeId) { if (isInCreateMode()) { this.innerModel().withTargetWorkerSizeId(targetWorkerSizeId); return this; } else { this.updateAppServicePlan.withTargetWorkerSizeId(targetWorkerSizeId); return this; } } public AppServicePlanImpl withKind(String kind) { if (isInCreateMode()) { this.innerModel().withKind(kind); return this; } else { this.updateAppServicePlan.withKind(kind); return this; } } private boolean isInCreateMode() { return this.innerModel().id() == null; } }
11,884
0.656176
0.656176
382
30.109947
27.822144
120
false
false
0
0
0
0
0
0
0.41623
false
false
14
b79d25c29fe307db3259216c7b523b997cc4e8fe
20,486,994,004,240
f59cb0bfe18356b2fcbac4df06173f94417a470d
/part3/LocalClass.java
bfb1989c8a29ba5152d2635dd406b9ec2d71e1f8
[]
no_license
ashish-mj/java_practice
https://github.com/ashish-mj/java_practice
4a174f88312df0f3521a1c9662c80fc879cc4ca3
3a59d5d641225936b3bf304f3ce2022b59c2895d
refs/heads/master
2023-03-13T01:26:22.307000
2021-03-03T04:39:13
2021-03-03T04:39:13
341,892,586
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rakuten.oops.part3; public class LocalClass { public static void main(String[] args) { // TODO Auto-generated method stub int x=10; class Local{ void f1() { System.out.println("local class f1 method"+x); } } Local l=new Local(); l.f1(); } }
UTF-8
Java
283
java
LocalClass.java
Java
[]
null
[]
package com.rakuten.oops.part3; public class LocalClass { public static void main(String[] args) { // TODO Auto-generated method stub int x=10; class Local{ void f1() { System.out.println("local class f1 method"+x); } } Local l=new Local(); l.f1(); } }
283
0.628975
0.607774
18
14.611111
15.506769
50
false
false
0
0
0
0
0
0
1.611111
false
false
14
609c492e19da625d3cb68cfd9d337bbe219c3540
10,436,770,544,404
ab481d3a8169c293b7ed39c3b90b521a90ad26d4
/src/main/java/io/matel/youtube/Test.java
4bcfa3430cc9636f76d98dd2fecd33310e912623
[]
no_license
matelrepo/youtube-server-java
https://github.com/matelrepo/youtube-server-java
a7a3e9f08ee73d06330fbc1cb030cab35dc8a85d
6f9fb848d5b2a7471a93f8e8f7a68cf6e1af2350
refs/heads/master
2020-08-28T07:30:00.975000
2019-10-26T02:08:13
2019-10-26T02:08:13
217,636,964
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.matel.youtube; public class Test { }
UTF-8
Java
49
java
Test.java
Java
[]
null
[]
package io.matel.youtube; public class Test { }
49
0.734694
0.734694
4
11.25
10.963006
25
false
false
0
0
0
0
0
0
0.25
false
false
14
cd0584391adf027f883848c4b34e425f30d438e1
22,462,679,018,149
72ac50684f14b565b3c06295a3110191ef7200b1
/src/main/java/com/playlist/domain/Logs.java
70fc7c7bf045aa8a1aad3d046014dfa518910a51
[]
no_license
xcoders-hub/playlistParser
https://github.com/xcoders-hub/playlistParser
a585d16b1513c7149d8edc73a7e479352a73f78d
4b94264cf491bc98267d8f06dbbfc1d529318e21
refs/heads/master
2022-02-18T21:17:19.206000
2019-09-02T11:14:52
2019-09-02T11:14:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.playlist.domain; import java.util.ArrayList; import java.util.List; /** * @author 62000465 2019-03-20 * */ public class Logs { private List< Log > lstLogs = new ArrayList<>(); /** * Getter for logs * * @author 62000465 2019-03-20 * @return the logs {@link List<Log>} */ public List< Log > getLogs() { return lstLogs; } /** * Setter for logs * * @author 62000465 2019-03-20 * @param logs the logs to set */ public void setLogs( List< Log > logs ) { lstLogs = logs; } /** * The <b>addLog</b> method returns {@link void} * * @author 62000465 2019-03-20 * @param strMessage */ public void addLog( String strMessage ) { lstLogs.add( new Log( strMessage ) ); } }
UTF-8
Java
729
java
Logs.java
Java
[]
null
[]
package com.playlist.domain; import java.util.ArrayList; import java.util.List; /** * @author 62000465 2019-03-20 * */ public class Logs { private List< Log > lstLogs = new ArrayList<>(); /** * Getter for logs * * @author 62000465 2019-03-20 * @return the logs {@link List<Log>} */ public List< Log > getLogs() { return lstLogs; } /** * Setter for logs * * @author 62000465 2019-03-20 * @param logs the logs to set */ public void setLogs( List< Log > logs ) { lstLogs = logs; } /** * The <b>addLog</b> method returns {@link void} * * @author 62000465 2019-03-20 * @param strMessage */ public void addLog( String strMessage ) { lstLogs.add( new Log( strMessage ) ); } }
729
0.615912
0.528121
46
14.847826
15.201498
49
false
false
0
0
0
0
0
0
0.891304
false
false
14
a6f24c9fa91dc1170d402272d6392cf3b31dd0b9
21,844,203,675,350
4d3f4d42cf8fa4f69b9f8031c96d990afa33c9a2
/silktouch_spawner/src/main/java/com/jsonmack/mcplugins/silktouch_spawner/key/SpawnerNamespacedKeySet.java
6e446823ff8429322b2bedfb9da1f2c6ecf765bc
[]
no_license
JasonMacKeigan/mcplugins
https://github.com/JasonMacKeigan/mcplugins
1a95c8395b96ae6a25da0ba053d153883792cab5
c1368349c962ca0cfaa7b8b422a8dcf1e531c4e3
refs/heads/master
2021-03-09T17:12:48.642000
2020-09-01T19:08:17
2020-09-01T19:08:17
246,360,748
0
1
null
false
2020-10-14T00:22:22
2020-03-10T17:08:25
2020-09-01T19:08:28
2020-10-14T00:22:21
14,332
0
0
15
Java
false
false
package com.jsonmack.mcplugins.silktouch_spawner.key; import org.bukkit.NamespacedKey; import org.bukkit.plugin.java.JavaPlugin; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Created by Jason MK on 2020-03-22 at 2:30 a.m. */ public class SpawnerNamespacedKeySet { private final JavaPlugin plugin; private final Map<SpawnerNamespacedKey, NamespacedKey> keys; public SpawnerNamespacedKeySet(JavaPlugin plugin) { this.plugin = plugin; this.keys = Stream.of(SpawnerNamespacedKey.values()).collect(Collectors.toMap(Function.identity(), key -> new NamespacedKey(plugin, key.name()))); } public NamespacedKey getNamespacedKey(SpawnerNamespacedKey key) { return keys.get(key); } }
UTF-8
Java
817
java
SpawnerNamespacedKeySet.java
Java
[ { "context": "import java.util.stream.Stream;\n\n/**\n * Created by Jason MK on 2020-03-22 at 2:30 a.m.\n */\npublic class Spawn", "end": 284, "score": 0.9963297843933105, "start": 276, "tag": "NAME", "value": "Jason MK" } ]
null
[]
package com.jsonmack.mcplugins.silktouch_spawner.key; import org.bukkit.NamespacedKey; import org.bukkit.plugin.java.JavaPlugin; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Created by <NAME> on 2020-03-22 at 2:30 a.m. */ public class SpawnerNamespacedKeySet { private final JavaPlugin plugin; private final Map<SpawnerNamespacedKey, NamespacedKey> keys; public SpawnerNamespacedKeySet(JavaPlugin plugin) { this.plugin = plugin; this.keys = Stream.of(SpawnerNamespacedKey.values()).collect(Collectors.toMap(Function.identity(), key -> new NamespacedKey(plugin, key.name()))); } public NamespacedKey getNamespacedKey(SpawnerNamespacedKey key) { return keys.get(key); } }
815
0.741738
0.728274
29
27.172413
32.400585
154
false
false
0
0
0
0
0
0
0.517241
false
false
14
d2632a1c869dbb76a048c79d7f18b79c5b735ad9
5,677,946,807,240
fa12498e9ef58294919c6493064f12f1a032bce9
/src/main/java/org/catkin/supermassage/repository/StaffPackagesRepository.java
89060d42c284a3e716afa000c1b5092824ce261d
[]
no_license
CatkinNice/SuperMassage
https://github.com/CatkinNice/SuperMassage
8623bf2c7c835bf3e54f7300fab692a16e7eb7e6
7f6b4922467dc27838cf17f7a591a61c5a5716ad
refs/heads/master
2021-01-21T02:10:40.553000
2016-06-02T14:23:39
2016-06-02T14:23:39
36,355,803
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.catkin.supermassage.repository; import java.util.Collections; import java.util.List; import org.catkin.supermassage.entity.StaffPackages; import org.catkin.supermassage.utils.MyJdbcTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.stereotype.Repository; /** * * @author Catkin_nice * */ @Repository public class StaffPackagesRepository { @Autowired private MyJdbcTemplate template; public void addStaffPackages(List<StaffPackages> staffPackages) { String sql = "INSERT INTO t_staff_packages (staff_id, package_id) VALUES(:staffId, :packagesId)"; SqlParameterSource[] batchValues = new SqlParameterSource[staffPackages.size()]; for (int i = 0; i < batchValues.length; i++) { batchValues[i] = new BeanPropertySqlParameterSource(staffPackages.get(i)); } template.batchUpdate(sql, batchValues); } public void delStaffPackagesByStaffId(Long staffId) { String sql = "DELETE FROM t_staff_packages WHERE staff_id = :staffId"; template.update(sql, Collections.singletonMap("staffId", staffId)); } public void delStaffPackagesByPackageId(Long packageId) { String sql = "DELETE FROM t_staff_packages WHERE package_id = :packageId"; template.update(sql, Collections.singletonMap("packageId", packageId)); } }
UTF-8
Java
1,492
java
StaffPackagesRepository.java
Java
[ { "context": "ork.stereotype.Repository;\r\n\r\n/**\r\n * \r\n * @author Catkin_nice\r\n *\r\n */\r\n@Repository\r\npublic class StaffPackages", "end": 511, "score": 0.9995764493942261, "start": 500, "tag": "USERNAME", "value": "Catkin_nice" } ]
null
[]
package org.catkin.supermassage.repository; import java.util.Collections; import java.util.List; import org.catkin.supermassage.entity.StaffPackages; import org.catkin.supermassage.utils.MyJdbcTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.stereotype.Repository; /** * * @author Catkin_nice * */ @Repository public class StaffPackagesRepository { @Autowired private MyJdbcTemplate template; public void addStaffPackages(List<StaffPackages> staffPackages) { String sql = "INSERT INTO t_staff_packages (staff_id, package_id) VALUES(:staffId, :packagesId)"; SqlParameterSource[] batchValues = new SqlParameterSource[staffPackages.size()]; for (int i = 0; i < batchValues.length; i++) { batchValues[i] = new BeanPropertySqlParameterSource(staffPackages.get(i)); } template.batchUpdate(sql, batchValues); } public void delStaffPackagesByStaffId(Long staffId) { String sql = "DELETE FROM t_staff_packages WHERE staff_id = :staffId"; template.update(sql, Collections.singletonMap("staffId", staffId)); } public void delStaffPackagesByPackageId(Long packageId) { String sql = "DELETE FROM t_staff_packages WHERE package_id = :packageId"; template.update(sql, Collections.singletonMap("packageId", packageId)); } }
1,492
0.760724
0.760054
41
34.390244
30.679205
99
false
false
0
0
0
0
0
0
1.439024
false
false
14
d0f27f4a097783d0161a4535f231d73f3a40f357
5,677,946,807,217
8564ad796766513f64af24217c972565ccfc8ce5
/Old_HotelOS/HotelOS/Client/src/blservice_driver/MemberBLService_Driver.java
16ff7c764e398d8ddad8cedbd2ddaacf38fb0c9d
[]
no_license
Leftovers4/Leftovers
https://github.com/Leftovers4/Leftovers
9d540860f3f48261eb569fcdca40feebdaca3d7b
e8f1bd4a515541abe6007e7627cd720b59382f8a
refs/heads/master
2021-06-09T19:38:20.206000
2017-01-01T17:20:15
2017-01-01T17:20:15
68,731,894
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package blservice_driver; import blservice.memberblservice.MemberBLService; import org.junit.Before; import org.junit.Test; import util.MemberType; import util.ResultMessage; import vo.member.MemberVO; import static org.junit.Assert.*; /** * Created by kevin on 2016/10/16. */ public class MemberBLService_Driver { MemberBLService tested; @Before public void setUp() throws Exception { } @Test public void register() throws Exception { assertEquals(ResultMessage.SUCCESS, tested.register(new MemberVO("张三", MemberType.NORMAL_MEMBER, 1, null, null))); } @Test public void delete() throws Exception { assertEquals(ResultMessage.SUCCESS, tested.delete("张三")); } @Test public void showInfo() throws Exception { MemberVO res = tested.showInfo("张三"); printMemberVO(res); } private void printMemberVO(MemberVO memberVO){ System.out.println(memberVO.memberType); System.out.println(memberVO.username); System.out.println(memberVO.level); System.out.println(memberVO.birthday); System.out.println(memberVO.enterprise); } }
UTF-8
Java
1,168
java
MemberBLService_Driver.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n * Created by kevin on 2016/10/16.\n */\npublic class MemberBLService_D", "end": 262, "score": 0.9986034631729126, "start": 257, "tag": "USERNAME", "value": "kevin" } ]
null
[]
package blservice_driver; import blservice.memberblservice.MemberBLService; import org.junit.Before; import org.junit.Test; import util.MemberType; import util.ResultMessage; import vo.member.MemberVO; import static org.junit.Assert.*; /** * Created by kevin on 2016/10/16. */ public class MemberBLService_Driver { MemberBLService tested; @Before public void setUp() throws Exception { } @Test public void register() throws Exception { assertEquals(ResultMessage.SUCCESS, tested.register(new MemberVO("张三", MemberType.NORMAL_MEMBER, 1, null, null))); } @Test public void delete() throws Exception { assertEquals(ResultMessage.SUCCESS, tested.delete("张三")); } @Test public void showInfo() throws Exception { MemberVO res = tested.showInfo("张三"); printMemberVO(res); } private void printMemberVO(MemberVO memberVO){ System.out.println(memberVO.memberType); System.out.println(memberVO.username); System.out.println(memberVO.level); System.out.println(memberVO.birthday); System.out.println(memberVO.enterprise); } }
1,168
0.690311
0.682526
46
24.152174
24.092184
122
false
false
0
0
0
0
0
0
0.521739
false
false
14
71bd0bd1c870c0d878622e00218a106174d18ef2
23,398,981,845,213
367d99efff964798ad19d3117663457c33291921
/AdministracionHoteles/src/controladoras/Usuarios.java
e9d14994be849a125470984ce2703c5ba478a130
[]
no_license
sklante/UPC-POO-Hoteles
https://github.com/sklante/UPC-POO-Hoteles
df868ece3b90b70e21f5403ec234201d9b8696cb
b5251ec4c320fba774088449e5a043a2c17ffd47
refs/heads/master
2021-01-17T23:26:09.477000
2012-06-16T18:43:12
2012-06-16T18:43:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controladoras; import java.util.ArrayList; import modelos.Usuario; import modelos.Usuario; public class Usuarios { private ArrayList<Usuario> datosUsuarios = new ArrayList<Usuario>(); private void simularTabla(){ this.datosUsuarios.add(new Usuario("001", "Miguel ", "Angel", "sklante_1@hotmail.com", "123456")); this.datosUsuarios.add(new Usuario("002", "Alfredo ", "Luyo", "alfredoluy@hotmail.com", "alfred123")); this.datosUsuarios.add(new Usuario("003", "Jose", "Rabanal", "josrab@hotmail.com", "josrab333")); this.datosUsuarios.add(new Usuario("004", "Gonzalo", "Gutierrez", "gongut@hotmail.com", "gongut444")); } public Usuario existeCorreoElectronico(String userName){ simularTabla(); Usuario usuarioEncontrado = null; for(Usuario usuario : datosUsuarios){ if(usuario.getCorreoe().equals(userName)) usuarioEncontrado = usuario; } return usuarioEncontrado; } /* public Usuario asignarCodigo(String codigoUsuario){ simularTabla(); Usuario usuarioEncontrado = null; for(Usuario usuario : datosUsuarios){ if(usuario.getCodigoUsuario().equals(codigoUsuario)) usuarioEncontrado = usuario; else String enteroString = "5"; int entero = Integer.parseInt(); } return usuarioEncontrado; }*/ public boolean validarPassword(String userName, String password){ boolean acceso = false; Usuario usuarioValido = existeCorreoElectronico(userName); if(usuarioValido.getPassword().equals(password)){ acceso = true; } return acceso; } }
UTF-8
Java
1,813
java
Usuarios.java
Java
[ { "context": " this.datosUsuarios.add(new Usuario(\"001\", \"Miguel \", \"Angel\", \"sklante_1@hotmail.com\", \"123456\"));\n", "end": 300, "score": 0.9998294711112976, "start": 294, "tag": "NAME", "value": "Miguel" }, { "context": ".datosUsuarios.add(new Usuario(\"001\", \"Miguel \", \"Angel\", \"sklante_1@hotmail.com\", \"123456\"));\n th", "end": 310, "score": 0.9996764063835144, "start": 305, "tag": "NAME", "value": "Angel" }, { "context": "arios.add(new Usuario(\"001\", \"Miguel \", \"Angel\", \"sklante_1@hotmail.com\", \"123456\"));\n this.datosUsuarios.add(new ", "end": 335, "score": 0.9999234676361084, "start": 314, "tag": "EMAIL", "value": "sklante_1@hotmail.com" }, { "context": " this.datosUsuarios.add(new Usuario(\"002\", \"Alfredo \", \"Luyo\", \"alfredoluy@hotmail.com\", \"alfred123\")", "end": 408, "score": 0.9998307228088379, "start": 401, "tag": "NAME", "value": "Alfredo" }, { "context": "datosUsuarios.add(new Usuario(\"002\", \"Alfredo \", \"Luyo\", \"alfredoluy@hotmail.com\", \"alfred123\"));\n ", "end": 417, "score": 0.9980162382125854, "start": 413, "tag": "NAME", "value": "Luyo" }, { "context": "arios.add(new Usuario(\"002\", \"Alfredo \", \"Luyo\", \"alfredoluy@hotmail.com\", \"alfred123\"));\n this.datosUsuarios.add(n", "end": 443, "score": 0.9999203681945801, "start": 421, "tag": "EMAIL", "value": "alfredoluy@hotmail.com" }, { "context": "\", \"Alfredo \", \"Luyo\", \"alfredoluy@hotmail.com\", \"alfred123\"));\n this.datosUsuarios.add(new Usuario(\"0", "end": 456, "score": 0.976824939250946, "start": 447, "tag": "USERNAME", "value": "alfred123" }, { "context": " this.datosUsuarios.add(new Usuario(\"003\", \"Jose\", \"Rabanal\", \"josrab@hotmail.com\", \"josrab333\"));", "end": 516, "score": 0.9998270273208618, "start": 512, "tag": "NAME", "value": "Jose" }, { "context": "his.datosUsuarios.add(new Usuario(\"003\", \"Jose\", \"Rabanal\", \"josrab@hotmail.com\", \"josrab333\"));\n th", "end": 527, "score": 0.9995781779289246, "start": 520, "tag": "NAME", "value": "Rabanal" }, { "context": "uarios.add(new Usuario(\"003\", \"Jose\", \"Rabanal\", \"josrab@hotmail.com\", \"josrab333\"));\n this.datosUsuarios.add(n", "end": 549, "score": 0.9999287724494934, "start": 531, "tag": "EMAIL", "value": "josrab@hotmail.com" }, { "context": "(\"003\", \"Jose\", \"Rabanal\", \"josrab@hotmail.com\", \"josrab333\"));\n this.datosUsuarios.add(new Usuario(\"0", "end": 562, "score": 0.9721200466156006, "start": 553, "tag": "USERNAME", "value": "josrab333" }, { "context": " this.datosUsuarios.add(new Usuario(\"004\", \"Gonzalo\", \"Gutierrez\", \"gongut@hotmail.com\", \"gongut444\")", "end": 625, "score": 0.9998354911804199, "start": 618, "tag": "NAME", "value": "Gonzalo" }, { "context": ".datosUsuarios.add(new Usuario(\"004\", \"Gonzalo\", \"Gutierrez\", \"gongut@hotmail.com\", \"gongut444\"));\n \n ", "end": 638, "score": 0.9996681213378906, "start": 629, "tag": "NAME", "value": "Gutierrez" }, { "context": "s.add(new Usuario(\"004\", \"Gonzalo\", \"Gutierrez\", \"gongut@hotmail.com\", \"gongut444\"));\n \n }\n \n \n publi", "end": 660, "score": 0.9999231100082397, "start": 642, "tag": "EMAIL", "value": "gongut@hotmail.com" }, { "context": ", \"Gonzalo\", \"Gutierrez\", \"gongut@hotmail.com\", \"gongut444\"));\n \n }\n \n \n public Usuario ", "end": 670, "score": 0.5531663298606873, "start": 665, "tag": "USERNAME", "value": "ongut" } ]
null
[]
package controladoras; import java.util.ArrayList; import modelos.Usuario; import modelos.Usuario; public class Usuarios { private ArrayList<Usuario> datosUsuarios = new ArrayList<Usuario>(); private void simularTabla(){ this.datosUsuarios.add(new Usuario("001", "Miguel ", "Angel", "<EMAIL>", "123456")); this.datosUsuarios.add(new Usuario("002", "Alfredo ", "Luyo", "<EMAIL>", "alfred123")); this.datosUsuarios.add(new Usuario("003", "Jose", "Rabanal", "<EMAIL>", "josrab333")); this.datosUsuarios.add(new Usuario("004", "Gonzalo", "Gutierrez", "<EMAIL>", "gongut444")); } public Usuario existeCorreoElectronico(String userName){ simularTabla(); Usuario usuarioEncontrado = null; for(Usuario usuario : datosUsuarios){ if(usuario.getCorreoe().equals(userName)) usuarioEncontrado = usuario; } return usuarioEncontrado; } /* public Usuario asignarCodigo(String codigoUsuario){ simularTabla(); Usuario usuarioEncontrado = null; for(Usuario usuario : datosUsuarios){ if(usuario.getCodigoUsuario().equals(codigoUsuario)) usuarioEncontrado = usuario; else String enteroString = "5"; int entero = Integer.parseInt(); } return usuarioEncontrado; }*/ public boolean validarPassword(String userName, String password){ boolean acceso = false; Usuario usuarioValido = existeCorreoElectronico(userName); if(usuarioValido.getPassword().equals(password)){ acceso = true; } return acceso; } }
1,762
0.608935
0.59294
55
31.945454
29.91103
110
false
false
0
0
0
0
0
0
0.727273
false
false
14
07764e26be6da28dc3097683ae7987fe60fb3e9a
12,180,527,280,390
61f6649ed60be4707014f77cc8464f35cc5acfbf
/ReportEngine/src/main/java/com/miniproject/ReportEngine/Model/listKlaster.java
89e7a084c5309ffa9f8b8be4c0a426c665f435b1
[]
no_license
Anggi-anggraeni/miniproject
https://github.com/Anggi-anggraeni/miniproject
fad17141c30dec146183e9113722d47ab509a19c
468851358b84e44a2527fe6ed13b2b52a0f39649
refs/heads/master
2020-06-22T17:59:28.835000
2019-07-24T07:07:04
2019-07-24T07:07:04
197,764,302
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.miniproject.ReportEngine.Model; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @Data @Entity @Table(name ="list_klaster") @EntityListeners(AuditingEntityListener.class) @JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, allowGetters = true) public class listKlaster implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String titleklaster; @Column(name="data_source") private String dataSource; private String contact; @Temporal(TemporalType.TIMESTAMP) @Column(name="date_of_filling") private Date dateOfFilling; @Column(name="update_of_klaster") @Temporal(TemporalType.TIMESTAMP) private Date updateOfKlaster; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitleklaster() { return titleklaster; } public void setTitleklaster(String titleklaster) { this.titleklaster = titleklaster; } public String getDataSource() { return dataSource; } public void setDataSource(String dataSource) { this.dataSource = dataSource; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public Date getDateOfFilling() { return dateOfFilling; } public void setDateOfFilling(Date dateOfFilling) { this.dateOfFilling = dateOfFilling; } public Date getUpdateOfKlaster() { return updateOfKlaster; } public void setUpdateOfKlaster(Date updateOfKlaster) { this.updateOfKlaster = updateOfKlaster; } }
UTF-8
Java
2,052
java
listKlaster.java
Java
[]
null
[]
package com.miniproject.ReportEngine.Model; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @Data @Entity @Table(name ="list_klaster") @EntityListeners(AuditingEntityListener.class) @JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, allowGetters = true) public class listKlaster implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String titleklaster; @Column(name="data_source") private String dataSource; private String contact; @Temporal(TemporalType.TIMESTAMP) @Column(name="date_of_filling") private Date dateOfFilling; @Column(name="update_of_klaster") @Temporal(TemporalType.TIMESTAMP) private Date updateOfKlaster; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitleklaster() { return titleklaster; } public void setTitleklaster(String titleklaster) { this.titleklaster = titleklaster; } public String getDataSource() { return dataSource; } public void setDataSource(String dataSource) { this.dataSource = dataSource; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public Date getDateOfFilling() { return dateOfFilling; } public void setDateOfFilling(Date dateOfFilling) { this.dateOfFilling = dateOfFilling; } public Date getUpdateOfKlaster() { return updateOfKlaster; } public void setUpdateOfKlaster(Date updateOfKlaster) { this.updateOfKlaster = updateOfKlaster; } }
2,052
0.774854
0.774854
102
19.117647
19.246235
78
false
false
0
0
0
0
0
0
1
false
false
14
b880fd3d4bf373eddda4933607b9df1a47914206
32,830,730,050,347
e27db8a6f6218a6599873afea70f3d8597716cb7
/SSM_ERP/src/main/java/com/kk/service/DeviceMaintainService.java
fd73021b1dbcb1fddda28ced3fa185af7a3fd5db
[]
no_license
kangjunfeng/java_ssm_erp
https://github.com/kangjunfeng/java_ssm_erp
b8f9465caa2a9d2521369558eb4205a6228a65de
353d7de13dbb5093682a54944ce18cf642be7e10
refs/heads/master
2021-01-25T06:45:51.300000
2017-06-16T09:27:15
2017-06-16T09:27:15
93,610,457
4
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kk.service; import com.kk.domain.DeviceMaintain; import com.kk.domain.customize.CustomResult; import com.kk.domain.customize.EUDataGridResult; public interface DeviceMaintainService { EUDataGridResult getList(int page, int rows, DeviceMaintain deviceMaintain) throws Exception; DeviceMaintain get(String string) throws Exception; CustomResult insert(DeviceMaintain deviceMaintain) throws Exception; CustomResult delete(String deviceMaintainId) throws Exception; CustomResult deleteBatch(String[] deviceMaintainIds) throws Exception; CustomResult update(DeviceMaintain deviceMaintain) throws Exception; CustomResult updateNote(DeviceMaintain deviceMaintain) throws Exception; EUDataGridResult searchDeviceMaintainByDeviceMaintainId(Integer page, Integer rows, String deviceMaintainId) throws Exception; EUDataGridResult searchDeviceMaintainByDeviceFaultId(Integer page, Integer rows, String deviceFaultId) throws Exception; }
UTF-8
Java
998
java
DeviceMaintainService.java
Java
[]
null
[]
package com.kk.service; import com.kk.domain.DeviceMaintain; import com.kk.domain.customize.CustomResult; import com.kk.domain.customize.EUDataGridResult; public interface DeviceMaintainService { EUDataGridResult getList(int page, int rows, DeviceMaintain deviceMaintain) throws Exception; DeviceMaintain get(String string) throws Exception; CustomResult insert(DeviceMaintain deviceMaintain) throws Exception; CustomResult delete(String deviceMaintainId) throws Exception; CustomResult deleteBatch(String[] deviceMaintainIds) throws Exception; CustomResult update(DeviceMaintain deviceMaintain) throws Exception; CustomResult updateNote(DeviceMaintain deviceMaintain) throws Exception; EUDataGridResult searchDeviceMaintainByDeviceMaintainId(Integer page, Integer rows, String deviceMaintainId) throws Exception; EUDataGridResult searchDeviceMaintainByDeviceFaultId(Integer page, Integer rows, String deviceFaultId) throws Exception; }
998
0.814629
0.814629
28
33.642857
31.514412
94
false
false
0
0
0
0
0
0
1.321429
false
false
14
72b394dadcab463c4ee46e7ef55f2874b3595e40
20,864,951,145,249
306717229b52a1bf7317ba9e80b46bd12790f180
/client/src/main/java/com/yodlee/iae/commons/dbcobrandinfo/client/cache/DefaultCobrandDetailsFetcher.java
713fb5ef6c0cc205093964117462a0f6f624003c
[]
no_license
wupadhyay/dbcobrandInfo
https://github.com/wupadhyay/dbcobrandInfo
153e86e37a82c3fcba1d978e5a769e05189d505d
cf84e6079482c9787bba87c847f6f5de2683138d
refs/heads/master
2022-05-27T01:23:55.471000
2019-11-27T21:03:05
2019-11-27T21:03:05
224,516,488
0
0
null
false
2022-05-20T21:17:44
2019-11-27T21:02:35
2019-11-27T21:04:26
2022-05-20T21:17:43
148,711
0
0
2
Java
false
false
/** * * Copyright (c) 2018 Yodlee Inc. All Rights Reserved. * * This software is the confidential and proprietary information of Yodlee, Inc. * Use is subject to license terms. * */ package com.yodlee.iae.commons.dbcobrandinfo.client.cache; import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.yodlee.iae.commons.dbcobrandinfo.cache.CobrandDetailsFetcher; import com.yodlee.iae.commons.dbcobrandinfo.client.DBCobrandInfoFetcher; import com.yodlee.iae.commons.dbcobrandinfo.model.lookup.CobrandStatus; import com.yodlee.iae.commons.dbcobrandinfo.model.lookup.DataCenter; import com.yodlee.iae.commons.dbcobrandinfo.model.lookup.Environment; import com.yodlee.iae.commons.dbcobrandinfo.model.response.CobrandInfo; /** * @author Sundhara Raja Perumal .S (sperumal@yodlee.com) * @since Date: Jan 4, 2017 */ @Repository @Scope(SCOPE_PROTOTYPE) @Transactional(readOnly = true, transactionManager = "oltpTransactionManager") public class DefaultCobrandDetailsFetcher implements CobrandDetailsFetcher { private static Logger logger = LoggerFactory.getLogger(DefaultCobrandDetailsFetcher.class); @Autowired private DBCobrandInfoFetcher dbCobrandInfoFetcher; protected Set<CobrandInfo> cobrandInfos = null; private final String dbName; private final Environment environment; private final DataCenter dataCenter; /** * @param dbName * @param environment * @param dataCenter */ public DefaultCobrandDetailsFetcher(final String dbName, final Environment environment, final DataCenter dataCenter) { this.dbName = dbName; this.environment = environment; this.dataCenter = dataCenter; } /* * (non-Javadoc) * * @see com.yodlee.iae.commons.dbcobrandinfo.cache.CobrandDetailsFetcher# * getCobrandInfos() */ @Override public Set<CobrandInfo> getCobrandInfos() { return this.cobrandInfos; } /* * (non-Javadoc) * * @see * com.yodlee.iae.commons.dbcobrandinfo.cache.CobrandDetailsFetcher#initialize * () */ @Override public void initialize() { this.init(); } /** * */ private void init() { try { this.cobrandInfos = this.dbCobrandInfoFetcher.fetchCobrands(this.dbName); this.cobrandInfos.forEach(c -> { logger.trace("\t Reading Cobrand from DB: {}; ", c.getCobrandDisplayName()); c.setDbName(this.dbName).setEnvironment(this.environment).setDataCenter(this.dataCenter) .setCobrandStatus(CobrandStatus.fromStatus(c.getCobrandPresentStatus())); }); } catch (Throwable e) { logger.info("loading failed due to runtime exception"); } } }
UTF-8
Java
2,986
java
DefaultCobrandDetailsFetcher.java
Java
[ { "context": "ndinfo.model.response.CobrandInfo;\n\n/**\n * @author Sundhara Raja Perumal .S (sperumal@yodlee.com)\n * @since Date: Jan 4, 2", "end": 1125, "score": 0.9998886585235596, "start": 1104, "tag": "NAME", "value": "Sundhara Raja Perumal" }, { "context": "ndInfo;\n\n/**\n * @author Sundhara Raja Perumal .S (sperumal@yodlee.com)\n * @since Date: Jan 4, 2017\n */\n@Repository\n@Sco", "end": 1149, "score": 0.9999228715896606, "start": 1130, "tag": "EMAIL", "value": "sperumal@yodlee.com" } ]
null
[]
/** * * Copyright (c) 2018 Yodlee Inc. All Rights Reserved. * * This software is the confidential and proprietary information of Yodlee, Inc. * Use is subject to license terms. * */ package com.yodlee.iae.commons.dbcobrandinfo.client.cache; import static org.springframework.beans.factory.config.ConfigurableBeanFactory.SCOPE_PROTOTYPE; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import com.yodlee.iae.commons.dbcobrandinfo.cache.CobrandDetailsFetcher; import com.yodlee.iae.commons.dbcobrandinfo.client.DBCobrandInfoFetcher; import com.yodlee.iae.commons.dbcobrandinfo.model.lookup.CobrandStatus; import com.yodlee.iae.commons.dbcobrandinfo.model.lookup.DataCenter; import com.yodlee.iae.commons.dbcobrandinfo.model.lookup.Environment; import com.yodlee.iae.commons.dbcobrandinfo.model.response.CobrandInfo; /** * @author <NAME> .S (<EMAIL>) * @since Date: Jan 4, 2017 */ @Repository @Scope(SCOPE_PROTOTYPE) @Transactional(readOnly = true, transactionManager = "oltpTransactionManager") public class DefaultCobrandDetailsFetcher implements CobrandDetailsFetcher { private static Logger logger = LoggerFactory.getLogger(DefaultCobrandDetailsFetcher.class); @Autowired private DBCobrandInfoFetcher dbCobrandInfoFetcher; protected Set<CobrandInfo> cobrandInfos = null; private final String dbName; private final Environment environment; private final DataCenter dataCenter; /** * @param dbName * @param environment * @param dataCenter */ public DefaultCobrandDetailsFetcher(final String dbName, final Environment environment, final DataCenter dataCenter) { this.dbName = dbName; this.environment = environment; this.dataCenter = dataCenter; } /* * (non-Javadoc) * * @see com.yodlee.iae.commons.dbcobrandinfo.cache.CobrandDetailsFetcher# * getCobrandInfos() */ @Override public Set<CobrandInfo> getCobrandInfos() { return this.cobrandInfos; } /* * (non-Javadoc) * * @see * com.yodlee.iae.commons.dbcobrandinfo.cache.CobrandDetailsFetcher#initialize * () */ @Override public void initialize() { this.init(); } /** * */ private void init() { try { this.cobrandInfos = this.dbCobrandInfoFetcher.fetchCobrands(this.dbName); this.cobrandInfos.forEach(c -> { logger.trace("\t Reading Cobrand from DB: {}; ", c.getCobrandDisplayName()); c.setDbName(this.dbName).setEnvironment(this.environment).setDataCenter(this.dataCenter) .setCobrandStatus(CobrandStatus.fromStatus(c.getCobrandPresentStatus())); }); } catch (Throwable e) { logger.info("loading failed due to runtime exception"); } } }
2,959
0.746484
0.7428
103
27.990292
29.400316
96
true
false
0
0
0
0
0
0
0.368932
false
false
14
1bcd9c5b0381fc32a19dfdf97602e8635bc5a32a
9,680,856,303,974
6788577573f062f50304fe07fca566cb2fedb0ca
/Java_Base/test41/Client/chatGUI.java
900ad8139ddbfefc49b98d3a5ff66061757b3e87
[]
no_license
RookieMasterrr/Java
https://github.com/RookieMasterrr/Java
837d2b6c2b40c8bab4c015c812b993783b158d05
51a6243b6737db5f9cb33517b833970cbdbd4400
refs/heads/main
2023-07-07T02:24:34.971000
2021-07-31T14:08:49
2021-07-31T14:08:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.plaf.DimensionUIResource; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.Container; import java.awt.event.ActionListener; import java.io.IOException; public class chatGUI { static JFrame aFrame; static Container aContainer; static JPanel aJPanel; static JTextArea EditArea; static JTextArea RecArea; static JButton aButton; public chatGUI(){ aFrame = new JFrame("chatGUI"); aContainer = aFrame.getContentPane(); aContainer.setLayout(new FlowLayout()); aJPanel = new JPanel(); aJPanel.add(new JLabel("RecText")); RecArea = new JTextArea(); RecArea.setPreferredSize(new DimensionUIResource(200, 100)); aJPanel.add(RecArea); aJPanel.add(new JLabel("EditText")); EditArea = new JTextArea(); EditArea.setPreferredSize(new DimensionUIResource(200, 100)); aJPanel.add(EditArea); aButton = new JButton("aButton"); aButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ try{ CCommunicator.ChatFromUserToServer(EditArea.getText()); }catch(IOException aException){ } } }); aJPanel.add(aButton); aContainer.add(aJPanel); aFrame.setSize(700,300); aFrame.setDefaultCloseOperation(3); aFrame.setVisible(true); } public static void RecInfo(String Info){ RecArea.setText(RecArea.getText()+"\n"+Info); } public static void main(String[] args) throws IOException { // Client aClient = new Client("localhost", 5050); // new chatGUI(); // aClient.close(); } }
UTF-8
Java
1,916
java
chatGUI.java
Java
[]
null
[]
import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.plaf.DimensionUIResource; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.Container; import java.awt.event.ActionListener; import java.io.IOException; public class chatGUI { static JFrame aFrame; static Container aContainer; static JPanel aJPanel; static JTextArea EditArea; static JTextArea RecArea; static JButton aButton; public chatGUI(){ aFrame = new JFrame("chatGUI"); aContainer = aFrame.getContentPane(); aContainer.setLayout(new FlowLayout()); aJPanel = new JPanel(); aJPanel.add(new JLabel("RecText")); RecArea = new JTextArea(); RecArea.setPreferredSize(new DimensionUIResource(200, 100)); aJPanel.add(RecArea); aJPanel.add(new JLabel("EditText")); EditArea = new JTextArea(); EditArea.setPreferredSize(new DimensionUIResource(200, 100)); aJPanel.add(EditArea); aButton = new JButton("aButton"); aButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ try{ CCommunicator.ChatFromUserToServer(EditArea.getText()); }catch(IOException aException){ } } }); aJPanel.add(aButton); aContainer.add(aJPanel); aFrame.setSize(700,300); aFrame.setDefaultCloseOperation(3); aFrame.setVisible(true); } public static void RecInfo(String Info){ RecArea.setText(RecArea.getText()+"\n"+Info); } public static void main(String[] args) throws IOException { // Client aClient = new Client("localhost", 5050); // new chatGUI(); // aClient.close(); } }
1,916
0.639875
0.627871
64
28.9375
18.727383
75
false
false
0
0
0
0
0
0
0.703125
false
false
14
399cac481a8cc8f91422553c1ac8fd6b7ed24024
9,680,856,304,514
7a179473b1a295e8d8ec746e44082c89db575894
/core/src/com/sage/shengji/utils/renderable/RenderableHand.java
436239d6ffd3b2a221895d405ef99bd14074f2ca
[]
no_license
SageBinder/ShengJiImproved
https://github.com/SageBinder/ShengJiImproved
2d0bae4f04a8cfb3e8555029b88efb6047c7e491
b1ed94e0979a77b0dc3604eefbef4b108b7b13ff
refs/heads/master
2020-07-02T14:17:25.311000
2019-08-17T23:18:13
2019-08-17T23:18:13
201,554,517
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sage.shengji.utils.renderable; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.utils.viewport.Viewport; import com.sage.shengji.utils.card.Card; import com.sage.shengji.utils.card.Rank; import com.sage.shengji.utils.card.Suit; import java.util.Collection; public class RenderableHand<T extends Card & RenderableCard> extends RenderableCardGroup<T> { public float bottomPaddingProportion = 0.025f, leftPaddingProportion = 0.05f, rightPaddingProportion = 0.05f, cardHeightProportion = 1f / 7f; public RenderableHand() { super(); super.cardHeight = Gdx.graphics.getHeight() * cardHeightProportion; } public RenderableHand(Collection<? extends T> cards) { super(cards); super.cardHeight = Gdx.graphics.getHeight() * cardHeightProportion; } @Override public void render(SpriteBatch batch, Viewport viewport) { this.render(batch, viewport, false); } @Override public void render(SpriteBatch batch, Viewport viewport, boolean renderBase) { super.rotationRad = 0; super.cardHeight = viewport.getWorldHeight() * cardHeightProportion; super.regionWidth = viewport.getWorldWidth() - (viewport.getWorldWidth() * leftPaddingProportion) - (viewport.getWorldWidth() * rightPaddingProportion); super.pos.x = viewport.getWorldWidth() * leftPaddingProportion; super.pos.y = viewport.getWorldHeight() * bottomPaddingProportion; super.render(batch, viewport, renderBase); } @Override public boolean add(T t) { boolean ret = super.add(t); sort(Card::compareTo); return ret; } @Override public void add(int index, T element) { super.add(index, element); sort(Card::compareTo); } @Override public boolean addAll(Collection<? extends T> c) { boolean ret = super.addAll(c); sort(Card::compareTo); return ret; } @Override public boolean addAll(int index, Collection<? extends T> c) { boolean ret = super.addAll(index, c); sort(Card::compareTo); return ret; } }
UTF-8
Java
2,250
java
RenderableHand.java
Java
[]
null
[]
package com.sage.shengji.utils.renderable; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.utils.viewport.Viewport; import com.sage.shengji.utils.card.Card; import com.sage.shengji.utils.card.Rank; import com.sage.shengji.utils.card.Suit; import java.util.Collection; public class RenderableHand<T extends Card & RenderableCard> extends RenderableCardGroup<T> { public float bottomPaddingProportion = 0.025f, leftPaddingProportion = 0.05f, rightPaddingProportion = 0.05f, cardHeightProportion = 1f / 7f; public RenderableHand() { super(); super.cardHeight = Gdx.graphics.getHeight() * cardHeightProportion; } public RenderableHand(Collection<? extends T> cards) { super(cards); super.cardHeight = Gdx.graphics.getHeight() * cardHeightProportion; } @Override public void render(SpriteBatch batch, Viewport viewport) { this.render(batch, viewport, false); } @Override public void render(SpriteBatch batch, Viewport viewport, boolean renderBase) { super.rotationRad = 0; super.cardHeight = viewport.getWorldHeight() * cardHeightProportion; super.regionWidth = viewport.getWorldWidth() - (viewport.getWorldWidth() * leftPaddingProportion) - (viewport.getWorldWidth() * rightPaddingProportion); super.pos.x = viewport.getWorldWidth() * leftPaddingProportion; super.pos.y = viewport.getWorldHeight() * bottomPaddingProportion; super.render(batch, viewport, renderBase); } @Override public boolean add(T t) { boolean ret = super.add(t); sort(Card::compareTo); return ret; } @Override public void add(int index, T element) { super.add(index, element); sort(Card::compareTo); } @Override public boolean addAll(Collection<? extends T> c) { boolean ret = super.addAll(c); sort(Card::compareTo); return ret; } @Override public boolean addAll(int index, Collection<? extends T> c) { boolean ret = super.addAll(index, c); sort(Card::compareTo); return ret; } }
2,250
0.659111
0.652889
72
30.25
25.199068
93
false
false
0
0
0
0
0
0
0.625
false
false
14
cf618741185793c56b47a41cacee3ef9ab1755cc
27,977,416,979,850
bfb8ff0d09c98c82ef87b68e137544bf76a95770
/hashTable/SingleNumber.java
8d92a46b80c9a543fe6a5103233385dcac5f6a45
[]
no_license
jguo32/leetcode
https://github.com/jguo32/leetcode
3a75922acb70cf80c5953f378eec4c688a9b0091
a115102ee5e5146838f56b316ce61870a2165da8
refs/heads/master
2016-05-03T14:20:00.850000
2016-02-01T05:14:49
2016-02-01T05:14:49
48,139,320
0
0
null
false
2015-12-17T03:32:09
2015-12-16T22:42:23
2015-12-16T22:42:23
2015-12-17T03:32:09
0
0
0
0
null
null
null
package hashTable; import java.util.HashMap; public class SingleNumber { public int singleNumber(int[] nums) { HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); for(int i = 0; i < nums.length; i++) { if(map.containsKey(nums[i])) map.remove(nums[i]); else map.put(nums[i], i); } int result = 0; for(Integer i:map.keySet()) result = i; return result; } }
UTF-8
Java
439
java
SingleNumber.java
Java
[]
null
[]
package hashTable; import java.util.HashMap; public class SingleNumber { public int singleNumber(int[] nums) { HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); for(int i = 0; i < nums.length; i++) { if(map.containsKey(nums[i])) map.remove(nums[i]); else map.put(nums[i], i); } int result = 0; for(Integer i:map.keySet()) result = i; return result; } }
439
0.583144
0.578588
19
22.105263
16.751732
67
false
false
0
0
0
0
0
0
1.631579
false
false
14
ccb9a621fbacc04fd2568397c0fd49ed625c90a1
30,743,375,952,488
b40e0f617c68b723912a494ab46357dd9aacd8ca
/src/util/package-info.java
72691524acb94527fdb835d46ccb7bfae7f311e9
[]
no_license
sunmaer/roseGarden
https://github.com/sunmaer/roseGarden
d95c964ec678d2886c8e1bc2ed7d2d9a0d338eb4
9745aa4ae56dbc2de870eb048f30bd2b428f7b21
refs/heads/master
2021-01-01T19:49:46.520000
2017-10-12T07:22:15
2017-10-12T07:22:15
98,701,753
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * 辅助类 */ /** * @author dlz * */ package util;
UTF-8
Java
67
java
package-info.java
Java
[ { "context": "/**\r\n * 辅助类\r\n */\r\n/**\r\n * @author dlz\r\n *\r\n */\r\npackage util;", "end": 37, "score": 0.9995614290237427, "start": 34, "tag": "USERNAME", "value": "dlz" } ]
null
[]
/** * 辅助类 */ /** * @author dlz * */ package util;
67
0.377049
0.377049
8
5.875
4.539755
14
false
false
0
0
0
0
0
0
0.125
false
false
14
b7d58d8c1e51d890ed7474f31d2790eaa7ff94e5
21,260,088,152,094
7fe5cb99188c7270f726b1145fc356fd2922df9d
/geoapi-examples/src/main/java/org/opengis/example/metadata/SimpleGeographicBoundingBox.java
738bcbeeba0d003410d9d32c2eeccfd459080344
[ "Apache-2.0" ]
permissive
opengeospatial/geoapi
https://github.com/opengeospatial/geoapi
eedcf2d3259284fc614f7fa132c77fcef67d7ecc
7a0872373e4ad70039b5ec9be2f086081fb5c746
refs/heads/master
2023-08-17T23:37:23.874000
2023-08-10T20:02:27
2023-08-10T20:02:27
27,879,839
111
33
NOASSERTION
false
2021-06-28T08:08:29
2014-12-11T16:13:54
2021-05-12T11:15:13
2021-06-28T08:08:26
25,338
76
29
23
Java
false
false
/* * GeoAPI - Java interfaces for OGC/ISO standards * This file is hereby placed into the Public Domain. * This means anyone is free to do whatever they wish with this file. */ package org.opengis.example.metadata; import java.util.Collection; import java.util.Collections; import java.awt.geom.Rectangle2D; import org.opengis.metadata.extent.Extent; import org.opengis.metadata.extent.GeographicExtent; import org.opengis.metadata.extent.GeographicBoundingBox; /** * An {@link Extent} containing only a single {@link GeographicBoundingBox}. * In order to keep the model simpler, this simple geographic bounding box * is also an extent with no vertical or temporal elements. * * @author Martin Desruisseaux (Geomatys) * @version 3.1 * @since 3.1 */ public class SimpleGeographicBoundingBox implements GeographicBoundingBox, Extent { /** * An extent and a bounding box ranging from 180°W to 180°E and 90°S to 90°N. */ public static final SimpleGeographicBoundingBox WORLD = new SimpleGeographicBoundingBox(-180, 180, -90, 90); /** * The western-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). */ protected final double westBoundLongitude; /** * The eastern-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). */ protected final double eastBoundLongitude; /** * The southern-most coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). */ protected final double southBoundLatitude; /** * The northern-most, coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). */ protected final double northBoundLatitude; /** * Constructs a geographic bounding box initialized to the same values than the specified one. * * @param box the existing box to use for initializing this geographic bounding box. */ public SimpleGeographicBoundingBox(final GeographicBoundingBox box) { this(box.getWestBoundLongitude(), box.getEastBoundLongitude(), box.getSouthBoundLatitude(), box.getNorthBoundLatitude()); } /** * Constructs a geographic bounding box from the specified rectangle. The rectangle is assumed * in {@linkplain org.opengis.example.referencing.SimpleCRS.Geographic#WGS84 WGS84} CRS. * * @param bounds the rectangle to use for initializing this geographic bounding box. */ public SimpleGeographicBoundingBox(final Rectangle2D bounds) { this(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY()); } /** * Creates a geographic bounding box initialized to the specified values. * * <p><strong>Caution:</strong> Arguments are expected in the same order than they appear in the * ISO 19115 specification. This is different than the order commonly found in Java world, * which is rather (<var>x</var><sub>min</sub>, <var>y</var><sub>min</sub>, * <var>x</var><sub>max</sub>, <var>y</var><sub>max</sub>).</p> * * @param westBoundLongitude the minimal <var>x</var> value. * @param eastBoundLongitude the maximal <var>x</var> value. * @param southBoundLatitude the minimal <var>y</var> value. * @param northBoundLatitude the maximal <var>y</var> value. * @throws IllegalArgumentException if (<var>west bound</var> &gt; <var>east bound</var>) * or (<var>south bound</var> &gt; <var>north bound</var>). Note that * {@linkplain Double#NaN NaN} values are allowed. */ public SimpleGeographicBoundingBox(final double westBoundLongitude, final double eastBoundLongitude, final double southBoundLatitude, final double northBoundLatitude) throws IllegalArgumentException { final String dim; final double min, max; if (westBoundLongitude > eastBoundLongitude) { min = westBoundLongitude; max = eastBoundLongitude; dim = "longitude"; // Exception will be thrown below. } else if (southBoundLatitude > northBoundLatitude) { min = southBoundLatitude; max = northBoundLatitude; dim = "latitude"; // Exception will be thrown below. } else { this.westBoundLongitude = westBoundLongitude; this.eastBoundLongitude = eastBoundLongitude; this.southBoundLatitude = southBoundLatitude; this.northBoundLatitude = northBoundLatitude; return; } throw new IllegalArgumentException("Illegal " + dim + " range: [" + min + " … " + max + "]."); } /** * Returns the western-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). * * @return the western-most longitude between -180 and +180°. */ @Override public double getWestBoundLongitude() { return westBoundLongitude; } /** * Returns the eastern-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). * * @return the eastern-most longitude between -180 and +180°. */ @Override public double getEastBoundLongitude() { return eastBoundLongitude; } /** * Returns the southern-most coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). * * @return the southern-most latitude between -90 and +90°. */ @Override public double getSouthBoundLatitude() { return southBoundLatitude; } /** * Returns the northern-most, coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). * * @return the northern-most latitude between -90 and +90°. */ @Override public double getNorthBoundLatitude() { return northBoundLatitude; } /** * Indication of whether the bounding box encompasses an area covered by the data * (<cite>inclusion</cite>) or an area where data is not present (<cite>exclusion</cite>). * The default implementation unconditionally returns {@link Boolean#TRUE}. * * @return {@code true} for inclusion, or {@code false} for exclusion. */ @Override public Boolean getInclusion() { return Boolean.TRUE; } /** * Provides geographic component of the extent of the referring object. * The default implementation returns a singleton containing only this * geographic bounding box. * * @return the geographic extent, or an empty set if none. */ @Override public Collection<? extends GeographicExtent> getGeographicElements() { return Collections.singleton(this); } /** * Returns {@code true} if the given floating point values are equal. */ private static boolean equals(final double a, final double b) { return Double.doubleToLongBits(a) == Double.doubleToLongBits(b); } /** * Compares this geographic bounding box with the specified object for equality. * * @param object the object to compare for equality. * @return {@code true} if the given object is equal to this box. */ @Override public boolean equals(final Object object) { if (object instanceof SimpleGeographicBoundingBox) { final SimpleGeographicBoundingBox that = (SimpleGeographicBoundingBox) object; return equals(this.southBoundLatitude, that.southBoundLatitude) && equals(this.northBoundLatitude, that.northBoundLatitude) && equals(this.eastBoundLongitude, that.eastBoundLongitude) && equals(this.westBoundLongitude, that.westBoundLongitude); } return false; } /** * Returns a hash code value for this bounding box. */ @Override public int hashCode() { long code = -190508333 ^ (Double.doubleToLongBits(westBoundLongitude) + 31* (Double.doubleToLongBits(eastBoundLongitude) + 31* (Double.doubleToLongBits(southBoundLatitude) + 31* Double.doubleToLongBits(northBoundLatitude)))); return ((int) code) ^ ((int) (code >>> 32)); } /** * Returns a string representation of this extent. * * @return a string representation of this box. */ @Override public String toString() { return "GeographicBoundingBox[" + "west=" + westBoundLongitude + ", " + "east=" + eastBoundLongitude + ", " + "south=" + southBoundLatitude + ", " + "north=" + northBoundLatitude + ']'; } }
UTF-8
Java
9,220
java
SimpleGeographicBoundingBox.java
Java
[ { "context": "h no vertical or temporal elements.\n *\n * @author Martin Desruisseaux (Geomatys)\n * @version 3.1\n * @since 3.1\n */\npu", "end": 729, "score": 0.9997872114181519, "start": 710, "tag": "NAME", "value": "Martin Desruisseaux" }, { "context": "elements.\n *\n * @author Martin Desruisseaux (Geomatys)\n * @version 3.1\n * @since 3.1\n */\npublic class", "end": 739, "score": 0.6406746506690979, "start": 735, "tag": "NAME", "value": "atys" } ]
null
[]
/* * GeoAPI - Java interfaces for OGC/ISO standards * This file is hereby placed into the Public Domain. * This means anyone is free to do whatever they wish with this file. */ package org.opengis.example.metadata; import java.util.Collection; import java.util.Collections; import java.awt.geom.Rectangle2D; import org.opengis.metadata.extent.Extent; import org.opengis.metadata.extent.GeographicExtent; import org.opengis.metadata.extent.GeographicBoundingBox; /** * An {@link Extent} containing only a single {@link GeographicBoundingBox}. * In order to keep the model simpler, this simple geographic bounding box * is also an extent with no vertical or temporal elements. * * @author <NAME> (Geomatys) * @version 3.1 * @since 3.1 */ public class SimpleGeographicBoundingBox implements GeographicBoundingBox, Extent { /** * An extent and a bounding box ranging from 180°W to 180°E and 90°S to 90°N. */ public static final SimpleGeographicBoundingBox WORLD = new SimpleGeographicBoundingBox(-180, 180, -90, 90); /** * The western-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). */ protected final double westBoundLongitude; /** * The eastern-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). */ protected final double eastBoundLongitude; /** * The southern-most coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). */ protected final double southBoundLatitude; /** * The northern-most, coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). */ protected final double northBoundLatitude; /** * Constructs a geographic bounding box initialized to the same values than the specified one. * * @param box the existing box to use for initializing this geographic bounding box. */ public SimpleGeographicBoundingBox(final GeographicBoundingBox box) { this(box.getWestBoundLongitude(), box.getEastBoundLongitude(), box.getSouthBoundLatitude(), box.getNorthBoundLatitude()); } /** * Constructs a geographic bounding box from the specified rectangle. The rectangle is assumed * in {@linkplain org.opengis.example.referencing.SimpleCRS.Geographic#WGS84 WGS84} CRS. * * @param bounds the rectangle to use for initializing this geographic bounding box. */ public SimpleGeographicBoundingBox(final Rectangle2D bounds) { this(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY()); } /** * Creates a geographic bounding box initialized to the specified values. * * <p><strong>Caution:</strong> Arguments are expected in the same order than they appear in the * ISO 19115 specification. This is different than the order commonly found in Java world, * which is rather (<var>x</var><sub>min</sub>, <var>y</var><sub>min</sub>, * <var>x</var><sub>max</sub>, <var>y</var><sub>max</sub>).</p> * * @param westBoundLongitude the minimal <var>x</var> value. * @param eastBoundLongitude the maximal <var>x</var> value. * @param southBoundLatitude the minimal <var>y</var> value. * @param northBoundLatitude the maximal <var>y</var> value. * @throws IllegalArgumentException if (<var>west bound</var> &gt; <var>east bound</var>) * or (<var>south bound</var> &gt; <var>north bound</var>). Note that * {@linkplain Double#NaN NaN} values are allowed. */ public SimpleGeographicBoundingBox(final double westBoundLongitude, final double eastBoundLongitude, final double southBoundLatitude, final double northBoundLatitude) throws IllegalArgumentException { final String dim; final double min, max; if (westBoundLongitude > eastBoundLongitude) { min = westBoundLongitude; max = eastBoundLongitude; dim = "longitude"; // Exception will be thrown below. } else if (southBoundLatitude > northBoundLatitude) { min = southBoundLatitude; max = northBoundLatitude; dim = "latitude"; // Exception will be thrown below. } else { this.westBoundLongitude = westBoundLongitude; this.eastBoundLongitude = eastBoundLongitude; this.southBoundLatitude = southBoundLatitude; this.northBoundLatitude = northBoundLatitude; return; } throw new IllegalArgumentException("Illegal " + dim + " range: [" + min + " … " + max + "]."); } /** * Returns the western-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). * * @return the western-most longitude between -180 and +180°. */ @Override public double getWestBoundLongitude() { return westBoundLongitude; } /** * Returns the eastern-most coordinate of the limit of the dataset extent. * The value is expressed in longitude in decimal degrees (positive east). * * @return the eastern-most longitude between -180 and +180°. */ @Override public double getEastBoundLongitude() { return eastBoundLongitude; } /** * Returns the southern-most coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). * * @return the southern-most latitude between -90 and +90°. */ @Override public double getSouthBoundLatitude() { return southBoundLatitude; } /** * Returns the northern-most, coordinate of the limit of the dataset extent. * The value is expressed in latitude in decimal degrees (positive north). * * @return the northern-most latitude between -90 and +90°. */ @Override public double getNorthBoundLatitude() { return northBoundLatitude; } /** * Indication of whether the bounding box encompasses an area covered by the data * (<cite>inclusion</cite>) or an area where data is not present (<cite>exclusion</cite>). * The default implementation unconditionally returns {@link Boolean#TRUE}. * * @return {@code true} for inclusion, or {@code false} for exclusion. */ @Override public Boolean getInclusion() { return Boolean.TRUE; } /** * Provides geographic component of the extent of the referring object. * The default implementation returns a singleton containing only this * geographic bounding box. * * @return the geographic extent, or an empty set if none. */ @Override public Collection<? extends GeographicExtent> getGeographicElements() { return Collections.singleton(this); } /** * Returns {@code true} if the given floating point values are equal. */ private static boolean equals(final double a, final double b) { return Double.doubleToLongBits(a) == Double.doubleToLongBits(b); } /** * Compares this geographic bounding box with the specified object for equality. * * @param object the object to compare for equality. * @return {@code true} if the given object is equal to this box. */ @Override public boolean equals(final Object object) { if (object instanceof SimpleGeographicBoundingBox) { final SimpleGeographicBoundingBox that = (SimpleGeographicBoundingBox) object; return equals(this.southBoundLatitude, that.southBoundLatitude) && equals(this.northBoundLatitude, that.northBoundLatitude) && equals(this.eastBoundLongitude, that.eastBoundLongitude) && equals(this.westBoundLongitude, that.westBoundLongitude); } return false; } /** * Returns a hash code value for this bounding box. */ @Override public int hashCode() { long code = -190508333 ^ (Double.doubleToLongBits(westBoundLongitude) + 31* (Double.doubleToLongBits(eastBoundLongitude) + 31* (Double.doubleToLongBits(southBoundLatitude) + 31* Double.doubleToLongBits(northBoundLatitude)))); return ((int) code) ^ ((int) (code >>> 32)); } /** * Returns a string representation of this extent. * * @return a string representation of this box. */ @Override public String toString() { return "GeographicBoundingBox[" + "west=" + westBoundLongitude + ", " + "east=" + eastBoundLongitude + ", " + "south=" + southBoundLatitude + ", " + "north=" + northBoundLatitude + ']'; } }
9,207
0.646797
0.638979
240
37.375
31.365602
112
false
false
0
0
0
0
0
0
0.308333
false
false
14
df9588cdb7cd07c0c932f08cfebc6992294b1d18
32,547,262,235,952
27cecdbcde460d34de4a3e69851387106ee0089f
/.svn/pristine/df/df9588cdb7cd07c0c932f08cfebc6992294b1d18.svn-base
fdafd26634965161ecd0ab84d98149a355c323f5
[]
no_license
raymond10/PreProjets
https://github.com/raymond10/PreProjets
77b4dba4acf10524c714712da625371467a4eb50
6a11899b2219fa16505efe039a7ad71d1e3d7bf9
refs/heads/master
2021-01-01T19:10:12.105000
2014-07-08T09:41:48
2014-07-08T09:41:48
3,021,594
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package utt.rec.projet.server.utils; import java.util.Calendar; import java.util.GregorianCalendar; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSNumberFormatter; import com.webobjects.foundation.NSTimestamp; import fr.univlr.cri.util.StringCtrl; /** * @author Raymond NANEON <raymond.naneon at utt.fr> * */ @SuppressWarnings("all") public class TimeCtrl { // GET MINUTES : Retourne le nombre de minutes correspondant à la chaine // string au format %H:%M (l'inverse de stringFor: ) public static int getMinutes(String chaine) { NSArray str = NSArray.componentsSeparatedByString(chaine, ":"); int nombre = 0; if (StringCtrl.isEmpty(chaine) || ("00:00".equals(chaine)) || ("".equals(chaine)) || ("..:..".equals(chaine))) return 0; if (chaine.length() == 0) return 0; if (str.count() == 1) nombre = ((Number) str.objectAtIndex(0)).intValue() * 60; else { if ((((Number) new Integer((String) str.objectAtIndex(0))) .intValue()) < 0) nombre = (-((((Number) new Integer( (String) str.objectAtIndex(0))).intValue()) * 60) + ((((Number) new Integer( (String) str.objectAtIndex(1))).intValue()))); else nombre = (((((Number) new Integer((String) str.objectAtIndex(0))) .intValue()) * 60) + ((((Number) new Integer( (String) str.objectAtIndex(1))).intValue()))); } if ((((Number) new Integer((String) str.objectAtIndex(0))).intValue()) < 0) nombre = -nombre; // on a passe une valeur negative return nombre; } // STRING FOR MINUTES // Formatte le nombre de minutes en une chaine au format %H:%M (l'inverse de // numberOfMinutesFor: ) public static String stringForMinutes(int numberOfMinutes) { String formattedString; int hours, minutes; boolean negatif = false; if (numberOfMinutes == 0) return "00:00"; if (numberOfMinutes < 0) { negatif = true; numberOfMinutes = -numberOfMinutes; } hours = numberOfMinutes / 60; minutes = numberOfMinutes % 60; if (hours < 10) formattedString = "0" + hours; else formattedString = "" + hours; if (minutes < 10) formattedString = formattedString + ":0" + minutes; else formattedString = formattedString + ":" + minutes; if (negatif) formattedString = "-" + formattedString; return formattedString; } /** * retourne le nombre de minutes ecoulées dans la journée * * @param date * @return */ public static int getMinutesOfDay(NSTimestamp aDate) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(aDate); return calendar.get(Calendar.MINUTE) + calendar.get(Calendar.HOUR_OF_DAY) * 60; } /** * mettre une date a minuit (le jour meme) * * @param aDate * @return */ public static NSTimestamp dateToMinuit(NSTimestamp aDate) { GregorianCalendar nowGC = new GregorianCalendar(); nowGC.setTime(aDate); return aDate.timestampByAddingGregorianUnits(0, 0, 0, -nowGC.get(GregorianCalendar.HOUR_OF_DAY), -nowGC.get(GregorianCalendar.MINUTE), -nowGC.get(GregorianCalendar.SECOND)); } /** * permet de transformer une heure en durée (remplace le : par un h * * @param heure * @return */ public static String stringHeureToDuree(String heure) { if (heure != null) return heure.replace(':', 'h'); else return "00h00"; } /** * permet de transformer une durée en heure (remplace le h par un : * * @param heure * @return */ public static String stringDureeToHeure(String heure) { if (heure != null) return heure.replace('h', ':'); else return "00:00"; } // TODO controler si null ou po public static int getHeuresFromString(String heuresMinutes) { return (int) ((float) TimeCtrl.getMinutes(heuresMinutes) / (float) 60); } public static int getMinutesFromString(String heuresMinutes) { return TimeCtrl.getMinutes(heuresMinutes) % 60; } public static String to_duree_en_jours(int minutes, String dureeJour) { String to_duree = ""; double lesJours = (double) minutes / (double) (TimeCtrl.getMinutes(TimeCtrl .stringDureeToHeure(dureeJour))); Double unNombre = new Double(lesJours); NSNumberFormatter numberFormat = new NSNumberFormatter("0.00"); to_duree += numberFormat.format(unNombre) + "j"; return to_duree; } }
ISO-8859-1
Java
4,291
df9588cdb7cd07c0c932f08cfebc6992294b1d18.svn-base
Java
[ { "context": "ort fr.univlr.cri.util.StringCtrl;\n\n/**\n * @author Raymond NANEON <raymond.naneon at utt.fr>\n *\n */\n@SuppressWarnin", "end": 322, "score": 0.9998723864555359, "start": 308, "tag": "NAME", "value": "Raymond NANEON" }, { "context": ".util.StringCtrl;\n\n/**\n * @author Raymond NANEON <raymond.naneon at utt.fr>\n *\n */\n@SuppressWarnings(\"a", "end": 327, "score": 0.8339335322380066, "start": 324, "tag": "USERNAME", "value": "ray" } ]
null
[]
/** * */ package utt.rec.projet.server.utils; import java.util.Calendar; import java.util.GregorianCalendar; import com.webobjects.foundation.NSArray; import com.webobjects.foundation.NSNumberFormatter; import com.webobjects.foundation.NSTimestamp; import fr.univlr.cri.util.StringCtrl; /** * @author <NAME> <raymond.naneon at utt.fr> * */ @SuppressWarnings("all") public class TimeCtrl { // GET MINUTES : Retourne le nombre de minutes correspondant à la chaine // string au format %H:%M (l'inverse de stringFor: ) public static int getMinutes(String chaine) { NSArray str = NSArray.componentsSeparatedByString(chaine, ":"); int nombre = 0; if (StringCtrl.isEmpty(chaine) || ("00:00".equals(chaine)) || ("".equals(chaine)) || ("..:..".equals(chaine))) return 0; if (chaine.length() == 0) return 0; if (str.count() == 1) nombre = ((Number) str.objectAtIndex(0)).intValue() * 60; else { if ((((Number) new Integer((String) str.objectAtIndex(0))) .intValue()) < 0) nombre = (-((((Number) new Integer( (String) str.objectAtIndex(0))).intValue()) * 60) + ((((Number) new Integer( (String) str.objectAtIndex(1))).intValue()))); else nombre = (((((Number) new Integer((String) str.objectAtIndex(0))) .intValue()) * 60) + ((((Number) new Integer( (String) str.objectAtIndex(1))).intValue()))); } if ((((Number) new Integer((String) str.objectAtIndex(0))).intValue()) < 0) nombre = -nombre; // on a passe une valeur negative return nombre; } // STRING FOR MINUTES // Formatte le nombre de minutes en une chaine au format %H:%M (l'inverse de // numberOfMinutesFor: ) public static String stringForMinutes(int numberOfMinutes) { String formattedString; int hours, minutes; boolean negatif = false; if (numberOfMinutes == 0) return "00:00"; if (numberOfMinutes < 0) { negatif = true; numberOfMinutes = -numberOfMinutes; } hours = numberOfMinutes / 60; minutes = numberOfMinutes % 60; if (hours < 10) formattedString = "0" + hours; else formattedString = "" + hours; if (minutes < 10) formattedString = formattedString + ":0" + minutes; else formattedString = formattedString + ":" + minutes; if (negatif) formattedString = "-" + formattedString; return formattedString; } /** * retourne le nombre de minutes ecoulées dans la journée * * @param date * @return */ public static int getMinutesOfDay(NSTimestamp aDate) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(aDate); return calendar.get(Calendar.MINUTE) + calendar.get(Calendar.HOUR_OF_DAY) * 60; } /** * mettre une date a minuit (le jour meme) * * @param aDate * @return */ public static NSTimestamp dateToMinuit(NSTimestamp aDate) { GregorianCalendar nowGC = new GregorianCalendar(); nowGC.setTime(aDate); return aDate.timestampByAddingGregorianUnits(0, 0, 0, -nowGC.get(GregorianCalendar.HOUR_OF_DAY), -nowGC.get(GregorianCalendar.MINUTE), -nowGC.get(GregorianCalendar.SECOND)); } /** * permet de transformer une heure en durée (remplace le : par un h * * @param heure * @return */ public static String stringHeureToDuree(String heure) { if (heure != null) return heure.replace(':', 'h'); else return "00h00"; } /** * permet de transformer une durée en heure (remplace le h par un : * * @param heure * @return */ public static String stringDureeToHeure(String heure) { if (heure != null) return heure.replace('h', ':'); else return "00:00"; } // TODO controler si null ou po public static int getHeuresFromString(String heuresMinutes) { return (int) ((float) TimeCtrl.getMinutes(heuresMinutes) / (float) 60); } public static int getMinutesFromString(String heuresMinutes) { return TimeCtrl.getMinutes(heuresMinutes) % 60; } public static String to_duree_en_jours(int minutes, String dureeJour) { String to_duree = ""; double lesJours = (double) minutes / (double) (TimeCtrl.getMinutes(TimeCtrl .stringDureeToHeure(dureeJour))); Double unNombre = new Double(lesJours); NSNumberFormatter numberFormat = new NSNumberFormatter("0.00"); to_duree += numberFormat.format(unNombre) + "j"; return to_duree; } }
4,283
0.674988
0.660989
163
25.294479
23.308792
82
false
false
0
0
0
0
0
0
1.932515
false
false
14
be31e3f4debbc9ea730f232c2730753b19e83e0c
26,147,760,950,539
f63a74e0a05424fcfbc9caaeed8de2547257c039
/propad/src/main/java/com/prodapt/propad/service/ServiceApiImpl.java
bbca9b0bd173e0daaa61e4422b9c8e80f5368ed3
[]
no_license
banubanu/propadVersion1
https://github.com/banubanu/propadVersion1
866afdfcfa98f289af9dc6e732cef16bb2157612
fc320b3309bf3b0781ded49c045d9753d5ef430d
refs/heads/master
2023-08-10T02:15:31.768000
2019-06-20T13:29:08
2019-06-20T13:29:08
191,306,504
0
0
null
false
2023-07-22T08:03:28
2019-06-11T06:17:49
2019-06-20T13:29:27
2023-07-22T08:03:27
118
0
0
1
Java
false
false
package com.prodapt.propad.service; import java.util.List; import org.springframework.stereotype.Service; import com.prodapt.propad.model.PropadEmpTechDetails; import com.prodapt.propad.model.PropadInitiateEmployee; import com.prodapt.propad.repository.ServiceRepository; @Service public class ServiceApiImpl implements ServiceApi { ServiceRepository serviceRepository; public ServiceApiImpl(ServiceRepository serviceRepository) { // TODO Auto-generated constructor stub this.serviceRepository = serviceRepository; } @Override public List<PropadInitiateEmployee> getAll() { // TODO Auto-generated method stub return serviceRepository.findAll(); } @Override public PropadInitiateEmployee save(PropadInitiateEmployee pie) { // TODO Auto-generated method stub return serviceRepository.save(pie); } @Override public List<PropadInitiateEmployee> getOneRow(String ie_emp_mail) { // TODO Auto-generated method stub return serviceRepository.getOneRow(ie_emp_mail); } @Override public List<PropadInitiateEmployee> getOne(int ie_emp_id) { // TODO Auto-generated method stub return serviceRepository.getByEmpid(ie_emp_id); } }
UTF-8
Java
1,178
java
ServiceApiImpl.java
Java
[]
null
[]
package com.prodapt.propad.service; import java.util.List; import org.springframework.stereotype.Service; import com.prodapt.propad.model.PropadEmpTechDetails; import com.prodapt.propad.model.PropadInitiateEmployee; import com.prodapt.propad.repository.ServiceRepository; @Service public class ServiceApiImpl implements ServiceApi { ServiceRepository serviceRepository; public ServiceApiImpl(ServiceRepository serviceRepository) { // TODO Auto-generated constructor stub this.serviceRepository = serviceRepository; } @Override public List<PropadInitiateEmployee> getAll() { // TODO Auto-generated method stub return serviceRepository.findAll(); } @Override public PropadInitiateEmployee save(PropadInitiateEmployee pie) { // TODO Auto-generated method stub return serviceRepository.save(pie); } @Override public List<PropadInitiateEmployee> getOneRow(String ie_emp_mail) { // TODO Auto-generated method stub return serviceRepository.getOneRow(ie_emp_mail); } @Override public List<PropadInitiateEmployee> getOne(int ie_emp_id) { // TODO Auto-generated method stub return serviceRepository.getByEmpid(ie_emp_id); } }
1,178
0.78438
0.78438
47
23.893618
23.222544
68
false
false
0
0
0
0
0
0
1.085106
false
false
14
6c92e9645768d4ab8764c1a766635b9cdc16964f
29,076,928,623,403
653da39415884ede929474e176eecc4a86326c53
/thread_day01/src/com/it/day14/condition005/MyService.java
47fd8c2aebe540ab0982ab964f2e4ed1cd104de6
[]
no_license
cxlzwx/thread
https://github.com/cxlzwx/thread
cb2113d3bbdb374ec2eb3e3b0ccb8f8240b8392c
0a80cc78da023b01a68675c4184d8e7395b10671
refs/heads/master
2020-04-02T02:12:29.579000
2018-10-31T15:03:53
2018-10-31T15:03:53
153,897,270
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.it.day14.condition005;/** * Created by sunrise on 2018/10/31. */ import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * @ClassName MyService * @Description 不同线程获得不同的condition,多路复用 * @Author sunrise * @Date 2018/10/31 17:18 * @Version 1.0 */ public class MyService { private Lock lock = new ReentrantLock(); private Condition condition1 = lock.newCondition(); private Condition condition2 = lock.newCondition(); public void methodA(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" 等待时间:"+System.currentTimeMillis()); condition1.await(); System.out.println(Thread.currentThread().getName()+" 结束时间:"+System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); }finally{ lock.unlock(); } } public void methodB(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" 等待时间:"+System.currentTimeMillis()); condition2.await(); System.out.println(Thread.currentThread().getName()+" 结束时间:"+System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); }finally{ lock.unlock(); } } public void signalMethodA(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" signal时间为:"+System.currentTimeMillis()); condition1.signalAll(); }finally { lock.unlock(); } } public void signalMethodB(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" signal时间为:"+System.currentTimeMillis()); condition2.signalAll(); }finally { lock.unlock(); } } }
UTF-8
Java
2,039
java
MyService.java
Java
[ { "context": "ackage com.it.day14.condition005;/**\n * Created by sunrise on 2018/10/31.\n */\n\nimport java.util.concurrent.l", "end": 59, "score": 0.9996634721755981, "start": 52, "tag": "USERNAME", "value": "sunrise" }, { "context": " * @Description 不同线程获得不同的condition,多路复用\n * @Author sunrise\n * @Date 2018/10/31 17:18\n * @Version 1.0\n */\npub", "end": 301, "score": 0.9996809959411621, "start": 294, "tag": "USERNAME", "value": "sunrise" } ]
null
[]
package com.it.day14.condition005;/** * Created by sunrise on 2018/10/31. */ import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** * @ClassName MyService * @Description 不同线程获得不同的condition,多路复用 * @Author sunrise * @Date 2018/10/31 17:18 * @Version 1.0 */ public class MyService { private Lock lock = new ReentrantLock(); private Condition condition1 = lock.newCondition(); private Condition condition2 = lock.newCondition(); public void methodA(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" 等待时间:"+System.currentTimeMillis()); condition1.await(); System.out.println(Thread.currentThread().getName()+" 结束时间:"+System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); }finally{ lock.unlock(); } } public void methodB(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" 等待时间:"+System.currentTimeMillis()); condition2.await(); System.out.println(Thread.currentThread().getName()+" 结束时间:"+System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); }finally{ lock.unlock(); } } public void signalMethodA(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" signal时间为:"+System.currentTimeMillis()); condition1.signalAll(); }finally { lock.unlock(); } } public void signalMethodB(){ try { lock.lock(); System.out.println(Thread.currentThread().getName()+" signal时间为:"+System.currentTimeMillis()); condition2.signalAll(); }finally { lock.unlock(); } } }
2,039
0.589132
0.572372
67
28.38806
27.373566
106
false
false
0
0
0
0
0
0
0.41791
false
false
14
fd790fd0d38aa45cc7b1ab1fd687e3cba66cde5b
20,933,670,609,934
f06fa1aa99eccfff44078e8c60a2bb023a3de3ac
/isy-web-lib/src/main/java/de/bund/bva/isyfact/common/web/webflow/titles/BreadcrumbAwareFlowExecutionSnapshotGroup.java
ca67078746cef33c428352acbd7c721658de0309
[]
no_license
IsyFact/isy-web
https://github.com/IsyFact/isy-web
0063e98d2cb6e045cb9f1fe2512bbfee3acde746
83cf5b919ada2f840454f97c22448b839fa620e4
refs/heads/master
2023-09-01T23:24:47.336000
2023-04-18T13:22:36
2023-04-18T13:22:36
141,108,912
5
9
null
false
2023-09-12T11:33:29
2018-07-16T08:21:29
2021-12-22T09:07:59
2023-09-12T11:33:29
2,968
5
5
10
Java
false
false
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * The Federal Office of Administration (Bundesverwaltungsamt, BVA) * licenses this file to you under the Apache License, Version 2.0 (the * License). You may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package de.bund.bva.isyfact.common.web.webflow.titles; import java.io.Serializable; import java.util.LinkedHashMap; import org.springframework.webflow.execution.repository.impl.FlowExecutionSnapshotGroup; import org.springframework.webflow.execution.repository.snapshot.FlowExecutionSnapshot; import org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException; /** * Verwaltet eine Gruppe von Snapshots. Zum Breadcrumb gehörige Snapshots werden gesondert behandelt und nicht * entfernt, sobald die Anzahl der gespeicherten Snapshots {@link #getMaxSnapshots()} übersteigt. * * @author Capgemini * @version $Id: BreadcrumbAwareFlowExecutionSnapshotGroup.java 123758 2014-10-10 10:01:14Z sdm_ahoerning $ */ @Deprecated public class BreadcrumbAwareFlowExecutionSnapshotGroup implements FlowExecutionSnapshotGroup, Serializable { /** * Serial Version UID. */ private static final long serialVersionUID = -9223063152560721825L; /** Anzahl der Snapshots für den Breadcrumb. */ private int breadcrumbSnapshotCount; /** Anzahl der maximal vorgehaltenen normalen Snapsots. */ private int maxSnapshots; /** * The snapshot map; the key is a snapshot id, and the value is a {@link FlowExecutionSnapshot} object. */ private LinkedHashMap<Serializable, FlowExecutionSnapshot> snapshots = new LinkedHashMap<Serializable, FlowExecutionSnapshot>(); /** * {@inheritDoc} */ @Override public void addSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) { if (snapshots.containsKey(snapshotId)) { snapshots.remove(snapshotId); } snapshots.put(snapshotId, snapshot); if (getSnapshotCount() > getMaxSnapshots()) { performCleanup(); } } /** * Sucht die größte gespeicherte Id. * @return die größte gespeicherte Id */ public int getBiggestSnapshotId() { int result = 0; for (Serializable key : snapshots.keySet()) { String str = key.toString(); int i = Integer.parseInt(str); result = result > i ? result : i; } return result; } /** * Liefert das Feld 'maxSnapshots' zurück. * @return Wert von maxSnapshots */ public int getMaxSnapshots() { return maxSnapshots; } /** * gibt den Snapshot mit der gegebenen snapshotId zurück. * @param snapshotId * die snapshotId des zu suchenden Snapshots * @return den snapshot mit der gegebenen snapshotId */ @Override public FlowExecutionSnapshot getSnapshot(Serializable snapshotId) { FlowExecutionSnapshot snapshot = snapshots.get(snapshotId); if (snapshot == null) { throw new SnapshotNotFoundException(snapshotId); } return snapshot; } /** * Gibt die Anzahl der gespeicherten Snapshots, die nicht zum Breadcrumb gehörden zurück. {@inheritDoc} */ @Override public int getSnapshotCount() { return snapshots.size() - breadcrumbSnapshotCount; } /** * legt einen zum Breadcrumb gehörigen Snapshot mit der gegebenen Id an. * @param sitemapKey * die Id unter welcher der Snapshot abgelegt wird. * @param snapshot * der abzulegende Snapshot */ public void makeSitemapLink(String sitemapKey, FlowExecutionSnapshot snapshot) { if (!snapshots.containsKey(sitemapKey)) { breadcrumbSnapshotCount++; } addSnapshot(sitemapKey, snapshot); } /** * löscht den ältesten nicht zum Breadcrumb gehörigen Snapshot. */ private void performCleanup() { for (Serializable id : snapshots.keySet()) { if (!(istBreadcrumbSnapshot(id))) { snapshots.remove(id); return; } } } /** * {@inheritDoc} */ @Override public void removeAllSnapshots() { // hier wird alles zurück gesetzt. // da die Breadcrumb-Zustände durch das Entfernen aller normalen Zustände nicht // mehr erreichbar sind, können diese ebenfalls entfernt werden. snapshots.clear(); breadcrumbSnapshotCount = 0; } /** * {@inheritDoc} */ @Override public void removeSnapshot(Serializable snapshotId) { snapshots.remove(snapshotId); if (istBreadcrumbSnapshot(snapshotId)) { breadcrumbSnapshotCount--; } } /** * Setzt das Feld 'maxSnapshots'. * @param maxSnapshots * Neuer Wert für maxSnapshots */ public void setMaxSnapshots(int maxSnapshots) { this.maxSnapshots = maxSnapshots; } /** * {@inheritDoc} */ @Override public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) { if (!snapshots.containsKey(snapshotId)) { throw new SnapshotNotFoundException(snapshotId); } snapshots.put(snapshotId, snapshot); } /** * {@inheritDoc} */ @Override public Serializable nextSnapshotId() { return Integer.valueOf(getBiggestSnapshotId() + 1); } /** * Ersucht, ob ein Schlüssel zu einem Breadcrumeintrag gehört. * * @param snapshotId * der Schlüssel, der untersucht werden soll * @return <code>true</code> wenn es sich um einen Breadcrumb-Eintrag handelt, <code>false</code> sonst. */ private boolean istBreadcrumbSnapshot(Serializable snapshotId) { if (snapshotId instanceof String) { String s = (String) snapshotId; return s.startsWith(BreadcrumbAwareFlowExecutionRepository.BREADCRUMB_PREFIX); } else { return false; } } }
UTF-8
Java
6,615
java
BreadcrumbAwareFlowExecutionSnapshotGroup.java
Java
[ { "context": "ink #getMaxSnapshots()} übersteigt.\n * \n * @author Capgemini\n * @version $Id: BreadcrumbAwareFlowExecutionSnap", "end": 1381, "score": 0.998095691204071, "start": 1372, "tag": "NAME", "value": "Capgemini" }, { "context": "tionSnapshotGroup.java 123758 2014-10-10 10:01:14Z sdm_ahoerning $\n */\n@Deprecated\npublic class BreadcrumbAwareFlo", "end": 1487, "score": 0.9362189769744873, "start": 1474, "tag": "USERNAME", "value": "sdm_ahoerning" } ]
null
[]
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * The Federal Office of Administration (Bundesverwaltungsamt, BVA) * licenses this file to you under the Apache License, Version 2.0 (the * License). You may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package de.bund.bva.isyfact.common.web.webflow.titles; import java.io.Serializable; import java.util.LinkedHashMap; import org.springframework.webflow.execution.repository.impl.FlowExecutionSnapshotGroup; import org.springframework.webflow.execution.repository.snapshot.FlowExecutionSnapshot; import org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException; /** * Verwaltet eine Gruppe von Snapshots. Zum Breadcrumb gehörige Snapshots werden gesondert behandelt und nicht * entfernt, sobald die Anzahl der gespeicherten Snapshots {@link #getMaxSnapshots()} übersteigt. * * @author Capgemini * @version $Id: BreadcrumbAwareFlowExecutionSnapshotGroup.java 123758 2014-10-10 10:01:14Z sdm_ahoerning $ */ @Deprecated public class BreadcrumbAwareFlowExecutionSnapshotGroup implements FlowExecutionSnapshotGroup, Serializable { /** * Serial Version UID. */ private static final long serialVersionUID = -9223063152560721825L; /** Anzahl der Snapshots für den Breadcrumb. */ private int breadcrumbSnapshotCount; /** Anzahl der maximal vorgehaltenen normalen Snapsots. */ private int maxSnapshots; /** * The snapshot map; the key is a snapshot id, and the value is a {@link FlowExecutionSnapshot} object. */ private LinkedHashMap<Serializable, FlowExecutionSnapshot> snapshots = new LinkedHashMap<Serializable, FlowExecutionSnapshot>(); /** * {@inheritDoc} */ @Override public void addSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) { if (snapshots.containsKey(snapshotId)) { snapshots.remove(snapshotId); } snapshots.put(snapshotId, snapshot); if (getSnapshotCount() > getMaxSnapshots()) { performCleanup(); } } /** * Sucht die größte gespeicherte Id. * @return die größte gespeicherte Id */ public int getBiggestSnapshotId() { int result = 0; for (Serializable key : snapshots.keySet()) { String str = key.toString(); int i = Integer.parseInt(str); result = result > i ? result : i; } return result; } /** * Liefert das Feld 'maxSnapshots' zurück. * @return Wert von maxSnapshots */ public int getMaxSnapshots() { return maxSnapshots; } /** * gibt den Snapshot mit der gegebenen snapshotId zurück. * @param snapshotId * die snapshotId des zu suchenden Snapshots * @return den snapshot mit der gegebenen snapshotId */ @Override public FlowExecutionSnapshot getSnapshot(Serializable snapshotId) { FlowExecutionSnapshot snapshot = snapshots.get(snapshotId); if (snapshot == null) { throw new SnapshotNotFoundException(snapshotId); } return snapshot; } /** * Gibt die Anzahl der gespeicherten Snapshots, die nicht zum Breadcrumb gehörden zurück. {@inheritDoc} */ @Override public int getSnapshotCount() { return snapshots.size() - breadcrumbSnapshotCount; } /** * legt einen zum Breadcrumb gehörigen Snapshot mit der gegebenen Id an. * @param sitemapKey * die Id unter welcher der Snapshot abgelegt wird. * @param snapshot * der abzulegende Snapshot */ public void makeSitemapLink(String sitemapKey, FlowExecutionSnapshot snapshot) { if (!snapshots.containsKey(sitemapKey)) { breadcrumbSnapshotCount++; } addSnapshot(sitemapKey, snapshot); } /** * löscht den ältesten nicht zum Breadcrumb gehörigen Snapshot. */ private void performCleanup() { for (Serializable id : snapshots.keySet()) { if (!(istBreadcrumbSnapshot(id))) { snapshots.remove(id); return; } } } /** * {@inheritDoc} */ @Override public void removeAllSnapshots() { // hier wird alles zurück gesetzt. // da die Breadcrumb-Zustände durch das Entfernen aller normalen Zustände nicht // mehr erreichbar sind, können diese ebenfalls entfernt werden. snapshots.clear(); breadcrumbSnapshotCount = 0; } /** * {@inheritDoc} */ @Override public void removeSnapshot(Serializable snapshotId) { snapshots.remove(snapshotId); if (istBreadcrumbSnapshot(snapshotId)) { breadcrumbSnapshotCount--; } } /** * Setzt das Feld 'maxSnapshots'. * @param maxSnapshots * Neuer Wert für maxSnapshots */ public void setMaxSnapshots(int maxSnapshots) { this.maxSnapshots = maxSnapshots; } /** * {@inheritDoc} */ @Override public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) { if (!snapshots.containsKey(snapshotId)) { throw new SnapshotNotFoundException(snapshotId); } snapshots.put(snapshotId, snapshot); } /** * {@inheritDoc} */ @Override public Serializable nextSnapshotId() { return Integer.valueOf(getBiggestSnapshotId() + 1); } /** * Ersucht, ob ein Schlüssel zu einem Breadcrumeintrag gehört. * * @param snapshotId * der Schlüssel, der untersucht werden soll * @return <code>true</code> wenn es sich um einen Breadcrumb-Eintrag handelt, <code>false</code> sonst. */ private boolean istBreadcrumbSnapshot(Serializable snapshotId) { if (snapshotId instanceof String) { String s = (String) snapshotId; return s.startsWith(BreadcrumbAwareFlowExecutionRepository.BREADCRUMB_PREFIX); } else { return false; } } }
6,615
0.656705
0.649727
205
31.156097
28.872217
110
false
false
0
0
0
0
0
0
0.292683
false
false
14
327ba6499b51fc230aba5489ee6220023239b8ac
23,562,190,591,466
81a27d248ad0b0daa82311fa7bafb26c5bb901f7
/app/src/main/java/com/bquiz/raipur/ecellapp2k17/events/model/data/EventsData.java
2ef2958af105b44ec1028a3494f0734dc87b5ca9
[]
no_license
Vrihas123/ECellApp2k17
https://github.com/Vrihas123/ECellApp2k17
d09bd71ea5b6805a8b36b69eb8bb807b677876e3
9657fe7c01b4f84e886eefbaf49f50362e65969a
refs/heads/master
2019-07-12T19:18:40.127000
2018-01-10T18:07:33
2018-01-10T18:07:33
120,071,710
1
0
null
true
2018-02-03T08:05:18
2018-02-03T08:05:18
2017-08-16T05:25:05
2018-01-10T18:07:33
98,951
0
0
0
null
false
null
package com.bquiz.raipur.ecellapp2k17.events.model.data; /** * Created by samveg on 21/6/17. */ public class EventsData { private String title,description,date,time,venue, meta,bg_image; public EventsData(String name, String date, String time, String venue, String description, String meta,String bg_image) { this.title =name; this.meta = meta; this.date=date; this.venue=venue; this.time=time; this.description=description; this.bg_image = bg_image; } public EventsData() { } public String getDescription() { return description; } public String getDate() { return date; } public String getVenue() { return venue; } public String getMeta() { return meta; } public String getTime(){ return time; } public String getBg_image(){return bg_image;} public void setDescription(String description) { this.description = description; } public void setDate(String date) { this.date = date; } public void setVenue(String venue) { this.venue = venue; } public String getEventName() { return title; } public void setEventName(String name) { this.title = name; } public void setBg_image(String bg_image){this.bg_image=bg_image;} }
UTF-8
Java
1,383
java
EventsData.java
Java
[ { "context": "ecellapp2k17.events.model.data;\n\n/**\n * Created by samveg on 21/6/17.\n */\n\npublic class EventsData {\n pr", "end": 82, "score": 0.9996366500854492, "start": 76, "tag": "USERNAME", "value": "samveg" } ]
null
[]
package com.bquiz.raipur.ecellapp2k17.events.model.data; /** * Created by samveg on 21/6/17. */ public class EventsData { private String title,description,date,time,venue, meta,bg_image; public EventsData(String name, String date, String time, String venue, String description, String meta,String bg_image) { this.title =name; this.meta = meta; this.date=date; this.venue=venue; this.time=time; this.description=description; this.bg_image = bg_image; } public EventsData() { } public String getDescription() { return description; } public String getDate() { return date; } public String getVenue() { return venue; } public String getMeta() { return meta; } public String getTime(){ return time; } public String getBg_image(){return bg_image;} public void setDescription(String description) { this.description = description; } public void setDate(String date) { this.date = date; } public void setVenue(String venue) { this.venue = venue; } public String getEventName() { return title; } public void setEventName(String name) { this.title = name; } public void setBg_image(String bg_image){this.bg_image=bg_image;} }
1,383
0.607375
0.601591
67
19.64179
22.016073
125
false
false
0
0
0
0
0
0
0.492537
false
false
14
7d3e99f2db8e4b769f95370340fffe3336702d51
23,562,190,592,851
4adf00934e493bf9d8200ac74b72c1ee194b9004
/src/main/java/edu/cmu/cs/cs214/hw4/gui/GameWindow.java
69012f7043e8ba93bf5def8e6c0c92162ad0eeff
[]
no_license
suisuiwudi/scrabble-with-stuff-game
https://github.com/suisuiwudi/scrabble-with-stuff-game
3b815a3bf4b6fc3f45903150048ceb15acd26b3b
5074bddfcc9d07b9ea389ed53d03fafc572b8a4a
refs/heads/master
2021-07-13T12:20:28.491000
2017-10-17T01:01:24
2017-10-17T01:01:24
84,178,748
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.cmu.cs.cs214.hw4.gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import edu.cmu.cs.cs214.hw4.core.GameSystem; import edu.cmu.cs.cs214.hw4.core.LetterTile; import edu.cmu.cs.cs214.hw4.core.Move; import edu.cmu.cs.cs214.hw4.core.Player; import edu.cmu.cs.cs214.hw4.core.Square; import edu.cmu.cs.cs214.hw4.core.SpecialTile.SpecialTile; public class GameWindow { private Scrabble scrabble; /** * There are 3 panels in the main window. * Head Panel displays some info: what's in a square which * your mouse hover above,what you have in your rack,all the * players' scores till now. */ private JPanel headPanel; /** * Board Panel display what's real in a board except special * Tiles. Special Tiles are only visible to their owner. */ private JPanel boardPanel; /** * Operation Panel:display the operations that a player can * choose from. */ private JPanel operationPanel; private JPanel wholeWindow; private JPanel squareInfoPanel; private JPanel scoreBoardPanel; private JPanel currentPlayerPanel; private ArrayList<Square> submits; /** * Click on the button to place something on a square. * The button has to be listened so it must be a field */ private JButton[] squareButtons; private JButton resetLetterTileRackButton; private JButton playMoveButton; private JButton challengeButton; private JButton buySpecialTileButton; private JButton endTurnButton; private JButton showBaseBoardButton; private Move move; private JLabel[] letterPrompt; private JLabel[] scores; private JLabel squareSpecialTile; private JLabel squareLetterTile; private JLabel squareNormalBonus; private JLabel currentPlayer; private String windowOwner; //TODO public GameWindow(Scrabble scrabble){ this.scrabble = scrabble; windowOwner = new String(scrabble.getGameWindowTitle()) ; JFrame frame = new JFrame(windowOwner + "'s Scrabble Game Window"); submits = new ArrayList<Square>(); letterPrompt = new JLabel[7]; squareSpecialTile = new JLabel(); squareLetterTile = new JLabel(); squareNormalBonus = new JLabel(); currentPlayer = new JLabel(); // scores = new JLabel[scrabble.getGameSystem().getController().getPlayers().size()]; wholeWindow = new JPanel(); operationPanel = new JPanel(); headPanel = new JPanel(); boardPanel = new JPanel(); squareInfoPanel = new JPanel(); scoreBoardPanel = new JPanel(); currentPlayerPanel = new JPanel(); frame.setSize(1100, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); wholeWindow.setLayout(new BorderLayout()); frame.add(wholeWindow); this.initBoardPanel(); this.initOperationPanel(); this.initHeadPanel(); frame.setVisible(true); } public String getWindowOwner(){ return windowOwner; } private void initOperationPanel() { operationPanel.setLayout(new BoxLayout(operationPanel,BoxLayout.Y_AXIS)); resetLetterTileRackButton = new JButton("Reset your letters"); playMoveButton = new JButton("Play Your Move"); challengeButton = new JButton("Challenge"); buySpecialTileButton = new JButton("Shop"); endTurnButton = new JButton("End this turn"); showBaseBoardButton = new JButton("Show Base Board"); operationPanel.add(resetLetterTileRackButton); operationPanel.add(playMoveButton); operationPanel.add(challengeButton); operationPanel.add(buySpecialTileButton); operationPanel.add(endTurnButton); operationPanel.add(showBaseBoardButton); this.initPlayMoveButton(); this.initChallengeButton(); this.initShopButton(); this.initEndButton(); this.initShowBaseBoardButton(); resetLetterTileRackButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ scrabble.getGameSystem().resetLetterTileRack(); for(int i = 0; i < 7;i++){ letterPrompt[i].setText(scrabble.getGameSystem().getCurrentPlayer().getLetters().get(i).getLetter() + ""); } } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); wholeWindow.add(operationPanel, BorderLayout.EAST); } private void initShowBaseBoardButton() { showBaseBoardButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ BaseBoard bb = new BaseBoard(); } }); } private void initEndButton() { endTurnButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ if(scrabble.getGameSystem().getChallenger() == null){ PromptWindow pw = new PromptWindow("No one challenges OR challenges fails. Your move is applyed to board."); } else{ PromptWindow pw = new PromptWindow("Someone has challenged. See the board for challenge result"); } // PromptWindow remainPrompt = new PromptWindow("You have "+scrabble.getGameSystem().getCurrentPlayer().getRemainingLetterTiles()+"letter(s) left in your bag"); scrabble.afterPressEndTurn(); } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); } private void initShopButton() { buySpecialTileButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ ShopWindow sw = new ShopWindow(scrabble.getGameSystem()); } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); } private void initChallengeButton() { //TODO challengeButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { for(Player player : scrabble.getGameSystem().getController().getPlayers() ){ if(player.getName().equals(windowOwner)){ PromptWindow pw = new PromptWindow(windowOwner +" challenges!"); scrabble.getGameSystem().setChallenger(player); break; } } } }); } private void initPlayMoveButton() { playMoveButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ move = new Move(scrabble.getSubmits(),scrabble.getGameSystem().getCurrentPlayer()); scrabble.setMove(move); if (scrabble.getGameSystem().checkMatchBoard(move)){ scrabble.newPromptWindow("The move pass the validation"); scrabble.afterValidApply(); } else{ scrabble.setSubmits(new ArrayList<>()); move = new Move(scrabble.getSubmits(),scrabble.getGameSystem().getCurrentPlayer()); scrabble.setMove(move); scrabble.updateAllGameWindow(); scrabble.newPromptWindow("The move didn't pass the validation"); } } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); } private void initHeadPanel() { // TODO Auto-generated method stub headPanel.setLayout(new BorderLayout()); squareInfoPanel.setLayout(new BoxLayout(squareInfoPanel,BoxLayout.Y_AXIS)); scoreBoardPanel.setLayout(new BoxLayout(scoreBoardPanel,BoxLayout.Y_AXIS)); currentPlayerPanel.setLayout(new BoxLayout(currentPlayerPanel,BoxLayout.Y_AXIS)); headPanel.add(squareInfoPanel, BorderLayout.WEST); headPanel.add(scoreBoardPanel, BorderLayout.CENTER); headPanel.add(currentPlayerPanel, BorderLayout.EAST); squareInfoPanel.add(squareLetterTile); squareInfoPanel.add(squareSpecialTile); squareInfoPanel.add(squareNormalBonus); currentPlayer.setText("Current Player is : "+scrabble.getGameSystem().getCurrentPlayer().getName()); currentPlayerPanel.add(currentPlayer); wholeWindow.add(headPanel, BorderLayout.NORTH); } private void initBoardPanel(){ wholeWindow.add(boardPanel,BorderLayout.CENTER); //TODO boardPanel.setLayout(new GridLayout(16,16)); squareButtons = new JButton[256]; ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent ae) { if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ JButton button = (JButton) ae.getSource(); for(int index = 0;index < 256;index++){ if(button == squareButtons[index]){ int x = index/16; int y = index%16; if (scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasLetterTile()){ PromptWindow pw = new PromptWindow("this square ("+(x-1)+","+(y-1)+") has a lettiletile"); }else if(x != 0 && y != 0){ scrabble.setPlaceX(x-1); scrabble.setPlaceY(y-1); scrabble.newPlaceWindow(); } } } } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }; //This is to initialize the whole board interface int index = 0; for(int x = 0;x<16;x++){ for(int y = 0; y < 16;y++){ index = x*16 + y; if(x == 0){ squareButtons[index] = new JButton(y-1+""); } if(y == 0){ squareButtons[index] = new JButton(x-1+""); } if(x !=0 && y!= 0){ squareButtons[index] = new JButton(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getNormalBonus().getName()); String normalBonusName = squareButtons[index].getText(); switch (normalBonusName) { case "3WS" : { squareButtons[index].setForeground(Color.RED); break; } case "3LS" : { squareButtons[index].setForeground(Color.BLUE); break; } case "2LS" : { squareButtons[index].setForeground(Color.CYAN); break; } case "2WS" : { squareButtons[index].setForeground(Color.PINK); break; } } //When you click the button,there should be a new window //designed to prompt you to place letters and special tiles. squareButtons[index].addActionListener(al); //When you hover over the button,the related info should be //displayed on the Head Panel. squareButtons[index].addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent me){ JButton button = (JButton) me.getSource(); int x = 0,y = 0; for(int index = 0;index < 256;index++){ if(button == squareButtons[index]){ x = index/16; y = index%16; } } if(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasSpecialTile()){ String specialTileInfo = " "; for(SpecialTile sp : scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getSpecialTile()){ if(sp.getOwner().getName().equals(windowOwner)){ specialTileInfo += sp.getName(); } } squareSpecialTile.setText("[special tiles are : "+ specialTileInfo +" ]"); } else { squareSpecialTile.setText("[special tiles are : "+"NULL"+" ]"); } if(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasLetterTile()){ squareLetterTile.setText("[letter tiles is : "+scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getLetterTile().getLetter()+" ]"); } else{ squareLetterTile.setText("[letter tiles is : NULL ]"); } squareNormalBonus.setText("[normal bonus is : "+ scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getNormalBonus().getName() +" ]"); } }); } boardPanel.add(squareButtons[index]); } } } public static void main(String args[]){ GameSystem game = new GameSystem(); Player player = new Player("Can Liu"); game.addPlayer(player); game.replenish(); } public void updateMyWindow() { for(int i = 0; i<256 ; i++){ int x = i/16; int y = i%16; if(x != 0 && y != 0){ if(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasLetterTile()){ squareButtons[i].setText(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getLetterTile().getLetter() + ""); } else{ squareButtons[i].setText(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getNormalBonus().getName()); } } } currentPlayer.setText("Current Player is : "+scrabble.getGameSystem().getCurrentPlayer().getName()); } public void seeOtherSubmits() { submits = scrabble.getSubmits(); System.out.println(submits.size()); for(Square square :submits){ if (square.hasLetterTile()){ int x = square.getX(); int y = square.getY(); int index = (x+1)*16 + (y+1); // System.out.println(squa); squareButtons[index].setText(square.getLetterTile().getLetter() + ""); } } } }
UTF-8
Java
13,632
java
GameWindow.java
Java
[ { "context": "= new GameSystem();\n\t\tPlayer player = new Player(\"Can Liu\");\n\t\tgame.addPlayer(player);\n\t\tgame.replenish();\n", "end": 12609, "score": 0.9998179078102112, "start": 12602, "tag": "NAME", "value": "Can Liu" } ]
null
[]
package edu.cmu.cs.cs214.hw4.gui; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import edu.cmu.cs.cs214.hw4.core.GameSystem; import edu.cmu.cs.cs214.hw4.core.LetterTile; import edu.cmu.cs.cs214.hw4.core.Move; import edu.cmu.cs.cs214.hw4.core.Player; import edu.cmu.cs.cs214.hw4.core.Square; import edu.cmu.cs.cs214.hw4.core.SpecialTile.SpecialTile; public class GameWindow { private Scrabble scrabble; /** * There are 3 panels in the main window. * Head Panel displays some info: what's in a square which * your mouse hover above,what you have in your rack,all the * players' scores till now. */ private JPanel headPanel; /** * Board Panel display what's real in a board except special * Tiles. Special Tiles are only visible to their owner. */ private JPanel boardPanel; /** * Operation Panel:display the operations that a player can * choose from. */ private JPanel operationPanel; private JPanel wholeWindow; private JPanel squareInfoPanel; private JPanel scoreBoardPanel; private JPanel currentPlayerPanel; private ArrayList<Square> submits; /** * Click on the button to place something on a square. * The button has to be listened so it must be a field */ private JButton[] squareButtons; private JButton resetLetterTileRackButton; private JButton playMoveButton; private JButton challengeButton; private JButton buySpecialTileButton; private JButton endTurnButton; private JButton showBaseBoardButton; private Move move; private JLabel[] letterPrompt; private JLabel[] scores; private JLabel squareSpecialTile; private JLabel squareLetterTile; private JLabel squareNormalBonus; private JLabel currentPlayer; private String windowOwner; //TODO public GameWindow(Scrabble scrabble){ this.scrabble = scrabble; windowOwner = new String(scrabble.getGameWindowTitle()) ; JFrame frame = new JFrame(windowOwner + "'s Scrabble Game Window"); submits = new ArrayList<Square>(); letterPrompt = new JLabel[7]; squareSpecialTile = new JLabel(); squareLetterTile = new JLabel(); squareNormalBonus = new JLabel(); currentPlayer = new JLabel(); // scores = new JLabel[scrabble.getGameSystem().getController().getPlayers().size()]; wholeWindow = new JPanel(); operationPanel = new JPanel(); headPanel = new JPanel(); boardPanel = new JPanel(); squareInfoPanel = new JPanel(); scoreBoardPanel = new JPanel(); currentPlayerPanel = new JPanel(); frame.setSize(1100, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); wholeWindow.setLayout(new BorderLayout()); frame.add(wholeWindow); this.initBoardPanel(); this.initOperationPanel(); this.initHeadPanel(); frame.setVisible(true); } public String getWindowOwner(){ return windowOwner; } private void initOperationPanel() { operationPanel.setLayout(new BoxLayout(operationPanel,BoxLayout.Y_AXIS)); resetLetterTileRackButton = new JButton("Reset your letters"); playMoveButton = new JButton("Play Your Move"); challengeButton = new JButton("Challenge"); buySpecialTileButton = new JButton("Shop"); endTurnButton = new JButton("End this turn"); showBaseBoardButton = new JButton("Show Base Board"); operationPanel.add(resetLetterTileRackButton); operationPanel.add(playMoveButton); operationPanel.add(challengeButton); operationPanel.add(buySpecialTileButton); operationPanel.add(endTurnButton); operationPanel.add(showBaseBoardButton); this.initPlayMoveButton(); this.initChallengeButton(); this.initShopButton(); this.initEndButton(); this.initShowBaseBoardButton(); resetLetterTileRackButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ scrabble.getGameSystem().resetLetterTileRack(); for(int i = 0; i < 7;i++){ letterPrompt[i].setText(scrabble.getGameSystem().getCurrentPlayer().getLetters().get(i).getLetter() + ""); } } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); wholeWindow.add(operationPanel, BorderLayout.EAST); } private void initShowBaseBoardButton() { showBaseBoardButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ BaseBoard bb = new BaseBoard(); } }); } private void initEndButton() { endTurnButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ if(scrabble.getGameSystem().getChallenger() == null){ PromptWindow pw = new PromptWindow("No one challenges OR challenges fails. Your move is applyed to board."); } else{ PromptWindow pw = new PromptWindow("Someone has challenged. See the board for challenge result"); } // PromptWindow remainPrompt = new PromptWindow("You have "+scrabble.getGameSystem().getCurrentPlayer().getRemainingLetterTiles()+"letter(s) left in your bag"); scrabble.afterPressEndTurn(); } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); } private void initShopButton() { buySpecialTileButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ ShopWindow sw = new ShopWindow(scrabble.getGameSystem()); } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); } private void initChallengeButton() { //TODO challengeButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { for(Player player : scrabble.getGameSystem().getController().getPlayers() ){ if(player.getName().equals(windowOwner)){ PromptWindow pw = new PromptWindow(windowOwner +" challenges!"); scrabble.getGameSystem().setChallenger(player); break; } } } }); } private void initPlayMoveButton() { playMoveButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ move = new Move(scrabble.getSubmits(),scrabble.getGameSystem().getCurrentPlayer()); scrabble.setMove(move); if (scrabble.getGameSystem().checkMatchBoard(move)){ scrabble.newPromptWindow("The move pass the validation"); scrabble.afterValidApply(); } else{ scrabble.setSubmits(new ArrayList<>()); move = new Move(scrabble.getSubmits(),scrabble.getGameSystem().getCurrentPlayer()); scrabble.setMove(move); scrabble.updateAllGameWindow(); scrabble.newPromptWindow("The move didn't pass the validation"); } } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }); } private void initHeadPanel() { // TODO Auto-generated method stub headPanel.setLayout(new BorderLayout()); squareInfoPanel.setLayout(new BoxLayout(squareInfoPanel,BoxLayout.Y_AXIS)); scoreBoardPanel.setLayout(new BoxLayout(scoreBoardPanel,BoxLayout.Y_AXIS)); currentPlayerPanel.setLayout(new BoxLayout(currentPlayerPanel,BoxLayout.Y_AXIS)); headPanel.add(squareInfoPanel, BorderLayout.WEST); headPanel.add(scoreBoardPanel, BorderLayout.CENTER); headPanel.add(currentPlayerPanel, BorderLayout.EAST); squareInfoPanel.add(squareLetterTile); squareInfoPanel.add(squareSpecialTile); squareInfoPanel.add(squareNormalBonus); currentPlayer.setText("Current Player is : "+scrabble.getGameSystem().getCurrentPlayer().getName()); currentPlayerPanel.add(currentPlayer); wholeWindow.add(headPanel, BorderLayout.NORTH); } private void initBoardPanel(){ wholeWindow.add(boardPanel,BorderLayout.CENTER); //TODO boardPanel.setLayout(new GridLayout(16,16)); squareButtons = new JButton[256]; ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent ae) { if(scrabble.getGameSystem().getCurrentPlayer().getName().equals(windowOwner)){ JButton button = (JButton) ae.getSource(); for(int index = 0;index < 256;index++){ if(button == squareButtons[index]){ int x = index/16; int y = index%16; if (scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasLetterTile()){ PromptWindow pw = new PromptWindow("this square ("+(x-1)+","+(y-1)+") has a lettiletile"); }else if(x != 0 && y != 0){ scrabble.setPlaceX(x-1); scrabble.setPlaceY(y-1); scrabble.newPlaceWindow(); } } } } else{ PromptWindow pw = new PromptWindow("this is not your turn"); } } }; //This is to initialize the whole board interface int index = 0; for(int x = 0;x<16;x++){ for(int y = 0; y < 16;y++){ index = x*16 + y; if(x == 0){ squareButtons[index] = new JButton(y-1+""); } if(y == 0){ squareButtons[index] = new JButton(x-1+""); } if(x !=0 && y!= 0){ squareButtons[index] = new JButton(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getNormalBonus().getName()); String normalBonusName = squareButtons[index].getText(); switch (normalBonusName) { case "3WS" : { squareButtons[index].setForeground(Color.RED); break; } case "3LS" : { squareButtons[index].setForeground(Color.BLUE); break; } case "2LS" : { squareButtons[index].setForeground(Color.CYAN); break; } case "2WS" : { squareButtons[index].setForeground(Color.PINK); break; } } //When you click the button,there should be a new window //designed to prompt you to place letters and special tiles. squareButtons[index].addActionListener(al); //When you hover over the button,the related info should be //displayed on the Head Panel. squareButtons[index].addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent me){ JButton button = (JButton) me.getSource(); int x = 0,y = 0; for(int index = 0;index < 256;index++){ if(button == squareButtons[index]){ x = index/16; y = index%16; } } if(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasSpecialTile()){ String specialTileInfo = " "; for(SpecialTile sp : scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getSpecialTile()){ if(sp.getOwner().getName().equals(windowOwner)){ specialTileInfo += sp.getName(); } } squareSpecialTile.setText("[special tiles are : "+ specialTileInfo +" ]"); } else { squareSpecialTile.setText("[special tiles are : "+"NULL"+" ]"); } if(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasLetterTile()){ squareLetterTile.setText("[letter tiles is : "+scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getLetterTile().getLetter()+" ]"); } else{ squareLetterTile.setText("[letter tiles is : NULL ]"); } squareNormalBonus.setText("[normal bonus is : "+ scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getNormalBonus().getName() +" ]"); } }); } boardPanel.add(squareButtons[index]); } } } public static void main(String args[]){ GameSystem game = new GameSystem(); Player player = new Player("<NAME>"); game.addPlayer(player); game.replenish(); } public void updateMyWindow() { for(int i = 0; i<256 ; i++){ int x = i/16; int y = i%16; if(x != 0 && y != 0){ if(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].hasLetterTile()){ squareButtons[i].setText(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getLetterTile().getLetter() + ""); } else{ squareButtons[i].setText(scrabble.getGameSystem().getBoard().getSquares()[x-1][y-1].getNormalBonus().getName()); } } } currentPlayer.setText("Current Player is : "+scrabble.getGameSystem().getCurrentPlayer().getName()); } public void seeOtherSubmits() { submits = scrabble.getSubmits(); System.out.println(submits.size()); for(Square square :submits){ if (square.hasLetterTile()){ int x = square.getX(); int y = square.getY(); int index = (x+1)*16 + (y+1); // System.out.println(squa); squareButtons[index].setText(square.getLetterTile().getLetter() + ""); } } } }
13,631
0.652362
0.643339
434
30.410139
28.745386
163
false
false
0
0
0
0
0
0
3.080645
false
false
14
94c45c8ce66b321221789043be55e50669380005
30,459,908,118,643
d9990bb9ca987675e4d248c04528c3d22e723c9b
/src/main/java/br/com/store/repository/CarrinhoRepository.java
9ccd3ab5ddde5317d02b674f5aa7321ff8569abc
[ "MIT" ]
permissive
ArthurJordao/store
https://github.com/ArthurJordao/store
c1609a0a633eb1b5dab8e0808ac9192afcb671ad
fec8b51d31b65ba2bd09e5a3ced1b6979a797de0
refs/heads/master
2021-01-12T14:59:38.969000
2017-04-03T21:35:28
2017-04-03T21:35:28
71,657,838
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.store.repository; import org.springframework.data.repository.CrudRepository; import br.com.store.model.Carrinho; public interface CarrinhoRepository extends CrudRepository<Carrinho, String> { }
UTF-8
Java
213
java
CarrinhoRepository.java
Java
[]
null
[]
package br.com.store.repository; import org.springframework.data.repository.CrudRepository; import br.com.store.model.Carrinho; public interface CarrinhoRepository extends CrudRepository<Carrinho, String> { }
213
0.826291
0.826291
9
22.666666
28.035692
78
false
false
0
0
0
0
0
0
0.444444
false
false
14
094f170ef20b8c99795de8b45b14fb0a86bcd521
35,235,911,697,059
7ac3ce5d9c8e75743ae5cc160eeee671fa063f25
/src/main/java/com/cms/core/config/RequestLimitContract.java
a39437be09d913bd2bd85049b4005fb4bbe7e5e7
[]
no_license
FatChigga/cms
https://github.com/FatChigga/cms
1c9db8025aa426d4a08cd8caeb5eb71d0cae90a4
5cd5b6030cd6048b4029cff21c9427c359fdfb79
refs/heads/master
2020-04-24T08:54:37.213000
2019-02-28T08:51:43
2019-02-28T08:51:43
171,845,713
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cms.core.config; import com.cms.core.exception.BizException; import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.*; /** 类名: RequestLimitContract * 包名: com.familyservice.config * 描述: 请求限制判断 **/ @Aspect @Component public class RequestLimitContract { private static final Logger logger = LoggerFactory.getLogger("requestLimitLogger"); private Map<String , Integer> redisTemplate = new HashMap<>(); @Before("within(@org.springframework.stereotype.Controller *) && @annotation(limit)") public void requestLimit(final JoinPoint joinPoint , RequestLimit limit) throws BizException { try { Object[] args = joinPoint.getArgs(); HttpServletRequest request = null; for (int i = 0; i < args.length; i++) { if (args[i] instanceof HttpServletRequest) { request = (HttpServletRequest) args[i]; break; } } if (request == null) { throw new BizException("方法中缺失HttpServletRequest参数"); } String ip = request.getLocalAddr(); String url = request.getRequestURL().toString(); String key = "req_limit_".concat(url).concat(ip); if (redisTemplate.get(key) == null || redisTemplate.get(key) == 0) { redisTemplate.put(key, 1); } else { redisTemplate.put(key, redisTemplate.get(key) + 1); } int count = redisTemplate.get(key); if (count > 0) { //这个线程设定在time规定的时间之后会执行上面的remove方法,也就是说在这个时间后它可以重新访问 ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("request-limit-pool-%d").build(); ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(1,threadFactory); scheduledExecutorService.schedule(() -> redisTemplate.remove(key),limit.time(), TimeUnit.MILLISECONDS); } if (count > limit.count()) { logger.info("用户IP[" + ip + "]访问地址[" + url + "]超过了限定的次数[" + limit.count() + "]"); throw new BizException("访问频繁,请一分钟后再试!"); } }catch (BizException e){ throw e; }catch (Exception e){ logger.error("发生异常",e); } } }
UTF-8
Java
2,977
java
RequestLimitContract.java
Java
[ { "context": "estURL().toString();\n String key = \"req_limit_\".concat(url).concat(ip);\n if (re", "end": 1622, "score": 0.5385099053382874, "start": 1622, "tag": "KEY", "value": "" }, { "context": "().toString();\n String key = \"req_limit_\".concat(url).concat(ip);\n if (redisTem", "end": 1628, "score": 0.5693374276161194, "start": 1628, "tag": "KEY", "value": "" } ]
null
[]
package com.cms.core.config; import com.cms.core.exception.BizException; import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.*; /** 类名: RequestLimitContract * 包名: com.familyservice.config * 描述: 请求限制判断 **/ @Aspect @Component public class RequestLimitContract { private static final Logger logger = LoggerFactory.getLogger("requestLimitLogger"); private Map<String , Integer> redisTemplate = new HashMap<>(); @Before("within(@org.springframework.stereotype.Controller *) && @annotation(limit)") public void requestLimit(final JoinPoint joinPoint , RequestLimit limit) throws BizException { try { Object[] args = joinPoint.getArgs(); HttpServletRequest request = null; for (int i = 0; i < args.length; i++) { if (args[i] instanceof HttpServletRequest) { request = (HttpServletRequest) args[i]; break; } } if (request == null) { throw new BizException("方法中缺失HttpServletRequest参数"); } String ip = request.getLocalAddr(); String url = request.getRequestURL().toString(); String key = "req_limit_".concat(url).concat(ip); if (redisTemplate.get(key) == null || redisTemplate.get(key) == 0) { redisTemplate.put(key, 1); } else { redisTemplate.put(key, redisTemplate.get(key) + 1); } int count = redisTemplate.get(key); if (count > 0) { //这个线程设定在time规定的时间之后会执行上面的remove方法,也就是说在这个时间后它可以重新访问 ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("request-limit-pool-%d").build(); ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(1,threadFactory); scheduledExecutorService.schedule(() -> redisTemplate.remove(key),limit.time(), TimeUnit.MILLISECONDS); } if (count > limit.count()) { logger.info("用户IP[" + ip + "]访问地址[" + url + "]超过了限定的次数[" + limit.count() + "]"); throw new BizException("访问频繁,请一分钟后再试!"); } }catch (BizException e){ throw e; }catch (Exception e){ logger.error("发生异常",e); } } }
2,977
0.611369
0.608509
72
37.847221
27.660973
119
false
false
0
0
0
0
0
0
0.652778
false
false
14
5f70b1e0f94a297338f145639cb92e620363a553
30,288,109,387,025
7e67bdacea46d4f296b768289947d814631b5841
/src/modelo/base.java
7e69f1416158e7b77ed7d2f13c0ad29f7f7b74b7
[]
no_license
luciafernandagonzalez/java2019
https://github.com/luciafernandagonzalez/java2019
28eac3a5cdd985ac50c35ff64241b0de4c91fa80
98ae5862ce6a7d2fbc9591508e10a1ff4e802bdc
refs/heads/master
2023-02-16T23:28:33.663000
2021-01-20T13:47:56
2021-01-20T13:47:56
331,318,278
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package modelo; /** * * @author lucia */ public class base { private String Descripcion; private Integer Precio; private tarifa Tarifa; public base() { } public base(String Descripcion, Integer Precio, tarifa Tarifa) { this.Descripcion = Descripcion; this.Precio = Precio; this.Tarifa = Tarifa; } public tarifa getTarifa() { return Tarifa; } public void setTarifa(tarifa Tarifa) { this.Tarifa = Tarifa; } public Integer getPrecio() { return Precio; } public void setPrecio(Integer Precio) { this.Precio = Precio; } public String getDescripcion() { return Descripcion; } public void setDescripcion(String Descripcion) { this.Descripcion = Descripcion; } }
UTF-8
Java
928
java
base.java
Java
[ { "context": "he editor.\n */\n\npackage modelo;\n\n/**\n *\n * @author lucia\n */\npublic class base {\n\n private String Descr", "end": 141, "score": 0.996542751789093, "start": 136, "tag": "USERNAME", "value": "lucia" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package modelo; /** * * @author lucia */ public class base { private String Descripcion; private Integer Precio; private tarifa Tarifa; public base() { } public base(String Descripcion, Integer Precio, tarifa Tarifa) { this.Descripcion = Descripcion; this.Precio = Precio; this.Tarifa = Tarifa; } public tarifa getTarifa() { return Tarifa; } public void setTarifa(tarifa Tarifa) { this.Tarifa = Tarifa; } public Integer getPrecio() { return Precio; } public void setPrecio(Integer Precio) { this.Precio = Precio; } public String getDescripcion() { return Descripcion; } public void setDescripcion(String Descripcion) { this.Descripcion = Descripcion; } }
928
0.606681
0.606681
53
16.509434
17.342958
68
false
false
0
0
0
0
0
0
0.320755
false
false
14
8b5037bdc29a9d6569fc30ca6eb7f8217410aa4b
17,635,135,734,415
a25d8ba60f80e3a10b6dd46a9728a9c1ce0a011a
/src/main/java/com/tjaktor/restshopping/core/service/dto/mapper/UserRolePrivilegeMapper.java
bcc368896d486eb9273636fb235344c274735421
[]
no_license
tjaktor/REST-shopping
https://github.com/tjaktor/REST-shopping
26c9e8c2efbe78d678b932a43e890e779a4e8176
7e8dd5abcdae85522916db199cea36bd1013d3a6
refs/heads/master
2021-08-26T08:15:05.209000
2017-11-22T12:46:41
2017-11-22T12:46:41
111,196,618
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tjaktor.restshopping.core.service.dto.mapper; import org.mapstruct.Mapper; import com.tjaktor.restshopping.core.service.dto.user.UserPrivilegeDataDto; import com.tjaktor.restshopping.security.user.UserPrivilege; @Mapper public interface UserRolePrivilegeMapper { UserPrivilegeDataDto map(UserPrivilege privilege); }
UTF-8
Java
345
java
UserRolePrivilegeMapper.java
Java
[]
null
[]
package com.tjaktor.restshopping.core.service.dto.mapper; import org.mapstruct.Mapper; import com.tjaktor.restshopping.core.service.dto.user.UserPrivilegeDataDto; import com.tjaktor.restshopping.security.user.UserPrivilege; @Mapper public interface UserRolePrivilegeMapper { UserPrivilegeDataDto map(UserPrivilege privilege); }
345
0.814493
0.814493
12
26.75
27.51704
75
false
false
0
0
0
0
0
0
0.5
false
false
14
ce95a87b2e6955dd6e73a74dbdc228b3920627c8
26,714,696,651,396
34f0e8cbe8569e5ffba72e9c8c1d39a67ccfbdaf
/app/src/main/java/fodel/com/fodelscanner/scanner/api/entity/response/ResSignature.java
e5ea0032df5149d00dafb4f2661d2da4e9aef06a
[]
no_license
tflgithub/driver
https://github.com/tflgithub/driver
5bbb45d89969f84218199f132ecda54ab7a20b59
03e068ffe3f69a14ba0b1f1f0b1185dd3f27d901
refs/heads/master
2020-03-24T06:38:17.343000
2018-07-27T06:17:37
2018-07-27T06:17:37
142,535,591
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fodel.com.fodelscanner.scanner.api.entity.response; /** * Created by fula on 2017/7/19. */ public class ResSignature extends BaseEntity { public String image_url; }
UTF-8
Java
183
java
ResSignature.java
Java
[ { "context": "er.scanner.api.entity.response;\n\n/**\n * Created by fula on 2017/7/19.\n */\n\npublic class ResSignature exte", "end": 83, "score": 0.9996060729026794, "start": 79, "tag": "USERNAME", "value": "fula" } ]
null
[]
package fodel.com.fodelscanner.scanner.api.entity.response; /** * Created by fula on 2017/7/19. */ public class ResSignature extends BaseEntity { public String image_url; }
183
0.726776
0.688525
10
17.299999
21.185137
59
false
false
0
0
0
0
0
0
0.2
false
false
14
e04905e73b241502b854b286aaef6e57893be207
8,186,207,711,009
e27070bca1080306451a741ffc4b4d74e23dce5e
/xfaceV2/src/main/java/com/xpand/xface/bean/report/StatisticsResult.java
b960aff7bf63d902747557441e3006108bf2cf56
[ "Apache-2.0" ]
permissive
eddy0055/xFaceRepo
https://github.com/eddy0055/xFaceRepo
ddcb6f9b67e54ec33bc59566161aefd8baafe5f7
f74035230cb0d1d9bf361fa296472b98f818c61d
refs/heads/master
2022-12-09T14:09:49.301000
2020-08-18T07:14:13
2020-08-18T07:14:13
288,382,802
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xpand.xface.bean.report; import com.xpand.xface.entity.EquipmentDirection; import com.xpand.xface.util.StringUtil; public class StatisticsResult { private String gateDesc; private String timePortion; private long noPassengerIn; private long noPassengerOut; private long noPassengerMatch; private long noPassengerUnMatch; private long noPassengerInOut; private long noPassengerMatchUnMatch; private Integer directionInId; private String directionInDesc; private Integer directionOutId; private String directionOutDesc; public StatisticsResult() { } public void createARCStatistic(Object[] columns) { //SELECT gate_name,SUM(rec_match) AS rec_match, SUM(rec_un_match) AS rec_un_match this.gateDesc = ""+columns[0]; this.noPassengerIn = 0; this.noPassengerOut = 0; this.noPassengerMatch = StringUtil.stringToLong(columns[1], 0); this.noPassengerUnMatch = StringUtil.stringToLong(columns[2], 0); this.noPassengerMatchUnMatch = this.noPassengerMatch+this.noPassengerUnMatch; this.noPassengerInOut = 0; this.timePortion = ""; } public void createARCStatisticTimePortion(Object[] columns) { //SELECT gate_name,alarm_time,SUM(rec_match) AS rec_match, SUM(rec_un_match) AS rec_un_match this.gateDesc = ""+columns[0]; this.timePortion = ""+columns[1]; this.noPassengerIn = 0; this.noPassengerOut = 0; this.noPassengerMatch = StringUtil.stringToLong(columns[2], 0); this.noPassengerUnMatch = StringUtil.stringToLong(columns[3], 0); this.noPassengerMatchUnMatch = this.noPassengerMatch+this.noPassengerUnMatch; this.noPassengerInOut = 0; } public void createGateStatistic(Object[] columns) { //0 gateDesc,1 = direction code, 2 = direction desc, 3 = direction cnt this.gateDesc = ""+columns[0]; int direction_code = StringUtil.stringToInteger(""+columns[1], EquipmentDirection.DIRECTION_IN); if (EquipmentDirection.DIRECTION_IN == direction_code) { this.noPassengerIn = StringUtil.stringToLong(columns[3], 0); this.noPassengerOut = 0; this.directionInId = direction_code; this.directionInDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerIn; }else { this.noPassengerIn = 0; this.noPassengerOut = StringUtil.stringToLong(columns[3], 0); this.directionOutId = direction_code; this.directionOutDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerOut; } this.noPassengerMatch = 0; this.noPassengerUnMatch = 0; this.noPassengerMatchUnMatch = 0; this.timePortion = ""; } public void createGateStatisticTimePortion(Object[] columns) { // SELECT gate.gate_name,record_time,direct.direction_code,direct.direction_desc,COUNT(record_id) cnt_tran this.gateDesc = ""+columns[0]; int direction_code = StringUtil.stringToInteger(""+columns[2], EquipmentDirection.DIRECTION_IN); if (EquipmentDirection.DIRECTION_IN == direction_code) { this.noPassengerIn = StringUtil.stringToLong(columns[4], 0); this.noPassengerOut = 0; this.directionInId = direction_code; this.directionInDesc = ""+columns[3]; this.noPassengerInOut = this.noPassengerIn; }else { this.noPassengerIn = 0; this.noPassengerOut = StringUtil.stringToLong(columns[4], 0); this.directionOutId = direction_code; this.directionOutDesc = ""+columns[3]; this.noPassengerInOut = this.noPassengerOut; } this.noPassengerMatch = 0; this.noPassengerUnMatch = 0; this.noPassengerMatchUnMatch = 0; this.timePortion = ""+columns[1]; } public void getGateStatisticsDMY(Object[] columns) { //"SELECT record_time,direct.direction_code,direct.direction_desc,COUNT(record_id) cnt_tran " this.gateDesc = ""; this.timePortion = ""+columns[0]; int direction_code = StringUtil.stringToInteger(""+columns[1], EquipmentDirection.DIRECTION_IN); if (EquipmentDirection.DIRECTION_IN == direction_code) { this.noPassengerIn = StringUtil.stringToLong(columns[3], 0); this.noPassengerOut = 0; this.directionInId = direction_code; this.directionInDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerIn; }else { this.noPassengerIn = 0; this.noPassengerOut = StringUtil.stringToLong(columns[3], 0); this.directionOutId = direction_code; this.directionOutDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerOut; } this.noPassengerMatch = 0; this.noPassengerUnMatch = 0; this.noPassengerMatchUnMatch = 0; } public String getGateDesc() { return gateDesc; } public void setGateDesc(String gateDesc) { this.gateDesc = gateDesc; } public long getNoPassengerIn() { return noPassengerIn; } public void setNoPassengerIn(long noPassengerIn) { this.noPassengerIn = noPassengerIn; } public long getNoPassengerOut() { return noPassengerOut; } public void setNoPassengerOut(long noPassengerOut) { this.noPassengerOut = noPassengerOut; } public long getNoPassengerMatch() { return noPassengerMatch; } public void setNoPassengerMatch(long noPassengerMatch) { this.noPassengerMatch = noPassengerMatch; } public long getNoPassengerUnMatch() { return noPassengerUnMatch; } public void setNoPassengerUnMatch(long noPassengerUnMatch) { this.noPassengerUnMatch = noPassengerUnMatch; } public long getNoPassengerInOut() { return noPassengerInOut; } public void setNoPassengerInOut(long noPassengerInOut) { this.noPassengerInOut = noPassengerInOut; } public long getNoPassengerMatchUnMatch() { return noPassengerMatchUnMatch; } public void setNoPassengerMatchUnMatch(long noPassengerMatchUnMatch) { this.noPassengerMatchUnMatch = noPassengerMatchUnMatch; } public String getTimePortion() { return timePortion; } public void setTimePortion(String timePortion) { this.timePortion = timePortion; } public Integer getDirectionInId() { return directionInId; } public void setDirectionInId(Integer directionInId) { this.directionInId = directionInId; } public String getDirectionInDesc() { return directionInDesc; } public void setDirectionInDesc(String directionInDesc) { this.directionInDesc = directionInDesc; } public Integer getDirectionOutId() { return directionOutId; } public void setDirectionOutId(Integer directionOutId) { this.directionOutId = directionOutId; } public String getDirectionOutDesc() { return directionOutDesc; } public void setDirectionOutDesc(String directionOutDesc) { this.directionOutDesc = directionOutDesc; } }
UTF-8
Java
6,407
java
StatisticsResult.java
Java
[]
null
[]
package com.xpand.xface.bean.report; import com.xpand.xface.entity.EquipmentDirection; import com.xpand.xface.util.StringUtil; public class StatisticsResult { private String gateDesc; private String timePortion; private long noPassengerIn; private long noPassengerOut; private long noPassengerMatch; private long noPassengerUnMatch; private long noPassengerInOut; private long noPassengerMatchUnMatch; private Integer directionInId; private String directionInDesc; private Integer directionOutId; private String directionOutDesc; public StatisticsResult() { } public void createARCStatistic(Object[] columns) { //SELECT gate_name,SUM(rec_match) AS rec_match, SUM(rec_un_match) AS rec_un_match this.gateDesc = ""+columns[0]; this.noPassengerIn = 0; this.noPassengerOut = 0; this.noPassengerMatch = StringUtil.stringToLong(columns[1], 0); this.noPassengerUnMatch = StringUtil.stringToLong(columns[2], 0); this.noPassengerMatchUnMatch = this.noPassengerMatch+this.noPassengerUnMatch; this.noPassengerInOut = 0; this.timePortion = ""; } public void createARCStatisticTimePortion(Object[] columns) { //SELECT gate_name,alarm_time,SUM(rec_match) AS rec_match, SUM(rec_un_match) AS rec_un_match this.gateDesc = ""+columns[0]; this.timePortion = ""+columns[1]; this.noPassengerIn = 0; this.noPassengerOut = 0; this.noPassengerMatch = StringUtil.stringToLong(columns[2], 0); this.noPassengerUnMatch = StringUtil.stringToLong(columns[3], 0); this.noPassengerMatchUnMatch = this.noPassengerMatch+this.noPassengerUnMatch; this.noPassengerInOut = 0; } public void createGateStatistic(Object[] columns) { //0 gateDesc,1 = direction code, 2 = direction desc, 3 = direction cnt this.gateDesc = ""+columns[0]; int direction_code = StringUtil.stringToInteger(""+columns[1], EquipmentDirection.DIRECTION_IN); if (EquipmentDirection.DIRECTION_IN == direction_code) { this.noPassengerIn = StringUtil.stringToLong(columns[3], 0); this.noPassengerOut = 0; this.directionInId = direction_code; this.directionInDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerIn; }else { this.noPassengerIn = 0; this.noPassengerOut = StringUtil.stringToLong(columns[3], 0); this.directionOutId = direction_code; this.directionOutDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerOut; } this.noPassengerMatch = 0; this.noPassengerUnMatch = 0; this.noPassengerMatchUnMatch = 0; this.timePortion = ""; } public void createGateStatisticTimePortion(Object[] columns) { // SELECT gate.gate_name,record_time,direct.direction_code,direct.direction_desc,COUNT(record_id) cnt_tran this.gateDesc = ""+columns[0]; int direction_code = StringUtil.stringToInteger(""+columns[2], EquipmentDirection.DIRECTION_IN); if (EquipmentDirection.DIRECTION_IN == direction_code) { this.noPassengerIn = StringUtil.stringToLong(columns[4], 0); this.noPassengerOut = 0; this.directionInId = direction_code; this.directionInDesc = ""+columns[3]; this.noPassengerInOut = this.noPassengerIn; }else { this.noPassengerIn = 0; this.noPassengerOut = StringUtil.stringToLong(columns[4], 0); this.directionOutId = direction_code; this.directionOutDesc = ""+columns[3]; this.noPassengerInOut = this.noPassengerOut; } this.noPassengerMatch = 0; this.noPassengerUnMatch = 0; this.noPassengerMatchUnMatch = 0; this.timePortion = ""+columns[1]; } public void getGateStatisticsDMY(Object[] columns) { //"SELECT record_time,direct.direction_code,direct.direction_desc,COUNT(record_id) cnt_tran " this.gateDesc = ""; this.timePortion = ""+columns[0]; int direction_code = StringUtil.stringToInteger(""+columns[1], EquipmentDirection.DIRECTION_IN); if (EquipmentDirection.DIRECTION_IN == direction_code) { this.noPassengerIn = StringUtil.stringToLong(columns[3], 0); this.noPassengerOut = 0; this.directionInId = direction_code; this.directionInDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerIn; }else { this.noPassengerIn = 0; this.noPassengerOut = StringUtil.stringToLong(columns[3], 0); this.directionOutId = direction_code; this.directionOutDesc = ""+columns[2]; this.noPassengerInOut = this.noPassengerOut; } this.noPassengerMatch = 0; this.noPassengerUnMatch = 0; this.noPassengerMatchUnMatch = 0; } public String getGateDesc() { return gateDesc; } public void setGateDesc(String gateDesc) { this.gateDesc = gateDesc; } public long getNoPassengerIn() { return noPassengerIn; } public void setNoPassengerIn(long noPassengerIn) { this.noPassengerIn = noPassengerIn; } public long getNoPassengerOut() { return noPassengerOut; } public void setNoPassengerOut(long noPassengerOut) { this.noPassengerOut = noPassengerOut; } public long getNoPassengerMatch() { return noPassengerMatch; } public void setNoPassengerMatch(long noPassengerMatch) { this.noPassengerMatch = noPassengerMatch; } public long getNoPassengerUnMatch() { return noPassengerUnMatch; } public void setNoPassengerUnMatch(long noPassengerUnMatch) { this.noPassengerUnMatch = noPassengerUnMatch; } public long getNoPassengerInOut() { return noPassengerInOut; } public void setNoPassengerInOut(long noPassengerInOut) { this.noPassengerInOut = noPassengerInOut; } public long getNoPassengerMatchUnMatch() { return noPassengerMatchUnMatch; } public void setNoPassengerMatchUnMatch(long noPassengerMatchUnMatch) { this.noPassengerMatchUnMatch = noPassengerMatchUnMatch; } public String getTimePortion() { return timePortion; } public void setTimePortion(String timePortion) { this.timePortion = timePortion; } public Integer getDirectionInId() { return directionInId; } public void setDirectionInId(Integer directionInId) { this.directionInId = directionInId; } public String getDirectionInDesc() { return directionInDesc; } public void setDirectionInDesc(String directionInDesc) { this.directionInDesc = directionInDesc; } public Integer getDirectionOutId() { return directionOutId; } public void setDirectionOutId(Integer directionOutId) { this.directionOutId = directionOutId; } public String getDirectionOutDesc() { return directionOutDesc; } public void setDirectionOutDesc(String directionOutDesc) { this.directionOutDesc = directionOutDesc; } }
6,407
0.755424
0.745903
182
34.203297
23.145916
108
false
false
0
0
0
0
0
0
2.554945
false
false
14
0e5aa35d07c88de7b4f066d1a0d2060e87da08a5
33,380,485,870,738
dedb1ca2f496b4607f0ed5f99552d78ca94d4ec8
/src/main/java/com/muksihs/farhorizons/Main.java
e6b7144084321e677d553a306f88afecf8cf49ee
[ "Apache-2.0" ]
permissive
muksihs/Far-Horizons-Steem
https://github.com/muksihs/Far-Horizons-Steem
05ef2a587e52ebd430db472d12ffb170f09e1a9c
5c5c503398958fe705b8291428f0ff58a6f37b02
refs/heads/master
2020-03-17T01:18:34.299000
2019-01-16T00:01:27
2019-01-16T00:01:27
133,142,017
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.muksihs.farhorizons; import com.muksihs.steembot.ui.AppWindow; public class Main { public static void main(String[] args) throws InterruptedException { // LoggerContext ctx = (LoggerContext) LogManager.getContext(false); // Configuration config = ctx.getConfiguration(); // LoggerConfig loggerCfg = config.getRootLogger(); // loggerCfg.setLevel(Level.WARN); //Using this level disables the logger. // ctx.updateLoggers(); new AppWindow("Far Horizons - STEEM"); new Thread(new FarHorizonsApp(args)).start(); } }
UTF-8
Java
553
java
Main.java
Java
[]
null
[]
package com.muksihs.farhorizons; import com.muksihs.steembot.ui.AppWindow; public class Main { public static void main(String[] args) throws InterruptedException { // LoggerContext ctx = (LoggerContext) LogManager.getContext(false); // Configuration config = ctx.getConfiguration(); // LoggerConfig loggerCfg = config.getRootLogger(); // loggerCfg.setLevel(Level.WARN); //Using this level disables the logger. // ctx.updateLoggers(); new AppWindow("Far Horizons - STEEM"); new Thread(new FarHorizonsApp(args)).start(); } }
553
0.726944
0.726944
18
29.722221
27.030447
78
false
false
0
0
0
0
0
0
1.277778
false
false
14
16cb3625ba327d11f917dfcb1dd3648604402532
5,549,097,809,462
d5e9e6c0aa4808f04b17a944e537770854d5014d
/.svn/pristine/cd/cd16f6d0fd1d5e62087b6698540fc09eba483c8f.svn-base
e503e47cdf267d21ec8b9f1ca5f958616698ce8a
[]
no_license
958212662/nm
https://github.com/958212662/nm
460eb414a1ad0b0f7fdd7dbf8f84bc78126158a1
80a54f6f736d81f93da60f56c6f23187a6edcf1d
refs/heads/master
2020-09-04T09:52:27.429000
2019-10-31T08:06:18
2019-10-31T08:06:18
219,705,531
1
0
null
true
2019-11-05T09:23:54
2019-11-05T09:23:54
2019-11-05T09:23:39
2019-10-31T08:21:36
146,253
0
0
0
null
false
false
package com.soholy.cb.utils; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; public class R extends LinkedHashMap<String, Object> implements Serializable { private static final long serialVersionUID = 1L; private static List<String> KEYS = null; static { KEYS = new ArrayList(); KEYS.add("code"); KEYS.add("msg"); KEYS.add("obj"); KEYS.add("ext"); KEYS.add("success"); } public R() { put("code", Integer.valueOf(0)); put("msg", "success"); } public static R error() { return error(1, "failure", null); } public static R error(String msg) { return error(500, msg); } public static R error(int code, String msg) { return error(code, msg, null); } public static R error(int code, String msg, Object obj) { return error(code, msg, obj, null); } public static R error(int code, String msg, Object obj, Object extData) { return result(code, msg, obj, extData, false); } public static R result(int code, String msg, Object obj, Object extData, boolean success) { List<Object> values = Arrays.asList(new Object[] { Integer.valueOf(code), msg, obj, extData, Boolean.valueOf(success) }); R r = new R(); for (int i = 0; i < KEYS.size(); i++) r.put((String)KEYS.get(i), values.get(i)); return r; } public static R ok(Map<String, Object> map) { return result(200, null, map, null, true); } public static R ok() { return ok("success"); } public static R ok(Object obj) { return ok(200, "success", obj, null); } public static R ok(int code, Object obj) { return ok(code, "success", obj, null); } public static R ok(String msg, Object obj) { return ok(200, msg, obj, null); } public static R ok(String msg) { return ok(200, msg, null, null); } public static R ok(int code, String msg) { return ok(code, msg, null, null); } public static R ok(int code, String msg, Object obj) { return ok(code, msg, obj, null); } public static R ok(int code, String msg, Object obj, Object extData) { return result(code, msg, obj, extData, true); } public R put(String key, Object value) { super.put(key, value); return this; } }
UTF-8
Java
2,279
cd16f6d0fd1d5e62087b6698540fc09eba483c8f.svn-base
Java
[]
null
[]
package com.soholy.cb.utils; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; public class R extends LinkedHashMap<String, Object> implements Serializable { private static final long serialVersionUID = 1L; private static List<String> KEYS = null; static { KEYS = new ArrayList(); KEYS.add("code"); KEYS.add("msg"); KEYS.add("obj"); KEYS.add("ext"); KEYS.add("success"); } public R() { put("code", Integer.valueOf(0)); put("msg", "success"); } public static R error() { return error(1, "failure", null); } public static R error(String msg) { return error(500, msg); } public static R error(int code, String msg) { return error(code, msg, null); } public static R error(int code, String msg, Object obj) { return error(code, msg, obj, null); } public static R error(int code, String msg, Object obj, Object extData) { return result(code, msg, obj, extData, false); } public static R result(int code, String msg, Object obj, Object extData, boolean success) { List<Object> values = Arrays.asList(new Object[] { Integer.valueOf(code), msg, obj, extData, Boolean.valueOf(success) }); R r = new R(); for (int i = 0; i < KEYS.size(); i++) r.put((String)KEYS.get(i), values.get(i)); return r; } public static R ok(Map<String, Object> map) { return result(200, null, map, null, true); } public static R ok() { return ok("success"); } public static R ok(Object obj) { return ok(200, "success", obj, null); } public static R ok(int code, Object obj) { return ok(code, "success", obj, null); } public static R ok(String msg, Object obj) { return ok(200, msg, obj, null); } public static R ok(String msg) { return ok(200, msg, null, null); } public static R ok(int code, String msg) { return ok(code, msg, null, null); } public static R ok(int code, String msg, Object obj) { return ok(code, msg, obj, null); } public static R ok(int code, String msg, Object obj, Object extData) { return result(code, msg, obj, extData, true); } public R put(String key, Object value) { super.put(key, value); return this; } }
2,279
0.650724
0.642387
69
32.028984
34.901505
125
false
false
0
0
0
0
0
0
1.536232
false
false
14
eb2447244506c12c478b8a00f90bff8767ed4446
4,569,845,252,173
add4ff5b948d806066249e217164d91de20d3e85
/src/main/java/cn/code/lc/ZigZagConversion6.java
026930a9bcb0ec1256d1829b7d3875c943bb61c3
[]
no_license
trbif/codetest
https://github.com/trbif/codetest
57b1ea9aa83dde35aabe9f020b9f81be752527be
9f1a1b77bbf4c1caaca676e19902109703f70e05
refs/heads/master
2020-03-27T04:19:03.574000
2018-08-29T09:32:37
2018-08-29T09:32:37
145,930,115
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package cn.code.lc; /** * @author zhangqi * @date 2018年3月15日 下午2:26:28 * @version V1.0 * @说明: */ public class ZigZagConversion6 { public String convert(String s, int numRows) { StringBuilder result = new StringBuilder(); for(int i=0;i<numRows;i++){ for(int j=0;;j++){ int index = (2*numRows-2)*j+i; if(index-numRows+1<s.length()){ if(j!=0){ result.append(s.charAt(index-j)); result.append(s.charAt(index+j)); }else{ result.append(s.charAt(index)); } } } } return null; } //wrong answer public String convertNew(String s, int numRows) { char[] result = new char[s.length()]; int helper = numRows*2-2; int[] deep = new int[helper]; int[] flag = new int[helper]; for(int i=0;i<helper;i++){ deep[i] = (i>numRows-1)?(deep[i-1]-1):(i); flag[i] = (i>numRows-1)?(1):(0); } int index = 0; int roller = 0; int length = 0; int count = 0; while(index<s.length()){ index = deep[roller]+((numRows-2)*2+1+flag[roller])*length; result[index] = s.charAt(count++); length = count/helper; roller = count%helper; } return null; } public String convertNewNew(String s, int numRows) { numRows = (numRows>s.length())?(s.length()):numRows; if(s==null||s.equals("")||numRows==1){ return s; } StringBuilder toReturn = new StringBuilder(); char[] result = new char[s.length()]; int[] rowsSize = new int[numRows+1]; rowsSize[0] = 0; int helper = 2*numRows-2; int[] deep = new int[helper]; for(int i=0;i<helper;i++){ deep[i] = (i>numRows-1)?(deep[i-1]-1):(i); } int blockLength = s.length()/helper; int extra = s.length()%helper; for(int i=1;i<rowsSize.length;i++){ if(i!=1&&i!=rowsSize.length-1){ rowsSize[i] = blockLength*2; }else{ rowsSize[i] = blockLength; } if(extra!=0){ if(i!=1&&i!=rowsSize.length-1&&extra+1==(numRows-i-1)*2){ rowsSize[i] += 2; extra -= 2; }else{ rowsSize[i] += 1; extra--; } } rowsSize[i] += rowsSize[i-1]; } for(int i=0;i<rowsSize.length;i++){ System.out.println((rowsSize[i])); } for(int i=0;i<s.length();i++){ int index = i%helper; int length = i/helper; if(index==0||index==helper/2){ index = rowsSize[deep[index]]+length; }else if(index>helper/2){ index = rowsSize[deep[index]]+2*length+1; }else{ index = rowsSize[deep[index]]+2*length; } result[index] = s.charAt(i); } for(int i=0;i<result.length;i++){ toReturn.append(result[i]); } return toReturn.toString(); } public static void main(String[] args) { String s = "abcdef"; System.out.println(new ZigZagConversion6().convertNewNew(s, 6)); } }
GB18030
Java
3,127
java
ZigZagConversion6.java
Java
[ { "context": "\r\n * \r\n */\r\npackage cn.code.lc;\r\n\r\n/**\r\n * @author zhangqi\r\n * @date 2018年3月15日 下午2:26:28\r\n * @version V1.0\r", "end": 61, "score": 0.8763921856880188, "start": 54, "tag": "USERNAME", "value": "zhangqi" } ]
null
[]
/** * */ package cn.code.lc; /** * @author zhangqi * @date 2018年3月15日 下午2:26:28 * @version V1.0 * @说明: */ public class ZigZagConversion6 { public String convert(String s, int numRows) { StringBuilder result = new StringBuilder(); for(int i=0;i<numRows;i++){ for(int j=0;;j++){ int index = (2*numRows-2)*j+i; if(index-numRows+1<s.length()){ if(j!=0){ result.append(s.charAt(index-j)); result.append(s.charAt(index+j)); }else{ result.append(s.charAt(index)); } } } } return null; } //wrong answer public String convertNew(String s, int numRows) { char[] result = new char[s.length()]; int helper = numRows*2-2; int[] deep = new int[helper]; int[] flag = new int[helper]; for(int i=0;i<helper;i++){ deep[i] = (i>numRows-1)?(deep[i-1]-1):(i); flag[i] = (i>numRows-1)?(1):(0); } int index = 0; int roller = 0; int length = 0; int count = 0; while(index<s.length()){ index = deep[roller]+((numRows-2)*2+1+flag[roller])*length; result[index] = s.charAt(count++); length = count/helper; roller = count%helper; } return null; } public String convertNewNew(String s, int numRows) { numRows = (numRows>s.length())?(s.length()):numRows; if(s==null||s.equals("")||numRows==1){ return s; } StringBuilder toReturn = new StringBuilder(); char[] result = new char[s.length()]; int[] rowsSize = new int[numRows+1]; rowsSize[0] = 0; int helper = 2*numRows-2; int[] deep = new int[helper]; for(int i=0;i<helper;i++){ deep[i] = (i>numRows-1)?(deep[i-1]-1):(i); } int blockLength = s.length()/helper; int extra = s.length()%helper; for(int i=1;i<rowsSize.length;i++){ if(i!=1&&i!=rowsSize.length-1){ rowsSize[i] = blockLength*2; }else{ rowsSize[i] = blockLength; } if(extra!=0){ if(i!=1&&i!=rowsSize.length-1&&extra+1==(numRows-i-1)*2){ rowsSize[i] += 2; extra -= 2; }else{ rowsSize[i] += 1; extra--; } } rowsSize[i] += rowsSize[i-1]; } for(int i=0;i<rowsSize.length;i++){ System.out.println((rowsSize[i])); } for(int i=0;i<s.length();i++){ int index = i%helper; int length = i/helper; if(index==0||index==helper/2){ index = rowsSize[deep[index]]+length; }else if(index>helper/2){ index = rowsSize[deep[index]]+2*length+1; }else{ index = rowsSize[deep[index]]+2*length; } result[index] = s.charAt(i); } for(int i=0;i<result.length;i++){ toReturn.append(result[i]); } return toReturn.toString(); } public static void main(String[] args) { String s = "abcdef"; System.out.println(new ZigZagConversion6().convertNewNew(s, 6)); } }
3,127
0.508191
0.485063
112
25.794643
16.803028
67
false
false
0
0
0
0
0
0
2.107143
false
false
14
a2e2d67243a3ca2f7258118ecddee56f89375b62
36,421,322,677,125
8315ec61985ae15b82b76b59e5e529ad19fa77d9
/src/org/darkquest/gs/plugins/listeners/executive/PlayerKilledNpcExecutiveListener.java
c8383107862aef552f0121c21803b317755cbf16
[]
no_license
gen0cide-/dqs
https://github.com/gen0cide-/dqs
dddc5659f562738dbe69be97e73ca76a5e85cbbe
782893676e6f8b0b9f3ccef26a65bb2ed75a382b
refs/heads/master
2021-01-19T16:58:52.876000
2014-05-14T01:26:32
2014-05-14T01:26:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.darkquest.gs.plugins.listeners.executive; import org.darkquest.gs.model.Npc; import org.darkquest.gs.model.Player; public interface PlayerKilledNpcExecutiveListener { /** * Return true to prevent the default action on a npcs death (no loot) */ public boolean blockPlayerKilledNpc(Player p, Npc n); }
UTF-8
Java
335
java
PlayerKilledNpcExecutiveListener.java
Java
[]
null
[]
package org.darkquest.gs.plugins.listeners.executive; import org.darkquest.gs.model.Npc; import org.darkquest.gs.model.Player; public interface PlayerKilledNpcExecutiveListener { /** * Return true to prevent the default action on a npcs death (no loot) */ public boolean blockPlayerKilledNpc(Player p, Npc n); }
335
0.743284
0.743284
11
28.454546
25.741243
72
false
false
0
0
0
0
0
0
0.454545
false
false
14
94c706dce0837906e8bb46b0321513730111e9c8
5,222,680,266,900
f3d19d9cd2ca323b66aa9fc6d63ab885bf2c46a8
/app/src/main/java/com/orcaformation/calculetterci/utils/LoadPdfFromFIPE.java
a584c05c21b55e90b1daf32b58b15d3577522e8c
[]
no_license
hmachat/rci
https://github.com/hmachat/rci
ad242e15d124f586991545dadb267402bc8e6fd4
c1b9a4c7997cab20d0e39b36fe30f00fad57c323
refs/heads/master
2021-08-30T22:28:00.604000
2017-12-12T12:13:09
2017-12-12T12:13:09
114,787,885
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.orcaformation.calculetterci.utils; import android.app.Activity; import android.net.Uri; import android.util.Log; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.google.gson.JsonArray; import com.orcaformation.calculetterci.app.AppConfig; import com.orcaformation.calculetterci.app.AppController; import org.json.JSONException; import org.json.JSONObject; /** * Created by PC_MA22 on 05/12/2017. */ public class LoadPdfFromFIPE { public static void loadFipePDF(final Activity activity, int flag){ final String tag_string_req = "req_get_fipe"; final Utils utils = new Utils(); String items = ""; if(!utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_NOM").equals("")){ items += "{\"xml_prestation_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_NOM") + "\"" + ",\"simulation_ass_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_MONTANT") + ",\"xml_produit\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_PRODUIT") + "}"; } if(!utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_NOM").equals("")){ items += ",{\"xml_prestation_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_NOM") + "\"" + ",\"simulation_ass_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_MONTANT") + ",\"xml_produit\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_PRODUIT") + "}"; } if(!utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_NOM").equals("")){ items += ",{\"xml_prestation_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_NOM") + "\"" + ",\"simulation_ass_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_MONTANT") + ",\"xml_produit\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_PRODUIT") + "}"; } final String FIP = "{\"simulation_id\":\"\",\"get_Fipe_Flag\":" + flag + "," + "\"type_simulation\":\"android\",\"simulation_info_vehicule_marque\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "INFO_VEH", "MARQUE_LIB") + "\"" + ",\"simulation_info_vehicule_modele\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "INFO_VEH", "MODELE_LIB") + "\"" + ",\"simulation_prix_vente\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "INFO_VEH", "MONTANT") + ",\"simulation_option_achat\":0" + ",\"type_client\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "TYPE_CLIENT_ID") + "\"" + ",\"simulation_info_client_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "NOM_CLIENT") + "\"" + ",\"simulation_info_client_prenom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "PRENOM_CLIENT") + "\"" + ",\"simulation_info_client_raison_sociale\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "RAISON_CLIENT") + "\"" + ",\"simulation_info_client_tel_port\":\""+ utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "TEL_CLIENT") + "\"" + ",\"simulation_info_client_email\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "EMAIL_CLIENT") + "\"" + ",\"simulation_info_client_adresse\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "ADRESSE_CLIENT") + "\"" + ",\"type_financement\":"+ utils.getFromSharedPrefs(activity.getApplicationContext(), "TARIF", "CHOICE") + ",\"simulation_tarification_id\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "TARIFICATION_ID") + "\"" + ",\"simulation_version_label\":\"\"" + ",\"simulation_apport\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "APPORT") + ",\"simulation_prestation_premier_loyer_majore\":0" + ",\"simulation_valeur_residuelle\":0" + ",\"simulation_mensualite_duree\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "DUREE") + ",\"mensualites\":{\"items\":[{\"simulation_mensualite_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "MONS_AVEC_ASS") + ",\"simulation_mensualite_montant_sans_assurance\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "MONS_SANS_ASS") + ",\"simulation_mensualite_duree\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "DUREE") + "}]}" + ",\"assurances\":{\"items\":" + "[" + items + "]}" + ",\"packs\":{\"items\":[]}}"; String URL_FIPE = AppConfig.URL_FIPE + "?login=" + utils.getFromSharedPrefs(activity.getApplicationContext(), "RciFinanceLogin", "login") + "&password=" + utils.getFromSharedPrefs(activity.getApplicationContext(), "RciFinanceLogin", "password") + "&fipe=" + Uri.encode(FIP) + "&_=" + ""; Log.d("URL : ", URL_FIPE); final StringRequest strReq = new StringRequest(Request.Method.GET, URL_FIPE , new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); utils.saveInSharedPrefs(activity.getApplicationContext(),"SIMULATION", "SIMULATION_ID", jsonObject.getString("simulation_id")); utils.saveInSharedPrefs(activity.getApplicationContext(),"SIMULATION", "SIMULATION_PDF", jsonObject.getString("simulation_lien")); } catch (JSONException e) { Log.e("error", "unexpected JSON exception", e); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(activity.getApplicationContext(), error.getMessage(), Toast.LENGTH_LONG).show(); } }); // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_string_req); } }
UTF-8
Java
6,983
java
LoadPdfFromFIPE.java
Java
[ { "context": "n;\nimport org.json.JSONObject;\n\n\n/**\n * Created by PC_MA22 on 05/12/2017.\n */\n\npublic class LoadPdfFromFIPE ", "end": 592, "score": 0.9996358156204224, "start": 585, "tag": "USERNAME", "value": "PC_MA22" } ]
null
[]
package com.orcaformation.calculetterci.utils; import android.app.Activity; import android.net.Uri; import android.util.Log; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.google.gson.JsonArray; import com.orcaformation.calculetterci.app.AppConfig; import com.orcaformation.calculetterci.app.AppController; import org.json.JSONException; import org.json.JSONObject; /** * Created by PC_MA22 on 05/12/2017. */ public class LoadPdfFromFIPE { public static void loadFipePDF(final Activity activity, int flag){ final String tag_string_req = "req_get_fipe"; final Utils utils = new Utils(); String items = ""; if(!utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_NOM").equals("")){ items += "{\"xml_prestation_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_NOM") + "\"" + ",\"simulation_ass_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_MONTANT") + ",\"xml_produit\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_ONE_PRODUIT") + "}"; } if(!utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_NOM").equals("")){ items += ",{\"xml_prestation_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_NOM") + "\"" + ",\"simulation_ass_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_MONTANT") + ",\"xml_produit\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_TWO_PRODUIT") + "}"; } if(!utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_NOM").equals("")){ items += ",{\"xml_prestation_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_NOM") + "\"" + ",\"simulation_ass_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_MONTANT") + ",\"xml_produit\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "ASS_THREE_PRODUIT") + "}"; } final String FIP = "{\"simulation_id\":\"\",\"get_Fipe_Flag\":" + flag + "," + "\"type_simulation\":\"android\",\"simulation_info_vehicule_marque\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "INFO_VEH", "MARQUE_LIB") + "\"" + ",\"simulation_info_vehicule_modele\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "INFO_VEH", "MODELE_LIB") + "\"" + ",\"simulation_prix_vente\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "INFO_VEH", "MONTANT") + ",\"simulation_option_achat\":0" + ",\"type_client\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "TYPE_CLIENT_ID") + "\"" + ",\"simulation_info_client_nom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "NOM_CLIENT") + "\"" + ",\"simulation_info_client_prenom\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "PRENOM_CLIENT") + "\"" + ",\"simulation_info_client_raison_sociale\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "RAISON_CLIENT") + "\"" + ",\"simulation_info_client_tel_port\":\""+ utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "TEL_CLIENT") + "\"" + ",\"simulation_info_client_email\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "EMAIL_CLIENT") + "\"" + ",\"simulation_info_client_adresse\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "CLIENT", "ADRESSE_CLIENT") + "\"" + ",\"type_financement\":"+ utils.getFromSharedPrefs(activity.getApplicationContext(), "TARIF", "CHOICE") + ",\"simulation_tarification_id\":\"" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "TARIFICATION_ID") + "\"" + ",\"simulation_version_label\":\"\"" + ",\"simulation_apport\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "APPORT") + ",\"simulation_prestation_premier_loyer_majore\":0" + ",\"simulation_valeur_residuelle\":0" + ",\"simulation_mensualite_duree\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "DUREE") + ",\"mensualites\":{\"items\":[{\"simulation_mensualite_montant\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "MONS_AVEC_ASS") + ",\"simulation_mensualite_montant_sans_assurance\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "MONS_SANS_ASS") + ",\"simulation_mensualite_duree\":" + utils.getFromSharedPrefs(activity.getApplicationContext(), "FINANCE", "DUREE") + "}]}" + ",\"assurances\":{\"items\":" + "[" + items + "]}" + ",\"packs\":{\"items\":[]}}"; String URL_FIPE = AppConfig.URL_FIPE + "?login=" + utils.getFromSharedPrefs(activity.getApplicationContext(), "RciFinanceLogin", "login") + "&password=" + utils.getFromSharedPrefs(activity.getApplicationContext(), "RciFinanceLogin", "password") + "&fipe=" + Uri.encode(FIP) + "&_=" + ""; Log.d("URL : ", URL_FIPE); final StringRequest strReq = new StringRequest(Request.Method.GET, URL_FIPE , new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); utils.saveInSharedPrefs(activity.getApplicationContext(),"SIMULATION", "SIMULATION_ID", jsonObject.getString("simulation_id")); utils.saveInSharedPrefs(activity.getApplicationContext(),"SIMULATION", "SIMULATION_PDF", jsonObject.getString("simulation_lien")); } catch (JSONException e) { Log.e("error", "unexpected JSON exception", e); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(activity.getApplicationContext(), error.getMessage(), Toast.LENGTH_LONG).show(); } }); // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_string_req); } }
6,983
0.623657
0.621796
101
68.138611
60.39999
295
false
false
0
0
0
0
0
0
1.405941
false
false
14
1e9237f4fe457e2b0d8c9ad7100b327b21ac6663
34,797,825,033,728
472206ba9bb8b026ed9d8328623d8d7426d6ca28
/app/src/main/java/com/teamnova/gunter/liveusedarticleauction/ui/my_product/data/MyAuctionData.java
7e3733253fcb027aef9961919dc33f66f8ab3817
[]
no_license
kwontaewan/LiveAuction_Android
https://github.com/kwontaewan/LiveAuction_Android
b683dbc86de987e20a2d9d83715b3878d6b0899a
a040b44606f3e4996e28b895cc9ef6095248a0d4
refs/heads/master
2020-04-06T06:41:06.271000
2016-12-11T06:23:04
2016-12-11T06:23:04
70,211,406
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.teamnova.gunter.liveusedarticleauction.ui.my_product.data; import com.google.gson.annotations.SerializedName; /** * Created by user on 2016-11-22. */ public class MyAuctionData { @SerializedName("no") public String no; @SerializedName("id") public String id; @SerializedName("name") public String name; @SerializedName("profile_url") public String profileUrl; @SerializedName("product_name") public String productName; @SerializedName("product_picture_url") public String productPictureUrl; @SerializedName("price") public String price; @SerializedName("created") public String created; }
UTF-8
Java
671
java
MyAuctionData.java
Java
[]
null
[]
package com.teamnova.gunter.liveusedarticleauction.ui.my_product.data; import com.google.gson.annotations.SerializedName; /** * Created by user on 2016-11-22. */ public class MyAuctionData { @SerializedName("no") public String no; @SerializedName("id") public String id; @SerializedName("name") public String name; @SerializedName("profile_url") public String profileUrl; @SerializedName("product_name") public String productName; @SerializedName("product_picture_url") public String productPictureUrl; @SerializedName("price") public String price; @SerializedName("created") public String created; }
671
0.709389
0.697466
27
23.851852
16.599205
70
false
false
0
0
0
0
0
0
0.37037
false
false
14
ba311d458fcfa33e7a455612ac8941f4b6060ee0
22,943,715,361,028
a17bf60b2e65d1a0e5c94bc8aff62913be5b6e24
/jypt-model/src/main/java/com/ucmed/common/items/dao/ItemRelateMapper.java
58a9da52376380c3a39abd333618b2a9aec55278
[]
no_license
hatemyselfandyouall/specalTask
https://github.com/hatemyselfandyouall/specalTask
2adb64da175a76a350a046ed80947be9e2da6ab8
d9fa9ac418fd0eaeef93822c6d0a806066ad5c0c
refs/heads/master
2020-03-04T01:15:32.870000
2017-06-26T03:31:22
2017-06-26T03:31:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ucmed.common.items.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.ucmed.common.items.model.ItemRelate; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.type.JdbcType; /** * 项目 关联关系 * @author lintc * @date 2016年10月8日 */ public interface ItemRelateMapper { /** * 查找 检验机构 项目关联 * @param hosId * @param assayId * @return */ List<ItemRelate> getAssayItemRelate(@Param("hosId")Integer hosId, @Param("assayId")Integer assayId); /** * 查找 医院 项目关联 * @param hosId * @param assayId * @return */ List<ItemRelate> getHosItemRelate(@Param("hosId")Integer hosId, @Param("assayId")Integer assayId); /** * items_pt_hospital 批量添加送检机构项目关联 * @param itemRelates */ void addHosRelateList(@Param("list")List<ItemRelate> itemRelates, @Param("hosId")Integer hosId); /** * items_pt_assay 批量添加检验机构项目关联 * @param itemRelates */ void addAssayRelateList(@Param("list")List<ItemRelate> itemRelates, @Param("assayId")Integer assayId); /** * items_buy_price 批量添加价格管理 * @param itemRelates */ void addPriceRelateList(@Param("list")List<ItemRelate> itemRelates, @Param("institutionRelationId")Integer institutionRelationId, @Param("assayId")Integer assayId, @Param("hosId")Integer hosId); /** * 查找pt_hos关联关系 */ @Select({ "select pt_items_id,h_items_id", "from items_pt_hospital", "where pt_items_id = #{itemRelate.ptItemId,jdbcType=INTEGER}", "AND h_items_id = #{itemRelate.hosItemId,jdbcType=INTEGER}", "AND institution_id = #{hosId,jdbcType=INTEGER}" }) @Results({ @Result(column = "pt_items_id", property = "ptItemId", jdbcType = JdbcType.INTEGER), @Result(column = "h_items_id", property = "hosItemId", jdbcType = JdbcType.INTEGER) }) ItemRelate existsHosPt(@Param("itemRelate")ItemRelate itemRelate,@Param("hosId")Integer hosId); /** * 查找pt_assay关联关系 */ @Select({ "select pt_items_id,institution_items_id", "from items_pt_assay", "where pt_items_id = #{itemRelate.ptItemId,jdbcType=INTEGER}", "AND institution_items_id = #{itemRelate.assayItemId,jdbcType=INTEGER}", "AND institution_id = #{assayId,jdbcType=INTEGER}" }) @Results({ @Result(column = "pt_items_id", property = "ptItemId", jdbcType = JdbcType.INTEGER), @Result(column = "institution_items_id", property = "assayItemId", jdbcType = JdbcType.INTEGER) }) ItemRelate existsPtAssay(@Param("itemRelate")ItemRelate itemRelate,@Param("assayId")Integer assayId); /** * 查找item价格关联关系 */ @Select({ "select pt_items_id,hos_items_id,assay_items_id", "from items_buy_price", "where pt_items_id = #{itemRelate.ptItemId,jdbcType=INTEGER}", "AND hos_items_id = #{itemRelate.hosItemId,jdbcType=INTEGER}", "AND assay_items_id = #{itemRelate.assayItemId,jdbcType=INTEGER}" }) @Results({ @Result(column = "pt_items_id", property = "ptItemId", jdbcType = JdbcType.INTEGER), @Result(column = "hos_items_id", property = "hosItemId", jdbcType = JdbcType.INTEGER), @Result(column = "assay_items_id", property = "assayItemId", jdbcType = JdbcType.INTEGER) }) ItemRelate existsBuyPrice(@Param("itemRelate")ItemRelate itemRelate); }
UTF-8
Java
3,745
java
ItemRelateMapper.java
Java
[ { "context": "e.ibatis.type.JdbcType;\n\n/**\n * 项目 关联关系\n * @author lintc\n * @date 2016年10月8日\n */\npublic interface ItemRela", "end": 362, "score": 0.9996472597122192, "start": 357, "tag": "USERNAME", "value": "lintc" } ]
null
[]
package com.ucmed.common.items.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.ucmed.common.items.model.ItemRelate; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.type.JdbcType; /** * 项目 关联关系 * @author lintc * @date 2016年10月8日 */ public interface ItemRelateMapper { /** * 查找 检验机构 项目关联 * @param hosId * @param assayId * @return */ List<ItemRelate> getAssayItemRelate(@Param("hosId")Integer hosId, @Param("assayId")Integer assayId); /** * 查找 医院 项目关联 * @param hosId * @param assayId * @return */ List<ItemRelate> getHosItemRelate(@Param("hosId")Integer hosId, @Param("assayId")Integer assayId); /** * items_pt_hospital 批量添加送检机构项目关联 * @param itemRelates */ void addHosRelateList(@Param("list")List<ItemRelate> itemRelates, @Param("hosId")Integer hosId); /** * items_pt_assay 批量添加检验机构项目关联 * @param itemRelates */ void addAssayRelateList(@Param("list")List<ItemRelate> itemRelates, @Param("assayId")Integer assayId); /** * items_buy_price 批量添加价格管理 * @param itemRelates */ void addPriceRelateList(@Param("list")List<ItemRelate> itemRelates, @Param("institutionRelationId")Integer institutionRelationId, @Param("assayId")Integer assayId, @Param("hosId")Integer hosId); /** * 查找pt_hos关联关系 */ @Select({ "select pt_items_id,h_items_id", "from items_pt_hospital", "where pt_items_id = #{itemRelate.ptItemId,jdbcType=INTEGER}", "AND h_items_id = #{itemRelate.hosItemId,jdbcType=INTEGER}", "AND institution_id = #{hosId,jdbcType=INTEGER}" }) @Results({ @Result(column = "pt_items_id", property = "ptItemId", jdbcType = JdbcType.INTEGER), @Result(column = "h_items_id", property = "hosItemId", jdbcType = JdbcType.INTEGER) }) ItemRelate existsHosPt(@Param("itemRelate")ItemRelate itemRelate,@Param("hosId")Integer hosId); /** * 查找pt_assay关联关系 */ @Select({ "select pt_items_id,institution_items_id", "from items_pt_assay", "where pt_items_id = #{itemRelate.ptItemId,jdbcType=INTEGER}", "AND institution_items_id = #{itemRelate.assayItemId,jdbcType=INTEGER}", "AND institution_id = #{assayId,jdbcType=INTEGER}" }) @Results({ @Result(column = "pt_items_id", property = "ptItemId", jdbcType = JdbcType.INTEGER), @Result(column = "institution_items_id", property = "assayItemId", jdbcType = JdbcType.INTEGER) }) ItemRelate existsPtAssay(@Param("itemRelate")ItemRelate itemRelate,@Param("assayId")Integer assayId); /** * 查找item价格关联关系 */ @Select({ "select pt_items_id,hos_items_id,assay_items_id", "from items_buy_price", "where pt_items_id = #{itemRelate.ptItemId,jdbcType=INTEGER}", "AND hos_items_id = #{itemRelate.hosItemId,jdbcType=INTEGER}", "AND assay_items_id = #{itemRelate.assayItemId,jdbcType=INTEGER}" }) @Results({ @Result(column = "pt_items_id", property = "ptItemId", jdbcType = JdbcType.INTEGER), @Result(column = "hos_items_id", property = "hosItemId", jdbcType = JdbcType.INTEGER), @Result(column = "assay_items_id", property = "assayItemId", jdbcType = JdbcType.INTEGER) }) ItemRelate existsBuyPrice(@Param("itemRelate")ItemRelate itemRelate); }
3,745
0.640647
0.638695
99
35.232323
36.235992
110
false
false
0
0
0
0
0
0
0.848485
false
false
14
9038d2842f51fbfef2f12a882925ba342352e6b5
24,137,716,237,175
90bd287e1c8acffc358ad500efbbe2a50bbfa6cd
/src/com/kirbydee/gamestate/editor/EditorState.java
faedf738bb4d181261e057bb06ac74079fd49beb
[]
no_license
KirbyDee/Kirby-s-Adventure
https://github.com/KirbyDee/Kirby-s-Adventure
a4c37abf5a349d142a06ad4941079061883895b5
4a4ddc6e30b91852099f1ea92e1e3565fde9d7d2
refs/heads/master
2021-08-23T01:58:10.711000
2017-12-02T10:04:45
2017-12-02T10:04:45
112,831,632
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kirbydee.gamestate.editor; import java.awt.Color; import java.awt.Graphics2D; import java.awt.MouseInfo; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import com.kirbydee.background.BackgroundColor; import com.kirbydee.gamestate.GameState; import com.kirbydee.gamestate.GameStateManager; import com.kirbydee.main.GamePanel; import com.kirbydee.utils.Vector2f; public class EditorState extends GameState { // background protected BackgroundColor background; // mouse pointer // private SmartImage mousePointer; private Vector2f mousePosition; // grid private Grid grid; public EditorState(GameStateManager gsm) { super(gsm); } @Override public void create() throws Exception { super.create(); // create background background = new BackgroundColor(Color.BLACK, this); // create mouse position // mousePointer = new SmartImage("/sprites/editor/mouse.png", this); mousePosition = new Vector2f(); // create grid grid = new Grid(GamePanel.WIDTH, GamePanel.HEIGHT); } @Override public void destroy() throws Exception { super.destroy(); // destroy background background.destroy(); background = null; // destroy mouse mousePosition = null; // mousePointer = null; } @Override public void update() throws Exception { // update mouse position updateMousePosition(); // update grid updateGrid(); } @Override public void render(Graphics2D g) throws Exception { // draw background background.render(g); // draw grid grid.render(g); // // draw mouse // int w = mousePointer.getWidth(); // int h = mousePointer.getHeight(); // g.drawImage(mousePointer.getImage(), // (int) (mousePosition.getX() - w / 2), // (int) (mousePosition.getY() - h / 2), // w, // h, // null); } private void updateMousePosition() { mousePosition.set(MouseInfo.getPointerInfo().getLocation()).subLocal(GamePanel.SCREEN_LOCATION); if (mousePosition.getX() < 0) mousePosition.setX(0); if (mousePosition.getX() > GamePanel.WIDTH) mousePosition.setX(GamePanel.WIDTH); if (mousePosition.getY() < 0) mousePosition.setY(0); if (mousePosition.getY() > GamePanel.HEIGHT) mousePosition.setY(GamePanel.HEIGHT); } private void updateGrid() throws Exception { grid.update(); } @Override public void keyPressed(KeyEvent key) { } @Override public void keyReleased(KeyEvent key) { } @Override public void keyTyped(KeyEvent key) { } @Override public void mouseClicked(MouseEvent mouse) { int x=mouse.getX(); int y=mouse.getY(); System.out.println(x+","+y);//these co-ords are relative to the component } @Override public void mousePressed(MouseEvent mouse) { } @Override public void mouseReleased(MouseEvent mouse) { } @Override public void mouseEntered(MouseEvent mouse) { } @Override public void mouseExited(MouseEvent mouse) { } }
UTF-8
Java
2,917
java
EditorState.java
Java
[]
null
[]
package com.kirbydee.gamestate.editor; import java.awt.Color; import java.awt.Graphics2D; import java.awt.MouseInfo; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import com.kirbydee.background.BackgroundColor; import com.kirbydee.gamestate.GameState; import com.kirbydee.gamestate.GameStateManager; import com.kirbydee.main.GamePanel; import com.kirbydee.utils.Vector2f; public class EditorState extends GameState { // background protected BackgroundColor background; // mouse pointer // private SmartImage mousePointer; private Vector2f mousePosition; // grid private Grid grid; public EditorState(GameStateManager gsm) { super(gsm); } @Override public void create() throws Exception { super.create(); // create background background = new BackgroundColor(Color.BLACK, this); // create mouse position // mousePointer = new SmartImage("/sprites/editor/mouse.png", this); mousePosition = new Vector2f(); // create grid grid = new Grid(GamePanel.WIDTH, GamePanel.HEIGHT); } @Override public void destroy() throws Exception { super.destroy(); // destroy background background.destroy(); background = null; // destroy mouse mousePosition = null; // mousePointer = null; } @Override public void update() throws Exception { // update mouse position updateMousePosition(); // update grid updateGrid(); } @Override public void render(Graphics2D g) throws Exception { // draw background background.render(g); // draw grid grid.render(g); // // draw mouse // int w = mousePointer.getWidth(); // int h = mousePointer.getHeight(); // g.drawImage(mousePointer.getImage(), // (int) (mousePosition.getX() - w / 2), // (int) (mousePosition.getY() - h / 2), // w, // h, // null); } private void updateMousePosition() { mousePosition.set(MouseInfo.getPointerInfo().getLocation()).subLocal(GamePanel.SCREEN_LOCATION); if (mousePosition.getX() < 0) mousePosition.setX(0); if (mousePosition.getX() > GamePanel.WIDTH) mousePosition.setX(GamePanel.WIDTH); if (mousePosition.getY() < 0) mousePosition.setY(0); if (mousePosition.getY() > GamePanel.HEIGHT) mousePosition.setY(GamePanel.HEIGHT); } private void updateGrid() throws Exception { grid.update(); } @Override public void keyPressed(KeyEvent key) { } @Override public void keyReleased(KeyEvent key) { } @Override public void keyTyped(KeyEvent key) { } @Override public void mouseClicked(MouseEvent mouse) { int x=mouse.getX(); int y=mouse.getY(); System.out.println(x+","+y);//these co-ords are relative to the component } @Override public void mousePressed(MouseEvent mouse) { } @Override public void mouseReleased(MouseEvent mouse) { } @Override public void mouseEntered(MouseEvent mouse) { } @Override public void mouseExited(MouseEvent mouse) { } }
2,917
0.705519
0.701748
138
20.137682
18.825743
98
false
false
0
0
0
0
0
0
1.702899
false
false
14
8f4f11dc3479442b573d8226ecd565b246b9f380
13,984,413,546,725
5bfc80574883b2af5fd8cf9b78dd60444f1874d8
/src/main/java/ueb09/fz/Bremse.java
cf1070e5c677440484f0c4fc349864f07f529b35
[]
no_license
mila58/oop-uebung09
https://github.com/mila58/oop-uebung09
cde12e985011b7d73cf65100289f804ca9b93d3f
21a59b1ca7e052242d83fc85f724efdffb3550ed
refs/heads/master
2020-05-30T20:53:06.560000
2019-07-08T19:27:29
2019-07-08T19:27:29
189,959,543
0
0
null
true
2019-06-03T07:51:13
2019-06-03T07:51:13
2019-05-29T17:11:17
2019-05-29T17:11:14
77
0
0
0
null
false
false
package ueb09.fz; public interface Bremse { public void bremsen (); public boolean bremsstatus(); }
UTF-8
Java
110
java
Bremse.java
Java
[]
null
[]
package ueb09.fz; public interface Bremse { public void bremsen (); public boolean bremsstatus(); }
110
0.690909
0.672727
7
14.714286
13.187811
33
false
false
0
0
0
0
0
0
0.428571
false
false
14
605177b1026559d3f9dbaf695ad240457935240d
30,176,440,259,215
67db059067078549e6c6215e59add7ee4ccb3cb4
/src/testeJunit/Teste.java
2de00c7732e76a929ad6b8922774c5d50539c7af
[]
no_license
jacksonapdantas/Desafio
https://github.com/jacksonapdantas/Desafio
627e5425890fe6c103e0b28807c27b0185c8a450
f244e623f87e173bd7d36f2da4222ccd4a844ee7
refs/heads/master
2023-03-09T18:17:28.857000
2021-02-21T21:39:30
2021-02-21T21:39:30
340,976,730
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package testeJunit; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import pageClass.SearchPage; import pageClass.SearchPageAccount; public class Teste { private WebDriver driver; private String baseURL; SearchPage searchPage; SearchPageAccount searchPageAccount; @Before public void setUp() throws Exception { driver = new FirefoxDriver(); searchPage = new SearchPage(driver); searchPageAccount = new SearchPageAccount(driver); baseURL = "http://automationpractice.com/"; driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get(baseURL); } @Test public void Comprar2Itens() throws InterruptedException { searchPage.SignIn("datumqatest@soprock.com","datum2021"); searchPage.SearchProduct("Printed Chiffon Dress"); searchPage.ClickProduct("Printed Chiffon Dress"); searchPage.AddToCart(); searchPage.ContinueShopping(); searchPage.SearchProduct("Blouse"); searchPage.ClickProduct("Blouse"); searchPage.AddToCart(); searchPage.ProceedCheckout(); searchPage.SummaryProceedCheckout(); searchPage.AddressProceedCheckout(); searchPage.CheckTermsOfService(); searchPage.ShippingProceedCheckout(); searchPage.payOrder("check"); searchPage.ConfirmOrderPay(); Assert.assertEquals("Your order on My Store is complete.", searchPage.StatusOrder()); } @Test public void ComprarComNovoUsuario() throws InterruptedException { searchPageAccount.CreateAccount("Renato@teste.com.br"); searchPageAccount.SelectGender("Mrs"); searchPageAccount.FillName("Renato", "Martins"); searchPageAccount.FillPassword("12345"); searchPageAccount.SelectBithDate("5", "July", "1989"); searchPageAccount.FillAddress("Rua dos teste, 200", "New York", "New York", "00000", "United States"); searchPageAccount.FillPhoneMobile("11945405450"); searchPageAccount.FillAliasAccount("Teste"); searchPageAccount.RegisterAccount(); searchPage.SearchProduct("Blouse"); searchPage.ClickProduct("Blouse"); searchPage.AddToCart(); searchPage.ProceedCheckout(); searchPage.SummaryProceedCheckout(); searchPage.AddressProceedCheckout(); searchPage.CheckTermsOfService(); searchPage.ShippingProceedCheckout(); searchPage.payOrder("check"); searchPage.ConfirmOrderPay(); Assert.assertEquals("Your order on My Store is complete.", searchPage.StatusOrder()); } @After public void tearDown() throws Exception { driver.quit(); } }
UTF-8
Java
2,633
java
Teste.java
Java
[ { "context": "ws InterruptedException {\n\t\t\n\t\tsearchPage.SignIn(\"datumqatest@soprock.com\",\"datum2021\");\n\t\tsearchPage.SearchProduct(\"Printe", "end": 918, "score": 0.999932587146759, "start": 895, "tag": "EMAIL", "value": "datumqatest@soprock.com" }, { "context": "Exception {\n\t\t\n\t\tsearchPageAccount.CreateAccount(\"Renato@teste.com.br\");\n\t\tsearchPageAccount.SelectGender(\"Mrs\");\n\t\tsea", "end": 1674, "score": 0.9999325275421143, "start": 1655, "tag": "EMAIL", "value": "Renato@teste.com.br" }, { "context": "electGender(\"Mrs\");\n\t\tsearchPageAccount.FillName(\"Renato\", \"Martins\");\n\t\tsearchPageAccount.FillPassword(\"1", "end": 1755, "score": 0.9998421669006348, "start": 1749, "tag": "NAME", "value": "Renato" }, { "context": "r(\"Mrs\");\n\t\tsearchPageAccount.FillName(\"Renato\", \"Martins\");\n\t\tsearchPageAccount.FillPassword(\"12345\");\n\t\ts", "end": 1766, "score": 0.9997131824493408, "start": 1759, "tag": "NAME", "value": "Martins" } ]
null
[]
package testeJunit; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import pageClass.SearchPage; import pageClass.SearchPageAccount; public class Teste { private WebDriver driver; private String baseURL; SearchPage searchPage; SearchPageAccount searchPageAccount; @Before public void setUp() throws Exception { driver = new FirefoxDriver(); searchPage = new SearchPage(driver); searchPageAccount = new SearchPageAccount(driver); baseURL = "http://automationpractice.com/"; driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get(baseURL); } @Test public void Comprar2Itens() throws InterruptedException { searchPage.SignIn("<EMAIL>","datum2021"); searchPage.SearchProduct("Printed Chiffon Dress"); searchPage.ClickProduct("Printed Chiffon Dress"); searchPage.AddToCart(); searchPage.ContinueShopping(); searchPage.SearchProduct("Blouse"); searchPage.ClickProduct("Blouse"); searchPage.AddToCart(); searchPage.ProceedCheckout(); searchPage.SummaryProceedCheckout(); searchPage.AddressProceedCheckout(); searchPage.CheckTermsOfService(); searchPage.ShippingProceedCheckout(); searchPage.payOrder("check"); searchPage.ConfirmOrderPay(); Assert.assertEquals("Your order on My Store is complete.", searchPage.StatusOrder()); } @Test public void ComprarComNovoUsuario() throws InterruptedException { searchPageAccount.CreateAccount("<EMAIL>"); searchPageAccount.SelectGender("Mrs"); searchPageAccount.FillName("Renato", "Martins"); searchPageAccount.FillPassword("12345"); searchPageAccount.SelectBithDate("5", "July", "1989"); searchPageAccount.FillAddress("Rua dos teste, 200", "New York", "New York", "00000", "United States"); searchPageAccount.FillPhoneMobile("11945405450"); searchPageAccount.FillAliasAccount("Teste"); searchPageAccount.RegisterAccount(); searchPage.SearchProduct("Blouse"); searchPage.ClickProduct("Blouse"); searchPage.AddToCart(); searchPage.ProceedCheckout(); searchPage.SummaryProceedCheckout(); searchPage.AddressProceedCheckout(); searchPage.CheckTermsOfService(); searchPage.ShippingProceedCheckout(); searchPage.payOrder("check"); searchPage.ConfirmOrderPay(); Assert.assertEquals("Your order on My Store is complete.", searchPage.StatusOrder()); } @After public void tearDown() throws Exception { driver.quit(); } }
2,605
0.767565
0.753893
85
29.976471
21.79907
104
false
false
0
0
0
0
0
0
2.176471
false
false
14
7f2922b209a79072c167057df422d6a67c2584e8
28,406,913,727,207
35aae6f3b462fdd13b4bc859fe04ac2940cf4e2b
/app/src/main/java/com/practica/ismael/examen_ismaelraqi_pspro/data/model/WeatherInfo.java
47b5e07c1287c8e686e2a85ce6782f964a7847ec
[]
no_license
IsmaelRP/Examen_IsmaelRaqi_PSPRO
https://github.com/IsmaelRP/Examen_IsmaelRaqi_PSPRO
835b1689e138948cfe58254aaa25aaf30c087004
e488dd8f27a0083aa6b9e23a1b0ca6b2eaaf5dbc
refs/heads/master
2020-04-27T00:32:29.635000
2019-03-05T15:20:57
2019-03-05T15:20:57
173,937,012
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.practica.ismael.examen_ismaelraqi_pspro.data.model; import java.util.Calendar; public class WeatherInfo { private String name; private String description; private double averageTemp; private double maxTemp; private double minTemp; private double humidity; private String rain; private double windSpeed; private double windDirection; private int clouds; private String imgWeather; private String dawn; private String sunset; private String country; public WeatherInfo(String name, String description, double averageTemp, double maxTemp, double minTemp, String rain, double humidity, double windSpeed, double windDirection, int clouds, String imgWeather, String dawn, String sunset, String country) { this.name = name; this.description = description; this.averageTemp = averageTemp; this.maxTemp = maxTemp; this.minTemp = minTemp; this.rain = rain; this.humidity = humidity; this.windSpeed = windSpeed; this.windDirection = windDirection; this.clouds = clouds; this.imgWeather = imgWeather; this.dawn = dawn; this.sunset = sunset; this.country = country; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getAverageTemp() { return averageTemp; } public void setAverageTemp(double averageTemp) { this.averageTemp = averageTemp; } public double getMaxTemp() { return maxTemp; } public void setMaxTemp(double maxTemp) { this.maxTemp = maxTemp; } public double getMinTemp() { return minTemp; } public void setMinTemp(double minTemp) { this.minTemp = minTemp; } public double getHumidity() { return humidity; } public void setHumidity(double humidity) { this.humidity = humidity; } public double getWindSpeed() { return windSpeed; } public void setWindSpeed(double windSpeed) { this.windSpeed = windSpeed; } public double getWindDirection() { return windDirection; } public void setWindDirection(double windDirection) { this.windDirection = windDirection; } public int getClouds() { return clouds; } public void setClouds(int clouds) { this.clouds = clouds; } public String getImgWeather() { return imgWeather; } public void setImgWeather(String imgWeather) { this.imgWeather = imgWeather; } public String getDawn() { return dawn; } public void setDawn(String dawn) { this.dawn = dawn; } public String getSunset() { return sunset; } public void setSunset(String sunset) { this.sunset = sunset; } public String getRain() { return rain; } public void setRain(String rain) { this.rain = rain; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } }
UTF-8
Java
3,369
java
WeatherInfo.java
Java
[]
null
[]
package com.practica.ismael.examen_ismaelraqi_pspro.data.model; import java.util.Calendar; public class WeatherInfo { private String name; private String description; private double averageTemp; private double maxTemp; private double minTemp; private double humidity; private String rain; private double windSpeed; private double windDirection; private int clouds; private String imgWeather; private String dawn; private String sunset; private String country; public WeatherInfo(String name, String description, double averageTemp, double maxTemp, double minTemp, String rain, double humidity, double windSpeed, double windDirection, int clouds, String imgWeather, String dawn, String sunset, String country) { this.name = name; this.description = description; this.averageTemp = averageTemp; this.maxTemp = maxTemp; this.minTemp = minTemp; this.rain = rain; this.humidity = humidity; this.windSpeed = windSpeed; this.windDirection = windDirection; this.clouds = clouds; this.imgWeather = imgWeather; this.dawn = dawn; this.sunset = sunset; this.country = country; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public double getAverageTemp() { return averageTemp; } public void setAverageTemp(double averageTemp) { this.averageTemp = averageTemp; } public double getMaxTemp() { return maxTemp; } public void setMaxTemp(double maxTemp) { this.maxTemp = maxTemp; } public double getMinTemp() { return minTemp; } public void setMinTemp(double minTemp) { this.minTemp = minTemp; } public double getHumidity() { return humidity; } public void setHumidity(double humidity) { this.humidity = humidity; } public double getWindSpeed() { return windSpeed; } public void setWindSpeed(double windSpeed) { this.windSpeed = windSpeed; } public double getWindDirection() { return windDirection; } public void setWindDirection(double windDirection) { this.windDirection = windDirection; } public int getClouds() { return clouds; } public void setClouds(int clouds) { this.clouds = clouds; } public String getImgWeather() { return imgWeather; } public void setImgWeather(String imgWeather) { this.imgWeather = imgWeather; } public String getDawn() { return dawn; } public void setDawn(String dawn) { this.dawn = dawn; } public String getSunset() { return sunset; } public void setSunset(String sunset) { this.sunset = sunset; } public String getRain() { return rain; } public void setRain(String rain) { this.rain = rain; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } }
3,369
0.626595
0.626595
150
21.459999
25.011099
254
false
false
0
0
0
0
0
0
0.473333
false
false
14
3386e290cf6fd6c138ac583d5ef18e71ef5028d3
18,957,985,645,183
46842001a34ed7148bf5213aef87983110511740
/src/aplicação/Programa.java
7bb556c3c85b20a5c90d38d960d6775925d32444
[]
no_license
ClaudiomarSantos/AreasDeRetangulos-Circulos
https://github.com/ClaudiomarSantos/AreasDeRetangulos-Circulos
0aebed2d9bb8dcf7c51342ab76c6028dc68e8018
487286a354eb8a3f430503a242c6d00dc4d76d0a
refs/heads/master
2021-04-18T07:17:09.134000
2020-03-23T18:47:50
2020-03-23T18:47:50
249,516,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aplicação; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Scanner; import entidades.Circulo; import entidades.Figuras; import entidades.Retangulo; public class Programa { public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner sc = new Scanner(System.in); List<Figuras> fig = new ArrayList<>(); System.out.println("Digite quantas formas deseja calcular a Área: "); int quant = sc.nextInt(); for (int i = 0; i < quant; i++) { System.out.println("dados da forma " + (i + 1) + ": "); System.out.println("Retangulo ou Circulo? (r - Retengulo, c - Circulo)"); char resp = sc.next().charAt(0); switch (resp) { case 'r': System.out.println("digite a cor: (BLACK,BLUE,RED)"); sc.nextLine(); String cor = sc.nextLine(); System.out.println("Altura: "); double autura = sc.nextDouble(); System.out.println("Base: "); double base = sc.nextDouble(); Figuras figura = new Retangulo(entidades.Enum.Color.valueOf(cor), autura, base); fig.add(figura); break; case 'c': System.out.println("digite a cor: (BLACK,BLUE,RED)"); sc.nextLine(); cor = sc.nextLine(); System.out.println("Raio: "); double raio = sc.nextDouble(); figura = new Circulo(entidades.Enum.Color.valueOf(cor), raio); fig.add(figura); } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < fig.size(); i++) { sb.append(String.format("%.2f%n", fig.get(i).areas())); } System.out.printf("Areas das Figuras: \n" + sb.toString()); sc.close(); } }
ISO-8859-1
Java
1,606
java
Programa.java
Java
[]
null
[]
package aplicação; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Scanner; import entidades.Circulo; import entidades.Figuras; import entidades.Retangulo; public class Programa { public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner sc = new Scanner(System.in); List<Figuras> fig = new ArrayList<>(); System.out.println("Digite quantas formas deseja calcular a Área: "); int quant = sc.nextInt(); for (int i = 0; i < quant; i++) { System.out.println("dados da forma " + (i + 1) + ": "); System.out.println("Retangulo ou Circulo? (r - Retengulo, c - Circulo)"); char resp = sc.next().charAt(0); switch (resp) { case 'r': System.out.println("digite a cor: (BLACK,BLUE,RED)"); sc.nextLine(); String cor = sc.nextLine(); System.out.println("Altura: "); double autura = sc.nextDouble(); System.out.println("Base: "); double base = sc.nextDouble(); Figuras figura = new Retangulo(entidades.Enum.Color.valueOf(cor), autura, base); fig.add(figura); break; case 'c': System.out.println("digite a cor: (BLACK,BLUE,RED)"); sc.nextLine(); cor = sc.nextLine(); System.out.println("Raio: "); double raio = sc.nextDouble(); figura = new Circulo(entidades.Enum.Color.valueOf(cor), raio); fig.add(figura); } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < fig.size(); i++) { sb.append(String.format("%.2f%n", fig.get(i).areas())); } System.out.printf("Areas das Figuras: \n" + sb.toString()); sc.close(); } }
1,606
0.642545
0.639426
57
27.122807
21.172699
84
false
false
0
0
0
0
0
0
2.947368
false
false
14
268207be40795d5ecd6017cd62ec4098a0b340ee
24,266,565,269,550
39a130f5b577a86751d888f017f994ed9d811954
/Codecademy - Learn Java/06. Conditionals and Control Flow/04. Boolean Operators: !/Not.java
d7cbc37e4fe9d978a41ffad51712996499eb0e0a
[]
no_license
Keven94/Java
https://github.com/Keven94/Java
a5e3909bc2eca326e5413e1abdd07f5bad7c8ed6
cf2212201e884df794d2dca6a966f3ff2b88bf24
refs/heads/master
2020-05-26T18:11:42.038000
2019-06-24T07:36:32
2019-06-24T07:36:32
188,330,815
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* 1. Use the ! operator to return a value of true for the code on line 10. 2. Use the ! operator to return a value of false for the code on line 11. */ public class Not { public static void main(String[] args) { System.out.println(!false); System.out.println( !(5>=1) ); } }
UTF-8
Java
288
java
Not.java
Java
[]
null
[]
/* 1. Use the ! operator to return a value of true for the code on line 10. 2. Use the ! operator to return a value of false for the code on line 11. */ public class Not { public static void main(String[] args) { System.out.println(!false); System.out.println( !(5>=1) ); } }
288
0.659722
0.631944
14
19.571428
25.407295
73
false
false
0
0
0
0
0
0
0.714286
false
false
14
a3f1a7e84d29726de94cef28d5e1844b833c5620
38,628,935,865,399
63c8ca2a5f44e37d6a9af40587ea5e9cb053dbe4
/src/main/java/ca/anygroup/timeportal/dao/AuthDAO.java
2c2e05ecd08d7ea1b19df50fa2533d53dda0cd2d
[]
no_license
sahilde3p/TimePortal
https://github.com/sahilde3p/TimePortal
5cc07fbce40f50fa80dd98cf115fde4c806adfb3
4607669af8237e081c14f381095b082d05347b80
refs/heads/master
2022-12-23T03:59:44.672000
2019-07-01T22:43:09
2019-07-01T22:43:09
190,960,637
0
0
null
false
2022-12-15T23:48:26
2019-06-09T03:40:03
2019-07-01T22:43:25
2022-12-15T23:48:25
41
0
0
5
Java
false
false
package ca.anygroup.timeportal.dao; import org.springframework.data.jpa.repository.JpaRepository; import ca.anygroup.timeportal.entity.Auth; public interface AuthDAO extends JpaRepository<Auth, String> { }
UTF-8
Java
210
java
AuthDAO.java
Java
[]
null
[]
package ca.anygroup.timeportal.dao; import org.springframework.data.jpa.repository.JpaRepository; import ca.anygroup.timeportal.entity.Auth; public interface AuthDAO extends JpaRepository<Auth, String> { }
210
0.819048
0.819048
9
22.333334
25.96151
62
false
false
0
0
0
0
0
0
0.444444
false
false
14
61bda3507a698f9639502d3c068c8521fb585037
35,794,257,465,490
c41aa4d42144f58d54fa0dc6d2fbedb072066a34
/src/main/java/ion/fmt/IonLineIndentProvider.java
bc388af2c0ad48a1961fd7a50676a625a5b25047
[]
no_license
nd/ion-plugin
https://github.com/nd/ion-plugin
e2c9737d8d6027308343cc4deb867ddbdcfdba20
9be8124482262d7f3041c01e4ae8908244a8f2e3
refs/heads/master
2020-08-12T13:47:29.251000
2020-03-01T12:49:32
2020-03-01T12:49:32
214,778,338
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ion.fmt; import com.intellij.lang.Language; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.TokenType; import com.intellij.psi.impl.source.codeStyle.SemanticEditorPosition; import com.intellij.psi.impl.source.codeStyle.lineIndent.JavaLikeLangLineIndentProvider; import com.intellij.psi.tree.IElementType; import ion.IonLanguage; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.HashMap; import static com.intellij.psi.impl.source.codeStyle.lineIndent.JavaLikeLangLineIndentProvider.JavaLikeElement.*; import static ion.psi.IonToken.*; public class IonLineIndentProvider extends JavaLikeLangLineIndentProvider { private final static HashMap<IElementType, SemanticEditorPosition.SyntaxElement> SYNTAX_MAP = new HashMap<IElementType, SemanticEditorPosition.SyntaxElement>() { { put(TokenType.WHITE_SPACE, Whitespace); put(SEMICOLON, Semicolon); put(LBRACE, BlockOpeningBrace); put(RBRACE, BlockClosingBrace); put(LBRACKET, ArrayOpeningBracket); put(RBRACKET, ArrayClosingBracket); put(RPAREN, RightParenthesis); put(LPAREN, LeftParenthesis); put(COLON, Colon); put(CASE, SwitchCase); put(DEFAULT, SwitchDefault); put(IF, IfKeyword); put(ELSE, ElseKeyword); put(FOR, ForKeyword); put(COMMA, Comma); put(BLOCK_COMMENT, BlockComment); put(LINE_COMMENT, LineComment); } }; @Nullable @Override protected SemanticEditorPosition.SyntaxElement mapType(@NotNull IElementType tokenType) { return SYNTAX_MAP.get(tokenType); } @Override public boolean isSuitableForLanguage(@NotNull Language language) { return language == IonLanguage.INSTANCE; } }
UTF-8
Java
1,971
java
IonLineIndentProvider.java
Java
[]
null
[]
package ion.fmt; import com.intellij.lang.Language; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.TokenType; import com.intellij.psi.impl.source.codeStyle.SemanticEditorPosition; import com.intellij.psi.impl.source.codeStyle.lineIndent.JavaLikeLangLineIndentProvider; import com.intellij.psi.tree.IElementType; import ion.IonLanguage; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.HashMap; import static com.intellij.psi.impl.source.codeStyle.lineIndent.JavaLikeLangLineIndentProvider.JavaLikeElement.*; import static ion.psi.IonToken.*; public class IonLineIndentProvider extends JavaLikeLangLineIndentProvider { private final static HashMap<IElementType, SemanticEditorPosition.SyntaxElement> SYNTAX_MAP = new HashMap<IElementType, SemanticEditorPosition.SyntaxElement>() { { put(TokenType.WHITE_SPACE, Whitespace); put(SEMICOLON, Semicolon); put(LBRACE, BlockOpeningBrace); put(RBRACE, BlockClosingBrace); put(LBRACKET, ArrayOpeningBracket); put(RBRACKET, ArrayClosingBracket); put(RPAREN, RightParenthesis); put(LPAREN, LeftParenthesis); put(COLON, Colon); put(CASE, SwitchCase); put(DEFAULT, SwitchDefault); put(IF, IfKeyword); put(ELSE, ElseKeyword); put(FOR, ForKeyword); put(COMMA, Comma); put(BLOCK_COMMENT, BlockComment); put(LINE_COMMENT, LineComment); } }; @Nullable @Override protected SemanticEditorPosition.SyntaxElement mapType(@NotNull IElementType tokenType) { return SYNTAX_MAP.get(tokenType); } @Override public boolean isSuitableForLanguage(@NotNull Language language) { return language == IonLanguage.INSTANCE; } }
1,971
0.694064
0.694064
53
36.188679
26.531616
113
false
false
0
0
0
0
0
0
1
false
false
14
8bf535fe36588f920b45c9ef564d1f5fe6d33258
31,078,383,394,518
3d478a54ff3306f32df47c804523a755681dee5f
/src/controllers/KatagoriController.java
2b6d28c00dfebfb34673e22a4c6a92db7f57aeb3
[ "Apache-2.0" ]
permissive
FXLJA/retail
https://github.com/FXLJA/retail
6992e35c513891f5215da6d6c1c366015ec9e8b7
7f8e79f910f5c1e06dfc9cf1e0e8388a6805bd6c
refs/heads/master
2022-12-23T16:43:07.938000
2020-09-28T17:51:30
2020-09-28T17:51:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controllers; import java.util.List; import java.util.Observable; import daos.KatagoriDAO; import models.Katagori; import interfaces.KatagoriInterface; import models.OperasiCRUD; public class KatagoriController extends Observable{ private KatagoriInterface dao = new KatagoriDAO(); private OperasiCRUD crud; public void setDAO(KatagoriInterface katagori){ dao = katagori; } public void setDml(Katagori katagori, OperasiCRUD c){ boolean hasil = false; this.crud = c; switch(c){ case INSERT: hasil = dao.insert(katagori); break; case UPDATE: hasil = dao.update(katagori); break; case DELETE: hasil = dao.delete(katagori); break; } setChanged(); if(hasil){ notifyObservers(katagori); }else{ notifyObservers(); } } public OperasiCRUD getCrudState(){ return crud; } public List<Katagori> getAllKatagori(){ return dao.getAllKatagori(); } public Katagori getByID_Katagori(String ID_Katagori){ return dao.getByID_Katagori(ID_Katagori); } }
UTF-8
Java
1,234
java
KatagoriController.java
Java
[]
null
[]
package controllers; import java.util.List; import java.util.Observable; import daos.KatagoriDAO; import models.Katagori; import interfaces.KatagoriInterface; import models.OperasiCRUD; public class KatagoriController extends Observable{ private KatagoriInterface dao = new KatagoriDAO(); private OperasiCRUD crud; public void setDAO(KatagoriInterface katagori){ dao = katagori; } public void setDml(Katagori katagori, OperasiCRUD c){ boolean hasil = false; this.crud = c; switch(c){ case INSERT: hasil = dao.insert(katagori); break; case UPDATE: hasil = dao.update(katagori); break; case DELETE: hasil = dao.delete(katagori); break; } setChanged(); if(hasil){ notifyObservers(katagori); }else{ notifyObservers(); } } public OperasiCRUD getCrudState(){ return crud; } public List<Katagori> getAllKatagori(){ return dao.getAllKatagori(); } public Katagori getByID_Katagori(String ID_Katagori){ return dao.getByID_Katagori(ID_Katagori); } }
1,234
0.598055
0.598055
49
24.183674
17.780605
57
false
false
0
0
0
0
0
0
0.510204
false
false
14
0105312cc8f4bec710cbbb16932487878f872c99
19,550,691,173,926
d55af3872a4b2d0e6ccaa91f1ea2e5a0cdc70588
/AustralianCricket/src/australiancricket/Tax.java
620761dd60752fca28ac596e269252a825e40764
[]
no_license
tqninh/java-programming-i
https://github.com/tqninh/java-programming-i
90318b70029e0555855d91e46ee3393bee8adf87
bbf1bda8a3f5f9f8666b8e8124f141f866d4a5e6
refs/heads/master
2021-01-10T02:45:41.620000
2013-05-31T10:35:54
2013-05-31T10:35:54
44,112,531
0
1
null
false
2017-10-27T01:57:12
2015-10-12T14:28:46
2015-10-12T14:29:30
2015-10-12T14:31:18
364
0
1
1
Java
false
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package australiancricket; /** * * @author TQNINH */ public interface Tax { public static final double TAX_PERCENT = 25; public abstract double calculateTax(); }
UTF-8
Java
288
java
Tax.java
Java
[ { "context": "\npackage australiancricket;\r\n\r\n/**\r\n *\r\n * @author TQNINH\r\n */\r\npublic interface Tax {\r\n public static f", "end": 160, "score": 0.9978287816047668, "start": 154, "tag": "USERNAME", "value": "TQNINH" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package australiancricket; /** * * @author TQNINH */ public interface Tax { public static final double TAX_PERCENT = 25; public abstract double calculateTax(); }
288
0.659722
0.652778
14
18.571428
18.80241
52
false
false
0
0
0
0
0
0
0.357143
false
false
14
8dda2d866591559f1d1822a2e346ea9564df209a
31,928,786,918,799
50fc41f0e3bc59d203e0cca550a0a0456ac9ec16
/test/src/com/jsheng/playground/crackingCodingInterview/Cards/BlackJackCard.java
cf76c20ad100e74b91426438a46691453553de67
[]
no_license
JSheng84/codingPractice
https://github.com/JSheng84/codingPractice
529010cd1e0dc0d99842887d38eae7b250879ca1
6f96b648a104de7f69a7576c8b6eccb53d32ca56
refs/heads/develop
2021-01-10T16:27:32.278000
2015-11-10T08:55:23
2015-11-10T08:55:23
45,885,874
0
0
null
false
2015-11-10T08:57:20
2015-11-10T03:51:08
2015-11-10T03:54:11
2015-11-10T08:57:20
0
0
0
0
Java
null
null
package com.jsheng.playground.crackingCodingInterview.Cards; public class BlackJackCard extends AbstractCard { public BlackJackCard(int c, Suit s) { super(c, s); } @Override public int getValue() { if (isAce()) { // Ace return 1; } else if (value >= 11 && value <= 13) { // Face card return 10; } else { // Number card return value; } } public int minValue() { if (isAce()) { // Ace return 1; } else { return getValue(); } } public int maxValue() { if (isAce()) { // Ace return 11; } else { return getValue(); } } public boolean isAce() { return value == 1; } public boolean isFaceCard() { return value >= 11 && value <= 13; } }
UTF-8
Java
874
java
BlackJackCard.java
Java
[]
null
[]
package com.jsheng.playground.crackingCodingInterview.Cards; public class BlackJackCard extends AbstractCard { public BlackJackCard(int c, Suit s) { super(c, s); } @Override public int getValue() { if (isAce()) { // Ace return 1; } else if (value >= 11 && value <= 13) { // Face card return 10; } else { // Number card return value; } } public int minValue() { if (isAce()) { // Ace return 1; } else { return getValue(); } } public int maxValue() { if (isAce()) { // Ace return 11; } else { return getValue(); } } public boolean isAce() { return value == 1; } public boolean isFaceCard() { return value >= 11 && value <= 13; } }
874
0.47254
0.455378
42
19.833334
15.898363
61
false
false
0
0
0
0
0
0
0.309524
false
false
14
aa052195c6000a16992268010c3b3ab4ba7c033b
19,164,144,129,496
6edf8a7cea4041cc9864d0082dc83e0dfcb1d4f8
/friday.java
21affbd7b1bff683b5eb759ec71d9f6215f96395
[]
no_license
PedroContipelli/Kattis
https://github.com/PedroContipelli/Kattis
75cdaaeae1d7d0aa2ceba1c53f56e1008e77b9c2
a6033d7644c885338e0375779e9f4a163935ed49
refs/heads/master
2022-02-19T09:43:09.479000
2022-02-05T11:24:53
2022-02-05T11:24:53
70,404,284
30
36
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class friday { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testcases = scan.nextInt(); for (int zaxby = 0; zaxby < testcases; zaxby++) { int months = scan.nextInt(); int[] nums = new int[months]; int lucky = 0; int day = 0; for (int i = 0; i < months; i++) nums[i] = scan.nextInt(); // 1 2 3 4 5 |6| 7 for (int i = 0; i < months; i++) for (int j = 1; j <= nums[i]; j++) { day++; if (j == 13 && (day % 7) == 6) lucky++; } System.out.println(lucky); } scan.close(); } }
UTF-8
Java
704
java
friday.java
Java
[]
null
[]
import java.util.Scanner; public class friday { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testcases = scan.nextInt(); for (int zaxby = 0; zaxby < testcases; zaxby++) { int months = scan.nextInt(); int[] nums = new int[months]; int lucky = 0; int day = 0; for (int i = 0; i < months; i++) nums[i] = scan.nextInt(); // 1 2 3 4 5 |6| 7 for (int i = 0; i < months; i++) for (int j = 1; j <= nums[i]; j++) { day++; if (j == 13 && (day % 7) == 6) lucky++; } System.out.println(lucky); } scan.close(); } }
704
0.460227
0.43608
34
19.735294
14.412635
47
false
false
0
0
0
0
0
0
0.647059
false
false
14
977c2b60e9b244bc10190ef86147526503d96b63
24,661,702,263,537
faac59078876ba368e8f8808f9bf0d4a648991e9
/src/com/rushdevo/gitdroid/ui/fragments/GitDroidFragment.java
87217964901cbefc1e379e90f6c966703b48887f
[]
no_license
wang663632304/GitDroid
https://github.com/wang663632304/GitDroid
52d5e9126a8c653b00d1a034aa67c884a8e834b1
84574fffb482010a92ecc66b1814ad8b7abb83d1
refs/heads/master
2021-01-16T17:52:42.776000
2012-06-29T19:29:22
2012-06-29T19:29:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rushdevo.gitdroid.ui.fragments; import com.rushdevo.gitdroid.listeners.ObjectSelectedListener; public interface GitDroidFragment { /** * Called by the surrounding parent activity's onRetainCustomNonConfigurationInstance() * @return The object that this fragment would like to retain during config change */ public abstract Object onRetainCustomNonConfigurationInstance(); public abstract ObjectSelectedListener getObjectSelectedListener(); public abstract void setObjectSelectedListener(ObjectSelectedListener listener); }
UTF-8
Java
551
java
GitDroidFragment.java
Java
[]
null
[]
package com.rushdevo.gitdroid.ui.fragments; import com.rushdevo.gitdroid.listeners.ObjectSelectedListener; public interface GitDroidFragment { /** * Called by the surrounding parent activity's onRetainCustomNonConfigurationInstance() * @return The object that this fragment would like to retain during config change */ public abstract Object onRetainCustomNonConfigurationInstance(); public abstract ObjectSelectedListener getObjectSelectedListener(); public abstract void setObjectSelectedListener(ObjectSelectedListener listener); }
551
0.829401
0.829401
15
35.733334
34.489548
88
false
false
0
0
0
0
0
0
0.933333
false
false
14
9128bce26f19d72ded3b4655543bb3617499a3d0
22,823,456,260,670
7a32951c7bbbe2866c1d554448f1289300a399fd
/app/src/main/java/com/example/incir/myapplication/P003GetGithubPublicGists.java
ffc75321845be52034c7c72f808ebe95ff09f03a
[]
no_license
githubmet/sademimarisketch
https://github.com/githubmet/sademimarisketch
763726e101f0c4afec39cd8f8db05c66a7b99198
3185543c13a3a8e2c8c5dc992a2bb36f6fec6333
refs/heads/master
2021-01-10T11:27:49.056000
2019-03-22T10:16:51
2019-03-22T10:16:51
49,754,347
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.incir.myapplication; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.LinearLayoutManager; import com.example.incir.myapplication.adapter.GithubPublicGistsRecyclerAdapter; import com.example.incir.myapplication.model.GithubPublicGistsStrong; import com.example.incir.myapplication.omurgaBackbone.MainActivity; import java.util.List; import retrofit.Call; import retrofit.Callback; import retrofit.Response; import retrofit.Retrofit; public class P003GetGithubPublicGists extends MainActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.p003getgithubpublicgists); final RecyclerView recyclerViewPublicGistsP003=(RecyclerView)findViewById(R.id.recyclerViewPublicGistsP003); recyclerViewPublicGistsP003.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); Call<List<GithubPublicGistsStrong>> githubPublicGistsStrongCall=getNetwork().getGithubPublicGists(); githubPublicGistsStrongCall.enqueue(new Callback<List<GithubPublicGistsStrong>>() { @Override public void onResponse(Response<List<GithubPublicGistsStrong>> response, Retrofit retrofit) { RecyclerView.Adapter adapter=new GithubPublicGistsRecyclerAdapter(P003GetGithubPublicGists.this,response.body()); recyclerViewPublicGistsP003.setAdapter(adapter); } @Override public void onFailure(Throwable throwable) { } }); } }
UTF-8
Java
1,651
java
P003GetGithubPublicGists.java
Java
[]
null
[]
package com.example.incir.myapplication; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.LinearLayoutManager; import com.example.incir.myapplication.adapter.GithubPublicGistsRecyclerAdapter; import com.example.incir.myapplication.model.GithubPublicGistsStrong; import com.example.incir.myapplication.omurgaBackbone.MainActivity; import java.util.List; import retrofit.Call; import retrofit.Callback; import retrofit.Response; import retrofit.Retrofit; public class P003GetGithubPublicGists extends MainActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.p003getgithubpublicgists); final RecyclerView recyclerViewPublicGistsP003=(RecyclerView)findViewById(R.id.recyclerViewPublicGistsP003); recyclerViewPublicGistsP003.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); Call<List<GithubPublicGistsStrong>> githubPublicGistsStrongCall=getNetwork().getGithubPublicGists(); githubPublicGistsStrongCall.enqueue(new Callback<List<GithubPublicGistsStrong>>() { @Override public void onResponse(Response<List<GithubPublicGistsStrong>> response, Retrofit retrofit) { RecyclerView.Adapter adapter=new GithubPublicGistsRecyclerAdapter(P003GetGithubPublicGists.this,response.body()); recyclerViewPublicGistsP003.setAdapter(adapter); } @Override public void onFailure(Throwable throwable) { } }); } }
1,651
0.762568
0.748637
48
33.395832
37.774406
129
false
false
0
0
0
0
0
0
0.5
false
false
14
83c82811bcdaa992367a8702eb206315c3c96fb3
19,310,173,031,321
89079a4915b6cecd3c7bc933718bf138bae6b1a9
/src/main/crossover/OrderCrossover.java
e25cc53f7b552194f292d3deacc5d454de78dac6
[]
no_license
Supporterino/TSP_SE1
https://github.com/Supporterino/TSP_SE1
8383f0bb3241716d87cd15e6ebb4683c1fc0a768
01ebaf958c38e07ad3522c4508df7944d829e0a6
refs/heads/master
2020-04-15T11:42:03.928000
2019-03-16T12:22:17
2019-03-16T12:22:17
164,641,075
5
9
null
false
2019-03-11T10:25:32
2019-01-08T12:10:03
2019-03-10T17:12:16
2019-03-11T10:25:32
41,802
4
7
0
Java
false
null
package crossover; import base.City; import base.Tour; import random.MersenneTwisterFast; import java.util.ArrayList; import java.util.Arrays; // OX1 public class OrderCrossover extends crossover.Crossover { random.MersenneTwisterFast random = new MersenneTwisterFast(); public ArrayList<Tour> doCrossover(Tour tour01, Tour tour02) { base.City[] parent1 = (base.City[]) tour01.getCities().toArray(); base.City[] parent2 = (base.City[]) tour02.getCities().toArray(); base.City[] child1 = new City[280]; base.City[] child2 = new City[280]; ArrayList<base.City> ordered1 = new ArrayList<>(); ArrayList<base.City> ordered2 = new ArrayList<>(); //Grenzen Erzeugen int firstCut = random.nextInt(0, 277);//cut nach eins bis vorletzte stelle int secondCut = random.nextInt(firstCut + 1, 278);//cut nach erstem und vor letzter stelle //sortiert die Parents um, beginnend nach secondCut for(int x = secondCut + 1; x != secondCut; x++){ if(x >= 280) x = 0; ordered1.add(parent2[x]); ordered2.add(parent1[x]); } //fuegt die Gene an stelle secondCut ein ordered1.add(parent2[secondCut]); ordered2.add(parent1[secondCut]); //Mittleren Teil uebertragen und ordered bereinigen for(int x = firstCut+1; x <= secondCut; x++){ //uebertraegt von parent an child child1[x] = parent1[x]; child2[x] = parent2[x]; //entfernt die bereits im child vorhandenen Gene ordered1.remove(child1[x]); ordered2.remove(child2[x]); } //Uebertraegt geordneten rest in childs for(int x = secondCut + 1; x != firstCut + 1; x++){ if(x >= 280) x = 0; child1[x] = ordered1.remove(0); child2[x] = ordered2.remove(0); } //erstellt das array fuer die Rueckgabe ArrayList<Tour> childList = new ArrayList<>(); //child1 ArrayList<City> genList = new ArrayList<>(Arrays.asList(child1)); Tour tour = new Tour(); tour.setCities(genList); childList.add(tour); //child2 genList = new ArrayList<>(Arrays.asList(child2)); tour = new Tour(); tour.setCities(genList); childList.add(tour); return childList; } }
UTF-8
Java
2,393
java
OrderCrossover.java
Java
[]
null
[]
package crossover; import base.City; import base.Tour; import random.MersenneTwisterFast; import java.util.ArrayList; import java.util.Arrays; // OX1 public class OrderCrossover extends crossover.Crossover { random.MersenneTwisterFast random = new MersenneTwisterFast(); public ArrayList<Tour> doCrossover(Tour tour01, Tour tour02) { base.City[] parent1 = (base.City[]) tour01.getCities().toArray(); base.City[] parent2 = (base.City[]) tour02.getCities().toArray(); base.City[] child1 = new City[280]; base.City[] child2 = new City[280]; ArrayList<base.City> ordered1 = new ArrayList<>(); ArrayList<base.City> ordered2 = new ArrayList<>(); //Grenzen Erzeugen int firstCut = random.nextInt(0, 277);//cut nach eins bis vorletzte stelle int secondCut = random.nextInt(firstCut + 1, 278);//cut nach erstem und vor letzter stelle //sortiert die Parents um, beginnend nach secondCut for(int x = secondCut + 1; x != secondCut; x++){ if(x >= 280) x = 0; ordered1.add(parent2[x]); ordered2.add(parent1[x]); } //fuegt die Gene an stelle secondCut ein ordered1.add(parent2[secondCut]); ordered2.add(parent1[secondCut]); //Mittleren Teil uebertragen und ordered bereinigen for(int x = firstCut+1; x <= secondCut; x++){ //uebertraegt von parent an child child1[x] = parent1[x]; child2[x] = parent2[x]; //entfernt die bereits im child vorhandenen Gene ordered1.remove(child1[x]); ordered2.remove(child2[x]); } //Uebertraegt geordneten rest in childs for(int x = secondCut + 1; x != firstCut + 1; x++){ if(x >= 280) x = 0; child1[x] = ordered1.remove(0); child2[x] = ordered2.remove(0); } //erstellt das array fuer die Rueckgabe ArrayList<Tour> childList = new ArrayList<>(); //child1 ArrayList<City> genList = new ArrayList<>(Arrays.asList(child1)); Tour tour = new Tour(); tour.setCities(genList); childList.add(tour); //child2 genList = new ArrayList<>(Arrays.asList(child2)); tour = new Tour(); tour.setCities(genList); childList.add(tour); return childList; } }
2,393
0.597576
0.569578
72
32.25
24.342321
98
false
false
0
0
0
0
0
0
0.652778
false
false
14
cee455a32eb564fae2961d30f27990881838383b
9,603,546,925,086
faefb54ae72db051ce3e4a1d76a2e5b3f87a0bcc
/webapp/src/main/java/ar/edu/itba/paw/webapp/DTO/users/BuyLimitsDTO.java
d3ce94d4a6301c243054ef2d2637b9ad46afb4d8
[]
no_license
lobo/PAW-final
https://github.com/lobo/PAW-final
5873ae5fd2eb64bda6b65f5d4e6b94fe632912da
918a10a02a9bce6783afda8812eda091bdd62bd5
refs/heads/master
2021-05-03T15:10:30.906000
2018-02-06T14:42:28
2018-02-06T14:42:28
120,471,882
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ar.edu.itba.paw.webapp.DTO.users; import ar.edu.itba.paw.model.FactoryType; import ar.edu.itba.paw.model.ResourceType; import ar.edu.itba.paw.model.packages.BuyLimits; import ar.edu.itba.paw.webapp.DTO.map.ResourceEntryDTO; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Stream; @XmlRootElement public class BuyLimitsDTO { public static String url = "/users/%s/factories/%s/buyLimits"; @XmlElement(name = "user_id") private long userID; @XmlElement(name = "factory_id") private int factoryID; @XmlElement(name = "max") private long max; @XmlElement(name = "cost_max") private List<ResourceEntryDTO> costMax; @XmlElement(name = "cost_next_max") private List<ResourceEntryDTO> costNextMax; @XmlElement(name = "cost_1") private List<ResourceEntryDTO> cost1; @XmlElement(name = "cost_10") private List<ResourceEntryDTO> cost10; @XmlElement(name = "cost_100") private List<ResourceEntryDTO> cost100; public BuyLimitsDTO(BuyLimits buyLimits, long userID, int factoryID) { this.userID = userID; this.factoryID = factoryID; FactoryType factoryType = FactoryType.fromId(factoryID); if(factoryType!=null) { max = buyLimits.getMaxFactories(); if(max>0) costMax = ResourceEntryDTO.fillCollection(buyLimits.getCostMax().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), max)); costNextMax = ResourceEntryDTO.fillCollection(buyLimits.getCostNextMax().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), max+1)); cost1 = ResourceEntryDTO.fillCollection(buyLimits.getCost1().rawMap(), factoryType.getBaseRecipe().getInputs()); cost10 = ResourceEntryDTO.fillCollection(buyLimits.getCost10().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), 10)); cost100 = ResourceEntryDTO.fillCollection(buyLimits.getCost100().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), 100)); } else { throw new IllegalArgumentException("No factory with the ID " + factoryID); } } private Map<ResourceType, BigDecimal> multiplyProductions(Map<ResourceType, BigDecimal> map, long factor) { for (ResourceType k: map.keySet()) { map.put(k, map.get(k).multiply(BigDecimal.valueOf(factor))); } return map; } public BuyLimitsDTO(){} }
UTF-8
Java
2,653
java
BuyLimitsDTO.java
Java
[]
null
[]
package ar.edu.itba.paw.webapp.DTO.users; import ar.edu.itba.paw.model.FactoryType; import ar.edu.itba.paw.model.ResourceType; import ar.edu.itba.paw.model.packages.BuyLimits; import ar.edu.itba.paw.webapp.DTO.map.ResourceEntryDTO; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Stream; @XmlRootElement public class BuyLimitsDTO { public static String url = "/users/%s/factories/%s/buyLimits"; @XmlElement(name = "user_id") private long userID; @XmlElement(name = "factory_id") private int factoryID; @XmlElement(name = "max") private long max; @XmlElement(name = "cost_max") private List<ResourceEntryDTO> costMax; @XmlElement(name = "cost_next_max") private List<ResourceEntryDTO> costNextMax; @XmlElement(name = "cost_1") private List<ResourceEntryDTO> cost1; @XmlElement(name = "cost_10") private List<ResourceEntryDTO> cost10; @XmlElement(name = "cost_100") private List<ResourceEntryDTO> cost100; public BuyLimitsDTO(BuyLimits buyLimits, long userID, int factoryID) { this.userID = userID; this.factoryID = factoryID; FactoryType factoryType = FactoryType.fromId(factoryID); if(factoryType!=null) { max = buyLimits.getMaxFactories(); if(max>0) costMax = ResourceEntryDTO.fillCollection(buyLimits.getCostMax().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), max)); costNextMax = ResourceEntryDTO.fillCollection(buyLimits.getCostNextMax().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), max+1)); cost1 = ResourceEntryDTO.fillCollection(buyLimits.getCost1().rawMap(), factoryType.getBaseRecipe().getInputs()); cost10 = ResourceEntryDTO.fillCollection(buyLimits.getCost10().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), 10)); cost100 = ResourceEntryDTO.fillCollection(buyLimits.getCost100().rawMap(), multiplyProductions(factoryType.getBaseRecipe().getInputs(), 100)); } else { throw new IllegalArgumentException("No factory with the ID " + factoryID); } } private Map<ResourceType, BigDecimal> multiplyProductions(Map<ResourceType, BigDecimal> map, long factor) { for (ResourceType k: map.keySet()) { map.put(k, map.get(k).multiply(BigDecimal.valueOf(factor))); } return map; } public BuyLimitsDTO(){} }
2,653
0.707878
0.696193
71
36.366196
39.295284
165
false
false
0
0
0
0
0
0
0.690141
false
false
14
5955a5fca6e3329a94bd023e4e7a3a37dd304a9b
9,603,546,922,901
81a6b7f6d6b6bac748a2378bff2157618ff51f61
/env-manage/customer-api/src/main/java/com/infore/service/IotBaseService.java
219c9c7df07df686bb974e37f07601e65964df7c
[]
no_license
fralulu/questionnaire_back
https://github.com/fralulu/questionnaire_back
cc07a029bd73407d13d4548388de3c911f07a13c
c2badb6d2dd2e727809e376dfa47ea488bf4b9e1
refs/heads/master
2020-03-11T12:15:07.204000
2018-04-20T02:15:24
2018-04-20T02:15:24
129,992,271
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.infore.service; /** * */ import java.util.List; import java.util.Map; import com.github.pagehelper.PageInfo; /** * @desc * @class IotBaseService * @author create author by deer * @date 2017年11月2日下午4:23:21 */ public interface IotBaseService <T>{ /** * 插入记录 * @param record * @return */ public int insert(T record); /** * 选择插入记录 * @param record * @return */ public int insertSelective(T record); /** * 选择性修改记录 * @param record * @return */ public int updateByPrimaryKeySelective(T record); /** * 修改记录 * @param record * @return */ public int updateByPrimaryKey(T record); /** * 分页查询 * @param parasMap * @return */ public List<T> selectListByPagination(Map<String, Object> parasMap); /** * 将实体类作为查询条件的参数进行查询,减少接收参数的步骤 * @param record * @return * @author XiaChengwei */ public List<T> selectListByEntity(T record); /** * 查询条数 * @param parasMap * @return */ public int queryCount(Map<String, Object> parasMap); /** * * @Title: queryList * @Description: TODO(这里用一句话描述这个方法的作用) * @param: @return * @return: List<T> * @throws */ public List<T> queryList(); /** * * @Title: selectListByPagination * @Description: TODO(这里用一句话描述这个方法的作用) * @param: @param pageNum * @param: @param pageSize * @param: @param orderBy * @return: PageInfo<T> * @throws */ public PageInfo<T> selectListByPagination(Integer pageNum,Integer pageSize,String orderBy, T entity); }
UTF-8
Java
1,923
java
IotBaseService.java
Java
[ { "context": "class IotBaseService\n * @author create author by deer\n * @date 2017年11月2日下午4:23:21\n */\npublic interfac", "end": 204, "score": 0.9943969249725342, "start": 200, "tag": "USERNAME", "value": "deer" }, { "context": " * @param record\n * @return\n * @author XiaChengwei\n */\n public List<T> selectListByEntity(T r", "end": 962, "score": 0.9951428174972534, "start": 951, "tag": "NAME", "value": "XiaChengwei" } ]
null
[]
package com.infore.service; /** * */ import java.util.List; import java.util.Map; import com.github.pagehelper.PageInfo; /** * @desc * @class IotBaseService * @author create author by deer * @date 2017年11月2日下午4:23:21 */ public interface IotBaseService <T>{ /** * 插入记录 * @param record * @return */ public int insert(T record); /** * 选择插入记录 * @param record * @return */ public int insertSelective(T record); /** * 选择性修改记录 * @param record * @return */ public int updateByPrimaryKeySelective(T record); /** * 修改记录 * @param record * @return */ public int updateByPrimaryKey(T record); /** * 分页查询 * @param parasMap * @return */ public List<T> selectListByPagination(Map<String, Object> parasMap); /** * 将实体类作为查询条件的参数进行查询,减少接收参数的步骤 * @param record * @return * @author XiaChengwei */ public List<T> selectListByEntity(T record); /** * 查询条数 * @param parasMap * @return */ public int queryCount(Map<String, Object> parasMap); /** * * @Title: queryList * @Description: TODO(这里用一句话描述这个方法的作用) * @param: @return * @return: List<T> * @throws */ public List<T> queryList(); /** * * @Title: selectListByPagination * @Description: TODO(这里用一句话描述这个方法的作用) * @param: @param pageNum * @param: @param pageSize * @param: @param orderBy * @return: PageInfo<T> * @throws */ public PageInfo<T> selectListByPagination(Integer pageNum,Integer pageSize,String orderBy, T entity); }
1,923
0.54911
0.542217
96
17.135416
17.547922
106
false
false
0
0
0
0
0
0
0.21875
false
false
14
f3b6109ffc55480b1a7d4e5856a6b35122d35c35
1,151,051,291,886
0d31d9fb230912736f51a5ca6471f5668baaf043
/JavaPrograms/src/simpleprograms/Palindrome.java
5886b3955165de860d2a379c97fadf399240c4a0
[]
no_license
Pramod1709/Test2_Framework
https://github.com/Pramod1709/Test2_Framework
29a70e5b737e8eacc9ee92beb237c16a9445ea58
46e6434ef802af2d5d09ddda7aba44085dc620c7
refs/heads/master
2020-05-15T04:01:44.054000
2019-04-23T11:58:38
2019-04-23T11:58:38
182,078,859
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package simpleprograms; import java.util.Scanner; public class Palindrome { public static void main(String[] args) { // Objects of String class String original, reverse = ""; // Create a scanner object Scanner sc = new Scanner(System.in); System.out.println("Enter a string/number to check if it is a palindrome?"); original = sc.nextLine(); int length = original.length(); for(int i=length-1; i>=0; i--) { reverse = reverse + original.charAt(i); } if(original.equals(reverse)) { System.out.println("Entered string/number is a palindrome."); } else { System.out.println("Entered string/number isn't a palindrome."); } sc.close(); } }
UTF-8
Java
854
java
Palindrome.java
Java
[]
null
[]
package simpleprograms; import java.util.Scanner; public class Palindrome { public static void main(String[] args) { // Objects of String class String original, reverse = ""; // Create a scanner object Scanner sc = new Scanner(System.in); System.out.println("Enter a string/number to check if it is a palindrome?"); original = sc.nextLine(); int length = original.length(); for(int i=length-1; i>=0; i--) { reverse = reverse + original.charAt(i); } if(original.equals(reverse)) { System.out.println("Entered string/number is a palindrome."); } else { System.out.println("Entered string/number isn't a palindrome."); } sc.close(); } }
854
0.5363
0.533958
32
24.6875
21.906673
85
false
false
0
0
0
0
0
0
1.53125
false
false
14
6736803b2abb2c5342b17870251e14da13b95e8b
8,246,337,272,148
9dcbc010bc8f6004bcdaa4d408b1f033497906c4
/habitathgrp/src/org/habitatguate/hgerp/seguridad/service/jdo/SegPuesto.java
422517e7d2453f5561ad66b310f031fd37483de6
[]
no_license
arorivegt/eps-habitat
https://github.com/arorivegt/eps-habitat
351349712a687ce1fd151f4fb102a1147deb8802
a0586f04cf5cd27439a1f7ee26cac8cff32e586f
refs/heads/master
2021-05-30T23:29:36.348000
2015-10-05T05:17:27
2015-10-05T05:17:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.habitatguate.hgerp.seguridad.service.jdo; import java.io.Serializable; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.appengine.api.datastore.Key; @SuppressWarnings("serial") @PersistenceCapable(identityType = IdentityType.APPLICATION) public class SegPuesto implements Serializable { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Key id_puesto; @Persistent private Date fecha_puesto; @Persistent private String nombre_puesto; @Persistent private String funciones; @Persistent private boolean activo; @Persistent private String motivoPuesto; @Persistent private String jornada; @Persistent private String horasTrabajo; @Persistent private String Lunes; @Persistent private String Martes; @Persistent private String Miercoles; @Persistent private String Jueves; @Persistent private String Viernes; @Persistent private String Sabado; @Persistent private String Domingo; @Persistent private SegEmpleado empleado; public SegPuesto() { super(); } public Long getId_puesto() { return id_puesto.getId(); } public Date getFecha_puesto() { return fecha_puesto; } public String getLunes() { return Lunes; } public void setLunes(String lunes) { Lunes = lunes; } public String getMartes() { return Martes; } public void setMartes(String martes) { Martes = martes; } public String getMiercoles() { return Miercoles; } public void setMiercoles(String miercoles) { Miercoles = miercoles; } public String getJueves() { return Jueves; } public void setJueves(String jueves) { Jueves = jueves; } public String getViernes() { return Viernes; } public void setViernes(String viernes) { Viernes = viernes; } public String getSabado() { return Sabado; } public void setSabado(String sabado) { Sabado = sabado; } public String getDomingo() { return Domingo; } public void setDomingo(String domingo) { Domingo = domingo; } public String getMotivoPuesto() { return motivoPuesto; } public String getJornada() { return jornada; } public void setJornada(String jornada) { this.jornada = jornada; } public String getHorasTrabajo() { return horasTrabajo; } public void setHorasTrabajo(String horasTrabajo) { this.horasTrabajo = horasTrabajo; } public void setMotivoPuesto(String motivoPuesto) { this.motivoPuesto = motivoPuesto; } public void setFecha_puesto(Date fecha_puesto) { this.fecha_puesto = fecha_puesto; } public String getNombre_puesto() { return nombre_puesto; } public void setNombre_puesto(String nombre_puesto) { this.nombre_puesto = nombre_puesto; } public String getFunciones() { return funciones; } public void setFunciones(String funciones) { this.funciones = funciones; } public boolean getActivo() { return activo; } public void setActivo(boolean activo) { this.activo = activo; } public SegEmpleado getEmpleado() { return empleado; } public void setEmpleado(SegEmpleado empleado) { this.empleado = empleado; } }
UTF-8
Java
3,343
java
SegPuesto.java
Java
[]
null
[]
package org.habitatguate.hgerp.seguridad.service.jdo; import java.io.Serializable; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.appengine.api.datastore.Key; @SuppressWarnings("serial") @PersistenceCapable(identityType = IdentityType.APPLICATION) public class SegPuesto implements Serializable { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Key id_puesto; @Persistent private Date fecha_puesto; @Persistent private String nombre_puesto; @Persistent private String funciones; @Persistent private boolean activo; @Persistent private String motivoPuesto; @Persistent private String jornada; @Persistent private String horasTrabajo; @Persistent private String Lunes; @Persistent private String Martes; @Persistent private String Miercoles; @Persistent private String Jueves; @Persistent private String Viernes; @Persistent private String Sabado; @Persistent private String Domingo; @Persistent private SegEmpleado empleado; public SegPuesto() { super(); } public Long getId_puesto() { return id_puesto.getId(); } public Date getFecha_puesto() { return fecha_puesto; } public String getLunes() { return Lunes; } public void setLunes(String lunes) { Lunes = lunes; } public String getMartes() { return Martes; } public void setMartes(String martes) { Martes = martes; } public String getMiercoles() { return Miercoles; } public void setMiercoles(String miercoles) { Miercoles = miercoles; } public String getJueves() { return Jueves; } public void setJueves(String jueves) { Jueves = jueves; } public String getViernes() { return Viernes; } public void setViernes(String viernes) { Viernes = viernes; } public String getSabado() { return Sabado; } public void setSabado(String sabado) { Sabado = sabado; } public String getDomingo() { return Domingo; } public void setDomingo(String domingo) { Domingo = domingo; } public String getMotivoPuesto() { return motivoPuesto; } public String getJornada() { return jornada; } public void setJornada(String jornada) { this.jornada = jornada; } public String getHorasTrabajo() { return horasTrabajo; } public void setHorasTrabajo(String horasTrabajo) { this.horasTrabajo = horasTrabajo; } public void setMotivoPuesto(String motivoPuesto) { this.motivoPuesto = motivoPuesto; } public void setFecha_puesto(Date fecha_puesto) { this.fecha_puesto = fecha_puesto; } public String getNombre_puesto() { return nombre_puesto; } public void setNombre_puesto(String nombre_puesto) { this.nombre_puesto = nombre_puesto; } public String getFunciones() { return funciones; } public void setFunciones(String funciones) { this.funciones = funciones; } public boolean getActivo() { return activo; } public void setActivo(boolean activo) { this.activo = activo; } public SegEmpleado getEmpleado() { return empleado; } public void setEmpleado(SegEmpleado empleado) { this.empleado = empleado; } }
3,343
0.725695
0.725695
196
16.056122
16.244997
60
false
false
0
0
0
0
0
0
1.112245
false
false
14
25dd6b83b5b548bd7652e38afc66a6b606438647
4,672,924,475,264
b696f77f92465b1835b40a467d57cb4db9032a3e
/src/neutron/Logic/Interfaces/BorderElementType.java
727f609ebe596c001c297b9f752d654127c7b67e
[]
no_license
mkaczynski/Neutron
https://github.com/mkaczynski/Neutron
8db0f369035a95c728086c20ab8ec495233549bf
9495c99cb8569ab5386739448f77fb2069cec192
refs/heads/master
2018-12-30T00:40:02.351000
2012-06-07T08:04:05
2012-06-07T08:04:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package neutron.Logic.Interfaces; /** * @author Marcin */ public enum BorderElementType { Blank, White, Black, Neutron }
UTF-8
Java
140
java
BorderElementType.java
Java
[ { "context": "package neutron.Logic.Interfaces;\n\n/**\n * @author Marcin\n */\npublic enum BorderElementType {\n Blank,\n ", "end": 56, "score": 0.9997915029525757, "start": 50, "tag": "NAME", "value": "Marcin" } ]
null
[]
package neutron.Logic.Interfaces; /** * @author Marcin */ public enum BorderElementType { Blank, White, Black, Neutron }
140
0.642857
0.642857
11
11.727273
10.728813
33
false
false
0
0
0
0
0
0
0.363636
false
false
14
6d0705c664507e00d88c93609186c8b97e83edcf
16,973,710,817,248
1320d4c1175fcac9ef1d9d3a90a1a01c36dc7ec1
/trabalho-oo-master/src/joalheria/control/JanelaNovoCliente.java
c1234380d5ada532c6a4fa9b0b9fff3f90ecf61b
[]
no_license
brendhagabii/jewelty-oo
https://github.com/brendhagabii/jewelty-oo
a3cf1468a0e4675e61dbc2c4592cf1f73935d779
2ec0d00a718141380484da643adc6da8d70f738b
refs/heads/master
2020-09-25T09:34:50.164000
2019-12-12T14:50:14
2019-12-12T14:50:14
225,975,809
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package joalheria.control; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.TextField; import joalheria.NavegadorCenas; import joalheria.model.Cliente; import joalheria.model.Joalheria; import java.sql.SQLException; public class JanelaNovoCliente { @FXML private TextField tfNome; @FXML private TextField tfCPF; @FXML private TextField tfEmail; @FXML private TextField tfTelefone; @FXML private TextField tfEndereco; public void cadastrar(ActionEvent actionEvent) { String nome = tfNome.getText(); String cpf = tfCPF.getText(); String email = tfEmail.getText(); String telefone = tfTelefone.getText(); String endereco = tfEndereco.getText(); try { Joalheria.getInstance().cadastraCliente(new Cliente(nome, cpf, email, telefone, endereco)); new Alert(Alert.AlertType.INFORMATION, "Cliente cadastrado com sucesso!").showAndWait(); } catch (SQLException e) { System.out.println(e.getMessage()); new Alert(Alert.AlertType.ERROR, "Não foi possível cadastrar o cliente.").showAndWait(); } finally { NavegadorCenas.loadJanela(NavegadorCenas.PRINCIPAL); } } public void voltar(ActionEvent actionEvent) { NavegadorCenas.loadJanela(NavegadorCenas.PRINCIPAL); } }
UTF-8
Java
1,429
java
JanelaNovoCliente.java
Java
[]
null
[]
package joalheria.control; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.TextField; import joalheria.NavegadorCenas; import joalheria.model.Cliente; import joalheria.model.Joalheria; import java.sql.SQLException; public class JanelaNovoCliente { @FXML private TextField tfNome; @FXML private TextField tfCPF; @FXML private TextField tfEmail; @FXML private TextField tfTelefone; @FXML private TextField tfEndereco; public void cadastrar(ActionEvent actionEvent) { String nome = tfNome.getText(); String cpf = tfCPF.getText(); String email = tfEmail.getText(); String telefone = tfTelefone.getText(); String endereco = tfEndereco.getText(); try { Joalheria.getInstance().cadastraCliente(new Cliente(nome, cpf, email, telefone, endereco)); new Alert(Alert.AlertType.INFORMATION, "Cliente cadastrado com sucesso!").showAndWait(); } catch (SQLException e) { System.out.println(e.getMessage()); new Alert(Alert.AlertType.ERROR, "Não foi possível cadastrar o cliente.").showAndWait(); } finally { NavegadorCenas.loadJanela(NavegadorCenas.PRINCIPAL); } } public void voltar(ActionEvent actionEvent) { NavegadorCenas.loadJanela(NavegadorCenas.PRINCIPAL); } }
1,429
0.687456
0.687456
46
30.02174
25.490398
103
false
false
0
0
0
0
0
0
0.673913
false
false
14
3e055129df1ba337b0f719b023eab0c7cb4d9f6e
15,556,371,585,516
637051c83ca28d9d9b0110ec4d62c1d322b4cb25
/P4-CodeGenForALG/src/alg/algBaseVisitor.java
dd1669c1bc6b07dee08c6f652a975301c3bf487d
[]
no_license
beybladeuser/Compiladores-P4
https://github.com/beybladeuser/Compiladores-P4
b51393bea8d66b4d260bac66a19af8307ddd18e7
3a7884f432779a5adb7cd64904e817e8ac38c56b
refs/heads/main
2023-05-14T02:09:58.657000
2021-06-05T18:15:02
2021-06-05T18:15:02
372,788,067
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Generated from E:/escola/universidade_boi/3_ano/2_semestre/Compiladores/Praticas/Compiladores-P4/P4-CodeGenForALG/src\alg.g4 by ANTLR 4.9.1 package alg; import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; /** * This class provides an empty implementation of {@link algVisitor}, * which can be extended to create a visitor which only needs to handle a subset * of the available methods. * * @param <T> The return type of the visit operation. Use {@link Void} for * operations with no return type. */ public class algBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements algVisitor<T> { /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_file(alg.Alg_fileContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_program(alg.Alg_programContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_declaration(alg.Alg_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_var_declaration(alg.Alg_var_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_simple_var_declaration(alg.Alg_simple_var_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_type(alg.Alg_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_primitive_type(alg.Alg_primitive_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_pointer_type(alg.Alg_pointer_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_init_var_declaration(alg.Alg_init_var_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitInt(alg.IntContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitNull(alg.NullContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitReal(alg.RealContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitBool_True(alg.Bool_TrueContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitBool_False(alg.Bool_FalseContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitString(alg.StringContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitVar(alg.VarContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitCall(alg.CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSimple_expr(alg.Simple_exprContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParen(alg.ParenContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParen_fail_1(alg.Paren_fail_1Context ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParen_fail_2(alg.Paren_fail_2Context ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAnd_op(alg.And_opContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitMultiplication(alg.MultiplicationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAddition(alg.AdditionContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOr_op(alg.Or_opContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitComparisson(alg.ComparissonContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSimple_expression(alg.Simple_expressionContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitUnary_Op(alg.Unary_OpContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitPointer_Indexing(alg.Pointer_IndexingContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_type(alg.Alg_func_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitNormal_Func(alg.Normal_FuncContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitALG_Func(alg.ALG_FuncContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_alg_function_args(alg.Alg_alg_function_argsContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_declaration_arg(alg.Alg_func_declaration_argContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_body(alg.Alg_func_bodyContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_prologue(alg.Alg_func_prologueContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_epilogue(alg.Alg_func_epilogueContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_block(alg.Alg_blockContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitNormal_Function_Call(alg.Normal_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAT_Function_Call(alg.AT_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSizeof_Function_Call(alg.Sizeof_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWrite_Function_Call(alg.Write_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWriteLn_Function_Call(alg.WriteLn_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_funtion_call_args(alg.Alg_funtion_call_argsContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_funtion_call_args_aux(alg.Alg_funtion_call_args_auxContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitExpInst(alg.ExpInstContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitCtrl(alg.CtrlContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAssign(alg.AssignContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitIf(alg.IfContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWhile(alg.WhileContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSubBlock(alg.SubBlockContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitLeave_control_instr(alg.Leave_control_instrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitRestart_control_instr(alg.Restart_control_instrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitReturn_control_instr(alg.Return_control_instrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instruction_controle_next(alg.Alg_instruction_controle_nextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitLado_esquerdo_ident(alg.Lado_esquerdo_identContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitLado_esquerdo_pointer_index(alg.Lado_esquerdo_pointer_indexContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_atrib(alg.Alg_atribContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instruction_cond(alg.Alg_instruction_condContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instruction_cond_next(alg.Alg_instruction_cond_nextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_cicle(alg.Alg_cicleContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_cicle_next(alg.Alg_cicle_nextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_subblock(alg.Alg_subblockContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instr_repeat(alg.Alg_instr_repeatContext ctx) { return visitChildren(ctx); } }
UTF-8
Java
16,220
java
algBaseVisitor.java
Java
[]
null
[]
// Generated from E:/escola/universidade_boi/3_ano/2_semestre/Compiladores/Praticas/Compiladores-P4/P4-CodeGenForALG/src\alg.g4 by ANTLR 4.9.1 package alg; import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; /** * This class provides an empty implementation of {@link algVisitor}, * which can be extended to create a visitor which only needs to handle a subset * of the available methods. * * @param <T> The return type of the visit operation. Use {@link Void} for * operations with no return type. */ public class algBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements algVisitor<T> { /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_file(alg.Alg_fileContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_program(alg.Alg_programContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_declaration(alg.Alg_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_var_declaration(alg.Alg_var_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_simple_var_declaration(alg.Alg_simple_var_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_type(alg.Alg_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_primitive_type(alg.Alg_primitive_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_pointer_type(alg.Alg_pointer_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_init_var_declaration(alg.Alg_init_var_declarationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitInt(alg.IntContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitNull(alg.NullContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitReal(alg.RealContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitBool_True(alg.Bool_TrueContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitBool_False(alg.Bool_FalseContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitString(alg.StringContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitVar(alg.VarContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitCall(alg.CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSimple_expr(alg.Simple_exprContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParen(alg.ParenContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParen_fail_1(alg.Paren_fail_1Context ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitParen_fail_2(alg.Paren_fail_2Context ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAnd_op(alg.And_opContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitMultiplication(alg.MultiplicationContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAddition(alg.AdditionContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitOr_op(alg.Or_opContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitComparisson(alg.ComparissonContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSimple_expression(alg.Simple_expressionContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitUnary_Op(alg.Unary_OpContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitPointer_Indexing(alg.Pointer_IndexingContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_type(alg.Alg_func_typeContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitNormal_Func(alg.Normal_FuncContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitALG_Func(alg.ALG_FuncContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_alg_function_args(alg.Alg_alg_function_argsContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_declaration_arg(alg.Alg_func_declaration_argContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_body(alg.Alg_func_bodyContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_prologue(alg.Alg_func_prologueContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_func_epilogue(alg.Alg_func_epilogueContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_block(alg.Alg_blockContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitNormal_Function_Call(alg.Normal_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAT_Function_Call(alg.AT_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSizeof_Function_Call(alg.Sizeof_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWrite_Function_Call(alg.Write_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWriteLn_Function_Call(alg.WriteLn_Function_CallContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_funtion_call_args(alg.Alg_funtion_call_argsContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_funtion_call_args_aux(alg.Alg_funtion_call_args_auxContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitExpInst(alg.ExpInstContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitCtrl(alg.CtrlContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAssign(alg.AssignContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitIf(alg.IfContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitWhile(alg.WhileContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitSubBlock(alg.SubBlockContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitLeave_control_instr(alg.Leave_control_instrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitRestart_control_instr(alg.Restart_control_instrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitReturn_control_instr(alg.Return_control_instrContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instruction_controle_next(alg.Alg_instruction_controle_nextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitLado_esquerdo_ident(alg.Lado_esquerdo_identContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitLado_esquerdo_pointer_index(alg.Lado_esquerdo_pointer_indexContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_atrib(alg.Alg_atribContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instruction_cond(alg.Alg_instruction_condContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instruction_cond_next(alg.Alg_instruction_cond_nextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_cicle(alg.Alg_cicleContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_cicle_next(alg.Alg_cicle_nextContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_subblock(alg.Alg_subblockContext ctx) { return visitChildren(ctx); } /** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */ @Override public T visitAlg_instr_repeat(alg.Alg_instr_repeatContext ctx) { return visitChildren(ctx); } }
16,220
0.684525
0.683724
462
34.11039
35.272083
142
false
false
0
0
0
0
0
0
1.114719
false
false
14
81767aaf0acd693b5ee9b1081b03e8cee411bae9
34,222,299,429,021
b3bfaa28c02fccc77973c7c562a9f44c5cd2b19f
/src/main/java/com/github/stoton/controller/MangaPageController.java
8966b6029e5c42047ad35cce1b1adaeaae84a0ec
[]
no_license
stoton/MangaReaderBackend
https://github.com/stoton/MangaReaderBackend
a9677b532d4e78e7b97c72c2cf3a112b1a2db29a
2d87867157c4bcb19d229f9f42d37d4f6e81b2d3
refs/heads/master
2020-12-02T16:35:42.863000
2017-07-09T14:02:39
2017-07-09T14:02:39
96,556,476
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.stoton.controller; import com.github.stoton.domain.MangaChapter; import com.github.stoton.repository.MangaChapterRepository; import com.github.stoton.service.MangaPageService; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; @RestController public class MangaPageController { private final Logger logger = Logger.getLogger(MangaPageController.class); @Autowired private MangaChapterRepository mangaChapterRepository; @Autowired private MangaPageService mangaPageService; @RequestMapping("/chapters/{mangaId:\\d+}/{chapterId:\\d+}") public List<String> downloadMangaChapters(@PathVariable long mangaId, @PathVariable long chapterId) { int length = mangaChapterRepository.getMangaChapterLength(mangaId); MangaChapter mangaChapter = mangaChapterRepository.getMangaChapterById(mangaId, (length+1) - chapterId); try { return mangaPageService.insertAndGetMangaPages(mangaChapter); } catch (Exception e) { logger.error(e.getMessage()); } return new ArrayList<>(); } }
UTF-8
Java
1,377
java
MangaPageController.java
Java
[]
null
[]
package com.github.stoton.controller; import com.github.stoton.domain.MangaChapter; import com.github.stoton.repository.MangaChapterRepository; import com.github.stoton.service.MangaPageService; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; @RestController public class MangaPageController { private final Logger logger = Logger.getLogger(MangaPageController.class); @Autowired private MangaChapterRepository mangaChapterRepository; @Autowired private MangaPageService mangaPageService; @RequestMapping("/chapters/{mangaId:\\d+}/{chapterId:\\d+}") public List<String> downloadMangaChapters(@PathVariable long mangaId, @PathVariable long chapterId) { int length = mangaChapterRepository.getMangaChapterLength(mangaId); MangaChapter mangaChapter = mangaChapterRepository.getMangaChapterById(mangaId, (length+1) - chapterId); try { return mangaPageService.insertAndGetMangaPages(mangaChapter); } catch (Exception e) { logger.error(e.getMessage()); } return new ArrayList<>(); } }
1,377
0.765432
0.76398
39
34.307693
30.692982
112
false
false
0
0
0
0
0
0
0.538462
false
false
14
adedb10cfa541b4105c78b12247e7f76a8fedb60
32,315,333,959,041
f2fabfc6d36577a3a50894e811146309e0ce278b
/brett-n-core-java-assignment/src/main/java/Assignment1/Q6IsEven.java
96927ec6570fd9685d48e03f37b39f9f2c64f0fa
[]
no_license
190624-java/core-java-assignment
https://github.com/190624-java/core-java-assignment
1b06b3ac6ba9e841b126c4e20768b56b70ba2d8b
a5a4a1f5d0d67380bc115660fc5c68fec761d39a
refs/heads/master
2021-07-06T13:52:02.888000
2019-07-04T00:54:10
2019-07-04T00:54:10
193,782,714
1
0
null
false
2020-10-13T14:20:30
2019-06-25T21:00:08
2019-07-04T00:54:13
2020-10-13T14:20:29
13,858
1
0
5
JavaScript
false
false
package Assignment1; public class Q6IsEven { public static boolean isEven(int num) { boolean isEven = true; for(int i = 1; i <= num; i++) isEven = !isEven; //Flag variable (switches from true to false every increment) return isEven; } }
UTF-8
Java
264
java
Q6IsEven.java
Java
[]
null
[]
package Assignment1; public class Q6IsEven { public static boolean isEven(int num) { boolean isEven = true; for(int i = 1; i <= num; i++) isEven = !isEven; //Flag variable (switches from true to false every increment) return isEven; } }
264
0.647727
0.636364
17
14.588235
20.987556
82
false
false
0
0
0
0
0
0
1.529412
false
false
14
d45c25a90ca62bb247ecc3704db38442214fe58d
35,364,760,719,585
54c1dcb9a6fb9e257c6ebe7745d5008d29b0d6b6
/app/src/main/java/com/p118pd/sdk/C5769Ll1.java
50282e1cd9b74913ca493d4e389c892c522a7878
[]
no_license
rcoolboy/guilvN
https://github.com/rcoolboy/guilvN
3817397da465c34fcee82c0ca8c39f7292bcc7e1
c779a8e2e5fd458d62503dc1344aa2185101f0f0
refs/heads/master
2023-05-31T10:04:41.992000
2021-07-07T09:58:05
2021-07-07T09:58:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.p118pd.sdk; /* renamed from: com.pd.sdk.Ll1丨丨 reason: invalid class name and case insensitive filesystem */ public class C5769Ll1 extends lilL1il { public AbstractC9738llL1L OooO00o; public C5769Ll1(AbstractC9738llL1L r1, C6106iIiIl iiiil) { super(iiiil); this.OooO00o = r1.m21800OooO00o() != null ? r1.OooO0Oo() : r1; } @Override // com.p118pd.sdk.lilL1il public AbstractC9738llL1L OooO00o() { return this.OooO00o; } }
UTF-8
Java
488
java
C5769Ll1.java
Java
[]
null
[]
package com.p118pd.sdk; /* renamed from: com.pd.sdk.Ll1丨丨 reason: invalid class name and case insensitive filesystem */ public class C5769Ll1 extends lilL1il { public AbstractC9738llL1L OooO00o; public C5769Ll1(AbstractC9738llL1L r1, C6106iIiIl iiiil) { super(iiiil); this.OooO00o = r1.m21800OooO00o() != null ? r1.OooO0Oo() : r1; } @Override // com.p118pd.sdk.lilL1il public AbstractC9738llL1L OooO00o() { return this.OooO00o; } }
488
0.68595
0.566116
16
29.25
27.662024
96
false
false
0
0
0
0
0
0
0.375
false
false
14
328010ad01b08d2d01952c03f6e365e7a234c18c
25,572,235,298,938
706221ec954d966508aa5a90f2969173466d9023
/extras/groovy/src/main/java/org/cipango/groovy/SipServletBinding.java
f79576bee545a2a1f47a2996396c59950b3bdd0c
[ "Apache-2.0" ]
permissive
dbroeglin/cipango
https://github.com/dbroeglin/cipango
c438a8ee2b95714a2f312d084da83f2c508f6d46
4fe778f0b59602160aa82055b1a3c994853d1f07
refs/heads/master
2020-06-04T15:48:46.340000
2011-04-06T21:11:35
2011-04-06T21:11:35
1,339,732
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
// ======================================================================== // Copyright 2010 NEXCOM Systems // ------------------------------------------------------------------------ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ======================================================================== package org.cipango.groovy; import java.util.ArrayList; import java.util.List; import groovy.lang.Binding; import javax.servlet.ServletContext; import javax.servlet.sip.SipServlet; import javax.servlet.sip.SipServletMessage; /** * SIP-Servlet-specific binding extension. * <p> * <h3>Variables</h3> * <ul> * <li><tt>"context"</tt> : the ServletContext object</li> * <li><tt>"session"</tt> : shorthand for <code>request.getSession()</code></li> * <li><tt>"sipFactory"</tt> : SIP servlet factory</code></li> * </ul> * <p/> */ public class SipServletBinding extends Binding { public static final String CONTEXT = "context", SESSION = "session", SIP_FACTORY = "sipFactory"; protected List<String> _reservedNames = new ArrayList<String>(); public SipServletBinding(SipServletMessage message, ServletContext context) { super.setVariable(CONTEXT, context); super.setVariable(SIP_FACTORY, context.getAttribute(SipServlet.SIP_FACTORY)); super.setVariable(SESSION, message.getSession()); } @Override public void setVariable(String name, Object value) { excludeReservedName(name); super.setVariable(name, value); } protected void excludeReservedName(String name) { if (_reservedNames.contains(name)) throw new IllegalArgumentException("Can't bind variable to key named '" + name + "'."); } }
UTF-8
Java
2,152
java
SipServletBinding.java
Java
[]
null
[]
// ======================================================================== // Copyright 2010 NEXCOM Systems // ------------------------------------------------------------------------ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ======================================================================== package org.cipango.groovy; import java.util.ArrayList; import java.util.List; import groovy.lang.Binding; import javax.servlet.ServletContext; import javax.servlet.sip.SipServlet; import javax.servlet.sip.SipServletMessage; /** * SIP-Servlet-specific binding extension. * <p> * <h3>Variables</h3> * <ul> * <li><tt>"context"</tt> : the ServletContext object</li> * <li><tt>"session"</tt> : shorthand for <code>request.getSession()</code></li> * <li><tt>"sipFactory"</tt> : SIP servlet factory</code></li> * </ul> * <p/> */ public class SipServletBinding extends Binding { public static final String CONTEXT = "context", SESSION = "session", SIP_FACTORY = "sipFactory"; protected List<String> _reservedNames = new ArrayList<String>(); public SipServletBinding(SipServletMessage message, ServletContext context) { super.setVariable(CONTEXT, context); super.setVariable(SIP_FACTORY, context.getAttribute(SipServlet.SIP_FACTORY)); super.setVariable(SESSION, message.getSession()); } @Override public void setVariable(String name, Object value) { excludeReservedName(name); super.setVariable(name, value); } protected void excludeReservedName(String name) { if (_reservedNames.contains(name)) throw new IllegalArgumentException("Can't bind variable to key named '" + name + "'."); } }
2,152
0.65381
0.649164
67
31.119404
27.988016
90
false
false
0
0
0
0
81
0.072491
0.940298
false
false
14
4c3eb5ba49bb5d9c3feabf0d2e81beab529b55d3
6,365,141,579,203
0851aefb321a3a4adf6ad4384a1bf3704e90a402
/uengine/src/main/java/org/uengine/processdesigner/mapper/transformers/DirectValueTransformer.java
4abc4d91cf8de0aeec18267b458db515355cf78d
[ "GPL-3.0-or-later", "GPL-1.0-or-later", "GPL-3.0-only", "EPL-2.0", "Apache-2.0", "LGPL-2.1-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.0-or-later", "LicenseRef-scancode-proprietary-license" ]
permissive
Lusky87/gas_bpm
https://github.com/Lusky87/gas_bpm
3b77016bbe66e88240ab131274de8bb001aff683
8bc7469a5fb0a58a2b841d71b9521d231930e67f
refs/heads/master
2020-04-08T22:32:50.652000
2018-11-28T09:19:38
2018-11-28T09:19:38
159,791,275
1
0
Apache-2.0
true
2018-11-30T08:20:18
2018-11-30T08:20:17
2018-11-30T08:20:15
2018-11-28T09:19:46
152,798
0
0
0
null
false
null
package org.uengine.processdesigner.mapper.transformers; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Map; import org.metaworks.FieldDescriptor; import org.metaworks.Type; import org.metaworks.inputter.Inputter; import org.metaworks.inputter.ObjectInput; import org.uengine.kernel.GlobalContext; import org.uengine.kernel.ProcessInstance; import org.uengine.processdesigner.mapper.Transformer; public class DirectValueTransformer extends Transformer{ public static void metaworksCallback_changeMetadata(Type type){ FieldDescriptor fd = type.getFieldDescriptor("Type"); final Inputter dtInput = fd.getInputter(); fd = type.getFieldDescriptor("Value"); final ObjectInput valueInput = new ObjectInput(); fd.setInputter(valueInput); dtInput.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { try{ Class type = (Class)dtInput.getValue(); if(type!=null){ valueInput.setType(type); } }catch(Exception ex){} } }); } public String getName() { return "Value"; } public Object transform(ProcessInstance instance, Map parameterMap, Map options) { return getValue(); } public String[] getInputArguments() { return new String[] {}; } public Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public Class type; public Class getType() { return type; } public void setType(Class type) { this.type = type; } }
UTF-8
Java
1,582
java
DirectValueTransformer.java
Java
[]
null
[]
package org.uengine.processdesigner.mapper.transformers; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Map; import org.metaworks.FieldDescriptor; import org.metaworks.Type; import org.metaworks.inputter.Inputter; import org.metaworks.inputter.ObjectInput; import org.uengine.kernel.GlobalContext; import org.uengine.kernel.ProcessInstance; import org.uengine.processdesigner.mapper.Transformer; public class DirectValueTransformer extends Transformer{ public static void metaworksCallback_changeMetadata(Type type){ FieldDescriptor fd = type.getFieldDescriptor("Type"); final Inputter dtInput = fd.getInputter(); fd = type.getFieldDescriptor("Value"); final ObjectInput valueInput = new ObjectInput(); fd.setInputter(valueInput); dtInput.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { try{ Class type = (Class)dtInput.getValue(); if(type!=null){ valueInput.setType(type); } }catch(Exception ex){} } }); } public String getName() { return "Value"; } public Object transform(ProcessInstance instance, Map parameterMap, Map options) { return getValue(); } public String[] getInputArguments() { return new String[] {}; } public Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public Class type; public Class getType() { return type; } public void setType(Class type) { this.type = type; } }
1,582
0.732617
0.732617
67
22.61194
20.053625
83
false
false
0
0
0
0
0
0
1.985075
false
false
14
56d5bd9a09266a76b1b375fff12fbdf177c8852a
21,672,405,016,620
6175f434b2b4e00eb2514a845cbadf0ac7c10ea2
/api/src/main/java/api/repository/ComplexoEolicoRepository.java
207f7c3dc38fc1217c9dc303aab04c3abc78bb7c
[]
no_license
felipekjr/eolic-api
https://github.com/felipekjr/eolic-api
34e5006207c6a8d1e09b3d587c8cb47a5a4ad041
93f3eec513b31fa4aa3a7b96d9afd69e35dd1ede
refs/heads/master
2022-03-16T04:02:07.138000
2022-03-04T17:01:37
2022-03-04T17:01:37
166,316,512
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package api.repository; import api.model.ComplexoEolico; import api.model.ParqueEolico; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; import java.util.Optional; @Service public interface ComplexoEolicoRepository extends JpaRepository<ComplexoEolico, Long> { Optional<ComplexoEolico> findByNome(String nome); Optional<ComplexoEolico> findByParquesEolicos(ParqueEolico parqueEolico); }
UTF-8
Java
458
java
ComplexoEolicoRepository.java
Java
[]
null
[]
package api.repository; import api.model.ComplexoEolico; import api.model.ParqueEolico; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; import java.util.Optional; @Service public interface ComplexoEolicoRepository extends JpaRepository<ComplexoEolico, Long> { Optional<ComplexoEolico> findByNome(String nome); Optional<ComplexoEolico> findByParquesEolicos(ParqueEolico parqueEolico); }
458
0.836245
0.836245
14
31.714285
28.355974
87
false
false
0
0
0
0
0
0
0.642857
false
false
14
152f33945a20c7f1cefa1e4857d507cd37d64878
35,974,646,074,980
7ade346ad25a3d8d54fc6079c968f037e280f789
/ordinario_EmilioGalindo/src/main/java/com/mayab/desarrollo/persistencia/DataBaseSelector.java
9c98f8250c0d102b1e45ce0d2ce3437facdae7af
[]
no_license
Galinbro/ordinario_GalindoEmilio
https://github.com/Galinbro/ordinario_GalindoEmilio
1843eb66d2e90f5177bf6ac0c0bba89053397471
67780109d16d91b696c88af58b9a3065b9be3c71
refs/heads/master
2021-07-04T08:26:34.220000
2019-05-24T21:03:20
2019-05-24T21:03:20
188,329,277
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mayab.desarrollo.persistencia; /** * * @author galindo */ public class DataBaseSelector extends DataBaseCreator{ public DataBase createDataBase(String string,String s) { if(string.equalsIgnoreCase("basea")) return new DataBaseA(s); else if(string.equalsIgnoreCase("baseb")) return new DataBaseB(s); else if(string.equalsIgnoreCase("basec")) return new DataBaseC(s); else return null; } }
UTF-8
Java
688
java
DataBaseSelector.java
Java
[ { "context": ".mayab.desarrollo.persistencia;\n\n/**\n *\n * @author galindo\n */\npublic class DataBaseSelector extends DataBas", "end": 254, "score": 0.9960724115371704, "start": 247, "tag": "USERNAME", "value": "galindo" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mayab.desarrollo.persistencia; /** * * @author galindo */ public class DataBaseSelector extends DataBaseCreator{ public DataBase createDataBase(String string,String s) { if(string.equalsIgnoreCase("basea")) return new DataBaseA(s); else if(string.equalsIgnoreCase("baseb")) return new DataBaseB(s); else if(string.equalsIgnoreCase("basec")) return new DataBaseC(s); else return null; } }
688
0.652616
0.652616
25
26.52
23.234663
79
false
false
0
0
0
0
0
0
0.36
false
false
14
f6bc42e480b8e416d6117852a306e6c4b848116b
22,969,485,148,802
598eaea7945290287e96c879a3683b0d59b79447
/codeLearn/src/main/java/com/lyp/learn/base/pk01/StringDemo.java
599327bd5767999d425650478ba13ea6895ba9e1
[]
no_license
liyapu/mytools
https://github.com/liyapu/mytools
8c8ccfa9d333d3a23336e420892c16ac88ffb5ca
c92bc20c328b816d7ececae239d2ee1c8ad67022
refs/heads/master
2023-08-31T00:51:03.254000
2023-08-27T01:41:06
2023-08-27T01:41:06
206,742,268
1
0
null
false
2022-12-16T05:05:39
2019-09-06T07:49:56
2021-12-21T03:03:19
2022-12-16T05:05:39
31,493
1
0
15
Java
false
false
package com.lyp.learn.base.pk01; public class StringDemo { public static void main(String[] args) { String str = "abcaabe fa gMBcabca"; System.out.println("str : " + str); //返回字符串的长度 System.out.println("str.length() : " + str.length()); //返回给定data type类型x参数的字符串表示形式 System.out.println("String.valueOf(100) :" + String.valueOf(100)); //测试此字符串是否以指定的前缀开始 System.out.println("str.startsWith(ab) :" + str.startsWith("ab")); //测试此字符串从指定索引开始的子字符串是否以指定前缀开始 System.out.println("str.startsWith(c,2) :" + str.startsWith("c",2)); //测试此字符串是否以指定的后缀结束 System.out.println("str.endsWith(Aa) : " + str.endsWith("Aa")); //使用默认语言环境的规则将此字符串中所有字符转换成小写后的新串 System.out.println("str.toLowerCase() :" + str.toLowerCase()); //使用默认语言环境的规则将此字符串中所有字符转换成大写后的新串 System.out.println("str.toUpperCase() :" + str.toUpperCase()); //返回一个新的字符串,它是此字符串的一个子字符串 //字符串 str 中字符的索引从0开始,范围为 0 到 str.length()-1 System.out.println("str.substring(2) : " + str.substring(2)); //返回一个新字符串,它是此字符串的一个子字符串 // 使用 substring(beginIndex , endIndex) 进行字符串截取时,包括 beginIndex 位置的字符,不包括 endIndex 位置的字符 System.out.println("str.substring(2,5) : " + str.substring(2,5)); //返回指定索引处的 char 值 System.out.println("str.charAt(1) : " + str.charAt(1)); System.out.println("str.charAt(2) : " + str.charAt(2)); //返回一个新的字符串,它是通过用 newChar 替换此字符串中出现的所有 oldChar 得到的 System.out.println("str.replace('a','A') :" + str.replace('a','A')); System.out.println("str.replace(\"a\",\"A\") :" + str.replace("a","A")); System.out.println("str.replace(\"ca\",\"CA\"): " + str.replace("ca","CA")); //使用给定的 replacement 替换此字符串所有匹配给定的正则表达式的子字符串 System.out.println("str.replaceAll(\"a\",\"A\") :" + str.replaceAll("a","A")); //使用给定的 replacement 替换此字符串匹配给定的正则表达式的第一个子字符串 System.out.println("str.replaceFirst(\"a\",\"A\") : " + str.replaceFirst("a","A")); System.out.println("str.contains(\"aa\") :" + str.contains("aa")); //将指定字符串连接到此字符串的结尾 System.out.println("str.concat(\"PinJie\"):" + str.concat("PinJie")); //使用'+'操作符来连接字符串 //当将一个字符串与一个非字符串的值进行拼接时,后者被转换成字符串( System.out.println("str + \"PinjIe\" : " + str + "PinjIe"); System.out.println("str + 56 : " + str + 56); //返回指定字符在此字符串中第一次出现处的索引 //使用 indexOf 进行字符或字符串查找时,如果匹配返回位置索引;如果没有匹配结果,返回 -1 System.out.println("str.indexOf(98):" + str.indexOf(98)); //返回在此字符串中第一次出现指定字符处的索引,从指定的索引开始搜索 System.out.println("str.indexOf(98,3) :" + str.indexOf(98,3)); System.out.println("str.indexOf(98,20) :" + str.indexOf(98,20)); // 返回指定子字符串在此字符串中第一次出现处的索引 System.out.println("str.indexOf(\"b\") :" + str.indexOf("b")); System.out.println("str.indexOf(\"aa\") :" + str.indexOf("aa")); //返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始 System.out.println("str.indexOf(\"aa\",10) :" + str.indexOf("aa",10)); //返回指定字符在此字符串中最后一次出现处的索引 System.out.println("str.lastIndexOf(99):" + str.lastIndexOf(99)); //返回指定字符在此字符串中最后一次出现处的索引,从指定的索引处开始进行反向搜索 System.out.println("str.lastIndexOf(99,10): " + str.lastIndexOf(99,10)); //返回指定子字符串在此字符串中最右边出现处的索引 System.out.println("str.lastIndexOf(\"M\") :" + str.lastIndexOf("M")); // 返回指定子字符串在此字符串中最后一次出现处的索引,从指定的索引开始反向搜索 System.out.println("str.lastIndexOf(\"M\",10) :" + str.lastIndexOf("M",10)); //使用分隔符|,拼接字符串 System.out.println("String.join(|,a,b,2,3) : " + String.join("|","a","b","2","3")); System.out.println(); String strr = "aBc"; System.out.println("strr : " + strr); //将此字符串与指定的对象比较 System.out.println("strr.equals(abc): " + "abc".equals(strr)); //将此 String 与另一个 String 比较,不考虑大小写 System.out.println("strr.equalsIgnoreCase(abc) : " + "abc".equalsIgnoreCase(strr)); //int compareTo(String other) //按照字典顺序 // 如果字符串位于 other 之前, 返回一个负数; // 如果字符串位于 other 之后,返回一个正数; // 如果两个字符串相等,返回 0 System.out.println("strr.compareTo(abc) : " + strr.compareTo("abc")); //按字典顺序比较两个字符串,不考虑大小写 System.out.println("strr.compareToIgnoreCase(abc) :" + strr.compareToIgnoreCase("abc")); //告知此字符串是否匹配给定的正则表达式 System.out.println(strr.matches("\\w+")); System.out.println(); //PrintStream 的 printf 格式化字符串 System.out.printf("浮点型 %f, 整型变量 %d, 字符串 %s", 6.6F, 100, "test"); System.out.println(); //String 的 format 静态方法格式化字符串 System.out.println(String.format("浮点型 %f, 整型变量 %d, 字符串 %s", 6.6F, 100, "test")); String strBlank = " aa bb c "; System.out.println("strBlank :" + strBlank); //返回字符串的副本,忽略前导空白和尾部空白 System.out.println("strBlank.trim() :" + strBlank.trim()); //根据给定正则表达式的匹配拆分此字符串 //用String[] split(String regex, int limit)进行字符串拆分时, // 如果按字符串没有的字符分隔则不进行分隔,即返回长度为1的数组内容就是原来的字符串 String [] strArr = strBlank.split(""); System.out.println("strArr.length :" + strArr.length); for(String s : strArr){ System.out.println(s); } System.out.println("----------"); String [] strArrr = strBlank.split("\\s+"); System.out.println("strArrr.length :" + strArrr.length); for(String s : strArrr){ System.out.println(s); } System.out.println("---------"); String [] strArrrr = strBlank.split("\\s*"); System.out.println("strArrrr.length : " + strArrrr.length); for(String s : strArrrr){ System.out.println(s); } System.out.println("----------------"); String strArrdemo = " ab Ca a"; // 使用平台的默认字符集将此 String 编码为 byte 序列,并将结果存储到一个新的 byte 数组中 byte[] byteArr = strArrdemo.getBytes(); for(byte b : byteArr){ System.out.println(b); } System.out.println(); //将此字符串转换为一个新的字符数组 char [] charArr = strArrdemo.toCharArray(); for(char c : charArr){ System.out.println(c); } System.out.println(); System.out.println("======================="); /** * intern方法使用:一个初始为空的字符串池,它由类String独自维护 * 当调用 intern方法时,如果池已经包含一个等于此String对象的字符串(用equals(oject)方法确定),则返回池中的字符串 * 否则,将此String对象添加到池中,并返回此String对象的引用 * * 它遵循以下规则:对于任意两个字符串 s 和 t,当且仅当 s.equals(t) 为 true 时,s.intern() == t.intern() 才为 true * * String.intern(); * 再补充介绍一点:存在于.class文件中的常量池,在运行期间被jvm装载,并且可以扩充 * String的intern()方法就是扩充常量池的一个方法; * 当一个String实例str调用intern()方法时,java查找常量池中是否有相同unicode的字符串常量, * 如果有,则返回其引用, * 如果没有,则在常量池中增加一个unicode等于str的字符串并返回它的引用 */ String s0 = "kvill"; String s1 = new String("kvill"); String s2 = new String("kvill"); System.out.println("===========test11============"); System.out.println( s0 == s1 ); //false System.out.println( "**********" ); s1.intern(); //虽然执行了s1.intern(),但它的返回值没有赋给s1 s2 = s2.intern(); //把常量池中"kvill"的引用赋给s2 System.out.println( s0 == s1); //flase System.out.println( s0 == s1.intern() ); //true//说明s1.intern()返回的是常量池中"kvill"的引用 System.out.println( s0 == s2 ); //true } }
UTF-8
Java
9,854
java
StringDemo.java
Java
[]
null
[]
package com.lyp.learn.base.pk01; public class StringDemo { public static void main(String[] args) { String str = "abcaabe fa gMBcabca"; System.out.println("str : " + str); //返回字符串的长度 System.out.println("str.length() : " + str.length()); //返回给定data type类型x参数的字符串表示形式 System.out.println("String.valueOf(100) :" + String.valueOf(100)); //测试此字符串是否以指定的前缀开始 System.out.println("str.startsWith(ab) :" + str.startsWith("ab")); //测试此字符串从指定索引开始的子字符串是否以指定前缀开始 System.out.println("str.startsWith(c,2) :" + str.startsWith("c",2)); //测试此字符串是否以指定的后缀结束 System.out.println("str.endsWith(Aa) : " + str.endsWith("Aa")); //使用默认语言环境的规则将此字符串中所有字符转换成小写后的新串 System.out.println("str.toLowerCase() :" + str.toLowerCase()); //使用默认语言环境的规则将此字符串中所有字符转换成大写后的新串 System.out.println("str.toUpperCase() :" + str.toUpperCase()); //返回一个新的字符串,它是此字符串的一个子字符串 //字符串 str 中字符的索引从0开始,范围为 0 到 str.length()-1 System.out.println("str.substring(2) : " + str.substring(2)); //返回一个新字符串,它是此字符串的一个子字符串 // 使用 substring(beginIndex , endIndex) 进行字符串截取时,包括 beginIndex 位置的字符,不包括 endIndex 位置的字符 System.out.println("str.substring(2,5) : " + str.substring(2,5)); //返回指定索引处的 char 值 System.out.println("str.charAt(1) : " + str.charAt(1)); System.out.println("str.charAt(2) : " + str.charAt(2)); //返回一个新的字符串,它是通过用 newChar 替换此字符串中出现的所有 oldChar 得到的 System.out.println("str.replace('a','A') :" + str.replace('a','A')); System.out.println("str.replace(\"a\",\"A\") :" + str.replace("a","A")); System.out.println("str.replace(\"ca\",\"CA\"): " + str.replace("ca","CA")); //使用给定的 replacement 替换此字符串所有匹配给定的正则表达式的子字符串 System.out.println("str.replaceAll(\"a\",\"A\") :" + str.replaceAll("a","A")); //使用给定的 replacement 替换此字符串匹配给定的正则表达式的第一个子字符串 System.out.println("str.replaceFirst(\"a\",\"A\") : " + str.replaceFirst("a","A")); System.out.println("str.contains(\"aa\") :" + str.contains("aa")); //将指定字符串连接到此字符串的结尾 System.out.println("str.concat(\"PinJie\"):" + str.concat("PinJie")); //使用'+'操作符来连接字符串 //当将一个字符串与一个非字符串的值进行拼接时,后者被转换成字符串( System.out.println("str + \"PinjIe\" : " + str + "PinjIe"); System.out.println("str + 56 : " + str + 56); //返回指定字符在此字符串中第一次出现处的索引 //使用 indexOf 进行字符或字符串查找时,如果匹配返回位置索引;如果没有匹配结果,返回 -1 System.out.println("str.indexOf(98):" + str.indexOf(98)); //返回在此字符串中第一次出现指定字符处的索引,从指定的索引开始搜索 System.out.println("str.indexOf(98,3) :" + str.indexOf(98,3)); System.out.println("str.indexOf(98,20) :" + str.indexOf(98,20)); // 返回指定子字符串在此字符串中第一次出现处的索引 System.out.println("str.indexOf(\"b\") :" + str.indexOf("b")); System.out.println("str.indexOf(\"aa\") :" + str.indexOf("aa")); //返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始 System.out.println("str.indexOf(\"aa\",10) :" + str.indexOf("aa",10)); //返回指定字符在此字符串中最后一次出现处的索引 System.out.println("str.lastIndexOf(99):" + str.lastIndexOf(99)); //返回指定字符在此字符串中最后一次出现处的索引,从指定的索引处开始进行反向搜索 System.out.println("str.lastIndexOf(99,10): " + str.lastIndexOf(99,10)); //返回指定子字符串在此字符串中最右边出现处的索引 System.out.println("str.lastIndexOf(\"M\") :" + str.lastIndexOf("M")); // 返回指定子字符串在此字符串中最后一次出现处的索引,从指定的索引开始反向搜索 System.out.println("str.lastIndexOf(\"M\",10) :" + str.lastIndexOf("M",10)); //使用分隔符|,拼接字符串 System.out.println("String.join(|,a,b,2,3) : " + String.join("|","a","b","2","3")); System.out.println(); String strr = "aBc"; System.out.println("strr : " + strr); //将此字符串与指定的对象比较 System.out.println("strr.equals(abc): " + "abc".equals(strr)); //将此 String 与另一个 String 比较,不考虑大小写 System.out.println("strr.equalsIgnoreCase(abc) : " + "abc".equalsIgnoreCase(strr)); //int compareTo(String other) //按照字典顺序 // 如果字符串位于 other 之前, 返回一个负数; // 如果字符串位于 other 之后,返回一个正数; // 如果两个字符串相等,返回 0 System.out.println("strr.compareTo(abc) : " + strr.compareTo("abc")); //按字典顺序比较两个字符串,不考虑大小写 System.out.println("strr.compareToIgnoreCase(abc) :" + strr.compareToIgnoreCase("abc")); //告知此字符串是否匹配给定的正则表达式 System.out.println(strr.matches("\\w+")); System.out.println(); //PrintStream 的 printf 格式化字符串 System.out.printf("浮点型 %f, 整型变量 %d, 字符串 %s", 6.6F, 100, "test"); System.out.println(); //String 的 format 静态方法格式化字符串 System.out.println(String.format("浮点型 %f, 整型变量 %d, 字符串 %s", 6.6F, 100, "test")); String strBlank = " aa bb c "; System.out.println("strBlank :" + strBlank); //返回字符串的副本,忽略前导空白和尾部空白 System.out.println("strBlank.trim() :" + strBlank.trim()); //根据给定正则表达式的匹配拆分此字符串 //用String[] split(String regex, int limit)进行字符串拆分时, // 如果按字符串没有的字符分隔则不进行分隔,即返回长度为1的数组内容就是原来的字符串 String [] strArr = strBlank.split(""); System.out.println("strArr.length :" + strArr.length); for(String s : strArr){ System.out.println(s); } System.out.println("----------"); String [] strArrr = strBlank.split("\\s+"); System.out.println("strArrr.length :" + strArrr.length); for(String s : strArrr){ System.out.println(s); } System.out.println("---------"); String [] strArrrr = strBlank.split("\\s*"); System.out.println("strArrrr.length : " + strArrrr.length); for(String s : strArrrr){ System.out.println(s); } System.out.println("----------------"); String strArrdemo = " ab Ca a"; // 使用平台的默认字符集将此 String 编码为 byte 序列,并将结果存储到一个新的 byte 数组中 byte[] byteArr = strArrdemo.getBytes(); for(byte b : byteArr){ System.out.println(b); } System.out.println(); //将此字符串转换为一个新的字符数组 char [] charArr = strArrdemo.toCharArray(); for(char c : charArr){ System.out.println(c); } System.out.println(); System.out.println("======================="); /** * intern方法使用:一个初始为空的字符串池,它由类String独自维护 * 当调用 intern方法时,如果池已经包含一个等于此String对象的字符串(用equals(oject)方法确定),则返回池中的字符串 * 否则,将此String对象添加到池中,并返回此String对象的引用 * * 它遵循以下规则:对于任意两个字符串 s 和 t,当且仅当 s.equals(t) 为 true 时,s.intern() == t.intern() 才为 true * * String.intern(); * 再补充介绍一点:存在于.class文件中的常量池,在运行期间被jvm装载,并且可以扩充 * String的intern()方法就是扩充常量池的一个方法; * 当一个String实例str调用intern()方法时,java查找常量池中是否有相同unicode的字符串常量, * 如果有,则返回其引用, * 如果没有,则在常量池中增加一个unicode等于str的字符串并返回它的引用 */ String s0 = "kvill"; String s1 = new String("kvill"); String s2 = new String("kvill"); System.out.println("===========test11============"); System.out.println( s0 == s1 ); //false System.out.println( "**********" ); s1.intern(); //虽然执行了s1.intern(),但它的返回值没有赋给s1 s2 = s2.intern(); //把常量池中"kvill"的引用赋给s2 System.out.println( s0 == s1); //flase System.out.println( s0 == s1.intern() ); //true//说明s1.intern()返回的是常量池中"kvill"的引用 System.out.println( s0 == s2 ); //true } }
9,854
0.5798
0.566028
163
44.435581
24.266678
96
false
false
0
0
0
0
0
0
0.791411
false
false
14
b94c47e4f9b4e5ad7c3eea5fba2b560c55a33c05
22,969,485,147,668
a90ba0d78aa675b006644ffeb1d68c4024e92ad5
/src/main/java/dbGUI/MyTableModel.java
a0e68fb05c82cbd1ebd608dbd60f7dddc2b8d37e
[]
no_license
traitorwtf/mySQL_traitor
https://github.com/traitorwtf/mySQL_traitor
d6c59753c6d3273159831563efed0dc67780dbaf
5009f6584129da24340f52a4559225991771c5d9
refs/heads/master
2021-01-18T22:49:44.449000
2017-08-16T16:53:43
2017-08-16T16:53:43
87,076,197
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dbGUI; import javax.swing.table.AbstractTableModel; import java.util.ArrayList; /** * Created by traitorwtf on 05.04.2017. */ public class MyTableModel extends AbstractTableModel{ private final int NAME_COLUMN = 0; private final int SURNAME_COLUMN = 1; private final int AGE_COLUMN = 2; private final int CITY_COLUMN = 3; private ArrayList<User> users; String [] columnNames = {"Name", "Surname", "Age", "City"}; MyTableModel(ArrayList<User> users){ this.users = users; } public int getRowCount() { return users.size(); } public int getColumnCount() { return columnNames.length; } public Object getValueAt(int rowIndex, int columnIndex) { User tempUser = users.get(rowIndex); switch (columnIndex){ case (NAME_COLUMN): return tempUser.getName(); case (SURNAME_COLUMN): return tempUser.getSurname(); case (AGE_COLUMN): return tempUser.getAge(); case (CITY_COLUMN): return tempUser.getCity(); default: return tempUser.getAge(); } } @Override public String getColumnName(int column) { return columnNames[column]; } }
UTF-8
Java
1,216
java
MyTableModel.java
Java
[ { "context": "el;\nimport java.util.ArrayList;\n\n/**\n * Created by traitorwtf on 05.04.2017.\n */\npublic class MyTableModel exte", "end": 118, "score": 0.9996208548545837, "start": 108, "tag": "USERNAME", "value": "traitorwtf" } ]
null
[]
package dbGUI; import javax.swing.table.AbstractTableModel; import java.util.ArrayList; /** * Created by traitorwtf on 05.04.2017. */ public class MyTableModel extends AbstractTableModel{ private final int NAME_COLUMN = 0; private final int SURNAME_COLUMN = 1; private final int AGE_COLUMN = 2; private final int CITY_COLUMN = 3; private ArrayList<User> users; String [] columnNames = {"Name", "Surname", "Age", "City"}; MyTableModel(ArrayList<User> users){ this.users = users; } public int getRowCount() { return users.size(); } public int getColumnCount() { return columnNames.length; } public Object getValueAt(int rowIndex, int columnIndex) { User tempUser = users.get(rowIndex); switch (columnIndex){ case (NAME_COLUMN): return tempUser.getName(); case (SURNAME_COLUMN): return tempUser.getSurname(); case (AGE_COLUMN): return tempUser.getAge(); case (CITY_COLUMN): return tempUser.getCity(); default: return tempUser.getAge(); } } @Override public String getColumnName(int column) { return columnNames[column]; } }
1,216
0.633224
0.623355
46
25.434782
21.351767
64
false
false
0
0
0
0
0
0
0.5
false
false
14
9b306457f73cacaef497b33f7fb01e52ecade638
670,014,913,911
8a1be00995a308826af110a107b3e1befb17423b
/CoraJet/src/test/java/com/coradec/corajet/cldr/ctrl/Test3.java
15ae7655bf35569db8efcfbe9402043d3bba7c0d
[]
no_license
freedio/coradeck
https://github.com/freedio/coradeck
8014de125cdf96803fd9141a533a6ce22dc5572d
0fb39d616688e360356bda091f53eea55a0db007
refs/heads/master
2021-01-22T04:18:09.306000
2017-10-22T20:00:39
2017-10-22T20:00:39
92,449,506
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright ⓒ 2017 by Coradec GmbH. * * This file is part of the Coradeck. * * Coradeck is free software: you can redistribute it under the the terms of the GNU General * Public License as published by the Free Software Foundation, either version 3 of the License, * or any later version. * * Coradeck is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR ANY PARTICULAR PURPOSE. See the * GNU General Public License for further details. * * The GNU General Public License is available from <http://www.gnu.org/licenses/>. * * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> * @author Dominik Wezel <dom@coradec.com> * */ package com.coradec.corajet.cldr.ctrl; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.*; import com.coradec.coracore.annotation.Inject; import com.coradec.corajet.cldr.data.MultiGenericInterface; /** * ​​CarClassLoader and injector test with generic class injection with several type parameters. */ @SuppressWarnings("ClassHasNoToStringMethod") public class Test3 { @Inject private MultiGenericInterface<Integer, String> cis; @Inject private MultiGenericInterface<String, Double> csi; public static void main(String... args) { new Test3().launch(); } private void launch() { assertThat(cis.value(13), is(equalTo("13"))); assertThat(csi.value("3.141592654"), is(equalTo(3.141592654))); } }
UTF-8
Java
1,541
java
Test3.java
Java
[ { "context": ".0+ <http://spdx.org/licenses/GPL-3.0+>\n * @author Dominik Wezel <dom@coradec.com>\n *\n */\n\npackage com.coradec.cor", "end": 717, "score": 0.9998510479927063, "start": 704, "tag": "NAME", "value": "Dominik Wezel" }, { "context": ".org/licenses/GPL-3.0+>\n * @author Dominik Wezel <dom@coradec.com>\n *\n */\n\npackage com.coradec.corajet.cldr.ctrl;\n\n", "end": 734, "score": 0.999930739402771, "start": 719, "tag": "EMAIL", "value": "dom@coradec.com" } ]
null
[]
/* * Copyright ⓒ 2017 by Coradec GmbH. * * This file is part of the Coradeck. * * Coradeck is free software: you can redistribute it under the the terms of the GNU General * Public License as published by the Free Software Foundation, either version 3 of the License, * or any later version. * * Coradeck is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR ANY PARTICULAR PURPOSE. See the * GNU General Public License for further details. * * The GNU General Public License is available from <http://www.gnu.org/licenses/>. * * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> * @author <NAME> <<EMAIL>> * */ package com.coradec.corajet.cldr.ctrl; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.*; import com.coradec.coracore.annotation.Inject; import com.coradec.corajet.cldr.data.MultiGenericInterface; /** * ​​CarClassLoader and injector test with generic class injection with several type parameters. */ @SuppressWarnings("ClassHasNoToStringMethod") public class Test3 { @Inject private MultiGenericInterface<Integer, String> cis; @Inject private MultiGenericInterface<String, Double> csi; public static void main(String... args) { new Test3().launch(); } private void launch() { assertThat(cis.value(13), is(equalTo("13"))); assertThat(csi.value("3.141592654"), is(equalTo(3.141592654))); } }
1,526
0.723127
0.700326
49
30.32653
31.433369
96
false
false
0
0
0
0
0
0
0.367347
false
false
14
5d994b61e4ce4d99fc9be09ee14b1a2862c9636c
5,162,550,719,798
a75fe697073dc6169e6d78d13e26ffa08e23dd83
/Primes/src/Primes.java
7ca6e651e73283bf5e9d72261ee56428e24c19b9
[]
no_license
JidarofaBiz/qa-swd-assignments
https://github.com/JidarofaBiz/qa-swd-assignments
c86bf50f5d6f454b10622e9a0e4d7b2069f8d7fc
c4f20bd0a43064963d8bed3c85c6161f95646321
refs/heads/master
2020-03-20T11:12:39.426000
2018-06-20T03:13:33
2018-06-20T03:13:33
137,396,174
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.List; import java.util.ArrayList; public class Primes { public static void main (String[] args) { CircularPrimes primes = new CircularPrimes(); List<Integer> list = new ArrayList<>(); list = primes.saveCircularPrimes(1000000); double begin = System.nanoTime(); for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } System.out.println("-----------------------"); System.out.println("Total circulars primes:"); System.out.println(list.size()); double end = System.nanoTime(); double result = end - begin; System.out.println("-----------------------"); System.out.println("Tiempo total ejecución"); System.out.println(result); } }
WINDOWS-1250
Java
756
java
Primes.java
Java
[]
null
[]
import java.util.List; import java.util.ArrayList; public class Primes { public static void main (String[] args) { CircularPrimes primes = new CircularPrimes(); List<Integer> list = new ArrayList<>(); list = primes.saveCircularPrimes(1000000); double begin = System.nanoTime(); for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } System.out.println("-----------------------"); System.out.println("Total circulars primes:"); System.out.println(list.size()); double end = System.nanoTime(); double result = end - begin; System.out.println("-----------------------"); System.out.println("Tiempo total ejecución"); System.out.println(result); } }
756
0.592053
0.581457
31
22.354839
18.733355
48
false
false
0
0
0
0
0
0
2.129032
false
false
14
89084aef59cd876216dee5dfda2f940652645d3d
10,058,813,409,759
479bdbbe022f68703adfdf8088f247cba3687628
/RType/code/java/model/Component.java
75c0523c8538807a175e062ccd30758bcecdc03e
[]
no_license
abhean/jooprtype
https://github.com/abhean/jooprtype
bd85458d4c9b3211a2d88972cd53b93ce98a0776
5181abef0efad2235ab39bb669a8178daa8f4eac
refs/heads/master
2020-04-07T05:15:56.503000
2013-05-30T19:09:36
2013-05-30T19:09:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; /** * */ /** * @author kique * */ public interface Component { /** * * @param componentDef */ public void init(Entity entity, ComponentDef componentDef); /** * */ public void dispose(); /** * * @param timeDelta */ public void update(final float timeDelta); /** * */ public Entity getEntity(); /** * * @return */ public Class<? extends Component> getComponentType(); }
UTF-8
Java
443
java
Component.java
Java
[ { "context": "package model;\n/**\n * \n */\n\n/**\n * @author kique\n *\n */\npublic interface Component\n{\n\t/**\n\t * \n\t *", "end": 48, "score": 0.9995708465576172, "start": 43, "tag": "USERNAME", "value": "kique" } ]
null
[]
package model; /** * */ /** * @author kique * */ public interface Component { /** * * @param componentDef */ public void init(Entity entity, ComponentDef componentDef); /** * */ public void dispose(); /** * * @param timeDelta */ public void update(final float timeDelta); /** * */ public Entity getEntity(); /** * * @return */ public Class<? extends Component> getComponentType(); }
443
0.564334
0.564334
41
9.804878
14.104522
60
false
false
0
0
0
0
0
0
0.878049
false
false
14
a495f21589b3fbe0e78ec92d3337e7172f6da8d6
21,835,613,736,459
3cda00fde05e0aa1a27de1216ea3a62b0824ef91
/112301.App.java
84aa32d17c43a8854559afb2c23b7e7eb5daa7ed
[]
no_license
lyq33323/xiaolan
https://github.com/lyq33323/xiaolan
bda113d7640dd515ebd58b468dc5c9af131e87ce
58b3a0d3ee5d756ccfa046dcc42ed7558bea4c58
refs/heads/main
2023-01-30T11:41:41.819000
2020-12-14T07:32:37
2020-12-14T07:32:37
314,547,541
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pak; import java.util.Scanner; public class Lo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); while (true) { int user_num = scn.nextInt(); if (user_num == 1) { System.out.println("R(" + (int) (Math.random() * 100) + "," + (int) (Math.random() * 100) + ")"); } } } }
UTF-8
Java
403
java
112301.App.java
Java
[]
null
[]
package pak; import java.util.Scanner; public class Lo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); while (true) { int user_num = scn.nextInt(); if (user_num == 1) { System.out.println("R(" + (int) (Math.random() * 100) + "," + (int) (Math.random() * 100) + ")"); } } } }
403
0.560794
0.543424
23
16.52174
17.682882
63
false
false
0
0
0
0
0
0
1.652174
false
false
14
415f3f1b075655d4b2ce8559ffc80a623a211c27
2,680,059,628,641
a51a3a3271d36096071c56edf2c42bd2f9a2d3d6
/Code/supportMe/src/main/java/org/supportmeinc/View/marTest.java
952bca1372c54c1831a77a82ec3b5a0679dde626
[]
no_license
AhmadToron/supportMe
https://github.com/AhmadToron/supportMe
086ad5b647de39a9bb378d45cf5a375f3a87462d
2fca0d1ef850efc228856b293ed3ae4f5d34b751
refs/heads/main
2023-04-01T09:54:27.374000
2021-03-22T14:36:13
2021-03-22T14:36:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.supportmeinc.View;public class marTest { }
UTF-8
Java
55
java
marTest.java
Java
[]
null
[]
package org.supportmeinc.View;public class marTest { }
55
0.8
0.8
2
26.5
25.5
52
false
false
0
0
0
0
0
0
0.5
false
false
14
2e8955ee054d26f0bcf140ee06a8230c71e442c4
2,310,692,429,687
ba0911593d96a310d60220b564716193912263d6
/app/src/main/java/practicum/getfitla_v3/ExerciseItemFormat.java
d2e6f704eda512868482f99b5f046b238a053366
[]
no_license
thepynetree/GetFitLA
https://github.com/thepynetree/GetFitLA
ee8e4b69c68d40ae45e9add2e13beefe7523395d
546305040e12a213bcb267f60380b7c35de56e04
refs/heads/master
2020-03-31T01:40:40.198000
2018-05-09T05:25:42
2018-05-09T05:25:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package practicum.getfitla_v3; import android.os.Parcel; import android.os.Parcelable; //Formats Information to be easily called public class ExerciseItemFormat implements Parcelable { private int id; private String name; private String shortdesc; private String isboolean; // TODO change this name private String equipment; private String instructions; private String image; public ExerciseItemFormat(int id, String name, String shortdesc, String isboolean, String equipment, String instructions, String image) { this.id = id; this.name = name; this.shortdesc = shortdesc; this.isboolean = isboolean; this.equipment = equipment; this.instructions = instructions; this.image = image; } public int getId() { return id; } public String getName() { return name; } public String getShortdesc() { return shortdesc; } public String getIsboolean() { return isboolean; } public String getEquipment() { return equipment; } public String getInstructions() { return instructions; } public String getImage() { return image; } //begin parcel stuff @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.id); dest.writeString(this.name); dest.writeString(this.shortdesc); dest.writeString(this.isboolean); dest.writeString(this.equipment); dest.writeString(this.instructions); dest.writeString(this.image); } protected ExerciseItemFormat(Parcel in) { this.id = in.readInt(); this.name = in.readString(); this.shortdesc = in.readString(); this.isboolean = in.readString(); this.equipment = in.readString(); this.instructions = in.readString(); this.image = in.readString(); } public static final Parcelable.Creator<ExerciseItemFormat> CREATOR = new Parcelable.Creator<ExerciseItemFormat>() { @Override public ExerciseItemFormat createFromParcel(Parcel source) { return new ExerciseItemFormat(source); } @Override public ExerciseItemFormat[] newArray(int size) { return new ExerciseItemFormat[size]; } }; }
UTF-8
Java
2,455
java
ExerciseItemFormat.java
Java
[]
null
[]
package practicum.getfitla_v3; import android.os.Parcel; import android.os.Parcelable; //Formats Information to be easily called public class ExerciseItemFormat implements Parcelable { private int id; private String name; private String shortdesc; private String isboolean; // TODO change this name private String equipment; private String instructions; private String image; public ExerciseItemFormat(int id, String name, String shortdesc, String isboolean, String equipment, String instructions, String image) { this.id = id; this.name = name; this.shortdesc = shortdesc; this.isboolean = isboolean; this.equipment = equipment; this.instructions = instructions; this.image = image; } public int getId() { return id; } public String getName() { return name; } public String getShortdesc() { return shortdesc; } public String getIsboolean() { return isboolean; } public String getEquipment() { return equipment; } public String getInstructions() { return instructions; } public String getImage() { return image; } //begin parcel stuff @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.id); dest.writeString(this.name); dest.writeString(this.shortdesc); dest.writeString(this.isboolean); dest.writeString(this.equipment); dest.writeString(this.instructions); dest.writeString(this.image); } protected ExerciseItemFormat(Parcel in) { this.id = in.readInt(); this.name = in.readString(); this.shortdesc = in.readString(); this.isboolean = in.readString(); this.equipment = in.readString(); this.instructions = in.readString(); this.image = in.readString(); } public static final Parcelable.Creator<ExerciseItemFormat> CREATOR = new Parcelable.Creator<ExerciseItemFormat>() { @Override public ExerciseItemFormat createFromParcel(Parcel source) { return new ExerciseItemFormat(source); } @Override public ExerciseItemFormat[] newArray(int size) { return new ExerciseItemFormat[size]; } }; }
2,455
0.628513
0.627699
93
25.408602
22.13703
120
false
false
0
0
0
0
0
0
0.526882
false
false
14
b88bf3d87e08801aa5a05da7fa2ca8a85d156628
386,547,073,885
75a2ba9648320159c141c17b92fee88f5585a761
/src/main/java/com/yuankui/java/test/javademo/crawler/plugin/output/UrlOutput.java
b476a3d20f9fa76e89558b0ebf25e536469c54cd
[]
no_license
yuankui/java-demo
https://github.com/yuankui/java-demo
fe9cd7902607d5ea1ec16d64491c96ae1be53abd
12a026c34a8ee4bdaa2379589342d52437730e35
refs/heads/master
2022-10-12T11:46:52.567000
2021-09-27T02:40:12
2021-09-27T02:40:12
164,274,036
0
0
null
false
2022-09-16T21:05:57
2019-01-06T04:08:37
2021-09-27T02:40:23
2022-09-16T21:05:57
217
0
0
5
Java
false
false
package com.yuankui.java.test.javademo.crawler.plugin.output; import com.yuankui.java.test.javademo.crawler.Context; import com.yuankui.java.test.javademo.crawler.Prototype; import com.yuankui.java.test.javademo.crawler.pipeline.Dataset; import com.yuankui.java.test.javademo.crawler.pipeline.Input; import com.yuankui.java.test.javademo.crawler.pipeline.IteratorDataset; import com.yuankui.java.test.javademo.crawler.pipeline.Output; import org.springframework.beans.factory.annotation.Autowired; import java.util.Iterator; import java.util.Queue; @Prototype public class UrlOutput implements Output<Context, Object> { @Autowired private Queue<Context> queue; @Override public void output(Context context) { queue.add(context.clone()); } }
UTF-8
Java
782
java
UrlOutput.java
Java
[]
null
[]
package com.yuankui.java.test.javademo.crawler.plugin.output; import com.yuankui.java.test.javademo.crawler.Context; import com.yuankui.java.test.javademo.crawler.Prototype; import com.yuankui.java.test.javademo.crawler.pipeline.Dataset; import com.yuankui.java.test.javademo.crawler.pipeline.Input; import com.yuankui.java.test.javademo.crawler.pipeline.IteratorDataset; import com.yuankui.java.test.javademo.crawler.pipeline.Output; import org.springframework.beans.factory.annotation.Autowired; import java.util.Iterator; import java.util.Queue; @Prototype public class UrlOutput implements Output<Context, Object> { @Autowired private Queue<Context> queue; @Override public void output(Context context) { queue.add(context.clone()); } }
782
0.782609
0.782609
24
31.583334
25.403275
71
false
false
0
0
0
0
0
0
0.541667
false
false
14
4268fff01d223f6f56d10df35f977eb39f76db96
1,984,274,914,609
21293dc0f750686a81ae04eae55c526894eb611a
/class JAVA/Ass10/Q1.java
68c52af47b946b7ba4e24585cc6877513b8a1586
[]
no_license
kaphleyy/Backup
https://github.com/kaphleyy/Backup
2f1dfb8d63af55c7d00a241ab8e66a93cd723cf4
844e48fe8ea37c0f255f2acd8a984f96740a37ba
refs/heads/main
2023-02-02T08:35:28.429000
2020-12-15T15:18:02
2020-12-15T15:18:02
321,707,004
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Ass10; import java.util.StringTokenizer; /** * Q1 */ public class Q1 { public static void main(String[] args) { String s = "THIS IS |A TEST, string for, string |tokenizer, class "; StringTokenizer token = new StringTokenizer(s , "|,"); while(token.hasMoreTokens()) { System.out.println(token.nextToken()); } } }
UTF-8
Java
378
java
Q1.java
Java
[]
null
[]
package Ass10; import java.util.StringTokenizer; /** * Q1 */ public class Q1 { public static void main(String[] args) { String s = "THIS IS |A TEST, string for, string |tokenizer, class "; StringTokenizer token = new StringTokenizer(s , "|,"); while(token.hasMoreTokens()) { System.out.println(token.nextToken()); } } }
378
0.595238
0.584656
19
18.947369
23.399221
76
false
false
0
0
0
0
0
0
0.684211
false
false
14
728037e21c76c10b7e4943271aa61bd24ee1c8f5
11,776,800,333,138
ff817735927fec71706f2d8a24953791df82fd3b
/src/main/java/com/pdale/code/MyRoute.java
333eecf185b280847f188e70dfce0328c3d58e55
[]
no_license
PatrickDale/CamelSpring
https://github.com/PatrickDale/CamelSpring
121aa37cc0a82edbf012cf162a8c14e8d85298ed
5e5b027fa59722208aa6ab4f593af8f4c0cf4a45
refs/heads/master
2021-01-11T01:50:25.033000
2016-10-13T22:10:15
2016-10-13T22:10:15
70,850,277
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pdale.code; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; @Component public class MyRoute extends RouteBuilder { public void configure() throws Exception { from("test-jms:queue:test.queueme").to("file://test"); from("test-jms:queue:name.queue").to("http://localhost:8080/"); } }
UTF-8
Java
367
java
MyRoute.java
Java
[]
null
[]
package com.pdale.code; import org.apache.camel.builder.RouteBuilder; import org.springframework.stereotype.Component; @Component public class MyRoute extends RouteBuilder { public void configure() throws Exception { from("test-jms:queue:test.queueme").to("file://test"); from("test-jms:queue:name.queue").to("http://localhost:8080/"); } }
367
0.713896
0.702997
13
27.23077
25.106401
71
false
false
0
0
0
0
0
0
0.384615
false
false
14
eb03c67b23fe4d6285c4a148171f33c20c4234e8
20,607,253,138,662
2d05bccb70272f36e59e5d90681adcf75c68f1f7
/app/src/main/java/com/lentimosystems/licio/safariguides/Fragments/CruisersFragment.java
3e47edff3a50727e224c536a9837a45a7008faa3
[]
no_license
Dun-Njuguna/SafariGuides
https://github.com/Dun-Njuguna/SafariGuides
6acf2ae329415b702bbd50a2fb7e3f3375c2b81f
921d1b6d766fe83661eab5b0ea071032ca6ee415
refs/heads/master
2020-05-30T04:35:47.429000
2019-06-13T12:24:24
2019-06-13T12:24:24
189,542,223
0
0
null
true
2019-05-31T06:44:01
2019-05-31T06:43:56
2019-05-31T06:43:59
2019-05-30T08:20:31
305
0
0
0
Java
false
false
package com.lentimosystems.licio.safariguides.Fragments; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.firebase.ui.database.FirebaseRecyclerOptions; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.lentimosystems.licio.safariguides.Common.Common; import com.lentimosystems.licio.safariguides.CruiserDetailActivity; import com.lentimosystems.licio.safariguides.Interface.ItemClickListener; import com.lentimosystems.licio.safariguides.Models.VansItem; import com.lentimosystems.licio.safariguides.R; import com.lentimosystems.licio.safariguides.ViewHolder.CruisersViewHolder; import com.lentimosystems.licio.safariguides.ViewHolder.VansViewHolder; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; /** * A simple {@link Fragment} subclass. */ public class CruisersFragment extends Fragment { FirebaseDatabase database; DatabaseReference cruisersData; FirebaseRecyclerOptions<VansItem> options; FirebaseRecyclerAdapter<VansItem, CruisersViewHolder> adapter; RecyclerView recyclerView; private static CruisersFragment INSTANCE=null; public CruisersFragment() { database = FirebaseDatabase.getInstance(); cruisersData = database.getReference(Common.STR_CRUISERS_BACKGROUND); options = new FirebaseRecyclerOptions.Builder<VansItem>() .setQuery(cruisersData,VansItem.class) .build(); adapter = new FirebaseRecyclerAdapter<VansItem, CruisersViewHolder>(options) { @Override protected void onBindViewHolder(@NonNull final CruisersViewHolder holder, int position, @NonNull final VansItem model) { Picasso.get() .load(model.getCar_image()) .networkPolicy(NetworkPolicy.OFFLINE) .into(holder.background_image, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Picasso.get() .load(model.getCar_image()) .error(R.drawable.ic_terrain_black_24dp) .into(holder.background_image, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Log.e("Error","Couldn't fetch image"); } }); } }); holder.cruiser_name.setText(model.getNumber_plate()); holder.setItemClickListener(new ItemClickListener() { @Override public void onclick(View view, int position, boolean isLongClick) { Intent intent = new Intent(getActivity(), CruiserDetailActivity.class); intent.putExtra("cruiserId", adapter.getRef(position).getKey()); startActivity(intent); } }); } @NonNull @Override public CruisersViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.layout_van_item,parent,false); return new CruisersViewHolder(itemView); } }; } public static CruisersFragment getInstance(){ if (INSTANCE==null) INSTANCE = new CruisersFragment(); return INSTANCE; } @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_cruisers, container, false); recyclerView = (RecyclerView)view.findViewById(R.id.recycler_cruisers); recyclerView.setHasFixedSize(true); GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2); recyclerView.setLayoutManager(gridLayoutManager); setVans(); return view; } private void setVans() { adapter.startListening(); recyclerView.setAdapter(adapter); } @Override public void onStart() { super.onStart(); if (adapter!=null) adapter.startListening(); } @Override public void onStop() { if (adapter!=null) adapter.stopListening(); super.onStop(); } @Override public void onResume() { super.onResume(); if (adapter!=null) adapter.startListening(); } }
UTF-8
Java
5,727
java
CruisersFragment.java
Java
[]
null
[]
package com.lentimosystems.licio.safariguides.Fragments; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.firebase.ui.database.FirebaseRecyclerAdapter; import com.firebase.ui.database.FirebaseRecyclerOptions; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.lentimosystems.licio.safariguides.Common.Common; import com.lentimosystems.licio.safariguides.CruiserDetailActivity; import com.lentimosystems.licio.safariguides.Interface.ItemClickListener; import com.lentimosystems.licio.safariguides.Models.VansItem; import com.lentimosystems.licio.safariguides.R; import com.lentimosystems.licio.safariguides.ViewHolder.CruisersViewHolder; import com.lentimosystems.licio.safariguides.ViewHolder.VansViewHolder; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; /** * A simple {@link Fragment} subclass. */ public class CruisersFragment extends Fragment { FirebaseDatabase database; DatabaseReference cruisersData; FirebaseRecyclerOptions<VansItem> options; FirebaseRecyclerAdapter<VansItem, CruisersViewHolder> adapter; RecyclerView recyclerView; private static CruisersFragment INSTANCE=null; public CruisersFragment() { database = FirebaseDatabase.getInstance(); cruisersData = database.getReference(Common.STR_CRUISERS_BACKGROUND); options = new FirebaseRecyclerOptions.Builder<VansItem>() .setQuery(cruisersData,VansItem.class) .build(); adapter = new FirebaseRecyclerAdapter<VansItem, CruisersViewHolder>(options) { @Override protected void onBindViewHolder(@NonNull final CruisersViewHolder holder, int position, @NonNull final VansItem model) { Picasso.get() .load(model.getCar_image()) .networkPolicy(NetworkPolicy.OFFLINE) .into(holder.background_image, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Picasso.get() .load(model.getCar_image()) .error(R.drawable.ic_terrain_black_24dp) .into(holder.background_image, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Log.e("Error","Couldn't fetch image"); } }); } }); holder.cruiser_name.setText(model.getNumber_plate()); holder.setItemClickListener(new ItemClickListener() { @Override public void onclick(View view, int position, boolean isLongClick) { Intent intent = new Intent(getActivity(), CruiserDetailActivity.class); intent.putExtra("cruiserId", adapter.getRef(position).getKey()); startActivity(intent); } }); } @NonNull @Override public CruisersViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.layout_van_item,parent,false); return new CruisersViewHolder(itemView); } }; } public static CruisersFragment getInstance(){ if (INSTANCE==null) INSTANCE = new CruisersFragment(); return INSTANCE; } @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_cruisers, container, false); recyclerView = (RecyclerView)view.findViewById(R.id.recycler_cruisers); recyclerView.setHasFixedSize(true); GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),2); recyclerView.setLayoutManager(gridLayoutManager); setVans(); return view; } private void setVans() { adapter.startListening(); recyclerView.setAdapter(adapter); } @Override public void onStart() { super.onStart(); if (adapter!=null) adapter.startListening(); } @Override public void onStop() { if (adapter!=null) adapter.stopListening(); super.onStop(); } @Override public void onResume() { super.onResume(); if (adapter!=null) adapter.startListening(); } }
5,727
0.593854
0.592806
157
35.477707
27.826025
132
false
false
0
0
0
0
0
0
0.528662
false
false
15
b72146059ce91ff4e52d03289644937cc4005834
18,365,280,222,886
170aba5d3492e7c37ffbbab60d39136aa093f701
/app/src/main/java/com/example/bitmani/carbook/SearchRideResultAdapter.java
97c2547ff7902b763309e1dd5fb2ac9369f3a229
[]
no_license
M2do/CarBook
https://github.com/M2do/CarBook
1fc700dc63919b3d2bb22206488801c0a5894e84
b63d4075f6ccddaf5ae4a6462186b0f852ab8c60
refs/heads/master
2020-04-03T06:45:03.864000
2018-11-09T06:19:33
2018-11-09T06:19:33
155,083,131
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bitmani.carbook; import android.content.Context; import android.support.annotation.NonNull; import android.support.constraint.ConstraintLayout; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import java.util.ArrayList; import de.hdodenhof.circleimageview.CircleImageView; public class SearchRideResultAdapter extends RecyclerView.Adapter<SearchRideResultAdapter.ViewHolder> { private static final String TAG = "SearchRideResultAdapter"; private Context mContext; private ArrayList<String> mImages = new ArrayList<>(); private ArrayList<String> mName = new ArrayList<>(); private ArrayList<String> mPhone = new ArrayList<>(); private ArrayList<String> mFrom = new ArrayList<>(); private ArrayList<String> mTo = new ArrayList<>(); private ArrayList<String> mDate = new ArrayList<>(); private ArrayList<String> mTime = new ArrayList<>(); public SearchRideResultAdapter(Context mContext, ArrayList<String> mImages, ArrayList<String> mName, ArrayList<String> mPhone, ArrayList<String> mFrom, ArrayList<String> mTo, ArrayList<String> mDate, ArrayList<String> mTime) { this.mContext = mContext; this.mImages = mImages; this.mName = mName; this.mPhone = mPhone; this.mFrom = mFrom; this.mTo = mTo; this.mDate = mDate; this.mTime = mTime; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.ride_search_results, viewGroup, false); ViewHolder holder = new ViewHolder(view); return holder; } @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { Log.d(TAG,"OnBindViewHolder : called"); Glide.with(mContext) .asBitmap() .load(mImages.get(i)) .into(viewHolder.image); viewHolder.name.setText(mName.get(i)); viewHolder.phone.setText(mPhone.get(i)); viewHolder.from.setText(mFrom.get(i)); viewHolder.to.setText(mTo.get(i)); viewHolder.date.setText(mDate.get(i)); viewHolder.time.setText(mTime.get(i)); viewHolder.parentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Item Clicked"); } }); } @Override public int getItemCount() { return mImages.size(); } public class ViewHolder extends RecyclerView.ViewHolder { ImageView image; TextView name; TextView phone; TextView from; TextView to; TextView date; TextView time; Button bookCar; ConstraintLayout parentLayout; public ViewHolder(@NonNull View itemView) { super(itemView); name = itemView.findViewById(R.id.owner_name); phone = itemView.findViewById(R.id.owner_phone_number); image = itemView.findViewById(R.id.circular_image_id); from = itemView.findViewById(R.id.recycler_view_from_text); to = itemView.findViewById(R.id.recycler_view_to_text); date = itemView.findViewById(R.id.recycler_view_date); time = itemView.findViewById(R.id.recycler_view_time); bookCar = itemView.findViewById(R.id.book_button_id); parentLayout = itemView.findViewById(R.id.search_ride_parent_layout); bookCar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //..send notification } }); } } }
UTF-8
Java
4,047
java
SearchRideResultAdapter.java
Java
[ { "context": "package com.example.bitmani.carbook;\n\nimport android.content.Context;\nimport ", "end": 27, "score": 0.714606523513794, "start": 20, "tag": "USERNAME", "value": "bitmani" } ]
null
[]
package com.example.bitmani.carbook; import android.content.Context; import android.support.annotation.NonNull; import android.support.constraint.ConstraintLayout; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.bumptech.glide.Glide; import java.util.ArrayList; import de.hdodenhof.circleimageview.CircleImageView; public class SearchRideResultAdapter extends RecyclerView.Adapter<SearchRideResultAdapter.ViewHolder> { private static final String TAG = "SearchRideResultAdapter"; private Context mContext; private ArrayList<String> mImages = new ArrayList<>(); private ArrayList<String> mName = new ArrayList<>(); private ArrayList<String> mPhone = new ArrayList<>(); private ArrayList<String> mFrom = new ArrayList<>(); private ArrayList<String> mTo = new ArrayList<>(); private ArrayList<String> mDate = new ArrayList<>(); private ArrayList<String> mTime = new ArrayList<>(); public SearchRideResultAdapter(Context mContext, ArrayList<String> mImages, ArrayList<String> mName, ArrayList<String> mPhone, ArrayList<String> mFrom, ArrayList<String> mTo, ArrayList<String> mDate, ArrayList<String> mTime) { this.mContext = mContext; this.mImages = mImages; this.mName = mName; this.mPhone = mPhone; this.mFrom = mFrom; this.mTo = mTo; this.mDate = mDate; this.mTime = mTime; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.ride_search_results, viewGroup, false); ViewHolder holder = new ViewHolder(view); return holder; } @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { Log.d(TAG,"OnBindViewHolder : called"); Glide.with(mContext) .asBitmap() .load(mImages.get(i)) .into(viewHolder.image); viewHolder.name.setText(mName.get(i)); viewHolder.phone.setText(mPhone.get(i)); viewHolder.from.setText(mFrom.get(i)); viewHolder.to.setText(mTo.get(i)); viewHolder.date.setText(mDate.get(i)); viewHolder.time.setText(mTime.get(i)); viewHolder.parentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Item Clicked"); } }); } @Override public int getItemCount() { return mImages.size(); } public class ViewHolder extends RecyclerView.ViewHolder { ImageView image; TextView name; TextView phone; TextView from; TextView to; TextView date; TextView time; Button bookCar; ConstraintLayout parentLayout; public ViewHolder(@NonNull View itemView) { super(itemView); name = itemView.findViewById(R.id.owner_name); phone = itemView.findViewById(R.id.owner_phone_number); image = itemView.findViewById(R.id.circular_image_id); from = itemView.findViewById(R.id.recycler_view_from_text); to = itemView.findViewById(R.id.recycler_view_to_text); date = itemView.findViewById(R.id.recycler_view_date); time = itemView.findViewById(R.id.recycler_view_time); bookCar = itemView.findViewById(R.id.book_button_id); parentLayout = itemView.findViewById(R.id.search_ride_parent_layout); bookCar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //..send notification } }); } } }
4,047
0.654312
0.654065
120
32.724998
30.747618
230
false
false
0
0
0
0
0
0
0.666667
false
false
15
5f6a4f718b25eaa3d0c2f314ba8e0710b481cc05
17,970,143,226,085
4c5e2354a87598a05d0c6314088e8c429193d06f
/src/mygame/Interceptor.java
ed21df4d58fb2e1c78f8eb027ae1c8938d1b49d9
[]
no_license
andstewart14/MyGame
https://github.com/andstewart14/MyGame
e6031c925f8a40089e31e02e234bc6aca7cd1e54
cabe890feae2e78346f0bba96029c9a8bfb7eacd
refs/heads/master
2020-03-18T13:09:28.954000
2018-05-24T20:15:20
2018-05-24T20:15:20
134,764,286
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mygame; import jgame.JGObject; class Interceptor extends JGObject implements MyGameValues { int timer = 0; int Health = 3; Interceptor(double x, double y) { // This is the call to the JG OBject constructor. There are many constructors // you can use for JG objects. This one is as follows: // Name, Unique ID?, xPos, yPos, cid, graphic, xspeed, yspeed, expiry) super("Bomber",true,x,y+350,enemyCollisionID,"interceptor", 5,5, -1); xdir = 4; ydir = 2; } public void hit(JGObject obj) { if(obj instanceof PlayerShot) { obj.remove(); } else if(obj instanceof PlayerShot1) { obj.remove(); } else if(obj instanceof PlayerShot2) { obj.remove(); } else if(obj instanceof PlayerShot3) { obj.remove(); } if(Health!=0) { Health--; eng.playAudio("beep"); } else { remove(); eng.playAudio("beep"); GenericGame.numInterceptor=GenericGame.numInterceptor-1; } } public void move() { timer++; if(timer % 30 == 0) { new InterceptorShot(x,y); } if(x>eng.pfWidth()-20) { xdir=-4; } if(x<0) { xdir=4; } if(y<200) { ydir=2; } if(y>450) { ydir=-2; } } }
UTF-8
Java
1,193
java
Interceptor.java
Java
[]
null
[]
package mygame; import jgame.JGObject; class Interceptor extends JGObject implements MyGameValues { int timer = 0; int Health = 3; Interceptor(double x, double y) { // This is the call to the JG OBject constructor. There are many constructors // you can use for JG objects. This one is as follows: // Name, Unique ID?, xPos, yPos, cid, graphic, xspeed, yspeed, expiry) super("Bomber",true,x,y+350,enemyCollisionID,"interceptor", 5,5, -1); xdir = 4; ydir = 2; } public void hit(JGObject obj) { if(obj instanceof PlayerShot) { obj.remove(); } else if(obj instanceof PlayerShot1) { obj.remove(); } else if(obj instanceof PlayerShot2) { obj.remove(); } else if(obj instanceof PlayerShot3) { obj.remove(); } if(Health!=0) { Health--; eng.playAudio("beep"); } else { remove(); eng.playAudio("beep"); GenericGame.numInterceptor=GenericGame.numInterceptor-1; } } public void move() { timer++; if(timer % 30 == 0) { new InterceptorShot(x,y); } if(x>eng.pfWidth()-20) { xdir=-4; } if(x<0) { xdir=4; } if(y<200) { ydir=2; } if(y>450) { ydir=-2; } } }
1,193
0.603521
0.577536
75
14.893333
18.213236
80
false
false
0
0
0
0
0
0
2.44
false
false
15
ac2ce61460b7bdeece326c2ee72e6d7091872839
32,487,132,647,748
380feed14178a8f33619a4bfc109ec10def83fbb
/src/test/java/com/jtchen/thread/ImgDownloadTest.java
a5ece1eeabcb38dbfe8ae0170de191d7f4d3229a
[]
no_license
HersonaREAL/reptile
https://github.com/HersonaREAL/reptile
f67a3562d3d53b18ca2a17b0e079e734c9bf8c87
98a9fbf4eef38c560a50196945ff37ca5f023bd6
refs/heads/master
2023-02-06T13:06:47.218000
2020-12-25T19:04:25
2020-12-25T19:04:25
323,943,413
1
0
null
true
2020-12-25T05:10:40
2020-12-23T15:55:39
2020-12-24T04:33:26
2020-12-25T05:10:40
166
1
0
0
HTML
false
false
package com.jtchen.thread; import org.junit.Test; public class ImgDownloadTest { @Test public void run() { } }
UTF-8
Java
126
java
ImgDownloadTest.java
Java
[]
null
[]
package com.jtchen.thread; import org.junit.Test; public class ImgDownloadTest { @Test public void run() { } }
126
0.65873
0.65873
11
10.545455
11.570838
30
false
false
0
0
0
0
0
0
0.181818
false
false
15
d504ebf65d1995f4a5362bd8a364b175f088fd63
16,466,904,632,281
ffc387e572d5066ed39d683e6e7f770ba9693239
/Garbage/Java/HW-6.T-2/Main.java
6bc34c9fad828b945771348bc47517db53e0319a
[]
no_license
aiskov/personal-notes
https://github.com/aiskov/personal-notes
963e58ef731c125fe43974c862c85a3901d10cdd
9356e2079a067ecd465d8c22678eca3af163f159
refs/heads/master
2019-08-08T03:37:40.655000
2017-09-04T07:46:39
2017-09-04T07:46:39
26,288,884
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Homework 6.2 * * Anton Iskov RDIR 42 * * Изучите самостоятельно компонент JTable. Используя данные текстового файла * Books.txt создайте таблицу. * * При выборе соответствующей категории из списка в таблице отображаются книги * данной категории. При выборе ALL отображаются все книги. * * Внизу таблицы должна отображаться информация — сколько книг в таблице и на * какую сумму. * * Дополнительно можно получить баллы, если реализовать сохранение изменений в * файл (где есть возможность добавить список для редактирования в таблицу). * */ package table; import java.awt.*; /** * Main class only create queue of treads and main window. * * @author Anton Ishkov */ public class Main { /** * Window run. * * @param args * not used */ public static void main(String[] args) { // Create new tread EventQueue.invokeLater(new Runnable() { /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ @Override public void run() { // Create form window @SuppressWarnings("unused") MainGui frame = new MainGui(); } }); } }
WINDOWS-1251
Java
1,678
java
Main.java
Java
[ { "context": "/**\n * Homework 6.2\n * \n * Anton Iskov RDIR 42\n * \n * Изучите самостоятельно компонент J", "end": 38, "score": 0.9998799562454224, "start": 27, "tag": "NAME", "value": "Anton Iskov" }, { "context": "te queue of treads and main window.\n * \n * @author Anton Ishkov\n */\npublic class Main\n{\n\n /**\n * Window ru", "end": 695, "score": 0.99983149766922, "start": 683, "tag": "NAME", "value": "Anton Ishkov" } ]
null
[]
/** * Homework 6.2 * * <NAME> RDIR 42 * * Изучите самостоятельно компонент JTable. Используя данные текстового файла * Books.txt создайте таблицу. * * При выборе соответствующей категории из списка в таблице отображаются книги * данной категории. При выборе ALL отображаются все книги. * * Внизу таблицы должна отображаться информация — сколько книг в таблице и на * какую сумму. * * Дополнительно можно получить баллы, если реализовать сохранение изменений в * файл (где есть возможность добавить список для редактирования в таблицу). * */ package table; import java.awt.*; /** * Main class only create queue of treads and main window. * * @author <NAME> */ public class Main { /** * Window run. * * @param args * not used */ public static void main(String[] args) { // Create new tread EventQueue.invokeLater(new Runnable() { /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ @Override public void run() { // Create form window @SuppressWarnings("unused") MainGui frame = new MainGui(); } }); } }
1,667
0.575077
0.571981
56
22.089285
22.817816
78
false
false
0
0
0
0
0
0
0.089286
false
false
15
74881a95b406d945232cf98c9911f4539ade6c5e
21,148,418,976,266
9c392760070de8a5675ef92bf31b461a5bbc50ec
/src/tree/application/ExpressionTree.java
b4ba36febc946554d6c7b40499bf046f07a27848
[]
no_license
Lewin671/DataStructure
https://github.com/Lewin671/DataStructure
72e85758d87ab78c5b635b47bc4e1428c8ef79d7
c869fe02a11414e15492673237351fbc5e306576
refs/heads/master
2023-02-25T08:50:09.005000
2021-01-31T17:18:42
2021-01-31T17:18:42
302,578,230
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tree.application; import java.util.ArrayDeque; import java.util.Deque; import java.util.LinkedList; import java.util.Scanner; // 这里主要实现这几个功能: // 中缀表达式 => 后缀表达式 // 直接计算后缀表达式的值 // 通过后缀表达式构建一个表达式树 // 计算表达式树的值(通过后根遍历) public class ExpressionTree { static void inOrderTraversal(ExpNode root) { if (root == null) return; boolean flag = false; if (root.type == ExpNodeType.opNode && (root.op == '+' || root.op == '-')) { flag = true; } if (flag) { System.out.print("("); } inOrderTraversal(root.left); System.out.print(root); inOrderTraversal(root.right); if (flag) { System.out.print(")"); } } public static void main(String[] args) throws Exception { String midExp; Scanner in = new Scanner(System.in); midExp = in.nextLine(); ExpressionTree expressionTree = new ExpressionTree(); String exp = expressionTree.middleExpToPostExp(midExp); // 中缀转后缀 System.out.println(exp); // 计算后缀表达式测试 System.out.println("直接计算后缀表达式的值: " + expressionTree.calculate(exp)); // 构造表达式树 ExpNode root = expressionTree.constructExpTree(exp); ExpressionTree.inOrderTraversal(root); System.out.println(); System.out.println("通过构造的表达式树来求值: " + expressionTree.calculateExpTree(root)); in.close(); } boolean isOperator(char c) { return c == '+' || c == '-' || c == '*' || c == '/'; } int priority(String c) { if (c.equals("+") || c.equals("-")) { return 1; } else { // * / return 2; } } /* 遇到数字, 直接输出 遇到运算符 a.若为“(” 直接入栈 b.若为“)” 将符号栈中的元素依次出栈并输出, 直到 “(“, “(“只出栈, 不输出 c.若为其他符号, 将符号栈中的元素依次出栈并输出, 直到遇到比当前符号优先级更低(相等优先级的符号也要弹出)的符号或者”(“。 将当前符号入栈。 扫描完后, 将栈中剩余符号依次输出 */ // 中缀表达式转后缀表达式 // 测试数据: 2 * (9 + 6 / 3 - 5) + 4 String middleExpToPostExp(String midExp) { midExp = midExp.replaceAll("\\s", ""); LinkedList<String> res = new LinkedList<>(); Deque<String> stack = new ArrayDeque<>(); for (int i = 0; i < midExp.length(); i++) { char c = midExp.charAt(i); if (c == '(') { stack.push("("); } else if (c == ')') { while (true) { String s = stack.pop(); if (s.equals("(")) { break; } res.add(s); } } else if (isOperator(c)) { while (!(stack.isEmpty() || stack.peek().equals("(")) // 栈中的优先级高,那么就要先出来,先运算 && priority(stack.peek()) >= priority(c + "")) { res.add(stack.pop()); } stack.push(c + ""); } else { // number int j = i + 1; for (; j < midExp.length(); j++) { char tmpC = midExp.charAt(j); if (isOperator(tmpC) || tmpC == '(' || tmpC == ')') { break; } } res.add(midExp.substring(i, j)); i = j - 1; } } while (!stack.isEmpty()) { res.add(stack.pop()); } return res.toString().replaceAll("[,\\[\\]]", ""); } // 测试数据: 3 4 + 5 * 6 - double calculate(String exp) throws Exception { double res; int i = 0; Deque<Double> stack = new ArrayDeque<>(); while (i < exp.length()) { // 获取下一个元素,或者是数字,或者是操作符 char c = exp.charAt(i); if (c == ' ') { i = i + 1; continue; } int l = exp.indexOf(' ', i); if (l == -1) { l = exp.length(); } if (c < '0' || c > '9') { double right = stack.pop(); double left = stack.pop(); if (c == '+') { stack.push(left + right); } else if (c == '-') { stack.push(left - right); } else if (c == '*') { stack.push(left * right); } else if (c == '/') { if (right == 0) { throw new Exception("divide zero"); } stack.push(left / right); } else { // 不合法字符 throw new Exception("unexpected sign"); } } else { double num = Double.parseDouble(exp.substring(i, l)); stack.push(num); } i = l + 1; } res = stack.pop(); return res; } // 通过后缀表达式构建表达式树 ExpNode constructExpTree(String exp) { ExpNode root; int i = 0; Deque<ExpNode> stack = new ArrayDeque<>(); while (i < exp.length()) { char c = exp.charAt(i); if (c == ' ') { i++; continue; } int l = exp.indexOf(' ', i); if (l == -1) { l = exp.length(); } // 如果是操作数结点 if (c == '+' || c == '-' || c == '*' || c == '/') { ExpNode opNode = new ExpNode(c); opNode.right = stack.pop(); opNode.left = stack.pop(); stack.push(opNode); } else { double num = Double.parseDouble(exp.substring(i, l)); stack.push(new ExpNode(num)); } i = l + 1; } root = stack.pop(); return root; } // 计算表达式树的值 double calculateExpTree(ExpNode root) throws Exception { class Pair<K, V> { final K first; final V second; Pair(K first, V second) { this.first = first; this.second = second; } } double res; Deque<Pair<ExpNode, Integer>> stack = new ArrayDeque<>(); Deque<Double> calculator = new ArrayDeque<>(); // 初始化栈 stack.push(new Pair<>(root, 0)); // 迭代 while (!stack.isEmpty()) { Pair<ExpNode, Integer> cur = stack.pop(); switch (cur.second) { case 0: stack.push(new Pair<>(cur.first, 1)); if (cur.first.left != null) stack.push(new Pair<>(cur.first.left, 0)); break; case 1: stack.push(new Pair<>(cur.first, 2)); if (cur.first.right != null) stack.push(new Pair<>(cur.first.right, 0)); break; default: if (cur.first.type == ExpNodeType.dataNode) { calculator.push(cur.first.data); } else { double right = calculator.pop(); double left = calculator.pop(); switch (cur.first.op) { case '+': calculator.push(left + right); break; case '-': calculator.push(left - right); break; case '*': calculator.push(left * right); break; case '/': if (right == 0) throw new Exception("divide zero"); calculator.push(left / right); break; default: throw new Exception("unexpected operation"); } } } } res = calculator.pop(); return res; } // 树的结点类型,叶子结点的数据域存储数据,分支节点的数据域存储操作符 enum ExpNodeType { opNode, dataNode } static class ExpNode { ExpNodeType type; double data; char op; ExpNode left, right; ExpNode(char op) { this.op = op; this.type = ExpNodeType.opNode; } ExpNode(double data) { this.data = data; this.type = ExpNodeType.dataNode; } @Override public String toString() { switch (type) { case opNode: return String.valueOf(op); case dataNode: return Double.toString(data); } return null; } } }
UTF-8
Java
9,590
java
ExpressionTree.java
Java
[]
null
[]
package tree.application; import java.util.ArrayDeque; import java.util.Deque; import java.util.LinkedList; import java.util.Scanner; // 这里主要实现这几个功能: // 中缀表达式 => 后缀表达式 // 直接计算后缀表达式的值 // 通过后缀表达式构建一个表达式树 // 计算表达式树的值(通过后根遍历) public class ExpressionTree { static void inOrderTraversal(ExpNode root) { if (root == null) return; boolean flag = false; if (root.type == ExpNodeType.opNode && (root.op == '+' || root.op == '-')) { flag = true; } if (flag) { System.out.print("("); } inOrderTraversal(root.left); System.out.print(root); inOrderTraversal(root.right); if (flag) { System.out.print(")"); } } public static void main(String[] args) throws Exception { String midExp; Scanner in = new Scanner(System.in); midExp = in.nextLine(); ExpressionTree expressionTree = new ExpressionTree(); String exp = expressionTree.middleExpToPostExp(midExp); // 中缀转后缀 System.out.println(exp); // 计算后缀表达式测试 System.out.println("直接计算后缀表达式的值: " + expressionTree.calculate(exp)); // 构造表达式树 ExpNode root = expressionTree.constructExpTree(exp); ExpressionTree.inOrderTraversal(root); System.out.println(); System.out.println("通过构造的表达式树来求值: " + expressionTree.calculateExpTree(root)); in.close(); } boolean isOperator(char c) { return c == '+' || c == '-' || c == '*' || c == '/'; } int priority(String c) { if (c.equals("+") || c.equals("-")) { return 1; } else { // * / return 2; } } /* 遇到数字, 直接输出 遇到运算符 a.若为“(” 直接入栈 b.若为“)” 将符号栈中的元素依次出栈并输出, 直到 “(“, “(“只出栈, 不输出 c.若为其他符号, 将符号栈中的元素依次出栈并输出, 直到遇到比当前符号优先级更低(相等优先级的符号也要弹出)的符号或者”(“。 将当前符号入栈。 扫描完后, 将栈中剩余符号依次输出 */ // 中缀表达式转后缀表达式 // 测试数据: 2 * (9 + 6 / 3 - 5) + 4 String middleExpToPostExp(String midExp) { midExp = midExp.replaceAll("\\s", ""); LinkedList<String> res = new LinkedList<>(); Deque<String> stack = new ArrayDeque<>(); for (int i = 0; i < midExp.length(); i++) { char c = midExp.charAt(i); if (c == '(') { stack.push("("); } else if (c == ')') { while (true) { String s = stack.pop(); if (s.equals("(")) { break; } res.add(s); } } else if (isOperator(c)) { while (!(stack.isEmpty() || stack.peek().equals("(")) // 栈中的优先级高,那么就要先出来,先运算 && priority(stack.peek()) >= priority(c + "")) { res.add(stack.pop()); } stack.push(c + ""); } else { // number int j = i + 1; for (; j < midExp.length(); j++) { char tmpC = midExp.charAt(j); if (isOperator(tmpC) || tmpC == '(' || tmpC == ')') { break; } } res.add(midExp.substring(i, j)); i = j - 1; } } while (!stack.isEmpty()) { res.add(stack.pop()); } return res.toString().replaceAll("[,\\[\\]]", ""); } // 测试数据: 3 4 + 5 * 6 - double calculate(String exp) throws Exception { double res; int i = 0; Deque<Double> stack = new ArrayDeque<>(); while (i < exp.length()) { // 获取下一个元素,或者是数字,或者是操作符 char c = exp.charAt(i); if (c == ' ') { i = i + 1; continue; } int l = exp.indexOf(' ', i); if (l == -1) { l = exp.length(); } if (c < '0' || c > '9') { double right = stack.pop(); double left = stack.pop(); if (c == '+') { stack.push(left + right); } else if (c == '-') { stack.push(left - right); } else if (c == '*') { stack.push(left * right); } else if (c == '/') { if (right == 0) { throw new Exception("divide zero"); } stack.push(left / right); } else { // 不合法字符 throw new Exception("unexpected sign"); } } else { double num = Double.parseDouble(exp.substring(i, l)); stack.push(num); } i = l + 1; } res = stack.pop(); return res; } // 通过后缀表达式构建表达式树 ExpNode constructExpTree(String exp) { ExpNode root; int i = 0; Deque<ExpNode> stack = new ArrayDeque<>(); while (i < exp.length()) { char c = exp.charAt(i); if (c == ' ') { i++; continue; } int l = exp.indexOf(' ', i); if (l == -1) { l = exp.length(); } // 如果是操作数结点 if (c == '+' || c == '-' || c == '*' || c == '/') { ExpNode opNode = new ExpNode(c); opNode.right = stack.pop(); opNode.left = stack.pop(); stack.push(opNode); } else { double num = Double.parseDouble(exp.substring(i, l)); stack.push(new ExpNode(num)); } i = l + 1; } root = stack.pop(); return root; } // 计算表达式树的值 double calculateExpTree(ExpNode root) throws Exception { class Pair<K, V> { final K first; final V second; Pair(K first, V second) { this.first = first; this.second = second; } } double res; Deque<Pair<ExpNode, Integer>> stack = new ArrayDeque<>(); Deque<Double> calculator = new ArrayDeque<>(); // 初始化栈 stack.push(new Pair<>(root, 0)); // 迭代 while (!stack.isEmpty()) { Pair<ExpNode, Integer> cur = stack.pop(); switch (cur.second) { case 0: stack.push(new Pair<>(cur.first, 1)); if (cur.first.left != null) stack.push(new Pair<>(cur.first.left, 0)); break; case 1: stack.push(new Pair<>(cur.first, 2)); if (cur.first.right != null) stack.push(new Pair<>(cur.first.right, 0)); break; default: if (cur.first.type == ExpNodeType.dataNode) { calculator.push(cur.first.data); } else { double right = calculator.pop(); double left = calculator.pop(); switch (cur.first.op) { case '+': calculator.push(left + right); break; case '-': calculator.push(left - right); break; case '*': calculator.push(left * right); break; case '/': if (right == 0) throw new Exception("divide zero"); calculator.push(left / right); break; default: throw new Exception("unexpected operation"); } } } } res = calculator.pop(); return res; } // 树的结点类型,叶子结点的数据域存储数据,分支节点的数据域存储操作符 enum ExpNodeType { opNode, dataNode } static class ExpNode { ExpNodeType type; double data; char op; ExpNode left, right; ExpNode(char op) { this.op = op; this.type = ExpNodeType.opNode; } ExpNode(double data) { this.data = data; this.type = ExpNodeType.dataNode; } @Override public String toString() { switch (type) { case opNode: return String.valueOf(op); case dataNode: return Double.toString(data); } return null; } } }
9,590
0.406257
0.40253
293
29.21843
19.206442
85
false
false
0
0
0
0
0
0
0.604096
false
false
15
3fdd790dc75cf378a65381f7ad8367867840ad1e
2,946,347,579,289
f617829e1b8e64d2800cfdc4f5741c98fddfe0e9
/source/ips1ap101/ips1ap101-lib/src/java/copy/ips1ap101/lib/core/enumeration/EnumTipoDatoSQL.java
447725f4f4385a63288bc4a1468f7a245ad45b91
[]
no_license
jrcampins/ips1ap101
https://github.com/jrcampins/ips1ap101
ccb637333d5d4a1020fe098eee274e885a3de1ff
68cbc7b416d0a29f265628e040169050056f4f89
refs/heads/master
2016-09-05T11:59:04.869000
2015-01-08T14:40:50
2015-01-08T14:40:50
32,464,367
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Este programa es software libre; usted puede redistribuirlo y/o modificarlo bajo los términos * de la licencia "GNU General Public License" publicada por la Fundación "Free Software Foundation". * * Este programa se distribuye con la esperanza de que pueda ser útil, pero SIN NINGUNA GARANTIA; * vea la licencia "GNU General Public License" para obtener mas información. */ package ips1ap101.lib.core.enumeration; import java.sql.Types; /** * @author Jorge Campins */ public enum EnumTipoDatoSQL { BOOLEAN(Types.BOOLEAN), CHAR(Types.CHAR), VARCHAR(Types.VARCHAR), INTEGER(Types.INTEGER), BIGINT(Types.BIGINT), DECIMAL(Types.DECIMAL), NUMERIC(Types.NUMERIC), DATE(Types.DATE), TIME(Types.TIME), TIMESTAMP(Types.TIMESTAMP), OTHER(Types.OTHER); public static EnumTipoDatoSQL valueOf(int i) { switch (i) { case Types.BOOLEAN: return BOOLEAN; case Types.CHAR: return CHAR; case Types.VARCHAR: return VARCHAR; case Types.INTEGER: return INTEGER; case Types.BIGINT: return BIGINT; case Types.DECIMAL: return DECIMAL; case Types.NUMERIC: return NUMERIC; case Types.DATE: return DATE; case Types.TIME: return TIME; case Types.TIMESTAMP: return TIMESTAMP; default: return OTHER; } } public static EnumTipoDatoSQL valueOf(Class<?> clazz) { if (clazz == null) { return OTHER; } else if (Boolean.class.isAssignableFrom(clazz)) { return BOOLEAN; } else if (Character.class.isAssignableFrom(clazz)) { return CHAR; } else if (String.class.isAssignableFrom(clazz)) { return VARCHAR; } else if (Integer.class.isAssignableFrom(clazz)) { return INTEGER; } else if (Long.class.isAssignableFrom(clazz)) { return BIGINT; } else if (java.math.BigInteger.class.isAssignableFrom(clazz)) { return BIGINT; } else if (java.math.BigDecimal.class.isAssignableFrom(clazz)) { return DECIMAL; } else if (Number.class.isAssignableFrom(clazz)) { return NUMERIC; } else if (java.sql.Date.class.isAssignableFrom(clazz)) { return DATE; } else if (java.sql.Time.class.isAssignableFrom(clazz)) { return TIME; } else if (java.sql.Timestamp.class.isAssignableFrom(clazz)) { return TIMESTAMP; } else if (java.util.Date.class.isAssignableFrom(clazz)) { return TIMESTAMP; } else { return OTHER; } } private final int value; EnumTipoDatoSQL(int value) { this.value = value; } public int intValue() { return value; } }
UTF-8
Java
3,104
java
EnumTipoDatoSQL.java
Java
[ { "context": "tion;\r\n\r\nimport java.sql.Types;\r\n\r\n/**\r\n * @author Jorge Campins\r\n */\r\npublic enum EnumTipoDatoSQL {\r\n\r\n BOOLEA", "end": 491, "score": 0.9994325637817383, "start": 478, "tag": "NAME", "value": "Jorge Campins" } ]
null
[]
/* * Este programa es software libre; usted puede redistribuirlo y/o modificarlo bajo los términos * de la licencia "GNU General Public License" publicada por la Fundación "Free Software Foundation". * * Este programa se distribuye con la esperanza de que pueda ser útil, pero SIN NINGUNA GARANTIA; * vea la licencia "GNU General Public License" para obtener mas información. */ package ips1ap101.lib.core.enumeration; import java.sql.Types; /** * @author <NAME> */ public enum EnumTipoDatoSQL { BOOLEAN(Types.BOOLEAN), CHAR(Types.CHAR), VARCHAR(Types.VARCHAR), INTEGER(Types.INTEGER), BIGINT(Types.BIGINT), DECIMAL(Types.DECIMAL), NUMERIC(Types.NUMERIC), DATE(Types.DATE), TIME(Types.TIME), TIMESTAMP(Types.TIMESTAMP), OTHER(Types.OTHER); public static EnumTipoDatoSQL valueOf(int i) { switch (i) { case Types.BOOLEAN: return BOOLEAN; case Types.CHAR: return CHAR; case Types.VARCHAR: return VARCHAR; case Types.INTEGER: return INTEGER; case Types.BIGINT: return BIGINT; case Types.DECIMAL: return DECIMAL; case Types.NUMERIC: return NUMERIC; case Types.DATE: return DATE; case Types.TIME: return TIME; case Types.TIMESTAMP: return TIMESTAMP; default: return OTHER; } } public static EnumTipoDatoSQL valueOf(Class<?> clazz) { if (clazz == null) { return OTHER; } else if (Boolean.class.isAssignableFrom(clazz)) { return BOOLEAN; } else if (Character.class.isAssignableFrom(clazz)) { return CHAR; } else if (String.class.isAssignableFrom(clazz)) { return VARCHAR; } else if (Integer.class.isAssignableFrom(clazz)) { return INTEGER; } else if (Long.class.isAssignableFrom(clazz)) { return BIGINT; } else if (java.math.BigInteger.class.isAssignableFrom(clazz)) { return BIGINT; } else if (java.math.BigDecimal.class.isAssignableFrom(clazz)) { return DECIMAL; } else if (Number.class.isAssignableFrom(clazz)) { return NUMERIC; } else if (java.sql.Date.class.isAssignableFrom(clazz)) { return DATE; } else if (java.sql.Time.class.isAssignableFrom(clazz)) { return TIME; } else if (java.sql.Timestamp.class.isAssignableFrom(clazz)) { return TIMESTAMP; } else if (java.util.Date.class.isAssignableFrom(clazz)) { return TIMESTAMP; } else { return OTHER; } } private final int value; EnumTipoDatoSQL(int value) { this.value = value; } public int intValue() { return value; } }
3,097
0.561935
0.560645
98
29.632652
22.23455
101
false
false
0
0
0
0
0
0
0.44898
false
false
15
93f68940c21007e973034e06b04340b2be2c0cb4
7,730,941,197,355
b7498036806b2abfc2aea89c246318666d3b5c02
/Kuwerdas/app/src/main/java/com/example/marvin/kuwerdas/song/model/Chord.java
2d14f03fcce6692ddee8309dbc7b217f1ac78dae
[]
no_license
MarvLpz/Music-App-Essentials
https://github.com/MarvLpz/Music-App-Essentials
3eff519eacf45a181f0ce931e1229f2e3967b260
a624b8af47f22386b1b6b1e286114e9de4d1d572
refs/heads/master
2020-03-23T04:17:10.269000
2018-09-07T04:48:28
2018-09-07T04:48:28
141,074,202
0
0
null
false
2018-07-30T08:22:03
2018-07-16T01:59:42
2018-07-16T01:59:44
2018-07-30T08:22:03
694
0
0
0
null
false
null
package com.example.marvin.kuwerdas.song.model; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.ForeignKey; import android.arch.persistence.room.PrimaryKey; import static android.arch.persistence.room.ForeignKey.CASCADE; @Entity(foreignKeys = @ForeignKey(entity = Line.class, parentColumns = "id", childColumns = "lineId", onDelete = CASCADE)) public class Chord { public static final String EMPTY_CHORD = " " + " "; private String chord; @PrimaryKey(autoGenerate = true) private int id; @ColumnInfo(name = "lineId") private int lineId; @ColumnInfo(name = "order") private int order = -1; public Chord(){} public Chord(String c) { chord = c; } public String getChord() { return chord; } public void setChord(String chord) { this.chord = chord; } public String toString(){ return chord; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getLineId() { return lineId; } public void setLineId(int lineId) { this.lineId = lineId; } public int getOrder() { return order; } public void setOrder(int order) { this.order = order; } }
UTF-8
Java
1,385
java
Chord.java
Java
[ { "context": "package com.example.marvin.kuwerdas.song.model;\n\nimport android.arch.persist", "end": 26, "score": 0.9957684278488159, "start": 20, "tag": "USERNAME", "value": "marvin" } ]
null
[]
package com.example.marvin.kuwerdas.song.model; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.ForeignKey; import android.arch.persistence.room.PrimaryKey; import static android.arch.persistence.room.ForeignKey.CASCADE; @Entity(foreignKeys = @ForeignKey(entity = Line.class, parentColumns = "id", childColumns = "lineId", onDelete = CASCADE)) public class Chord { public static final String EMPTY_CHORD = " " + " "; private String chord; @PrimaryKey(autoGenerate = true) private int id; @ColumnInfo(name = "lineId") private int lineId; @ColumnInfo(name = "order") private int order = -1; public Chord(){} public Chord(String c) { chord = c; } public String getChord() { return chord; } public void setChord(String chord) { this.chord = chord; } public String toString(){ return chord; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getLineId() { return lineId; } public void setLineId(int lineId) { this.lineId = lineId; } public int getOrder() { return order; } public void setOrder(int order) { this.order = order; } }
1,385
0.618773
0.618051
67
19.671642
17.070869
63
false
false
0
0
0
0
0
0
0.358209
false
false
15
5ab2a591911c254d51cf19fab4d550d3e1bcdac7
23,356,032,195,501
97b0bab29051d5acef16e7cb3290229325970a74
/src/main/java/com/dnf/reverse2/comparator/TermComparator.java
9a840442625d032c36d6fe38fb614de80e07f705
[]
no_license
gengbushuang/java-other-test
https://github.com/gengbushuang/java-other-test
9615cc0879171aae2adf34bb2b4501af53f13f79
aa5e65c7dc1f06de4b7b2a3bff5dfec074b7eef3
refs/heads/master
2022-10-23T16:49:33.396000
2019-11-02T18:59:49
2019-11-02T18:59:49
70,244,884
0
0
null
false
2022-10-05T18:50:24
2016-10-07T12:33:37
2019-11-02T18:59:57
2022-10-05T18:50:21
7,833
0
0
7
Java
false
false
package com.dnf.reverse2.comparator; import java.util.Comparator; import com.dnf.reverse2.model.Term; public class TermComparator implements Comparator<Term>{ @Override public int compare(Term o1, Term o2) { return o1.getId()-o2.getId(); } }
UTF-8
Java
266
java
TermComparator.java
Java
[]
null
[]
package com.dnf.reverse2.comparator; import java.util.Comparator; import com.dnf.reverse2.model.Term; public class TermComparator implements Comparator<Term>{ @Override public int compare(Term o1, Term o2) { return o1.getId()-o2.getId(); } }
266
0.710526
0.68797
14
17
18.864176
56
false
false
0
0
0
0
0
0
0.714286
false
false
15
1f0a10e6401bbae99c176e90a8cd202614424e78
15,444,702,412,624
a40baf4b50b07310faf1596ca9daff3a8a11a4b8
/src/main/java/srcastra/astra/gui/modules/dossier/utils/Makedefinition.java
399381bd47d3425240f2fada76bc7ed1e61fbc29
[]
no_license
hykiukira/astra-client
https://github.com/hykiukira/astra-client
bb5c6b920a43eab67a6a3dc9d35c51905ff5058e
1d6e41d351b901039c93eca383da0b7ea40a2617
refs/heads/master
2020-04-01T02:08:07.967000
2017-05-26T09:55:26
2017-05-26T09:55:26
152,766,484
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * makedefinition.java * * Created on 23 janvier 2003, 10:30 */ package srcastra.astra.gui.modules.dossier.utils; import srcastra.astra.gui.modules.mainScreenModule.*; import srcastra.astra.sys.classetransfert.dossier.produit_T; import srcastra.astra.gui.sys.*; import srcastra.astra.gui.modules.dossier.DossierProduitPane; import srcastra.astra.sys.classetransfert.Grpdecision_T; import srcastra.astra.sys.classetransfert.dossier.InterfaceProduit; import srcastra.astra.sys.classetransfert.Document_T; import srcastra.astra.sys.rmi.groupe_dec.*; import srcastra.astra.sys.rmi.*; /** * * @author Thomas */ public class Makedefinition { /** Creates a new instance of makedefinition */ public Makedefinition() { } public static void makeProduitDefinition(DossierMainScreenModule parent, produit_T produit,DossierProduitPane parentPane,int typeProduct,int fournisseur){ try{ if(produit.getGroupdec()==null){ GrpGroupDecRmiInterface grprmi=parent.getServeur().renvGrpDecRmiObject(parent.getCurrentUser().getUrcleunik()); Grpdecision_T tmp=grprmi.selectFournisseur(typeProduct,0,parent.getCurrentUser().getUrcleunik()); // Grpdecision_T tmp=(Grpdecision_T)parent.getServeur().ChargeObject(0, parent.getCurrentUser().getUrcleunik(), // typeProduct, 1, parent.getServeur().COMBO_FOURGRPDEC); produit.setGroupdec(tmp); produit.setFrgtcleunik(tmp.getFrgtcleunik()); try{ produit.setGroupdecBase((Grpdecision_T)tmp.clone()); }catch(CloneNotSupportedException cn){ cn.printStackTrace(); } parentPane.setProdutFournAndGpdec((InterfaceProduit)produit); } parent.setMenuProduit(true); //parent.getMainframe().setGrpdec(produit.getGroupdec()); if(produit.getDoc()==null){ produit.setDoc((Document_T)parent.getServeur().ChargeObject(0, parent.getCurrentUser().getUrcleunik(), fournisseur, 1, parent.getServeur().COMBO_FOURNDOC)); } } catch (srcastra.astra.sys.rmi.Exception.ServeurSqlFailure se) { ErreurScreenLibrary.displayErreur(parentPane, ErreurScreenLibrary.SERVEUR_SQL_FAILURE, srcastra.astra.Astra.DEBUG, se); } catch (java.rmi.RemoteException re) { ErreurScreenLibrary.displayErreur(parentPane, ErreurScreenLibrary.REMOTE_EXCEPTION, srcastra.astra.Astra.DEBUG, re); } } public static void makeProduitDefinition(astrainterface parent, produit_T produit,int typeProduct,int fournisseur,int urcleunik){ try{ if(produit.getGroupdec()==null){ GrpGroupDecRmiInterface grprmi=parent.renvGrpDecRmiObject(urcleunik); Grpdecision_T tmp=grprmi.selectFournisseur(typeProduct,0,urcleunik); if(tmp!=null){ // Grpdecision_T tmp=(Grpdecision_T)parent.getServeur().ChargeObject(0, parent.getCurrentUser().getUrcleunik(), // typeProduct, 1, parent.getServeur().COMBO_FOURGRPDEC); produit.setGroupdec(tmp); produit.setFrgtcleunik(tmp.getFrgtcleunik()); try{ produit.setGroupdecBase((Grpdecision_T)tmp.clone()); }catch(CloneNotSupportedException cn){ cn.printStackTrace(); } } // parentPane.setProdutFournAndGpdec((InterfaceProduit)produit); } //parent.setMenuProduit(true); //parent.getMainframe().setGrpdec(produit.getGroupdec()); if(produit.getDoc()==null){ produit.setDoc((Document_T)parent.ChargeObject(0, urcleunik, fournisseur, 1, parent.COMBO_FOURNDOC)); } } catch (srcastra.astra.sys.rmi.Exception.ServeurSqlFailure se) { ErreurScreenLibrary.displayErreur(null, ErreurScreenLibrary.SERVEUR_SQL_FAILURE, srcastra.astra.Astra.DEBUG, se); } catch (java.rmi.RemoteException re) { ErreurScreenLibrary.displayErreur(null, ErreurScreenLibrary.REMOTE_EXCEPTION, srcastra.astra.Astra.DEBUG, re); } } /* private static Object setProdutFournAndGpdec(InterfaceProduit tmp) { tmp.setFrcleunik(grp_LSelect_Fournisseur.getCleUnik()); tmp.setFrnom(grp_LSelect_Fournisseur.getText()); tmp.setFrgtcleunik(grp_LSelect_GrpProduits.getCleUnik()); tmp.setGroupe_produit_nom(grp_LSelect_GrpProduits.getText()); //tmp.setTypeDeProduitCleunik(grp_LSelect_TypeProduits.getCleUnik()); tmp.setTypeDeProduitNom(grp_LSelect_TypeProduits.getText()); return tmp; }*/ }
UTF-8
Java
5,932
java
Makedefinition.java
Java
[ { "context": "\n\r\r\n\r\r\n\r\r\n/**\r\r\n\r\r\n\r\r\n\r\r\n *\r\r\n\r\r\n\r\r\n\r\r\n * @author Thomas\r\r\n\r\r\n\r\r\n\r\r\n */\r\r\n\r\r\n\r\r\n\r\r\npublic class Makedefini", "end": 762, "score": 0.999748170375824, "start": 756, "tag": "NAME", "value": "Thomas" } ]
null
[]
/* * makedefinition.java * * Created on 23 janvier 2003, 10:30 */ package srcastra.astra.gui.modules.dossier.utils; import srcastra.astra.gui.modules.mainScreenModule.*; import srcastra.astra.sys.classetransfert.dossier.produit_T; import srcastra.astra.gui.sys.*; import srcastra.astra.gui.modules.dossier.DossierProduitPane; import srcastra.astra.sys.classetransfert.Grpdecision_T; import srcastra.astra.sys.classetransfert.dossier.InterfaceProduit; import srcastra.astra.sys.classetransfert.Document_T; import srcastra.astra.sys.rmi.groupe_dec.*; import srcastra.astra.sys.rmi.*; /** * * @author Thomas */ public class Makedefinition { /** Creates a new instance of makedefinition */ public Makedefinition() { } public static void makeProduitDefinition(DossierMainScreenModule parent, produit_T produit,DossierProduitPane parentPane,int typeProduct,int fournisseur){ try{ if(produit.getGroupdec()==null){ GrpGroupDecRmiInterface grprmi=parent.getServeur().renvGrpDecRmiObject(parent.getCurrentUser().getUrcleunik()); Grpdecision_T tmp=grprmi.selectFournisseur(typeProduct,0,parent.getCurrentUser().getUrcleunik()); // Grpdecision_T tmp=(Grpdecision_T)parent.getServeur().ChargeObject(0, parent.getCurrentUser().getUrcleunik(), // typeProduct, 1, parent.getServeur().COMBO_FOURGRPDEC); produit.setGroupdec(tmp); produit.setFrgtcleunik(tmp.getFrgtcleunik()); try{ produit.setGroupdecBase((Grpdecision_T)tmp.clone()); }catch(CloneNotSupportedException cn){ cn.printStackTrace(); } parentPane.setProdutFournAndGpdec((InterfaceProduit)produit); } parent.setMenuProduit(true); //parent.getMainframe().setGrpdec(produit.getGroupdec()); if(produit.getDoc()==null){ produit.setDoc((Document_T)parent.getServeur().ChargeObject(0, parent.getCurrentUser().getUrcleunik(), fournisseur, 1, parent.getServeur().COMBO_FOURNDOC)); } } catch (srcastra.astra.sys.rmi.Exception.ServeurSqlFailure se) { ErreurScreenLibrary.displayErreur(parentPane, ErreurScreenLibrary.SERVEUR_SQL_FAILURE, srcastra.astra.Astra.DEBUG, se); } catch (java.rmi.RemoteException re) { ErreurScreenLibrary.displayErreur(parentPane, ErreurScreenLibrary.REMOTE_EXCEPTION, srcastra.astra.Astra.DEBUG, re); } } public static void makeProduitDefinition(astrainterface parent, produit_T produit,int typeProduct,int fournisseur,int urcleunik){ try{ if(produit.getGroupdec()==null){ GrpGroupDecRmiInterface grprmi=parent.renvGrpDecRmiObject(urcleunik); Grpdecision_T tmp=grprmi.selectFournisseur(typeProduct,0,urcleunik); if(tmp!=null){ // Grpdecision_T tmp=(Grpdecision_T)parent.getServeur().ChargeObject(0, parent.getCurrentUser().getUrcleunik(), // typeProduct, 1, parent.getServeur().COMBO_FOURGRPDEC); produit.setGroupdec(tmp); produit.setFrgtcleunik(tmp.getFrgtcleunik()); try{ produit.setGroupdecBase((Grpdecision_T)tmp.clone()); }catch(CloneNotSupportedException cn){ cn.printStackTrace(); } } // parentPane.setProdutFournAndGpdec((InterfaceProduit)produit); } //parent.setMenuProduit(true); //parent.getMainframe().setGrpdec(produit.getGroupdec()); if(produit.getDoc()==null){ produit.setDoc((Document_T)parent.ChargeObject(0, urcleunik, fournisseur, 1, parent.COMBO_FOURNDOC)); } } catch (srcastra.astra.sys.rmi.Exception.ServeurSqlFailure se) { ErreurScreenLibrary.displayErreur(null, ErreurScreenLibrary.SERVEUR_SQL_FAILURE, srcastra.astra.Astra.DEBUG, se); } catch (java.rmi.RemoteException re) { ErreurScreenLibrary.displayErreur(null, ErreurScreenLibrary.REMOTE_EXCEPTION, srcastra.astra.Astra.DEBUG, re); } } /* private static Object setProdutFournAndGpdec(InterfaceProduit tmp) { tmp.setFrcleunik(grp_LSelect_Fournisseur.getCleUnik()); tmp.setFrnom(grp_LSelect_Fournisseur.getText()); tmp.setFrgtcleunik(grp_LSelect_GrpProduits.getCleUnik()); tmp.setGroupe_produit_nom(grp_LSelect_GrpProduits.getText()); //tmp.setTypeDeProduitCleunik(grp_LSelect_TypeProduits.getCleUnik()); tmp.setTypeDeProduitNom(grp_LSelect_TypeProduits.getText()); return tmp; }*/ }
5,932
0.532704
0.529332
577
8.762565
25.731398
190
false
false
0
0
0
0
0
0
0.145581
false
false
15
9ee90d361766648ab853a034f8ccccfda58cb33a
17,497,696,780,360
ffc95395c311c262e978e353149f3d143930244a
/DevJav3/src/less10HomeWork1/Brand.java
3eb77582305f6ca15bfdb0d99bb21220af1babbe
[]
no_license
Andrii-Didovych/DevJavaCore
https://github.com/Andrii-Didovych/DevJavaCore
480474c941d3334cb7957ac843206ecd3023cd81
a7fd6e673a8033539c2f2494ce9075a493dd453e
refs/heads/master
2021-07-10T22:53:17.558000
2017-10-11T12:54:23
2017-10-11T12:54:23
106,553,704
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package less10HomeWork1; public enum Brand { MERCEDES, TOYOTA, LEXUS, HONDA, AUDY }
UTF-8
Java
91
java
Brand.java
Java
[]
null
[]
package less10HomeWork1; public enum Brand { MERCEDES, TOYOTA, LEXUS, HONDA, AUDY }
91
0.714286
0.681319
5
16.200001
14.105318
37
false
false
0
0
0
0
0
0
1.2
false
false
15
3c59ee322dcc99ce99c97d906cb79e436ae1641b
23,158,463,666,538
a560dfb092baaa4317c85f505ad21e55750e5638
/hileco-drpc-core/src/main/java/com/hileco/drpc/core/reflection/ProxyMessageReceiver.java
bcdfeda06deff66cfe35f24ce759efa478fdfc0b
[]
no_license
rmoorman/hileco-drpc
https://github.com/rmoorman/hileco-drpc
ae1379c740863eaa07695d6c8de346704fcc9ed4
bba1cf6f88e45af5319982fde6d638a2ddc1c2f7
refs/heads/master
2021-01-18T14:40:12.023000
2015-02-07T16:42:36
2015-02-07T16:42:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hileco.drpc.core.reflection; import com.hileco.drpc.core.spec.MessageReceiver; import com.hileco.drpc.core.spec.MessageSender; import com.hileco.drpc.core.spec.Metadata; import com.hileco.drpc.core.spec.ArgumentsStreamer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InputStream; import java.lang.reflect.Method; import java.util.UUID; /** * Implementation of {@link com.hileco.drpc.core.spec.MessageReceiver}, interprets messages as method calls. * <p/> * Any method call results will be sent to {@link #client} as callback messages. * * @author Philipp Gayret */ public class ProxyMessageReceiver<T> implements MessageReceiver { private static final Logger LOG = LoggerFactory.getLogger(ProxyMessageReceiver.class); private Class<T> type; private ArgumentsStreamer argumentsStreamer; private MessageSender client; private Object receiver; public ProxyMessageReceiver(Class<T> type, ArgumentsStreamer argumentsStreamer, MessageSender client, T receiver) { this.type = type; this.argumentsStreamer = argumentsStreamer; this.client = client; this.receiver = receiver; } /** * Accepts any message and performs a method invocation on the local {@link #receiver}, sends callback results through {@link #client}. * <p/> * Consumes all errors and forwards them to the {@link #LOG}. * * @param metadata metadata describing how to handle the content * @param contentStream actual content to process */ @Override public void accept(Metadata metadata, InputStream contentStream) { try { Method[] methods = this.type.getMethods(); Method match = null; for (Method method : methods) { if (method.getName().equals(metadata.getOperation())) { match = method; break; } } if (match != null) { try { Class<?>[] parameterTypes = match.getParameterTypes(); Object[] convertedArgs = this.argumentsStreamer.deserializeFrom(contentStream, parameterTypes); Object result = match.invoke(this.receiver, convertedArgs); Metadata callbackMeta = new Metadata(UUID.randomUUID().toString(), metadata.getId()); client.send(callbackMeta, new Object[]{result}); } catch (ReflectiveOperationException e) { LOG.warn("Unable to process a call, erred while invoking. receiver type {}, metadata {}", receiver.getClass(), metadata, e); } } else { LOG.error("Unable to process a call, no matching method. receiver type {}, metadata {}", receiver.getClass(), metadata); } } catch (Exception e) { LOG.error("Erred while reading streamed content", e); } } }
UTF-8
Java
2,960
java
ProxyMessageReceiver.java
Java
[ { "context": "@link #client} as callback messages.\n *\n * @author Philipp Gayret\n */\npublic class ProxyMessageReceiver<T> implemen", "end": 608, "score": 0.9998613595962524, "start": 594, "tag": "NAME", "value": "Philipp Gayret" } ]
null
[]
package com.hileco.drpc.core.reflection; import com.hileco.drpc.core.spec.MessageReceiver; import com.hileco.drpc.core.spec.MessageSender; import com.hileco.drpc.core.spec.Metadata; import com.hileco.drpc.core.spec.ArgumentsStreamer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InputStream; import java.lang.reflect.Method; import java.util.UUID; /** * Implementation of {@link com.hileco.drpc.core.spec.MessageReceiver}, interprets messages as method calls. * <p/> * Any method call results will be sent to {@link #client} as callback messages. * * @author <NAME> */ public class ProxyMessageReceiver<T> implements MessageReceiver { private static final Logger LOG = LoggerFactory.getLogger(ProxyMessageReceiver.class); private Class<T> type; private ArgumentsStreamer argumentsStreamer; private MessageSender client; private Object receiver; public ProxyMessageReceiver(Class<T> type, ArgumentsStreamer argumentsStreamer, MessageSender client, T receiver) { this.type = type; this.argumentsStreamer = argumentsStreamer; this.client = client; this.receiver = receiver; } /** * Accepts any message and performs a method invocation on the local {@link #receiver}, sends callback results through {@link #client}. * <p/> * Consumes all errors and forwards them to the {@link #LOG}. * * @param metadata metadata describing how to handle the content * @param contentStream actual content to process */ @Override public void accept(Metadata metadata, InputStream contentStream) { try { Method[] methods = this.type.getMethods(); Method match = null; for (Method method : methods) { if (method.getName().equals(metadata.getOperation())) { match = method; break; } } if (match != null) { try { Class<?>[] parameterTypes = match.getParameterTypes(); Object[] convertedArgs = this.argumentsStreamer.deserializeFrom(contentStream, parameterTypes); Object result = match.invoke(this.receiver, convertedArgs); Metadata callbackMeta = new Metadata(UUID.randomUUID().toString(), metadata.getId()); client.send(callbackMeta, new Object[]{result}); } catch (ReflectiveOperationException e) { LOG.warn("Unable to process a call, erred while invoking. receiver type {}, metadata {}", receiver.getClass(), metadata, e); } } else { LOG.error("Unable to process a call, no matching method. receiver type {}, metadata {}", receiver.getClass(), metadata); } } catch (Exception e) { LOG.error("Erred while reading streamed content", e); } } }
2,952
0.638514
0.637838
74
39
36.436543
144
false
false
0
0
0
0
0
0
0.689189
false
false
15
c1b750c22b624e51374fa6d18b51ef69d1a3403d
25,116,968,752,721
92cf483aace5dfa2782d9eb8f8d878ba68880c25
/GeoSharerCore.java
6f9a90c2f9ff32cd21760c233e74d1a8b63a5b64
[ "MIT" ]
permissive
TealNerd/GeoSharerMod
https://github.com/TealNerd/GeoSharerMod
5abb0975ab31099bfdf3a70d9fae010618dda055
2a6c1cb3382ec581909cb25ebc9ee3df2aa7605c
refs/heads/master
2021-01-15T13:23:19.668000
2015-05-18T01:19:31
2015-05-18T01:19:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.azirale.geosharer.mod; // Imports import java.lang.reflect.Field; import java.nio.charset.Charset; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; // Class public class GeoSharerCore { private List<GeoSharerChunk> updateChunks; private boolean isActive; private Minecraft mc; private String outputFolderPath; private String serverName; private String serverIP; // Constructor public GeoSharerCore() { this.isActive = false; this.mc = Minecraft.getMinecraft(); this.updateChunks = new ArrayList<GeoSharerChunk>(); this.outputFolderPath = "mods/GeoSharer"; } // Start tracking chunk data public void activate() { // Check if the mod is active already if (isActive) { System.out.println("GeoSharer: Tried to re-activate while mod was already active"); return; } // try and get the server data to see if we're in MP and also to store the name and IP for later use ServerData srvdata = mc.getCurrentServerData(); if (srvdata == null) { System.err.println("GeoSharer: No ServerData - single player world?"); return; } this.serverName = srvdata.serverName.replaceAll("[^\\w]", ""); this.serverIP = srvdata.serverIP; this.isActive = true; System.out.println("GeoSharer: mod is active"); } // grab chunk data before a world is unloaded public void catchUnload(World world) { // Scan around the player for loaded chunks and add them to the save list int playerX = (int)mc.thePlayer.posX/16; int playerZ = (int)mc.thePlayer.posZ/16; for (int x=-10;x<=10;++x) { for (int z=-10;z<=10;++z) { Chunk newChunk = world.getChunkFromChunkCoords(playerX+x, playerZ+z); if (newChunk.isLoaded()) this.addChunk(newChunk); } } } // Stop tracking chunk data (and save) public void deactivate() { if (!isActive) // Already inactive { System.err.println("GeoSharer: Tried to deactivate while mod was already inactive"); return; } // output all stored chunks and deactivate this.writeOut(); this.isActive = false; } // save current data to file private void writeOut() { String timeText = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); String fileName = "mods/GeoSharer/" + serverName +"/" + serverName +"_" + timeText + ".geosharer"; List<GeoSharerChunk> writeChunks = this.updateChunks; System.out.println("Geosharer: Writing " + writeChunks.size() + " chunks to '" + fileName + "'"); this.updateChunks = new ArrayList<GeoSharerChunk>(); GeoWriter.writeToFile(fileName, serverIP, writeChunks); } // add a new chunk to stored data public void addChunk(Chunk chunk) { if (!isActive) return; // Don't bother, the mod isn't active if (chunk == null) return; // can't save a null object if (chunk.isEmpty()) return; // no point saving an empty chunk GeoSharerChunk newChunk = GeoSharerChunk.CreateFromChunk(chunk); updateChunks.remove(newChunk); updateChunks.add(newChunk); // if (updateChunks.size() > 10000) trimStoredChunks(); } public void printStatus() { if (mc == null) return; if (mc.thePlayer == null) return; if (isActive) mc.thePlayer.sendChatMessage("GeoSharer is active, holding " + updateChunks.size() + " chunks"); else mc.thePlayer.sendChatMessage("GeoSharer is inactive"); } }
UTF-8
Java
3,935
java
GeoSharerCore.java
Java
[]
null
[]
package net.azirale.geosharer.mod; // Imports import java.lang.reflect.Field; import java.nio.charset.Charset; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; // Class public class GeoSharerCore { private List<GeoSharerChunk> updateChunks; private boolean isActive; private Minecraft mc; private String outputFolderPath; private String serverName; private String serverIP; // Constructor public GeoSharerCore() { this.isActive = false; this.mc = Minecraft.getMinecraft(); this.updateChunks = new ArrayList<GeoSharerChunk>(); this.outputFolderPath = "mods/GeoSharer"; } // Start tracking chunk data public void activate() { // Check if the mod is active already if (isActive) { System.out.println("GeoSharer: Tried to re-activate while mod was already active"); return; } // try and get the server data to see if we're in MP and also to store the name and IP for later use ServerData srvdata = mc.getCurrentServerData(); if (srvdata == null) { System.err.println("GeoSharer: No ServerData - single player world?"); return; } this.serverName = srvdata.serverName.replaceAll("[^\\w]", ""); this.serverIP = srvdata.serverIP; this.isActive = true; System.out.println("GeoSharer: mod is active"); } // grab chunk data before a world is unloaded public void catchUnload(World world) { // Scan around the player for loaded chunks and add them to the save list int playerX = (int)mc.thePlayer.posX/16; int playerZ = (int)mc.thePlayer.posZ/16; for (int x=-10;x<=10;++x) { for (int z=-10;z<=10;++z) { Chunk newChunk = world.getChunkFromChunkCoords(playerX+x, playerZ+z); if (newChunk.isLoaded()) this.addChunk(newChunk); } } } // Stop tracking chunk data (and save) public void deactivate() { if (!isActive) // Already inactive { System.err.println("GeoSharer: Tried to deactivate while mod was already inactive"); return; } // output all stored chunks and deactivate this.writeOut(); this.isActive = false; } // save current data to file private void writeOut() { String timeText = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); String fileName = "mods/GeoSharer/" + serverName +"/" + serverName +"_" + timeText + ".geosharer"; List<GeoSharerChunk> writeChunks = this.updateChunks; System.out.println("Geosharer: Writing " + writeChunks.size() + " chunks to '" + fileName + "'"); this.updateChunks = new ArrayList<GeoSharerChunk>(); GeoWriter.writeToFile(fileName, serverIP, writeChunks); } // add a new chunk to stored data public void addChunk(Chunk chunk) { if (!isActive) return; // Don't bother, the mod isn't active if (chunk == null) return; // can't save a null object if (chunk.isEmpty()) return; // no point saving an empty chunk GeoSharerChunk newChunk = GeoSharerChunk.CreateFromChunk(chunk); updateChunks.remove(newChunk); updateChunks.add(newChunk); // if (updateChunks.size() > 10000) trimStoredChunks(); } public void printStatus() { if (mc == null) return; if (mc.thePlayer == null) return; if (isActive) mc.thePlayer.sendChatMessage("GeoSharer is active, holding " + updateChunks.size() + " chunks"); else mc.thePlayer.sendChatMessage("GeoSharer is inactive"); } }
3,935
0.64371
0.63939
115
33.226086
26.861015
116
false
false
0
0
0
0
0
0
2.113044
false
false
15