blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
5f48d8ad0bfe76530c17327992ea1606125adaa4
10,960,756,604,462
ca8647fd815904a9effadfbb70eb124cdf40f44b
/RuoYi/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/XzPurchaseResourceApplyServiceImpl.java
89b773a41427c43d96f7a97a516a97e7810b1928
[ "MIT" ]
permissive
tiandaqing1985/xphl_new
https://github.com/tiandaqing1985/xphl_new
ac2e3a77a957e999a8680190cb1a4da166175ea9
a4d163e1ad0fbebaaf221f22102ad7645fddcf6c
refs/heads/master
2022-09-17T17:11:30.331000
2020-09-16T02:44:27
2020-09-16T02:44:27
194,824,473
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ruoyi.system.service.impl; import java.util.Arrays; import java.util.List; import java.util.Set; import com.ruoyi.system.service.IXzApplyProcessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.system.mapper.XzExpenseRecordMapper; import com.ruoyi.system.mapper.XzPurchaseResourceApplyMapper; import com.ruoyi.system.mapper.XzPurchaseResourceMapper; import com.ruoyi.system.domain.XzExpenseRecord; import com.ruoyi.system.domain.XzPurchaseResource; import com.ruoyi.system.domain.XzPurchaseResourceApply; import com.ruoyi.system.service.IXzPurchaseResourceApplyService; import com.ruoyi.common.core.text.Convert; /** * 采购资源申请 服务层实现 * * @author ruoyi * @date 2019-09-17 */ @Service public class XzPurchaseResourceApplyServiceImpl implements IXzPurchaseResourceApplyService { @Autowired private XzPurchaseResourceApplyMapper xzPurchaseResourceApplyMapper; @Autowired private XzPurchaseResourceMapper xzPurchaseResourceMapper; @Autowired private XzExpenseRecordMapper xzExpenseRecordMapper; @Autowired private IXzApplyProcessService xzApplyProcessService; /** * 查询采购资源申请信息 * * @param id 采购资源申请ID * @return 采购资源申请信息 */ @Override public XzPurchaseResourceApply selectXzPurchaseResourceApplyById(Long id) { return xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyById(id); } /** * 查询采购资源申请列表 * * @param xzPurchaseResourceApply 采购资源申请信息 * @return 采购资源申请集合 */ @Override public List<XzPurchaseResourceApply> selectXzPurchaseResourceApplyList(XzPurchaseResourceApply xzPurchaseResourceApply) { List<XzPurchaseResourceApply> xzPurchaseResourceApplies = xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyList(xzPurchaseResourceApply); for (XzPurchaseResourceApply apply : xzPurchaseResourceApplies) { apply.setApproverName(xzApplyProcessService.selectApplyProcessApproverNameByApplyId(apply.getId())); } return xzPurchaseResourceApplies; } @Override public List<XzPurchaseResourceApply> selectXzPurchaseResourceApplyListByApprover(XzPurchaseResourceApply xzPurchaseResourceApply) { List<XzPurchaseResourceApply> xzPurchaseResourceApplies = xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyListByApprover(xzPurchaseResourceApply); for (XzPurchaseResourceApply apply : xzPurchaseResourceApplies) { apply.setApproverName(xzApplyProcessService.selectApplyProcessApproverNameByApplyId(apply.getId())); } return xzPurchaseResourceApplies; } /** * 新增采购资源申请 * * @param xzPurchaseResourceApply 采购资源申请信息 * @return 结果 */ @Override @Transactional public int insertXzPurchaseResourceApply(XzPurchaseResourceApply xzPurchaseResourceApply) { //修改:删除之前这条code数据 xzPurchaseResourceApplyMapper.deleteXzPurchaseResourceByCode(xzPurchaseResourceApply.getCode()); //新增数据 XzPurchaseResourceApply xz = xzPurchaseResourceMapper.selectXzPurchaseResourceIdByCode(xzPurchaseResourceApply.getCode()); xzPurchaseResourceApply.setApplyId(xz.getApplyId()); xzPurchaseResourceApply.setApplyPrice(xz.getApplyPrice()); //是否关联:1是 2否 xzPurchaseResourceApply.setIsRelation("2"); //审批状态:1同意 2驳回 3未审批 4审批中 xzPurchaseResourceApply.setApprovalStatus("3"); //提交状态:1保存 2提交 int i = xzPurchaseResourceApplyMapper.insertXzPurchaseResourceApply(xzPurchaseResourceApply); Set<Long> xzPurchaseResourceProcess = xzApplyProcessService.createXzPurchaseResourceProcess(xzPurchaseResourceApply.getId(), xzPurchaseResourceApply.getApplyUserId(), xzPurchaseResourceApply.getApplyPrice()); if (xzPurchaseResourceProcess.size() == 0) { XzPurchaseResourceApply updateVo = new XzPurchaseResourceApply(); updateVo.setId(xzPurchaseResourceApply.getId()); updateVo.setApprovalStatus("1"); xzPurchaseResourceApplyMapper.updateXzPurchaseResourceApply(updateVo); } return i; } /** * 修改采购资源申请 * * @param xzPurchaseResourceApply 采购资源申请信息 * @return 结果 */ @Override @Transactional public int updateXzPurchaseResourceApply(XzPurchaseResourceApply xzPurchaseResourceApply) { try { //查询关联详情添加到费用管理表中 String applyId = xzPurchaseResourceApply.getApplyId().replace(",", ","); List<String> applyid = Arrays.asList(applyId.split(",")); for (int sn = 0; sn < applyid.size(); sn++) { //查询详情 XzPurchaseResource xzPurchaseResource = xzPurchaseResourceMapper.selectXzPurchaseResourceById(Long.parseLong(applyid.get(sn))); XzExpenseRecord xzExpenseRecord = new XzExpenseRecord(); //添加一条记录 xzExpenseRecord.setExpenseName(xzPurchaseResource.getResourceName()); xzExpenseRecord.setExpenseTypeParent(xzPurchaseResource.getResourceParentId()); xzExpenseRecord.setExpenseType(xzPurchaseResource.getResourceTypeId()); xzExpenseRecord.setRegion(xzPurchaseResource.getRegion()); xzExpenseRecord.setDevDesc(xzPurchaseResource.getResourceSpec()); xzExpenseRecord.setPurchaseChannel(xzPurchaseResource.getPurchaseChannel()); xzExpenseRecord.setUnitPrice(xzPurchaseResource.getResourcePrice()); xzExpenseRecord.setCount(xzPurchaseResource.getResourceCount()); xzExpenseRecord.setUseDate(xzPurchaseResource.getUpdateTime()); xzExpenseRecord.setApplyUser(xzPurchaseResource.getCreateBy()); xzExpenseRecord.setSubmitType("2"); xzExpenseRecord.setSumPrice(xzPurchaseResource.getActualPrice()); xzExpenseRecord.setComment(xzPurchaseResource.getRemark()); xzExpenseRecordMapper.insertXzExpenseRecord(xzExpenseRecord); } //改为关联 xzPurchaseResourceApply.setIsRelation("1"); return xzPurchaseResourceApplyMapper.updateXzPurchaseResourceApply(xzPurchaseResourceApply); } catch (Exception e) { return 0; } } /** * 删除采购资源申请对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteXzPurchaseResourceApplyByIds(String ids) { return xzPurchaseResourceApplyMapper.deleteXzPurchaseResourceApplyByIds(Convert.toStrArray(ids)); } /** * 查看资源采购列表 */ @Override public XzPurchaseResourceApply detail(String code) { XzPurchaseResourceApply xzPurchaseResourceApply = xzPurchaseResourceApplyMapper.detail(code); List<XzPurchaseResource> xzPurchaseResourceList = xzPurchaseResourceApplyMapper.perResDetail(code); if (xzPurchaseResourceList.size() > 0 && xzPurchaseResourceList != null) { xzPurchaseResourceApply.setXzPurchaseResource(xzPurchaseResourceList); } return xzPurchaseResourceApply; } /** * 根据code查询 */ @Override public XzPurchaseResourceApply selectXzPurchaseResourceApplyByCode(String code) { return xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyByCode(code); } }
UTF-8
Java
7,865
java
XzPurchaseResourceApplyServiceImpl.java
Java
[ { "context": "e.text.Convert;\n\n/**\n * 采购资源申请 服务层实现\n *\n * @author ruoyi\n * @date 2019-09-17\n */\n@Service\npublic class XzP", "end": 819, "score": 0.9993612766265869, "start": 814, "tag": "USERNAME", "value": "ruoyi" } ]
null
[]
package com.ruoyi.system.service.impl; import java.util.Arrays; import java.util.List; import java.util.Set; import com.ruoyi.system.service.IXzApplyProcessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.system.mapper.XzExpenseRecordMapper; import com.ruoyi.system.mapper.XzPurchaseResourceApplyMapper; import com.ruoyi.system.mapper.XzPurchaseResourceMapper; import com.ruoyi.system.domain.XzExpenseRecord; import com.ruoyi.system.domain.XzPurchaseResource; import com.ruoyi.system.domain.XzPurchaseResourceApply; import com.ruoyi.system.service.IXzPurchaseResourceApplyService; import com.ruoyi.common.core.text.Convert; /** * 采购资源申请 服务层实现 * * @author ruoyi * @date 2019-09-17 */ @Service public class XzPurchaseResourceApplyServiceImpl implements IXzPurchaseResourceApplyService { @Autowired private XzPurchaseResourceApplyMapper xzPurchaseResourceApplyMapper; @Autowired private XzPurchaseResourceMapper xzPurchaseResourceMapper; @Autowired private XzExpenseRecordMapper xzExpenseRecordMapper; @Autowired private IXzApplyProcessService xzApplyProcessService; /** * 查询采购资源申请信息 * * @param id 采购资源申请ID * @return 采购资源申请信息 */ @Override public XzPurchaseResourceApply selectXzPurchaseResourceApplyById(Long id) { return xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyById(id); } /** * 查询采购资源申请列表 * * @param xzPurchaseResourceApply 采购资源申请信息 * @return 采购资源申请集合 */ @Override public List<XzPurchaseResourceApply> selectXzPurchaseResourceApplyList(XzPurchaseResourceApply xzPurchaseResourceApply) { List<XzPurchaseResourceApply> xzPurchaseResourceApplies = xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyList(xzPurchaseResourceApply); for (XzPurchaseResourceApply apply : xzPurchaseResourceApplies) { apply.setApproverName(xzApplyProcessService.selectApplyProcessApproverNameByApplyId(apply.getId())); } return xzPurchaseResourceApplies; } @Override public List<XzPurchaseResourceApply> selectXzPurchaseResourceApplyListByApprover(XzPurchaseResourceApply xzPurchaseResourceApply) { List<XzPurchaseResourceApply> xzPurchaseResourceApplies = xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyListByApprover(xzPurchaseResourceApply); for (XzPurchaseResourceApply apply : xzPurchaseResourceApplies) { apply.setApproverName(xzApplyProcessService.selectApplyProcessApproverNameByApplyId(apply.getId())); } return xzPurchaseResourceApplies; } /** * 新增采购资源申请 * * @param xzPurchaseResourceApply 采购资源申请信息 * @return 结果 */ @Override @Transactional public int insertXzPurchaseResourceApply(XzPurchaseResourceApply xzPurchaseResourceApply) { //修改:删除之前这条code数据 xzPurchaseResourceApplyMapper.deleteXzPurchaseResourceByCode(xzPurchaseResourceApply.getCode()); //新增数据 XzPurchaseResourceApply xz = xzPurchaseResourceMapper.selectXzPurchaseResourceIdByCode(xzPurchaseResourceApply.getCode()); xzPurchaseResourceApply.setApplyId(xz.getApplyId()); xzPurchaseResourceApply.setApplyPrice(xz.getApplyPrice()); //是否关联:1是 2否 xzPurchaseResourceApply.setIsRelation("2"); //审批状态:1同意 2驳回 3未审批 4审批中 xzPurchaseResourceApply.setApprovalStatus("3"); //提交状态:1保存 2提交 int i = xzPurchaseResourceApplyMapper.insertXzPurchaseResourceApply(xzPurchaseResourceApply); Set<Long> xzPurchaseResourceProcess = xzApplyProcessService.createXzPurchaseResourceProcess(xzPurchaseResourceApply.getId(), xzPurchaseResourceApply.getApplyUserId(), xzPurchaseResourceApply.getApplyPrice()); if (xzPurchaseResourceProcess.size() == 0) { XzPurchaseResourceApply updateVo = new XzPurchaseResourceApply(); updateVo.setId(xzPurchaseResourceApply.getId()); updateVo.setApprovalStatus("1"); xzPurchaseResourceApplyMapper.updateXzPurchaseResourceApply(updateVo); } return i; } /** * 修改采购资源申请 * * @param xzPurchaseResourceApply 采购资源申请信息 * @return 结果 */ @Override @Transactional public int updateXzPurchaseResourceApply(XzPurchaseResourceApply xzPurchaseResourceApply) { try { //查询关联详情添加到费用管理表中 String applyId = xzPurchaseResourceApply.getApplyId().replace(",", ","); List<String> applyid = Arrays.asList(applyId.split(",")); for (int sn = 0; sn < applyid.size(); sn++) { //查询详情 XzPurchaseResource xzPurchaseResource = xzPurchaseResourceMapper.selectXzPurchaseResourceById(Long.parseLong(applyid.get(sn))); XzExpenseRecord xzExpenseRecord = new XzExpenseRecord(); //添加一条记录 xzExpenseRecord.setExpenseName(xzPurchaseResource.getResourceName()); xzExpenseRecord.setExpenseTypeParent(xzPurchaseResource.getResourceParentId()); xzExpenseRecord.setExpenseType(xzPurchaseResource.getResourceTypeId()); xzExpenseRecord.setRegion(xzPurchaseResource.getRegion()); xzExpenseRecord.setDevDesc(xzPurchaseResource.getResourceSpec()); xzExpenseRecord.setPurchaseChannel(xzPurchaseResource.getPurchaseChannel()); xzExpenseRecord.setUnitPrice(xzPurchaseResource.getResourcePrice()); xzExpenseRecord.setCount(xzPurchaseResource.getResourceCount()); xzExpenseRecord.setUseDate(xzPurchaseResource.getUpdateTime()); xzExpenseRecord.setApplyUser(xzPurchaseResource.getCreateBy()); xzExpenseRecord.setSubmitType("2"); xzExpenseRecord.setSumPrice(xzPurchaseResource.getActualPrice()); xzExpenseRecord.setComment(xzPurchaseResource.getRemark()); xzExpenseRecordMapper.insertXzExpenseRecord(xzExpenseRecord); } //改为关联 xzPurchaseResourceApply.setIsRelation("1"); return xzPurchaseResourceApplyMapper.updateXzPurchaseResourceApply(xzPurchaseResourceApply); } catch (Exception e) { return 0; } } /** * 删除采购资源申请对象 * * @param ids 需要删除的数据ID * @return 结果 */ @Override public int deleteXzPurchaseResourceApplyByIds(String ids) { return xzPurchaseResourceApplyMapper.deleteXzPurchaseResourceApplyByIds(Convert.toStrArray(ids)); } /** * 查看资源采购列表 */ @Override public XzPurchaseResourceApply detail(String code) { XzPurchaseResourceApply xzPurchaseResourceApply = xzPurchaseResourceApplyMapper.detail(code); List<XzPurchaseResource> xzPurchaseResourceList = xzPurchaseResourceApplyMapper.perResDetail(code); if (xzPurchaseResourceList.size() > 0 && xzPurchaseResourceList != null) { xzPurchaseResourceApply.setXzPurchaseResource(xzPurchaseResourceList); } return xzPurchaseResourceApply; } /** * 根据code查询 */ @Override public XzPurchaseResourceApply selectXzPurchaseResourceApplyByCode(String code) { return xzPurchaseResourceApplyMapper.selectXzPurchaseResourceApplyByCode(code); } }
7,865
0.726432
0.723079
189
38.455025
39.625687
216
false
false
0
0
0
0
0
0
0.391534
false
false
12
9d6c4a943f990721552197f7d3c9f240ef75fdda
11,940,009,136,842
555f7111811ef5f0111d587d3469a928cbd1db53
/src/moviefiles/datamodel/MovieSummary.java
2ba7e3c36412281d582618f4d40952501948fcb7
[]
no_license
dhoang132/Danny-projects
https://github.com/dhoang132/Danny-projects
02e05b9b9a1d8579efeedaf690796b2fb7bd1fd8
c989b39e2968861e82d33862c2d743868a395baa
refs/heads/master
2021-09-02T02:07:09.657000
2017-12-29T17:16:10
2017-12-29T17:16:10
111,426,674
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package moviefiles.datamodel; import java.util.HashMap; import java.util.Map; public class MovieSummary { private Map<Integer, String> movieSummary; public MovieSummary(){ this.movieSummary=new HashMap<>(); } //adds key and summary to movie map. public void addSummary(Integer id, String summary){ this.movieSummary.put(id, summary); } //get summary with key public String getSumary(Integer id){ return movieSummary.get(id); } }
UTF-8
Java
494
java
MovieSummary.java
Java
[]
null
[]
package moviefiles.datamodel; import java.util.HashMap; import java.util.Map; public class MovieSummary { private Map<Integer, String> movieSummary; public MovieSummary(){ this.movieSummary=new HashMap<>(); } //adds key and summary to movie map. public void addSummary(Integer id, String summary){ this.movieSummary.put(id, summary); } //get summary with key public String getSumary(Integer id){ return movieSummary.get(id); } }
494
0.674089
0.674089
22
21.454546
18.074913
55
false
false
0
0
0
0
0
0
0.454545
false
false
12
a73c80165243b5460f3aa1316eb6f728c87d6c72
29,051,158,840,412
6b74b74960487f4af73fd992f18d4c171032ec3b
/Z-Queen/src/main/java/com/isahl/chess/queen/io/core/net/socket/BaseAioConnector.java
9afb23552021747382de9a61e6bae33d7b319ec8
[ "MIT" ]
permissive
William-d-zk/Z-Chess
https://github.com/William-d-zk/Z-Chess
266940045968761b21faa36e3ca5a95d46bb85bb
6cb2cf7bf5889adb65ebb9d7ee4b9d91615fdcd9
refs/heads/master
2023-05-28T09:46:33.301000
2022-09-13T13:34:33
2022-09-13T13:34:33
146,628,374
3
2
NOASSERTION
false
2023-05-23T20:16:13
2018-08-29T16:30:53
2022-09-13T13:51:40
2023-05-23T20:16:12
11,410
3
2
4
Java
false
false
/* * MIT License * * Copyright (c) 2016~2021. Z-Chess * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.isahl.chess.queen.io.core.net.socket; import com.isahl.chess.king.base.cron.features.ITask; import com.isahl.chess.king.base.disruptor.features.functions.IOperator; import com.isahl.chess.king.base.features.IFailed; import com.isahl.chess.king.base.features.model.ITriple; import com.isahl.chess.queen.config.ISocketConfig; import com.isahl.chess.queen.events.functions.SocketConnectFailed; import com.isahl.chess.queen.events.functions.SocketConnected; import com.isahl.chess.queen.io.core.features.model.session.ISession; import com.isahl.chess.queen.io.core.net.socket.features.IAioConnection; import com.isahl.chess.queen.io.core.net.socket.features.IAioConnector; import java.net.InetSocketAddress; import java.nio.channels.AsynchronousSocketChannel; import java.util.concurrent.atomic.AtomicInteger; import static com.isahl.chess.king.base.cron.Status.RUNNING; import static com.isahl.chess.king.base.cron.Status.STOP; /** * @author william.d.zk */ public abstract class BaseAioConnector extends AioCreator implements IAioConnector { protected BaseAioConnector(String host, int port, ISocketConfig socketConfig, IFailed<IAioConnector> failed) { super(socketConfig); _RemoteAddress = new InetSocketAddress(host, port); _FailedHandler = failed; } private final SocketConnectFailed _SocketConnectFailed = new SocketConnectFailed(); private final SocketConnected _SocketConnected = new SocketConnected(); private final InetSocketAddress _RemoteAddress; private final AtomicInteger _State = new AtomicInteger(ITask.ctlOf(RUNNING.getCode(), 0)); private final IFailed<IAioConnector> _FailedHandler; private InetSocketAddress mLocalBind; @Override public void error() { _FailedHandler.onFailed(this); } /** * 在执行retry操作之前需要先切换到stop状态 */ @Override public boolean retry() { OUTSIDE: for(; ; ) { int c = _State.get(); int rs = ITask.stateOf(c, RETRY_LIMIT); if(rs >= STOP.getCode()) {return false;} for(; ; ) { int rc = ITask.countOf(c, RETRY_LIMIT); if(rc >= RETRY_LIMIT) {return false;} if(ITask.compareAndIncrementRetry(_State, rc)) {return true;} c = _State.get();// reload if(ITask.stateOf(c, RETRY_LIMIT) != rs) { continue OUTSIDE; } } } } @Override public InetSocketAddress getRemoteAddress() { return _RemoteAddress; } @Override public InetSocketAddress getLocalAddress() { return mLocalBind; } @Override public void setLocalAddress(InetSocketAddress address) { mLocalBind = address; } @Override public IOperator<IAioConnection, AsynchronousSocketChannel, ITriple> getConnectedOperator() { return _SocketConnected; } @Override public IOperator<Throwable, IAioConnection, Void> getErrorOperator() { return _SocketConnectFailed; } @Override public void shutdown() { ITask.advanceState(_State, STOP.getCode(), RETRY_LIMIT); } @Override public boolean isShutdown() { return ITask.stateOf(_State.get(), RETRY_LIMIT) >= STOP.getCode(); } @Override public boolean isRunning() { return ITask.stateOf(_State.get(), RETRY_LIMIT) < STOP.getCode(); } @Override public boolean isValid() { return !isShutdown(); } @Override public boolean isInvalid() { return isShutdown(); } @Override public void onCreated(ISession session) { session.ready(); } }
UTF-8
Java
4,976
java
BaseAioConnector.java
Java
[ { "context": ".chess.king.base.cron.Status.STOP;\n\n/**\n * @author william.d.zk\n */\npublic abstract class BaseAioConnector\n ", "end": 2103, "score": 0.9109804630279541, "start": 2091, "tag": "USERNAME", "value": "william.d.zk" } ]
null
[]
/* * MIT License * * Copyright (c) 2016~2021. Z-Chess * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.isahl.chess.queen.io.core.net.socket; import com.isahl.chess.king.base.cron.features.ITask; import com.isahl.chess.king.base.disruptor.features.functions.IOperator; import com.isahl.chess.king.base.features.IFailed; import com.isahl.chess.king.base.features.model.ITriple; import com.isahl.chess.queen.config.ISocketConfig; import com.isahl.chess.queen.events.functions.SocketConnectFailed; import com.isahl.chess.queen.events.functions.SocketConnected; import com.isahl.chess.queen.io.core.features.model.session.ISession; import com.isahl.chess.queen.io.core.net.socket.features.IAioConnection; import com.isahl.chess.queen.io.core.net.socket.features.IAioConnector; import java.net.InetSocketAddress; import java.nio.channels.AsynchronousSocketChannel; import java.util.concurrent.atomic.AtomicInteger; import static com.isahl.chess.king.base.cron.Status.RUNNING; import static com.isahl.chess.king.base.cron.Status.STOP; /** * @author william.d.zk */ public abstract class BaseAioConnector extends AioCreator implements IAioConnector { protected BaseAioConnector(String host, int port, ISocketConfig socketConfig, IFailed<IAioConnector> failed) { super(socketConfig); _RemoteAddress = new InetSocketAddress(host, port); _FailedHandler = failed; } private final SocketConnectFailed _SocketConnectFailed = new SocketConnectFailed(); private final SocketConnected _SocketConnected = new SocketConnected(); private final InetSocketAddress _RemoteAddress; private final AtomicInteger _State = new AtomicInteger(ITask.ctlOf(RUNNING.getCode(), 0)); private final IFailed<IAioConnector> _FailedHandler; private InetSocketAddress mLocalBind; @Override public void error() { _FailedHandler.onFailed(this); } /** * 在执行retry操作之前需要先切换到stop状态 */ @Override public boolean retry() { OUTSIDE: for(; ; ) { int c = _State.get(); int rs = ITask.stateOf(c, RETRY_LIMIT); if(rs >= STOP.getCode()) {return false;} for(; ; ) { int rc = ITask.countOf(c, RETRY_LIMIT); if(rc >= RETRY_LIMIT) {return false;} if(ITask.compareAndIncrementRetry(_State, rc)) {return true;} c = _State.get();// reload if(ITask.stateOf(c, RETRY_LIMIT) != rs) { continue OUTSIDE; } } } } @Override public InetSocketAddress getRemoteAddress() { return _RemoteAddress; } @Override public InetSocketAddress getLocalAddress() { return mLocalBind; } @Override public void setLocalAddress(InetSocketAddress address) { mLocalBind = address; } @Override public IOperator<IAioConnection, AsynchronousSocketChannel, ITriple> getConnectedOperator() { return _SocketConnected; } @Override public IOperator<Throwable, IAioConnection, Void> getErrorOperator() { return _SocketConnectFailed; } @Override public void shutdown() { ITask.advanceState(_State, STOP.getCode(), RETRY_LIMIT); } @Override public boolean isShutdown() { return ITask.stateOf(_State.get(), RETRY_LIMIT) >= STOP.getCode(); } @Override public boolean isRunning() { return ITask.stateOf(_State.get(), RETRY_LIMIT) < STOP.getCode(); } @Override public boolean isValid() { return !isShutdown(); } @Override public boolean isInvalid() { return isShutdown(); } @Override public void onCreated(ISession session) { session.ready(); } }
4,976
0.674484
0.672665
163
29.343557
29.116938
117
false
false
0
0
0
0
0
0
0.539877
false
false
12
5a3abfdf9e6cc5c124e58c3485aeac30daea4ba6
29,051,158,839,012
abfd8511977611ba907f9e922e11870494854750
/OVERAPP/app/src/main/java/com/com/overapp/model/CommentAdapter.java
50422563c258564efaf8244a756fdbd07c5afcc5
[]
no_license
ymhapp/MinHaoAndroid
https://github.com/ymhapp/MinHaoAndroid
ad005c4ed7098fd7438fae7b7cf6b3a3e79d3199
cdba1149d2e1c9b82e4136388198481f23204dc3
refs/heads/master
2020-04-12T05:40:04.667000
2017-02-28T18:22:43
2017-02-28T18:22:43
65,703,689
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.com.overapp.model; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.example.overapp.R; import java.util.List; /** * Created by acer on 2016/11/26. */ public class CommentAdapter extends BaseAdapter { public List<CommentItemBean> mList; public LayoutInflater mInflater; public CommentAdapter(Context context, List<CommentItemBean> list) { mList = list; mInflater = LayoutInflater.from(context); } @Override public int getCount() { return mList.size(); } @Override public Object getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.comment_list, null); } TextView usernaem = (TextView) convertView.findViewById(R.id.text_username); TextView time = (TextView) convertView.findViewById(R.id.text_time); TextView comment = (TextView) convertView.findViewById(R.id.text_comment); CommentItemBean bean = mList.get(position); usernaem.setText(bean.UserName); time.setText(bean.Time); comment.setText(bean.Comment); return convertView; } }
UTF-8
Java
1,527
java
CommentAdapter.java
Java
[ { "context": "rapp.R;\n\nimport java.util.List;\n\n/**\n * Created by acer on 2016/11/26.\n */\npublic class CommentAdapter ex", "end": 303, "score": 0.9994537830352783, "start": 299, "tag": "USERNAME", "value": "acer" } ]
null
[]
package com.com.overapp.model; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.example.overapp.R; import java.util.List; /** * Created by acer on 2016/11/26. */ public class CommentAdapter extends BaseAdapter { public List<CommentItemBean> mList; public LayoutInflater mInflater; public CommentAdapter(Context context, List<CommentItemBean> list) { mList = list; mInflater = LayoutInflater.from(context); } @Override public int getCount() { return mList.size(); } @Override public Object getItem(int position) { return mList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.comment_list, null); } TextView usernaem = (TextView) convertView.findViewById(R.id.text_username); TextView time = (TextView) convertView.findViewById(R.id.text_time); TextView comment = (TextView) convertView.findViewById(R.id.text_comment); CommentItemBean bean = mList.get(position); usernaem.setText(bean.UserName); time.setText(bean.Time); comment.setText(bean.Comment); return convertView; } }
1,527
0.679109
0.67387
59
24.864407
23.488518
84
false
false
0
0
0
0
0
0
0.491525
false
false
12
57ba1de84032c07973a615f3489affdd40a47699
28,372,554,007,568
07cc2898821e9a025684c1c989f78f5a7f1f303b
/InteInfo/src/main/java/com/inter/info/action/BaseAction.java
61b353f53d0e80bab5d5cd082d7eff0dbd449094
[]
no_license
oprcalf/InteInfo
https://github.com/oprcalf/InteInfo
620376c5e0451d166c8e51e529682ac6ddec3469
f801f0ebd6673c92776c7939f1864e57f3fb4db2
refs/heads/master
2020-04-10T19:48:16.049000
2015-01-26T02:41:00
2015-01-26T02:41:00
15,509,955
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.inter.info.action; import org.apache.log4j.Logger; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; import com.inter.info.utils.HandleEmail; import com.inter.info.utils.HandleJson; import com.inter.info.utils.HandleProperties; import com.opensymphony.xwork2.ActionSupport; @ParentPackage("basePackage") @Namespace("/") public class BaseAction extends ActionSupport { private static final Logger logger = Logger.getLogger(BaseAction.class); private static final long serialVersionUID = 6883203228535458267L; public void writeJson(Object object) { HandleJson.writeJson(object); } public void writeException(String ex) { logger.error(ex); } public void sendEmail(String Host, String[] FromAddress, String[] ToAddress, String Subject, String Content, String[] FileAddress) { HandleEmail sc = new HandleEmail(); sc.Send(Host, FromAddress, ToAddress, Subject, Content, FileAddress); } public String getProperties(String str) { HandleProperties getProperties = new HandleProperties(); return getProperties.getProps(str); } }
UTF-8
Java
1,179
java
BaseAction.java
Java
[]
null
[]
package com.inter.info.action; import org.apache.log4j.Logger; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; import com.inter.info.utils.HandleEmail; import com.inter.info.utils.HandleJson; import com.inter.info.utils.HandleProperties; import com.opensymphony.xwork2.ActionSupport; @ParentPackage("basePackage") @Namespace("/") public class BaseAction extends ActionSupport { private static final Logger logger = Logger.getLogger(BaseAction.class); private static final long serialVersionUID = 6883203228535458267L; public void writeJson(Object object) { HandleJson.writeJson(object); } public void writeException(String ex) { logger.error(ex); } public void sendEmail(String Host, String[] FromAddress, String[] ToAddress, String Subject, String Content, String[] FileAddress) { HandleEmail sc = new HandleEmail(); sc.Send(Host, FromAddress, ToAddress, Subject, Content, FileAddress); } public String getProperties(String str) { HandleProperties getProperties = new HandleProperties(); return getProperties.getProps(str); } }
1,179
0.75827
0.738762
39
28.23077
26.906734
109
false
false
0
0
0
0
0
0
1.333333
false
false
12
5971d6b364f597df7b5201e455a2218345142c25
12,713,103,199,812
9f087b78583ae101198714447806c3258f999e87
/src/session/OdbornikDaoLocal.java
c337228d0a7fa63e8d9597df40f2a8247344ca2b
[]
no_license
jansulja/XMLProjekat
https://github.com/jansulja/XMLProjekat
68948f36e4fec9ebb388ba0e0d096c298f237d2d
8aa3ddcc2b2cbbc9ff0562894830768f933100dc
refs/heads/master
2020-04-06T05:48:00.343000
2016-06-21T09:07:56
2016-06-21T09:07:56
58,272,545
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package session; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import model.Gradjanin; import model.Odbornik; import rs.ac.uns.ftn.xws.sessionbeans.common.GenericDao; public interface OdbornikDaoLocal extends GenericDao<Odbornik, Integer> { public Odbornik login(String username, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException; public void logout(); public boolean chechCred(String username, String password); }
UTF-8
Java
500
java
OdbornikDaoLocal.java
Java
[]
null
[]
package session; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import model.Gradjanin; import model.Odbornik; import rs.ac.uns.ftn.xws.sessionbeans.common.GenericDao; public interface OdbornikDaoLocal extends GenericDao<Odbornik, Integer> { public Odbornik login(String username, String password) throws UnsupportedEncodingException, NoSuchAlgorithmException; public void logout(); public boolean chechCred(String username, String password); }
500
0.832
0.832
18
26.777779
32.596107
119
false
false
0
0
0
0
0
0
0.888889
false
false
12
1c822d678b91ba647b94db3c5d2f10a3e40abc03
32,212,254,781,423
9d0e7d367bd52bdb1b5f70529320c69629ba4a7a
/app/src/main/java/com/mvptemplate/App.java
68abe5da72abdcd0f5a085f762560e6eed4203a3
[]
no_license
eymar/MyAppTemplate
https://github.com/eymar/MyAppTemplate
9f54f8cc93c50bfda318f89d8b1e03275e610370
a7889782e52f84a29202f309c36c7f5ee6f10805
refs/heads/master
2017-12-18T08:39:28.723000
2016-12-23T15:49:38
2016-12-23T15:49:38
77,161,591
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mvptemplate; import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import android.widget.Toast; import com.mvptemplate.di.AppComponent; import com.mvptemplate.di.AppModule; import com.mvptemplate.di.DaggerAppComponent; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; public class App extends Application { private AppComponent mAppComponent; private RefWatcher refWatcher; public static RefWatcher getRefWatcher(Context context) { App application = (App) context.getApplicationContext(); return application.refWatcher; } @Override public void onCreate() { super.onCreate(); initializeLeakCanary(); mAppComponent = DaggerAppComponent.builder() .appModule(new AppModule(this)) .build(); } private void initializeLeakCanary() { if(BuildConfig.LEAK_CANARY_ENABLED) { if (LeakCanary.isInAnalyzerProcess(this)) { // This process is dedicated to LeakCanary for heap analysis. // You should not init your app in this process. return; } Toast.makeText(this, "Leak Canary is enabled", Toast.LENGTH_SHORT).show(); refWatcher = LeakCanary.install(this); } } @NonNull public AppComponent getAppComponent() { return mAppComponent; } }
UTF-8
Java
1,477
java
App.java
Java
[]
null
[]
package com.mvptemplate; import android.app.Application; import android.content.Context; import android.support.annotation.NonNull; import android.widget.Toast; import com.mvptemplate.di.AppComponent; import com.mvptemplate.di.AppModule; import com.mvptemplate.di.DaggerAppComponent; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; public class App extends Application { private AppComponent mAppComponent; private RefWatcher refWatcher; public static RefWatcher getRefWatcher(Context context) { App application = (App) context.getApplicationContext(); return application.refWatcher; } @Override public void onCreate() { super.onCreate(); initializeLeakCanary(); mAppComponent = DaggerAppComponent.builder() .appModule(new AppModule(this)) .build(); } private void initializeLeakCanary() { if(BuildConfig.LEAK_CANARY_ENABLED) { if (LeakCanary.isInAnalyzerProcess(this)) { // This process is dedicated to LeakCanary for heap analysis. // You should not init your app in this process. return; } Toast.makeText(this, "Leak Canary is enabled", Toast.LENGTH_SHORT).show(); refWatcher = LeakCanary.install(this); } } @NonNull public AppComponent getAppComponent() { return mAppComponent; } }
1,477
0.668246
0.668246
54
26.351852
22.665977
86
false
false
0
0
0
0
0
0
0.425926
false
false
12
836f551ea848a4da59220f916f5f4ca5bedf284e
18,957,985,669,959
5fa590ba1a19c9eb9f000d652ff3d3a8a0cf1d64
/EclipseProject/tsdk4a/src/net/telesing/tsdk/tlib/utils/Utils.java
68ab8bd3b294e377cc198c95855c47b52db33ffe
[]
no_license
liliang2008ll/Telesing
https://github.com/liliang2008ll/Telesing
416fb9c5d43e41888166fa83aa8fd9722b0ade88
faca6a55e560a6eaba410c35612746cf120e43ef
refs/heads/master
2021-01-10T08:10:07.344000
2015-12-25T10:47:50
2015-12-25T10:47:50
47,320,122
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.telesing.tsdk.tlib.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; /** * Created by Administrator on 2015/12/16. */ public class Utils { /** * 获取日期相差天数 * * @param * @return 日期类型时间 * @throws ParseException */ public static int getDiffDay(String beginDate, String endDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); int checkday = 0; try { checkday = (int)(formatter.parse(endDate).getTime() - formatter.parse(beginDate).getTime()) / (1000 * 24 * 60 * 60); } catch (ParseException e) { e.printStackTrace(); checkday = 0; } return checkday; } /** * 获取系统时间 * * @param type: 1 获取日期 2 获取详细时间 * @return 字符串类型时间 * @throws ParseException */ public static String getStrSystemTime(String type) { String Pattern = "yyyy-MM-dd"; if (type.equals("1")) { Pattern = "yyyy-MM-dd"; } if (type.equals("2")) { Pattern = "yyyy-MM-dd HH:mm:ss"; } SimpleDateFormat formatter = new SimpleDateFormat(Pattern); Calendar calendar = Calendar.getInstance(); formatter.format(calendar.getTime()); String strdate = null; strdate = formatter.format(calendar.getTime()); return strdate; } }
UTF-8
Java
1,509
java
Utils.java
Java
[ { "context": "mat;\nimport java.util.Calendar;\n\n/**\n * Created by Administrator on 2015/12/16.\n */\npublic class Utils {\n /**\n ", "end": 166, "score": 0.6322106122970581, "start": 153, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package net.telesing.tsdk.tlib.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; /** * Created by Administrator on 2015/12/16. */ public class Utils { /** * 获取日期相差天数 * * @param * @return 日期类型时间 * @throws ParseException */ public static int getDiffDay(String beginDate, String endDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); int checkday = 0; try { checkday = (int)(formatter.parse(endDate).getTime() - formatter.parse(beginDate).getTime()) / (1000 * 24 * 60 * 60); } catch (ParseException e) { e.printStackTrace(); checkday = 0; } return checkday; } /** * 获取系统时间 * * @param type: 1 获取日期 2 获取详细时间 * @return 字符串类型时间 * @throws ParseException */ public static String getStrSystemTime(String type) { String Pattern = "yyyy-MM-dd"; if (type.equals("1")) { Pattern = "yyyy-MM-dd"; } if (type.equals("2")) { Pattern = "yyyy-MM-dd HH:mm:ss"; } SimpleDateFormat formatter = new SimpleDateFormat(Pattern); Calendar calendar = Calendar.getInstance(); formatter.format(calendar.getTime()); String strdate = null; strdate = formatter.format(calendar.getTime()); return strdate; } }
1,509
0.579791
0.563066
53
26.075472
23.44713
128
false
false
0
0
0
0
0
0
0.377358
false
false
12
c009959ad32e2efa02cdd2ce6ff319b4fdb1a255
13,426,067,768,228
b63ba1142a7796d265e8717b110c6ef73d6a4bdd
/app/src/main/java/com/fanxl/fanreader/presenter/impl/IGuokrPresenterImpl.java
5e28e1224d17a9f6e227f902c760a252133c02f4
[]
no_license
fanxl12/FanReader
https://github.com/fanxl12/FanReader
0d5fdcd150bfae466671cb594194b66b41f5bd26
dd32e86adbf73a890376a315115f231152f9ca0b
refs/heads/master
2021-01-09T20:37:39.126000
2016-06-29T02:22:37
2016-06-29T02:22:37
61,865,158
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fanxl.fanreader.presenter.impl; import com.fanxl.fanreader.api.guokr.GuokrRequest; import com.fanxl.fanreader.bean.guokr.GuokrHot; import com.fanxl.fanreader.presenter.IGuokrPresenter; import com.fanxl.fanreader.ui.iView.IGuokrFragment; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by fanxl2 on 2016/6/23. */ public class IGuokrPresenterImpl extends BasePresenterImpl implements IGuokrPresenter { private IGuokrFragment iGuokrFragment; public IGuokrPresenterImpl(IGuokrFragment iGuokrFragment){ if (iGuokrFragment==null){ throw new IllegalArgumentException("iGuokrFragment can not be null"); } this.iGuokrFragment=iGuokrFragment; } @Override public void getGuokrHot(int offset) { iGuokrFragment.showProgressDialog(); Subscription s = GuokrRequest.getGuokrApi().getGuokrHot(offset) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<GuokrHot>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { iGuokrFragment.hidProgressDialog(); iGuokrFragment.showError(e.getMessage()); } @Override public void onNext(GuokrHot guokrHot) { iGuokrFragment.hidProgressDialog(); iGuokrFragment.updateList(guokrHot.getResult()); } }); addSubscription(s); } @Override public void getGuokrHotFromCache(int offset) { } }
UTF-8
Java
1,510
java
IGuokrPresenterImpl.java
Java
[ { "context": "mport rx.schedulers.Schedulers;\n\n/**\n * Created by fanxl2 on 2016/6/23.\n */\npublic class IGuokrPresenterImp", "end": 401, "score": 0.999599277973175, "start": 395, "tag": "USERNAME", "value": "fanxl2" } ]
null
[]
package com.fanxl.fanreader.presenter.impl; import com.fanxl.fanreader.api.guokr.GuokrRequest; import com.fanxl.fanreader.bean.guokr.GuokrHot; import com.fanxl.fanreader.presenter.IGuokrPresenter; import com.fanxl.fanreader.ui.iView.IGuokrFragment; import rx.Observer; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; /** * Created by fanxl2 on 2016/6/23. */ public class IGuokrPresenterImpl extends BasePresenterImpl implements IGuokrPresenter { private IGuokrFragment iGuokrFragment; public IGuokrPresenterImpl(IGuokrFragment iGuokrFragment){ if (iGuokrFragment==null){ throw new IllegalArgumentException("iGuokrFragment can not be null"); } this.iGuokrFragment=iGuokrFragment; } @Override public void getGuokrHot(int offset) { iGuokrFragment.showProgressDialog(); Subscription s = GuokrRequest.getGuokrApi().getGuokrHot(offset) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<GuokrHot>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { iGuokrFragment.hidProgressDialog(); iGuokrFragment.showError(e.getMessage()); } @Override public void onNext(GuokrHot guokrHot) { iGuokrFragment.hidProgressDialog(); iGuokrFragment.updateList(guokrHot.getResult()); } }); addSubscription(s); } @Override public void getGuokrHotFromCache(int offset) { } }
1,510
0.749669
0.744371
59
24.59322
22.576513
87
false
false
0
0
0
0
0
0
2.169492
false
false
12
df2a06622b66b7b558c4f4ba420b02c9944bb950
37,220,186,615,260
605c28cc4d7ffd35583f6aba8cc58c7068f237e2
/src/com/dxjr/portal/account/util/UserNetFullBorrowValue.java
df2b9434c0ed67232334639f41bd3b45a3fc3302
[]
no_license
Lwb6666/dxjr_portal
https://github.com/Lwb6666/dxjr_portal
7ffb56c79f0bd07a39ac94f30b2280f7cc98a2e4
cceef6ee83d711988e9d1340f682e0782e392ba0
refs/heads/master
2023-04-21T07:38:25.528000
2021-05-10T02:47:22
2021-05-10T02:47:22
351,003,513
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dxjr.portal.account.util; import java.io.Serializable; import java.math.BigDecimal; /** * * <p> * Description:估算净值标满标后的净值额度和可提金额<br /> * </p> * * @title UserNetFullBorrowValue.java * @package com.dxjr.portal.account.util * @author yangshijin * @version 0.1 2015年1月21日 */ public class UserNetFullBorrowValue implements Serializable { private static final long serialVersionUID = 2983336490619187126L; /** 借款人id */ private Integer userid; /** 借款金额 */ private BigDecimal borrow_account; /** 借款期限 */ private Integer borrow_timelimit; /** 还款方式 */ private Integer borrow_style; /** */ private BigDecimal borrow_apr; /** 净值额度 */ private BigDecimal netMoneyLimit; /** 可提金额 */ private BigDecimal netDrawMoney; public Integer getUserid() { return userid; } public void setUserid(Integer userid) { this.userid = userid; } public BigDecimal getBorrow_account() { return borrow_account; } public void setBorrow_account(BigDecimal borrow_account) { this.borrow_account = borrow_account; } public Integer getBorrow_timelimit() { return borrow_timelimit; } public void setBorrow_timelimit(Integer borrow_timelimit) { this.borrow_timelimit = borrow_timelimit; } public Integer getBorrow_style() { return borrow_style; } public void setBorrow_style(Integer borrow_style) { this.borrow_style = borrow_style; } public BigDecimal getNetMoneyLimit() { return netMoneyLimit; } public void setNetMoneyLimit(BigDecimal netMoneyLimit) { this.netMoneyLimit = netMoneyLimit; } public BigDecimal getNetDrawMoney() { return netDrawMoney; } public void setNetDrawMoney(BigDecimal netDrawMoney) { this.netDrawMoney = netDrawMoney; } public BigDecimal getBorrow_apr() { return borrow_apr; } public void setBorrow_apr(BigDecimal borrow_apr) { this.borrow_apr = borrow_apr; } }
UTF-8
Java
1,943
java
UserNetFullBorrowValue.java
Java
[ { "context": "* @package com.dxjr.portal.account.util\n * @author yangshijin\n * @version 0.1 2015年1月21日\n */\npublic class UserN", "end": 265, "score": 0.9995777606964111, "start": 255, "tag": "USERNAME", "value": "yangshijin" } ]
null
[]
package com.dxjr.portal.account.util; import java.io.Serializable; import java.math.BigDecimal; /** * * <p> * Description:估算净值标满标后的净值额度和可提金额<br /> * </p> * * @title UserNetFullBorrowValue.java * @package com.dxjr.portal.account.util * @author yangshijin * @version 0.1 2015年1月21日 */ public class UserNetFullBorrowValue implements Serializable { private static final long serialVersionUID = 2983336490619187126L; /** 借款人id */ private Integer userid; /** 借款金额 */ private BigDecimal borrow_account; /** 借款期限 */ private Integer borrow_timelimit; /** 还款方式 */ private Integer borrow_style; /** */ private BigDecimal borrow_apr; /** 净值额度 */ private BigDecimal netMoneyLimit; /** 可提金额 */ private BigDecimal netDrawMoney; public Integer getUserid() { return userid; } public void setUserid(Integer userid) { this.userid = userid; } public BigDecimal getBorrow_account() { return borrow_account; } public void setBorrow_account(BigDecimal borrow_account) { this.borrow_account = borrow_account; } public Integer getBorrow_timelimit() { return borrow_timelimit; } public void setBorrow_timelimit(Integer borrow_timelimit) { this.borrow_timelimit = borrow_timelimit; } public Integer getBorrow_style() { return borrow_style; } public void setBorrow_style(Integer borrow_style) { this.borrow_style = borrow_style; } public BigDecimal getNetMoneyLimit() { return netMoneyLimit; } public void setNetMoneyLimit(BigDecimal netMoneyLimit) { this.netMoneyLimit = netMoneyLimit; } public BigDecimal getNetDrawMoney() { return netDrawMoney; } public void setNetDrawMoney(BigDecimal netDrawMoney) { this.netDrawMoney = netDrawMoney; } public BigDecimal getBorrow_apr() { return borrow_apr; } public void setBorrow_apr(BigDecimal borrow_apr) { this.borrow_apr = borrow_apr; } }
1,943
0.730997
0.715903
90
19.611111
18.888971
67
false
false
0
0
0
0
0
0
1.066667
false
false
12
7c65ea3d7e261cbe82c1913ae67b6bdabd457ac4
35,098,472,787,070
2258f30427a4bf11b2d4bf19e8b2eb371f63c26f
/BangJeck/app/src/main/java/com/bangjeck/setting/BangJeckSetting.java
ed66f03fef77051fd6117e75f5bc623dda276630
[]
no_license
handharbeni/BangJekCustomer
https://github.com/handharbeni/BangJekCustomer
23f1df17a9305f536d407a54aa03ac9128e45480
6bc6f1825d1aa3e40692080da95c36faebd8a92d
refs/heads/master
2021-04-27T09:14:09.495000
2018-03-18T18:05:49
2018-03-18T18:05:49
122,509,649
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bangjeck.setting; import android.support.v7.app.AppCompatActivity; public class BangJeckSetting extends AppCompatActivity{ public static String base_url = "http://31.220.53.148/bangjeck/"; public static boolean show_history = false; public static boolean show_notif = false; public static String kode_transaksi = ""; public static String kode_status = ""; public static String dari = ""; public static String pesan = ""; public static String tanggal = ""; public static int status = 0; }
UTF-8
Java
568
java
BangJeckSetting.java
Java
[ { "context": "ity{\n public static String base_url = \"http://31.220.53.148/bangjeck/\";\n public static boolean show_histor", "end": 195, "score": 0.9941111207008362, "start": 182, "tag": "IP_ADDRESS", "value": "31.220.53.148" } ]
null
[]
package com.bangjeck.setting; import android.support.v7.app.AppCompatActivity; public class BangJeckSetting extends AppCompatActivity{ public static String base_url = "http://172.16.31.10/bangjeck/"; public static boolean show_history = false; public static boolean show_notif = false; public static String kode_transaksi = ""; public static String kode_status = ""; public static String dari = ""; public static String pesan = ""; public static String tanggal = ""; public static int status = 0; }
567
0.674296
0.653169
17
32.470589
22.292488
70
false
false
0
0
0
0
0
0
0.647059
false
false
12
585a85fd8ab0308160bac558454c2f74475dcc80
34,162,169,927,233
65d59b1ad8acfee85926abf6eede6269af3d589e
/day0-day36/day30_arrayList/wrapper_class.java
7287effec865dda1d88ad982eec2cbc86ad457e9
[]
no_license
tskyline/Summer2019_Java
https://github.com/tskyline/Summer2019_Java
80ceb57d8997987e117e791c0180b7e83e6b5bb4
ee8d47ec8ce7bb33223bbc4067c8b3c98155011a
refs/heads/master
2020-09-19T21:26:33.692000
2019-12-10T18:51:45
2019-12-10T18:51:45
207,389,399
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package day30_arrayList; import java.util.Arrays; public class wrapper_class { public static void main(String[] args) { /* every primitives in java has a class that's designed to it. primitives : byte, short, int, long, float, double, boolean, char wrapper classes : Byte, Short, Integer, Long, Float, Double, Boolean, Character all wrapper classes presented in "java.lang" package String class is also presented in "java.lang" package All classes in "java.lang" are imported by default. */ int num=10; Integer numw=10; double d=1.1; Double dw=1.1; long l=20L; Long lw=l; // Auto-Boxing: process in the background Boolean rw=false; boolean r=rw; // Unboxing int[]arr=new int[3]; System.out.println(Arrays.toString(arr)); Integer[]arw=new Integer[3]; System.out.println(Arrays.toString(arw)); //All the default value of wrapper classes is "null". /* useful methods of wrapper class Max_Value Min_Value parse methods ValueOfmethods */ Integer num2=20; int x=num2.MAX_VALUE; System.out.println(x); } }
UTF-8
Java
1,165
java
wrapper_class.java
Java
[]
null
[]
package day30_arrayList; import java.util.Arrays; public class wrapper_class { public static void main(String[] args) { /* every primitives in java has a class that's designed to it. primitives : byte, short, int, long, float, double, boolean, char wrapper classes : Byte, Short, Integer, Long, Float, Double, Boolean, Character all wrapper classes presented in "java.lang" package String class is also presented in "java.lang" package All classes in "java.lang" are imported by default. */ int num=10; Integer numw=10; double d=1.1; Double dw=1.1; long l=20L; Long lw=l; // Auto-Boxing: process in the background Boolean rw=false; boolean r=rw; // Unboxing int[]arr=new int[3]; System.out.println(Arrays.toString(arr)); Integer[]arw=new Integer[3]; System.out.println(Arrays.toString(arw)); //All the default value of wrapper classes is "null". /* useful methods of wrapper class Max_Value Min_Value parse methods ValueOfmethods */ Integer num2=20; int x=num2.MAX_VALUE; System.out.println(x); } }
1,165
0.643777
0.628326
59
18.745762
20.727116
83
false
false
0
0
0
0
0
0
2.779661
false
false
12
c53d022fa06a31d1d2306d8eba497d0b8da73594
39,024,072,867,898
a9ca37753c3bd77020036772339307c337efa52a
/src/util/DadosException.java
5f536a6961bd98e404833e9f7be4ee950b7e8c1c
[]
no_license
DayvsonWellerson/goToChurch
https://github.com/DayvsonWellerson/goToChurch
3155893809a87c424b13dbeeb7eb5557f8058275
28f1774f3f88e6f894e5aa8af10e845a4bcb7ee0
refs/heads/master
2021-01-20T05:09:02.763000
2017-06-12T18:38:14
2017-06-12T18:38:14
89,751,425
0
2
null
false
2017-06-04T21:20:33
2017-04-28T23:18:28
2017-04-28T23:18:28
2017-06-04T21:20:33
3,724
0
2
0
null
null
null
package util; @SuppressWarnings("serial") public class DadosException extends Exception { public DadosException() { super(); } public DadosException(String erro) { super(erro); } }
UTF-8
Java
192
java
DadosException.java
Java
[]
null
[]
package util; @SuppressWarnings("serial") public class DadosException extends Exception { public DadosException() { super(); } public DadosException(String erro) { super(erro); } }
192
0.71875
0.71875
13
13.769231
15.171602
47
false
false
0
0
0
0
0
0
0.846154
false
false
12
d927f3c21713e307365a9aef71a1e7a1e82be4c8
39,427,799,817,902
6e5c9b3dfed5b3f168e395db2dc221fa48aa6dc9
/itb4/EasyCheck-beta/src/main/java/at/fhv/itb4/teamC/gui/guicontroller/tableView/PersonSelectionTable.java
9e499dd9e2b49c62b180bb21592e024b3d2da3ba
[]
no_license
DrexAt/FHV-Bachelor
https://github.com/DrexAt/FHV-Bachelor
34318e1b695c6602a6faf2fa1986894660838636
def2701035987767cd9fa6006059013f99aaa181
refs/heads/master
2020-07-26T21:54:59.447000
2019-09-16T10:51:12
2019-09-16T10:51:12
208,776,281
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.fhv.itb4.teamC.gui.guicontroller.tableView; import at.fhv.itb4.teamC.domainmodel.view.PersonView; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; /** * PersonSelectionTable<br> * description * <br> * project EasyCheck <br> * package at.fhv.itb4.teamC.guicontroller.tableView * * @author Mathias * @version 0.1 * @since 2018_04_09 */ public class PersonSelectionTable { private SimpleIntegerProperty _personID; private SimpleStringProperty _fname; private SimpleStringProperty _lname; private SimpleStringProperty _dateOfBirth; private SimpleStringProperty _phoneNumber; private SimpleStringProperty _emailAddress; private SimpleStringProperty _country; private SimpleStringProperty _address; private PersonView _view; public PersonSelectionTable(PersonView personView){ _view = personView; _personID = new SimpleIntegerProperty(personView.getPersonOID()); _fname = new SimpleStringProperty(personView.getFirstName()); _lname = new SimpleStringProperty(personView.getLastName()); _phoneNumber = new SimpleStringProperty(personView.getPhone()); _emailAddress = new SimpleStringProperty(personView.getEmail()); _dateOfBirth = new SimpleStringProperty(personView.getDateOfBirth().toString()); _country = new SimpleStringProperty(personView.getCountry()); _address = new SimpleStringProperty(personView.getStreet()); } public int getPersonID() { return _personID.get(); } public SimpleIntegerProperty personIDProperty() { return _personID; } public void setPersonID(int personID) { _personID.set(personID); } public String getFname() { return _fname.get(); } public SimpleStringProperty fnameProperty() { return _fname; } public void setFname(String fname) { _fname.set(fname); } public String getLname() { return _lname.get(); } public SimpleStringProperty lnameProperty() { return _lname; } public void setLname(String lname) { _lname.set(lname); } public String getDateOfBirth() { return _dateOfBirth.get(); } public SimpleStringProperty dateOfBirthProperty() { return _dateOfBirth; } public void setDateOfBirth(String dateOfBirth) { _dateOfBirth.set(dateOfBirth); } public String getPhoneNumber() { return _phoneNumber.get(); } public SimpleStringProperty phoneNumberProperty() { return _phoneNumber; } public void setPhoneNumber(String phoneNumber) { _phoneNumber.set(phoneNumber); } public String getEmailAddress() { return _emailAddress.get(); } public SimpleStringProperty emailAddressProperty() { return _emailAddress; } public void setEmailAddress(String emailAddress) { _emailAddress.set(emailAddress); } public String getCountry() { return _country.get(); } public SimpleStringProperty countryProperty() { return _country; } public void setCountry(String country) { _country.set(country); } public String getAddress() { return _address.get(); } public SimpleStringProperty addressProperty() { return _address; } public void setAddress(String address) { _address.set(address); } }
UTF-8
Java
3,495
java
PersonSelectionTable.java
Java
[ { "context": "v.itb4.teamC.guicontroller.tableView\n *\n * @author Mathias\n * @version 0.1\n * @since 2018_04_09\n */\npublic c", "end": 369, "score": 0.999779462814331, "start": 362, "tag": "NAME", "value": "Mathias" } ]
null
[]
package at.fhv.itb4.teamC.gui.guicontroller.tableView; import at.fhv.itb4.teamC.domainmodel.view.PersonView; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; /** * PersonSelectionTable<br> * description * <br> * project EasyCheck <br> * package at.fhv.itb4.teamC.guicontroller.tableView * * @author Mathias * @version 0.1 * @since 2018_04_09 */ public class PersonSelectionTable { private SimpleIntegerProperty _personID; private SimpleStringProperty _fname; private SimpleStringProperty _lname; private SimpleStringProperty _dateOfBirth; private SimpleStringProperty _phoneNumber; private SimpleStringProperty _emailAddress; private SimpleStringProperty _country; private SimpleStringProperty _address; private PersonView _view; public PersonSelectionTable(PersonView personView){ _view = personView; _personID = new SimpleIntegerProperty(personView.getPersonOID()); _fname = new SimpleStringProperty(personView.getFirstName()); _lname = new SimpleStringProperty(personView.getLastName()); _phoneNumber = new SimpleStringProperty(personView.getPhone()); _emailAddress = new SimpleStringProperty(personView.getEmail()); _dateOfBirth = new SimpleStringProperty(personView.getDateOfBirth().toString()); _country = new SimpleStringProperty(personView.getCountry()); _address = new SimpleStringProperty(personView.getStreet()); } public int getPersonID() { return _personID.get(); } public SimpleIntegerProperty personIDProperty() { return _personID; } public void setPersonID(int personID) { _personID.set(personID); } public String getFname() { return _fname.get(); } public SimpleStringProperty fnameProperty() { return _fname; } public void setFname(String fname) { _fname.set(fname); } public String getLname() { return _lname.get(); } public SimpleStringProperty lnameProperty() { return _lname; } public void setLname(String lname) { _lname.set(lname); } public String getDateOfBirth() { return _dateOfBirth.get(); } public SimpleStringProperty dateOfBirthProperty() { return _dateOfBirth; } public void setDateOfBirth(String dateOfBirth) { _dateOfBirth.set(dateOfBirth); } public String getPhoneNumber() { return _phoneNumber.get(); } public SimpleStringProperty phoneNumberProperty() { return _phoneNumber; } public void setPhoneNumber(String phoneNumber) { _phoneNumber.set(phoneNumber); } public String getEmailAddress() { return _emailAddress.get(); } public SimpleStringProperty emailAddressProperty() { return _emailAddress; } public void setEmailAddress(String emailAddress) { _emailAddress.set(emailAddress); } public String getCountry() { return _country.get(); } public SimpleStringProperty countryProperty() { return _country; } public void setCountry(String country) { _country.set(country); } public String getAddress() { return _address.get(); } public SimpleStringProperty addressProperty() { return _address; } public void setAddress(String address) { _address.set(address); } }
3,495
0.6701
0.666381
141
23.787233
22.213282
88
false
false
0
0
0
0
0
0
0.326241
false
false
12
0c4efb8a6a7458e6b7093332a83d801c5f5bb83f
39,333,310,500,747
d62a4ba5e94279bfc9f1216c2ef208e46d17bbaf
/Capitulo 06 -Numeros Aleatorios/Apuntes.java
0bf9d01b73f9f2ebf276e579bbb7ecd413977125
[]
no_license
JavierBernalGuerrero/ejercicios-java
https://github.com/JavierBernalGuerrero/ejercicios-java
7701e4f64f82765e74a9e87c7cb465049f7a73c0
f64023b4d07ade7d05b4d5aa505485ace8093789
refs/heads/master
2020-04-06T04:27:24.507000
2016-09-21T20:36:11
2016-09-21T20:36:11
43,484,206
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Generación de números aleatorios. * * @author Javier Bernal Guerrero **/ public class Apuntes { public static void main(String[] args) { System.out.println("20 números aleatorios entre 3 y 12 (sin decimales):"); for (int i = 1; i <= 20; i++) { // \/ Cantidad de posibilidades System.out.print((int)(Math.random() * 10) + 3 + " "); // /\ Primer numero para la cadena } } }
UTF-8
Java
464
java
Apuntes.java
Java
[ { "context": " * Generación de números aleatorios.\n *\n * @author Javier Bernal Guerrero\n**/\n\n\npublic class Apuntes {\n public static void", "end": 77, "score": 0.9998456239700317, "start": 55, "tag": "NAME", "value": "Javier Bernal Guerrero" } ]
null
[]
/** * Generación de números aleatorios. * * @author <NAME> **/ public class Apuntes { public static void main(String[] args) { System.out.println("20 números aleatorios entre 3 y 12 (sin decimales):"); for (int i = 1; i <= 20; i++) { // \/ Cantidad de posibilidades System.out.print((int)(Math.random() * 10) + 3 + " "); // /\ Primer numero para la cadena } } }
448
0.537961
0.5141
17
26.117647
29.397644
83
false
false
0
0
0
0
0
0
0.235294
false
false
12
52b327ccc2611e5ee971a03d098e910d902241dc
19,756,849,563,101
91e04b72229eaecb041c96d3d56069022eeb6f14
/spreadsheet/spreadsheet-poi/src/main/java/ec/util/spreadsheet/poi/FastPoiSheetBuilder.java
d55518418e424db430df8357dc425d5221393606
[]
no_license
codeaudit/jdemetra-core
https://github.com/codeaudit/jdemetra-core
067c3326b419175b4b66dce6921cfd1c8f27347c
c5091e7c5c8158b9a29806f306a80baacc38aaa8
refs/heads/master
2021-01-14T11:07:57.153000
2015-01-13T10:18:36
2015-01-13T10:18:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2013 National Bank of Belgium * * Licensed under the EUPL, Version 1.1 or – as soon they will be approved * by the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * * http://ec.europa.eu/idabc/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package ec.util.spreadsheet.poi; import ec.util.spreadsheet.Sheet; import ec.util.spreadsheet.helpers.ArraySheet; import ec.util.spreadsheet.helpers.CellRefHelper; import ec.util.spreadsheet.poi.FastPoiBook.SheetContext; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Queue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.poi.ss.usermodel.DateUtil; import java.text.DateFormat; import java.text.ParseException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Philippe Charles */ abstract class FastPoiSheetBuilder { @Nonnull abstract public FastPoiSheetBuilder put(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex); @Nonnull abstract public Sheet build(); private static final int CORES = Runtime.getRuntime().availableProcessors(); @Nonnull public static FastPoiSheetBuilder create(@Nonnull String name, @Nonnull FastPoiBook.SheetContext sheetContext, @Nullable String sheetBounds) { return CORES > 1 ? new MultiThreadedBuilder(name, sheetContext, sheetBounds) : new Builder(name, sheetContext, sheetBounds); } //<editor-fold defaultstate="collapsed" desc="Implementation details"> private static class Builder extends FastPoiSheetBuilder { private final ArraySheet.Builder valuesBuilder; private final CellRefHelper refHelper; private final CellValueFactory valueFactory; public Builder(@Nonnull String name, @Nonnull FastPoiBook.SheetContext sheetContext, @Nullable String sheetBounds) { this.valuesBuilder = ArraySheet.builder(sheetBounds).name(name); this.refHelper = new CellRefHelper(); this.valueFactory = new CellValueFactory(sheetContext); } @Override public Builder put(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { process(ref, rawValue, rawDataType, rawStyleIndex); return this; } protected void process(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { Object cellValue = valueFactory.getValue(rawValue.toString(), rawDataType, rawStyleIndex); if (cellValue == null || !refHelper.parse(ref)) { return; } valuesBuilder.value(refHelper.getRowIndex(), refHelper.getColumnIndex(), cellValue); } @Override public Sheet build() { return valuesBuilder.build(); } } private static final class MultiThreadedBuilder extends Builder { private final ExecutorService executor; private final Queue<QueueItem> queue; private final Consumer singleConsumer; // int outOfCapacity = 0; public MultiThreadedBuilder(@Nonnull String name, @Nonnull FastPoiBook.SheetContext sheetContext, @Nullable String sheetBounds) { super(name, sheetContext, sheetBounds); this.executor = Executors.newSingleThreadExecutor(); this.queue = new P1C1QueueOriginal3<>(1000); this.singleConsumer = new Consumer<QueueItem>(queue) { @Override protected void consume(QueueItem item) { process(item.ref, item.rawValue, item.rawDataType, item.rawStyleIndex); } }; executor.execute(singleConsumer); } @Override public Builder put(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { QueueItem item = new QueueItem(ref, rawValue, rawDataType, rawStyleIndex); if (!queue.offer(item)) { // outOfCapacity++; do { threadYield(); } while (!queue.offer(item)); } return this; } @Override public Sheet build() { // System.out.println("outOfCapacity=" + outOfCapacity); while (!queue.isEmpty()) { threadYield(); } singleConsumer.interrupt(); executor.shutdown(); try { executor.awaitTermination(100, TimeUnit.SECONDS); } catch (InterruptedException ex) { Logger.getLogger(MultiThreadedBuilder.class.getName()).log(Level.SEVERE, "", ex); } return super.build(); } private static final class QueueItem { @Nullable public final String ref; @Nonnull public final CharSequence rawValue; @Nullable public final String rawDataType; @Nullable public final String rawStyleIndex; public QueueItem(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { this.ref = ref; this.rawValue = rawValue; this.rawDataType = rawDataType; this.rawStyleIndex = rawStyleIndex; } } private static abstract class Consumer<T> implements Runnable { private final Queue<T> queue; private final AtomicBoolean endOfData; public Consumer(Queue<T> queue) { this.queue = queue; this.endOfData = new AtomicBoolean(false); } @Override public void run() { T result; while (true) { while (null == (result = queue.poll())) { if (endOfData.get()) { return; } threadYield(); } consume(result); } } abstract protected void consume(T item); public void interrupt() { endOfData.set(true); } } @SuppressWarnings("CallToThreadYield") private static void threadYield() { Thread.yield(); } } private static final class CellValueFactory { // http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2012/03/08/dates-in-strict-spreadsheetml-files.aspx private static final String ISO_DATE_FORMAT = "yyyy-MM-dd"; // http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.cellvalues.aspx private static final String BOOLEAN = "b"; private static final String NUMBER = "n"; private static final String ERROR = "e"; private static final String SHARED_STRING = "s"; private static final String STRING = "str"; private static final String INLINE_STRING = "inlineStr"; private static final String DATE = "d"; // private final SheetContext context; // private final Calendar calendar; private final DateFormat isoDateFormat; public CellValueFactory(SheetContext context) { this.context = context; // using default time-zone this.calendar = new GregorianCalendar(); this.isoDateFormat = new SimpleDateFormat(ISO_DATE_FORMAT); } private boolean isDateStyle(@Nullable String rawStyleIndex) { if (rawStyleIndex == null) { return false; } int styleIndex = Integer.parseInt(rawStyleIndex); FastPoiBook.Style style = context.styles.get(styleIndex); return DateUtil.isADateFormat(style.formatId, style.formatString); } @Nullable private Number parseNumber(@Nonnull String rawValue) { try { return Double.valueOf(rawValue); } catch (NumberFormatException ex) { return null; } } @Nullable private Object getNumberOrDate(@Nonnull String rawValue, @Nullable String rawStyleIndex) { Number number = parseNumber(rawValue); if (number != null && isDateStyle(rawStyleIndex)) { double tmp = number.doubleValue(); if (DateUtil.isValidExcelDate(tmp)) { return DateUtil2.getJavaDate(calendar, tmp, context.date1904); } } return number; } @Nullable public Object getValue(@Nonnull String rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { if (rawDataType == null) { return getNumberOrDate(rawValue, rawStyleIndex); } switch (rawDataType) { case NUMBER: return getNumberOrDate(rawValue, rawStyleIndex); case SHARED_STRING: return context.sharedStrings.get(Integer.parseInt(rawValue)); case STRING: return rawValue; case INLINE_STRING: // TODO: rawValue might contain rich text return rawValue; case DATE: try { return isoDateFormat.parse(rawValue); } catch (ParseException ex) { return null; } default: // BOOLEAN or ERROR or default return null; } } } //</editor-fold> }
UTF-8
Java
10,831
java
FastPoiSheetBuilder.java
Java
[ { "context": "t java.util.logging.Logger;\r\n\r\n/**\r\n *\r\n * @author Philippe Charles\r\n */\r\nabstract class FastPoiSheetBuilder {\r\n\r\n ", "end": 1515, "score": 0.9996359348297119, "start": 1499, "tag": "NAME", "value": "Philippe Charles" } ]
null
[]
/* * Copyright 2013 National Bank of Belgium * * Licensed under the EUPL, Version 1.1 or – as soon they will be approved * by the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * * http://ec.europa.eu/idabc/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package ec.util.spreadsheet.poi; import ec.util.spreadsheet.Sheet; import ec.util.spreadsheet.helpers.ArraySheet; import ec.util.spreadsheet.helpers.CellRefHelper; import ec.util.spreadsheet.poi.FastPoiBook.SheetContext; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Queue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.poi.ss.usermodel.DateUtil; import java.text.DateFormat; import java.text.ParseException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author <NAME> */ abstract class FastPoiSheetBuilder { @Nonnull abstract public FastPoiSheetBuilder put(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex); @Nonnull abstract public Sheet build(); private static final int CORES = Runtime.getRuntime().availableProcessors(); @Nonnull public static FastPoiSheetBuilder create(@Nonnull String name, @Nonnull FastPoiBook.SheetContext sheetContext, @Nullable String sheetBounds) { return CORES > 1 ? new MultiThreadedBuilder(name, sheetContext, sheetBounds) : new Builder(name, sheetContext, sheetBounds); } //<editor-fold defaultstate="collapsed" desc="Implementation details"> private static class Builder extends FastPoiSheetBuilder { private final ArraySheet.Builder valuesBuilder; private final CellRefHelper refHelper; private final CellValueFactory valueFactory; public Builder(@Nonnull String name, @Nonnull FastPoiBook.SheetContext sheetContext, @Nullable String sheetBounds) { this.valuesBuilder = ArraySheet.builder(sheetBounds).name(name); this.refHelper = new CellRefHelper(); this.valueFactory = new CellValueFactory(sheetContext); } @Override public Builder put(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { process(ref, rawValue, rawDataType, rawStyleIndex); return this; } protected void process(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { Object cellValue = valueFactory.getValue(rawValue.toString(), rawDataType, rawStyleIndex); if (cellValue == null || !refHelper.parse(ref)) { return; } valuesBuilder.value(refHelper.getRowIndex(), refHelper.getColumnIndex(), cellValue); } @Override public Sheet build() { return valuesBuilder.build(); } } private static final class MultiThreadedBuilder extends Builder { private final ExecutorService executor; private final Queue<QueueItem> queue; private final Consumer singleConsumer; // int outOfCapacity = 0; public MultiThreadedBuilder(@Nonnull String name, @Nonnull FastPoiBook.SheetContext sheetContext, @Nullable String sheetBounds) { super(name, sheetContext, sheetBounds); this.executor = Executors.newSingleThreadExecutor(); this.queue = new P1C1QueueOriginal3<>(1000); this.singleConsumer = new Consumer<QueueItem>(queue) { @Override protected void consume(QueueItem item) { process(item.ref, item.rawValue, item.rawDataType, item.rawStyleIndex); } }; executor.execute(singleConsumer); } @Override public Builder put(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { QueueItem item = new QueueItem(ref, rawValue, rawDataType, rawStyleIndex); if (!queue.offer(item)) { // outOfCapacity++; do { threadYield(); } while (!queue.offer(item)); } return this; } @Override public Sheet build() { // System.out.println("outOfCapacity=" + outOfCapacity); while (!queue.isEmpty()) { threadYield(); } singleConsumer.interrupt(); executor.shutdown(); try { executor.awaitTermination(100, TimeUnit.SECONDS); } catch (InterruptedException ex) { Logger.getLogger(MultiThreadedBuilder.class.getName()).log(Level.SEVERE, "", ex); } return super.build(); } private static final class QueueItem { @Nullable public final String ref; @Nonnull public final CharSequence rawValue; @Nullable public final String rawDataType; @Nullable public final String rawStyleIndex; public QueueItem(@Nullable String ref, @Nonnull CharSequence rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { this.ref = ref; this.rawValue = rawValue; this.rawDataType = rawDataType; this.rawStyleIndex = rawStyleIndex; } } private static abstract class Consumer<T> implements Runnable { private final Queue<T> queue; private final AtomicBoolean endOfData; public Consumer(Queue<T> queue) { this.queue = queue; this.endOfData = new AtomicBoolean(false); } @Override public void run() { T result; while (true) { while (null == (result = queue.poll())) { if (endOfData.get()) { return; } threadYield(); } consume(result); } } abstract protected void consume(T item); public void interrupt() { endOfData.set(true); } } @SuppressWarnings("CallToThreadYield") private static void threadYield() { Thread.yield(); } } private static final class CellValueFactory { // http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2012/03/08/dates-in-strict-spreadsheetml-files.aspx private static final String ISO_DATE_FORMAT = "yyyy-MM-dd"; // http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.cellvalues.aspx private static final String BOOLEAN = "b"; private static final String NUMBER = "n"; private static final String ERROR = "e"; private static final String SHARED_STRING = "s"; private static final String STRING = "str"; private static final String INLINE_STRING = "inlineStr"; private static final String DATE = "d"; // private final SheetContext context; // private final Calendar calendar; private final DateFormat isoDateFormat; public CellValueFactory(SheetContext context) { this.context = context; // using default time-zone this.calendar = new GregorianCalendar(); this.isoDateFormat = new SimpleDateFormat(ISO_DATE_FORMAT); } private boolean isDateStyle(@Nullable String rawStyleIndex) { if (rawStyleIndex == null) { return false; } int styleIndex = Integer.parseInt(rawStyleIndex); FastPoiBook.Style style = context.styles.get(styleIndex); return DateUtil.isADateFormat(style.formatId, style.formatString); } @Nullable private Number parseNumber(@Nonnull String rawValue) { try { return Double.valueOf(rawValue); } catch (NumberFormatException ex) { return null; } } @Nullable private Object getNumberOrDate(@Nonnull String rawValue, @Nullable String rawStyleIndex) { Number number = parseNumber(rawValue); if (number != null && isDateStyle(rawStyleIndex)) { double tmp = number.doubleValue(); if (DateUtil.isValidExcelDate(tmp)) { return DateUtil2.getJavaDate(calendar, tmp, context.date1904); } } return number; } @Nullable public Object getValue(@Nonnull String rawValue, @Nullable String rawDataType, @Nullable String rawStyleIndex) { if (rawDataType == null) { return getNumberOrDate(rawValue, rawStyleIndex); } switch (rawDataType) { case NUMBER: return getNumberOrDate(rawValue, rawStyleIndex); case SHARED_STRING: return context.sharedStrings.get(Integer.parseInt(rawValue)); case STRING: return rawValue; case INLINE_STRING: // TODO: rawValue might contain rich text return rawValue; case DATE: try { return isoDateFormat.parse(rawValue); } catch (ParseException ex) { return null; } default: // BOOLEAN or ERROR or default return null; } } } //</editor-fold> }
10,821
0.590082
0.587219
280
36.674999
31.758205
160
false
false
0
0
0
0
0
0
0.596429
false
false
12
04d8beac581b09e41dc032bcd21251bab4d84e05
36,249,524,006,048
c96347596034671a097cbb39a586643d9b967e9c
/designpattern/src/structural/facade/HeadFirst/Projector.java
783ca4d62e43a5d393f95d7dc9fffe6014c387c8
[]
no_license
jackliaoontheway/designpattern
https://github.com/jackliaoontheway/designpattern
3274e9476f7c5c08670ce446ea63fed3c9e32b70
e73f7f602435b1a071b76eb46e324a0c895cef0d
refs/heads/master
2020-06-15T23:44:57.165000
2019-11-28T23:48:06
2019-11-28T23:48:06
195,424,035
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package structural.facade.HeadFirst; public class Projector { }
UTF-8
Java
65
java
Projector.java
Java
[]
null
[]
package structural.facade.HeadFirst; public class Projector { }
65
0.8
0.8
4
15.25
15.352118
36
false
false
0
0
0
0
0
0
0.25
false
false
12
f536db4a6b1ef716cc7c9040712d42c7f951d434
36,009,005,846,342
f3a1122c111e7b126bb2750282d5bdc8ce20fc15
/core/src/com/ormisiclapps/slickyfuton/game/nodes/combination/StaticCombinationNode.java
d57a93d8e0f12305273476fb71867ffd567305e2
[ "MIT" ]
permissive
MedAnisBenSalah/Slicky-Futon
https://github.com/MedAnisBenSalah/Slicky-Futon
02b5bf3491226789dd2ac896d1e87c41ea7e57db
7d18e88a154d75a6c315ef3e4d8854e8eb288cc3
refs/heads/master
2020-03-25T21:10:18.844000
2018-11-23T13:44:18
2018-11-23T13:44:18
144,162,906
1
0
null
false
2018-11-23T13:44:19
2018-08-09T14:20:44
2018-08-29T17:20:51
2018-11-23T13:44:18
32,650
0
0
1
Java
false
null
package com.ormisiclapps.slickyfuton.game.nodes.combination; /** * Created by Anis on 12/14/2016. */ public class StaticCombinationNode extends CombinationNode { public String[] position; public StaticCombinationNode(float speed, float endDistance, int count) { // Create the combination node super(speed, endDistance, count); // Create arrays position = new String[count]; } public void addObject(int id, String model, String position, float distance, boolean passable) { // Set the combination node parameters super.addObject(id, model, distance, passable); // Save the position this.position[id] = position; } }
UTF-8
Java
713
java
StaticCombinationNode.java
Java
[ { "context": "kyfuton.game.nodes.combination;\n\n/**\n * Created by Anis on 12/14/2016.\n */\n\npublic class StaticCombinatio", "end": 84, "score": 0.9981111288070679, "start": 80, "tag": "NAME", "value": "Anis" } ]
null
[]
package com.ormisiclapps.slickyfuton.game.nodes.combination; /** * Created by Anis on 12/14/2016. */ public class StaticCombinationNode extends CombinationNode { public String[] position; public StaticCombinationNode(float speed, float endDistance, int count) { // Create the combination node super(speed, endDistance, count); // Create arrays position = new String[count]; } public void addObject(int id, String model, String position, float distance, boolean passable) { // Set the combination node parameters super.addObject(id, model, distance, passable); // Save the position this.position[id] = position; } }
713
0.669004
0.657784
26
26.423077
26.641745
98
false
false
0
0
0
0
0
0
0.653846
false
false
12
39259b1d5ce0d8518a4364c047a802d83e91c89c
34,935,264,015,558
ac622e1b183087bbc5da5b10d99d56fd20e74244
/kimt-android/src/com/waikato/kimt/sync/MusicalSyncClient.java
b09ccc52bb98cc708a0b6e6a96d24d816b2487e8
[]
no_license
simon2k6/keeping-in-musical-touch
https://github.com/simon2k6/keeping-in-musical-touch
e14448458e403e569fe2425769718a8c4f309f8a
ca2ef46dbe613a7ec63eb3f5a30355877adc4ad7
refs/heads/master
2021-01-10T22:01:37.397000
2011-10-20T11:28:12
2011-10-20T11:28:12
41,951,716
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.waikato.kimt.sync; import java.io.EOFException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import android.os.AsyncTask; import android.os.Handler; import android.util.Log; import com.waikato.kimt.greenstone.MusicLibrary; import com.waikato.kimt.greenstone.MusicView; import com.waikato.kimt.server.commands.MusicalCommandFactory; public class MusicalSyncClient implements MusicalLibrarySync { private String userName; private MusicalDataFrame dataframe; private InetSocketAddress kimtAddress; private volatile ObjectOutputStream objectOutput; private volatile Socket mainSyncSocket; private boolean isLeader; private boolean inSync; private BroadcastListener broadcastListener; private MusicLibrary currentLibrary; public MusicalSyncClient(String userName, InetSocketAddress location) throws UnknownHostException, IOException { this.userName = userName; this.dataframe = new MusicalDataFrame(); this.inSync = false; this.kimtAddress= location; } public boolean isLeader() { return isLeader; } public String getUserName() { return userName; } public MusicalDataFrame getDataFrame() { return dataframe; } private synchronized ObjectOutputStream getObjectOutputStream() throws IOException { if (objectOutput == null) { objectOutput = new ObjectOutputStream(mainSyncSocket.getOutputStream()); } return objectOutput; } private synchronized Socket getMainSocket() throws IOException { if (mainSyncSocket == null) { mainSyncSocket = new Socket(kimtAddress.getAddress(), kimtAddress.getPort()); } return mainSyncSocket; } @Override public MusicView getMusicView() { return null; // return dataframe.getMusicView(); } @Override public void setMusicView(MusicView mv) { // this.dataframe.setMusicView(mv); setMusicalDataFrame(dataframe); } public synchronized void setMusicalDataFrame(MusicalDataFrame mdf) { this.dataframe = mdf; if (isLeader) { new UploadSyncTask().execute(mdf); } else { notifyMusicalDataFrameUpdated(mdf); } } @Override public String getLibraryLocation() { return dataframe.getLibraryLocation(); } private void writeHeaders(ObjectOutputStream out, String command) throws IOException { out.writeObject("KIMT 1.0"); out.writeObject(command); } /** * Starts the listening thread which will callback use the specified * handler to update using the updater. * @param handler * The handler to handle the posting of the data to UI thread. * @param updater * The class to run in order to update the UI. * @throws IOException */ public void startListening(Handler handler) throws IOException, IllegalThreadStateException { if (broadcastListener == null) { broadcastListener = new BroadcastListener(handler); broadcastListener.start(); } else { throw new IllegalThreadStateException("This client is already listening to the MusicalSyncServer."); } } /** * Listens to broadcasts from the Keeping In Musical Touch * socket. Posts the data back to the UI thread via the Handler, * which then runs the Runnable object in the UI thread. * @author Simon * */ private class BroadcastListener extends Thread { /** * This class relies on information from the Android development * database. If there's any problems then check here for the official * guide: * http://developer.android.com/resources/faq/commontasks.html#threading */ /** * The handler created in the UI thread that will push the data * from this thread back to the UI thread. */ private Handler handler; /** * Create a BroadcastListener with the handler that will push the * data back to the UI thread. The runnable will be run when the handler * is ready. * @param handler * The Handler that will invoke the runnable on the UI thread * @param updater * The Runnable that will be invoked when the handler is ready * to run code * @throws IOException */ public BroadcastListener(Handler handler) throws IOException { this.handler = handler; } public synchronized void close() throws IOException { if (mainSyncSocket != null) mainSyncSocket.close(); mainSyncSocket = null; } public void run() { ObjectInputStream in; ObjectOutputStream out; try { mainSyncSocket = new Socket(kimtAddress.getAddress(), kimtAddress.getPort()); in = new ObjectInputStream(mainSyncSocket.getInputStream()); out = getObjectOutputStream(); writeHeaders(out, "LOGIN"); out.writeObject(MusicalSyncClient.this.userName); out.flush(); while (mainSyncSocket != null) { Object obj = null; try { while ((obj = in.readObject()) != null) { if (obj instanceof String) { String msg = (String) obj; if (msg.compareTo("KIMT 1.0") == 0) { Log.v("KeepingInMusicalTouch", "I have a KIMT 1.0 header"); CommandType commandType = MusicalCommandFactory.getCommandType(in); Log.v("KeepingInMusicalTouch", "I have a command type of:" + commandType.toString()); switch (commandType) { case LOGIN: { Object extra = in.readObject(); if (extra instanceof Boolean) { MusicalSyncClient.this.isLeader = (Boolean) extra; Log.v("KeepingInMusicalTouch", "I am the leader? " + MusicalSyncClient.this.isLeader); handler.post(new Runnable() { @Override public void run() { notifyLoggedIn(MusicalSyncClient.this.isLeader()); } }); } continue; } case PUT_SYNC: { Object extra = in.readObject(); if (extra instanceof MusicalDataFrame) { final MusicalDataFrame musicalDataFrame = (MusicalDataFrame) extra; if (!isLeader) { handler.post(new Runnable() { @Override public void run() { setMusicalDataFrame(musicalDataFrame); } }); } else { } } } } } } } } catch (ClassNotFoundException e) { e.printStackTrace(); } } } catch (EOFException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } /** * An AsyncTask that will upload this clients MusicalDataFrame * to the Keeping In Musical Touch server. * @author Simon */ private class UploadSyncTask extends AsyncTask<MusicalDataFrame, Void, Boolean> { @Override protected Boolean doInBackground(MusicalDataFrame... params) { Socket s = null; ObjectOutputStream out = null; try { s = getMainSocket(); out = getObjectOutputStream(); writeHeaders(out, "PUT SYNC"); out.flush(); out.writeObject(params[0]); out.flush(); Log.v("KeepingInMusicalTouch", "Uploaded Dataframe " + params[0].toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } } private List<SyncedLibraryUpdateListener> registeredLibraryUpdateListeners = new ArrayList<SyncedLibraryUpdateListener>(); private List<SyncedLoginListener> registeredLoginListeners = new ArrayList<SyncedLoginListener>(); public void setOnSheetMetaDataUpdateListener(SyncedLibraryUpdateListener slul) { registeredLibraryUpdateListeners.add(slul); } public void setOnLoginUpdateListener(SyncedLoginListener sll) { registeredLoginListeners.add(sll); } /** * Notify all listeners that there has been a new sync object that has been * downloaded from the sync server. * @param k * The sync object that was downloaded from the sync server. */ private void notifyMusicalDataFrameUpdated(MusicalDataFrame musicalDataFrame) { for (SyncedLibraryUpdateListener s : registeredLibraryUpdateListeners) { s.onMusicalDataFrameUpdated(musicalDataFrame); } } /** * Notify all listeners that the library on this client has been * uploaded. * @param k * The library that was uploaded. */ private void notifySyncLibraryUploaded(Boolean uploaded) { for (SyncedLibraryUpdateListener s : registeredLibraryUpdateListeners) { s.onSyncUploaded(uploaded); } } /** * Notify all listeners that the synced view has changed on the * server. * @param mv * The new music view that is to be syncronised. */ private void notifySyncedViewChanged(MusicView mv) { for (SyncedLibraryUpdateListener s : registeredLibraryUpdateListeners) { s.onSyncViewUpdate(mv); } } private void notifyLoggedIn(boolean isLeader) { for (SyncedLoginListener s : registeredLoginListeners) { s.onLoggedIn(isLeader); } } @Override public void setOnSyncUpdateListener(SyncedLibraryUpdateListener slul) { registeredLibraryUpdateListeners.add(slul); } public void close() throws IOException { if (mainSyncSocket != null) mainSyncSocket.close(); if (objectOutput != null) objectOutput.close(); if (broadcastListener != null) broadcastListener.close(); } }
UTF-8
Java
9,797
java
MusicalSyncClient.java
Java
[ { "context": "rrentLibrary;\r\n\t\r\n\tpublic MusicalSyncClient(String userName, InetSocketAddress location) throws UnknownHostEx", "end": 1029, "score": 0.8219037652015686, "start": 1021, "tag": "USERNAME", "value": "userName" }, { "context": "ownHostException, IOException {\r\n\t\tthis.userName\t= userName;\r\n\t\tthis.dataframe\t= new MusicalDataFrame();\r\n\t\tt", "end": 1129, "score": 0.9944077730178833, "start": 1121, "tag": "USERNAME", "value": "userName" }, { "context": ";\r\n\t}\r\n\t\r\n\tpublic String getUserName() {\r\n\t\treturn userName;\r\n\t}\r\n\t\r\n\tpublic MusicalDataFrame getDataFrame() ", "end": 1345, "score": 0.9510284066200256, "start": 1337, "tag": "USERNAME", "value": "userName" }, { "context": "the Runnable object in the UI thread.\r\n\t * @author Simon\r\n\t *\r\n\t */\r\n\tprivate class BroadcastListener exte", "end": 3474, "score": 0.9993796348571777, "start": 3469, "tag": "NAME", "value": "Simon" }, { "context": " the Keeping In Musical Touch server.\r\n\t * @author Simon\r\n\t */\r\n\tprivate class UploadSyncTask extends Asyn", "end": 7069, "score": 0.99605393409729, "start": 7064, "tag": "NAME", "value": "Simon" } ]
null
[]
package com.waikato.kimt.sync; import java.io.EOFException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import android.os.AsyncTask; import android.os.Handler; import android.util.Log; import com.waikato.kimt.greenstone.MusicLibrary; import com.waikato.kimt.greenstone.MusicView; import com.waikato.kimt.server.commands.MusicalCommandFactory; public class MusicalSyncClient implements MusicalLibrarySync { private String userName; private MusicalDataFrame dataframe; private InetSocketAddress kimtAddress; private volatile ObjectOutputStream objectOutput; private volatile Socket mainSyncSocket; private boolean isLeader; private boolean inSync; private BroadcastListener broadcastListener; private MusicLibrary currentLibrary; public MusicalSyncClient(String userName, InetSocketAddress location) throws UnknownHostException, IOException { this.userName = userName; this.dataframe = new MusicalDataFrame(); this.inSync = false; this.kimtAddress= location; } public boolean isLeader() { return isLeader; } public String getUserName() { return userName; } public MusicalDataFrame getDataFrame() { return dataframe; } private synchronized ObjectOutputStream getObjectOutputStream() throws IOException { if (objectOutput == null) { objectOutput = new ObjectOutputStream(mainSyncSocket.getOutputStream()); } return objectOutput; } private synchronized Socket getMainSocket() throws IOException { if (mainSyncSocket == null) { mainSyncSocket = new Socket(kimtAddress.getAddress(), kimtAddress.getPort()); } return mainSyncSocket; } @Override public MusicView getMusicView() { return null; // return dataframe.getMusicView(); } @Override public void setMusicView(MusicView mv) { // this.dataframe.setMusicView(mv); setMusicalDataFrame(dataframe); } public synchronized void setMusicalDataFrame(MusicalDataFrame mdf) { this.dataframe = mdf; if (isLeader) { new UploadSyncTask().execute(mdf); } else { notifyMusicalDataFrameUpdated(mdf); } } @Override public String getLibraryLocation() { return dataframe.getLibraryLocation(); } private void writeHeaders(ObjectOutputStream out, String command) throws IOException { out.writeObject("KIMT 1.0"); out.writeObject(command); } /** * Starts the listening thread which will callback use the specified * handler to update using the updater. * @param handler * The handler to handle the posting of the data to UI thread. * @param updater * The class to run in order to update the UI. * @throws IOException */ public void startListening(Handler handler) throws IOException, IllegalThreadStateException { if (broadcastListener == null) { broadcastListener = new BroadcastListener(handler); broadcastListener.start(); } else { throw new IllegalThreadStateException("This client is already listening to the MusicalSyncServer."); } } /** * Listens to broadcasts from the Keeping In Musical Touch * socket. Posts the data back to the UI thread via the Handler, * which then runs the Runnable object in the UI thread. * @author Simon * */ private class BroadcastListener extends Thread { /** * This class relies on information from the Android development * database. If there's any problems then check here for the official * guide: * http://developer.android.com/resources/faq/commontasks.html#threading */ /** * The handler created in the UI thread that will push the data * from this thread back to the UI thread. */ private Handler handler; /** * Create a BroadcastListener with the handler that will push the * data back to the UI thread. The runnable will be run when the handler * is ready. * @param handler * The Handler that will invoke the runnable on the UI thread * @param updater * The Runnable that will be invoked when the handler is ready * to run code * @throws IOException */ public BroadcastListener(Handler handler) throws IOException { this.handler = handler; } public synchronized void close() throws IOException { if (mainSyncSocket != null) mainSyncSocket.close(); mainSyncSocket = null; } public void run() { ObjectInputStream in; ObjectOutputStream out; try { mainSyncSocket = new Socket(kimtAddress.getAddress(), kimtAddress.getPort()); in = new ObjectInputStream(mainSyncSocket.getInputStream()); out = getObjectOutputStream(); writeHeaders(out, "LOGIN"); out.writeObject(MusicalSyncClient.this.userName); out.flush(); while (mainSyncSocket != null) { Object obj = null; try { while ((obj = in.readObject()) != null) { if (obj instanceof String) { String msg = (String) obj; if (msg.compareTo("KIMT 1.0") == 0) { Log.v("KeepingInMusicalTouch", "I have a KIMT 1.0 header"); CommandType commandType = MusicalCommandFactory.getCommandType(in); Log.v("KeepingInMusicalTouch", "I have a command type of:" + commandType.toString()); switch (commandType) { case LOGIN: { Object extra = in.readObject(); if (extra instanceof Boolean) { MusicalSyncClient.this.isLeader = (Boolean) extra; Log.v("KeepingInMusicalTouch", "I am the leader? " + MusicalSyncClient.this.isLeader); handler.post(new Runnable() { @Override public void run() { notifyLoggedIn(MusicalSyncClient.this.isLeader()); } }); } continue; } case PUT_SYNC: { Object extra = in.readObject(); if (extra instanceof MusicalDataFrame) { final MusicalDataFrame musicalDataFrame = (MusicalDataFrame) extra; if (!isLeader) { handler.post(new Runnable() { @Override public void run() { setMusicalDataFrame(musicalDataFrame); } }); } else { } } } } } } } } catch (ClassNotFoundException e) { e.printStackTrace(); } } } catch (EOFException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } /** * An AsyncTask that will upload this clients MusicalDataFrame * to the Keeping In Musical Touch server. * @author Simon */ private class UploadSyncTask extends AsyncTask<MusicalDataFrame, Void, Boolean> { @Override protected Boolean doInBackground(MusicalDataFrame... params) { Socket s = null; ObjectOutputStream out = null; try { s = getMainSocket(); out = getObjectOutputStream(); writeHeaders(out, "PUT SYNC"); out.flush(); out.writeObject(params[0]); out.flush(); Log.v("KeepingInMusicalTouch", "Uploaded Dataframe " + params[0].toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; } } private List<SyncedLibraryUpdateListener> registeredLibraryUpdateListeners = new ArrayList<SyncedLibraryUpdateListener>(); private List<SyncedLoginListener> registeredLoginListeners = new ArrayList<SyncedLoginListener>(); public void setOnSheetMetaDataUpdateListener(SyncedLibraryUpdateListener slul) { registeredLibraryUpdateListeners.add(slul); } public void setOnLoginUpdateListener(SyncedLoginListener sll) { registeredLoginListeners.add(sll); } /** * Notify all listeners that there has been a new sync object that has been * downloaded from the sync server. * @param k * The sync object that was downloaded from the sync server. */ private void notifyMusicalDataFrameUpdated(MusicalDataFrame musicalDataFrame) { for (SyncedLibraryUpdateListener s : registeredLibraryUpdateListeners) { s.onMusicalDataFrameUpdated(musicalDataFrame); } } /** * Notify all listeners that the library on this client has been * uploaded. * @param k * The library that was uploaded. */ private void notifySyncLibraryUploaded(Boolean uploaded) { for (SyncedLibraryUpdateListener s : registeredLibraryUpdateListeners) { s.onSyncUploaded(uploaded); } } /** * Notify all listeners that the synced view has changed on the * server. * @param mv * The new music view that is to be syncronised. */ private void notifySyncedViewChanged(MusicView mv) { for (SyncedLibraryUpdateListener s : registeredLibraryUpdateListeners) { s.onSyncViewUpdate(mv); } } private void notifyLoggedIn(boolean isLeader) { for (SyncedLoginListener s : registeredLoginListeners) { s.onLoggedIn(isLeader); } } @Override public void setOnSyncUpdateListener(SyncedLibraryUpdateListener slul) { registeredLibraryUpdateListeners.add(slul); } public void close() throws IOException { if (mainSyncSocket != null) mainSyncSocket.close(); if (objectOutput != null) objectOutput.close(); if (broadcastListener != null) broadcastListener.close(); } }
9,797
0.660712
0.659794
350
25.991428
24.820786
113
false
false
0
0
0
0
0
0
3.402857
false
false
12
ac95649f1f0314251aedc117bb6ff261041c1f94
12,678,743,494,116
ee72762c6437c4541de0654365da00364d7d2bf2
/MDPapp/mobile/src/main/java/tudelft/mdp/locationTracker/LocatorFragment.java
575a7c804f6383600eb6617dd51419d374e38eba
[]
no_license
daringpig/MDP
https://github.com/daringpig/MDP
01d0a62d8baf829119ac383817b5f91a8d9909a5
4c497c64c3361f67119aff0d6f65280b45b59606
refs/heads/master
2020-03-12T10:19:48.717000
2015-05-12T10:59:39
2015-05-12T10:59:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tudelft.mdp.locationTracker; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.app.Fragment; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.preference.PreferenceManager; import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ExpandableListView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import it.gmariotti.cardslib.library.view.CardView; import tudelft.mdp.MdpWorkerService; import tudelft.mdp.R; import tudelft.mdp.backend.endpoints.radioMapFingerprintEndpoint.model.ApGaussianRecord; import tudelft.mdp.backend.endpoints.wekaObjectRecordEndpoint.model.LocationFeaturesRecord; import tudelft.mdp.backend.endpoints.wekaObjectRecordEndpoint.model.Text; import tudelft.mdp.enums.UserPreferences; import tudelft.mdp.ui.ExpandableListAdapterRSSI; import tudelft.mdp.ui.LocatorBayessianCard; import tudelft.mdp.ui.LocatorNewScanCard; import tudelft.mdp.ui.LocatorScanResultCard; import tudelft.mdp.ui.LocatorWekaCard; import tudelft.mdp.utils.Utils; import tudelft.mdp.weka.WekaNetworkScansObject; public class LocatorFragment extends Fragment implements ServiceConnection, RequestLocationEvaluationWekaAsyncTask.RequestLocationEvaluationWekaAsyncResponse{ private Messenger mServiceMessenger = null; private boolean mIsBound; private final Messenger mMessenger = new Messenger(new IncomingMessageHandler()); private ServiceConnection mConnection = this; private View rootView; private CardView mCardViewNewScan; private CardView mCardViewBayessian; private CardView mCardViewWeka; private CardView mCardViewScanResult; private LocatorScanResultCard mCardScanResult; private LocatorNewScanCard mCardNewScan; private LocatorBayessianCard mCardBayessian; private LocatorWekaCard mCardWeka; private Button mButtonRequestNewNetworkScan; private ProgressBar mProgressBar; // Bayessian Card private Button mButtonCalculateLocationUsingNextNetwork_Bayessian; private Button mButtonCalculateLocation_Bayessian; private Button mButtonCalculateLocation_Weka; private TextView mTextViewCurrentPlace_Weka; private TextView mTextViewZone_Weka; private TextView mTextViewProbability_Weka; private TextView mTextViewCurrentPlace_Bayessian; private TextView mTextViewZone_Bayessian; private TextView mTextViewProbability_Bayessian; private TextView mTextViewNetwork_Bayessian; private TextView mTextViewNetworkId_Bayessian; private LinearLayout mLinearLayoutBayessian; private LocationEstimator mLocationEstimator = new LocationEstimator(); private ArrayList<ArrayList<NetworkInfoObject>> mNetworkScans = new ArrayList<ArrayList<NetworkInfoObject>>(); private ArrayList<ApGaussianRecord> mGaussianRecords = new ArrayList<ApGaussianRecord>(); private HashMap<String,Double> pmfFinalBayessian = new HashMap<String, Double>(); private HashMap<String,Double> pmfFinalWeka = new HashMap<String, Double>(); private ArrayList<HashMap<String,Double>> pmfIntermediateResultsBayessian = new ArrayList<HashMap<String, Double>>(); private int networkIdCount; private String currentPlaceBayessian = "TBD"; private String currentPlaceWeka = "TBD"; private ExpandableListView mExpandableListAP; private ArrayList<NetworkInfoObject> groupItem = new ArrayList<NetworkInfoObject>(); private ArrayList<Object> childItem = new ArrayList<Object>(); private static final String TAG = "MDP-LocatorFragment"; public LocatorFragment() { // Required empty public constructor } // Lifecycle methods *************************************************************************** @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 rootView = inflater.inflate(R.layout.fragment_locator, container, false); configureCardsInit(); automaticBinding(); return rootView; } @Override public void onDestroy() { super.onDestroy(); try { if (mIsBound) { automaticUnbinding(); } } catch (Throwable t) { Log.e(TAG, "Failed to unbind from the service", t); } } // Configure Cards ***************************************************************************** private void configureCardsInit(){ configureNewScanCard(); configureBayessianCard(); configureWekaCard(); configureScanResultsCard(); } private void configureNewScanCard(){ mCardViewNewScan = (CardView) rootView.findViewById(R.id.cardNewScan); mCardNewScan = new LocatorNewScanCard(rootView.getContext()); mCardNewScan.setShadow(true); mCardViewNewScan.setCard(mCardNewScan); mProgressBar = (ProgressBar) mCardViewNewScan.findViewById(R.id.progressBar); mButtonRequestNewNetworkScan = (Button) mCardViewNewScan.findViewById(R.id.btnNewScan); mButtonRequestNewNetworkScan.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(rootView.getContext(), "Requesting new scan...", Toast.LENGTH_SHORT).show(); sendMessageToService(MdpWorkerService.MSG_LOCATION_STEP_BY_STEP); mProgressBar.setIndeterminate(true); refreshWekaCard(new HashMap<String, Double>(), "TBD"); mCardViewWeka.setVisibility(View.INVISIBLE); refreshBayessianCard(new HashMap<String, Double>(), "TBD", 0); mCardViewBayessian.setVisibility(View.INVISIBLE); mCardViewScanResult.setVisibility(View.INVISIBLE); } }); } private void configureScanResultsCard(){ mCardViewScanResult = (CardView) rootView.findViewById(R.id.cardScanResults); mCardScanResult = new LocatorScanResultCard(rootView.getContext()); mCardScanResult.setShadow(true); mCardViewScanResult.setCard(mCardScanResult); mExpandableListAP = (ExpandableListView) mCardViewScanResult.findViewById(R.id.ap_exp); //mExpandableListAP = (ExpandableListView) rootView.findViewById(R.id.ap_exp1); updateScanResultsList(mockLocationEstimator()); mCardViewScanResult.setVisibility(View.INVISIBLE); } private void configureWekaCard(){ mCardWeka = new LocatorWekaCard(rootView.getContext()); mCardWeka.init(); mCardWeka.setShadow(true); mCardViewWeka = (CardView) rootView.findViewById(R.id.cardWeka); mCardViewWeka.setCard(mCardWeka); mButtonCalculateLocation_Weka = (Button) mCardViewWeka.findViewById(R.id.btnFinalResultWeka); mButtonCalculateLocation_Weka.setEnabled(false); mTextViewCurrentPlace_Weka = (TextView) mCardViewWeka.findViewById(R.id.twPlace); mTextViewZone_Weka = (TextView) mCardViewWeka.findViewById(R.id.twZone); mTextViewProbability_Weka = (TextView) mCardViewWeka.findViewById(R.id.twProb); mButtonCalculateLocation_Weka.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Toast.makeText(rootView.getContext(), "Calculating final location...", Toast.LENGTH_SHORT).show(); calculateFinalLocationWeka(); } }); refreshWekaCard(new HashMap<String, Double>(), "TBD"); mCardViewWeka.setVisibility(View.INVISIBLE); } private void configureBayessianCard(){ mCardBayessian = new LocatorBayessianCard(rootView.getContext()); mCardBayessian.init(); mCardBayessian.setShadow(true); mCardViewBayessian = (CardView) rootView.findViewById(R.id.cardBayessian); mCardViewBayessian.setCard(mCardBayessian); mButtonCalculateLocationUsingNextNetwork_Bayessian = (Button) mCardViewBayessian.findViewById(R.id.btnNextAP); mButtonCalculateLocation_Bayessian = (Button) mCardViewBayessian.findViewById(R.id.btnFinalResultBayessian); mButtonCalculateLocationUsingNextNetwork_Bayessian.setEnabled(false); mButtonCalculateLocation_Bayessian.setEnabled(false); mTextViewCurrentPlace_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twPlace); mTextViewZone_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twZone); mTextViewProbability_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twProb); mTextViewNetwork_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twNetworkName); mTextViewNetworkId_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twNetworkNumber); mLinearLayoutBayessian = (LinearLayout) mCardViewBayessian.findViewById(R.id.resultBayessian); mButtonCalculateLocationUsingNextNetwork_Bayessian.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Toast.makeText(rootView.getContext(), "Calculating location...", Toast.LENGTH_SHORT).show(); calculateNextAPBayessian(); } }); mButtonCalculateLocation_Bayessian.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Toast.makeText(rootView.getContext(), "Calculating final location...", Toast.LENGTH_SHORT).show(); calculateFinalLocationBayessian(); } }); refreshBayessianCard(new HashMap<String, Double>(), "TBD", 0); mCardViewBayessian.setVisibility(View.INVISIBLE); } private void refreshWekaCard( HashMap<String, Double> updatedResults, String currentPlace){ String zone = "Unknown"; Double max = 0.0; HashMap<String, Double> sortedPMF = new HashMap<String, Double>(); if (updatedResults != null){ if (updatedResults.size() > 0) { //mLinearLayoutBayessian.setVisibility(View.VISIBLE); sortedPMF = LocationEstimator.sortByProbability(updatedResults); zone = (String) sortedPMF.keySet().toArray()[0]; max = sortedPMF.get(zone); } else { //mLinearLayoutBayessian.setVisibility(View.INVISIBLE); } } mTextViewCurrentPlace_Weka.setText(currentPlace); mTextViewZone_Weka.setText(zone); mTextViewProbability_Weka.setText(String.format("%.2f",max * 100) + "%"); mCardWeka.setCurrentPlace(currentPlace); mCardWeka.updateItems(sortedPMF); } private void refreshBayessianCard( HashMap<String, Double> updatedResults, String currentPlace, int index){ String networkId; String networkName; if ( index < mLocationEstimator.getNetworkScans().size() && index >= 0){ networkId = "[" + (index + 1) + "/"+ mLocationEstimator.getNetworkScans().size() +"]"; networkName = mLocationEstimator.getNetworkScans().get(index).getSSID(); } else { networkId = "[-]"; networkName = "Undetermined"; } String zone = "Unknown"; Double max = 0.0; HashMap<String, Double> sortedPMF = new HashMap<String, Double>(); if (updatedResults != null){ if (updatedResults.size() > 0) { //mLinearLayoutBayessian.setVisibility(View.VISIBLE); sortedPMF = LocationEstimator.sortByProbability(updatedResults); zone = (String) sortedPMF.keySet().toArray()[0]; max = sortedPMF.get(zone); } else { //mLinearLayoutBayessian.setVisibility(View.INVISIBLE); } } mTextViewCurrentPlace_Bayessian.setText(currentPlace); mTextViewZone_Bayessian.setText(zone); mTextViewProbability_Bayessian.setText(String.format("%.2f",max * 100) + "%"); mTextViewNetworkId_Bayessian.setText(networkId); mTextViewNetwork_Bayessian.setText(networkName); mCardBayessian.setCurrentPlace(currentPlace); mCardBayessian.updateItems(sortedPMF); } private HashMap<String, Double> mockZoneInfo (){ HashMap<String, Double> mockPMF = new HashMap<String, Double>(); mockPMF.put("Room A", 0.15); mockPMF.put("Room B", 0.7532); mockPMF.put("Room C", 0.05); mockPMF.put("Room D", 0.03); mockPMF.put("Room E", 0.02); return mockPMF; } private LocationEstimator mockLocationEstimator(){ LocationEstimator locationEstimator = new LocationEstimator(); ArrayList<ArrayList<NetworkInfoObject>> mNetworkScansRawMock = new ArrayList<ArrayList<NetworkInfoObject>>(); ArrayList<ApGaussianRecord> mGaussianRecordsMock = new ArrayList<ApGaussianRecord>(); NetworkInfoObject network1 = new NetworkInfoObject("OO:AA::BB:CC:DD", "Network 1", -75.00); NetworkInfoObject network2 = new NetworkInfoObject("O1:AA::BB:CC:DD", "Network 2", -85.00); NetworkInfoObject network3 = new NetworkInfoObject("O2:AA::BB:CC:DD", "Network 3", -95.00); NetworkInfoObject network4 = new NetworkInfoObject("O3:AA::BB:CC:DD", "Network 4", -65.00); NetworkInfoObject network5 = new NetworkInfoObject("O4:AA::BB:CC:DD", "Network 5", -55.00); ArrayList<NetworkInfoObject> networkInfoObjects = new ArrayList<NetworkInfoObject>(); NetworkInfoObject network1b = new NetworkInfoObject("OO:AA::BB:CC:DD", "Network 1", -77.00); NetworkInfoObject network2b = new NetworkInfoObject("O1:AA::BB:CC:DD", "Network 2", -87.00); NetworkInfoObject network3b = new NetworkInfoObject("O2:AA::BB:CC:DD", "Network 3", -97.00); NetworkInfoObject network4b = new NetworkInfoObject("O3:AA::BB:CC:DD", "Network 4", -67.00); ArrayList<NetworkInfoObject> networkInfoObjectsB = new ArrayList<NetworkInfoObject>(); networkInfoObjects.add(network1); networkInfoObjects.add(network2); networkInfoObjects.add(network3); networkInfoObjects.add(network4); networkInfoObjects.add(network5); mNetworkScansRawMock.add(networkInfoObjects); networkInfoObjectsB.add(network1b); networkInfoObjectsB.add(network2b); networkInfoObjectsB.add(network3b); networkInfoObjectsB.add(network4b); mNetworkScansRawMock.add(networkInfoObjectsB); ApGaussianRecord apGaussianRecord1a = createMockApGaussianRecord("OO:AA::BB:CC:DD", "Network 1", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2a = createMockApGaussianRecord("O0:AA::BB:CC:DD", "Network 1", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3a = createMockApGaussianRecord("O0:AA::BB:CC:DD", "Network 1", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1b = createMockApGaussianRecord("O1:AA::BB:CC:DD", "Network 2", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2b = createMockApGaussianRecord("O1:AA::BB:CC:DD", "Network 2", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3b = createMockApGaussianRecord("O1:AA::BB:CC:DD", "Network 2", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1c = createMockApGaussianRecord("O1:AA::BB:CC:DD", "Network 2", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2c = createMockApGaussianRecord("O2:AA::BB:CC:DD", "Network 3", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3c = createMockApGaussianRecord("O2:AA::BB:CC:DD", "Network 3", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1d = createMockApGaussianRecord("O2:AA::BB:CC:DD", "Network 3", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2d = createMockApGaussianRecord("O5:AA::BB:CC:DD", "Network 6", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3d = createMockApGaussianRecord("O5:AA::BB:CC:DD", "Network 6", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1e = createMockApGaussianRecord("O4:AA::BB:CC:DD", "Network 5", -59.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2e = createMockApGaussianRecord("O4:AA::BB:CC:DD", "Network 5", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3e = createMockApGaussianRecord("O4:AA::BB:CC:DD", "Network 5", -95.00, 1.00, "Home", "Room B"); mGaussianRecordsMock.add(apGaussianRecord1a); mGaussianRecordsMock.add(apGaussianRecord2a); mGaussianRecordsMock.add(apGaussianRecord3a); mGaussianRecordsMock.add(apGaussianRecord1b); mGaussianRecordsMock.add(apGaussianRecord2b); mGaussianRecordsMock.add(apGaussianRecord3b); mGaussianRecordsMock.add(apGaussianRecord1c); mGaussianRecordsMock.add(apGaussianRecord2c); mGaussianRecordsMock.add(apGaussianRecord3c); mGaussianRecordsMock.add(apGaussianRecord1d); mGaussianRecordsMock.add(apGaussianRecord2d); mGaussianRecordsMock.add(apGaussianRecord3d); mGaussianRecordsMock.add(apGaussianRecord1e); mGaussianRecordsMock.add(apGaussianRecord2e); mGaussianRecordsMock.add(apGaussianRecord3e); locationEstimator.setNetworkScansRaw(mNetworkScansRawMock); locationEstimator.setGaussianRecords(mGaussianRecordsMock); locationEstimator.consolidateNetworkScans(); locationEstimator.sortNetworksByRSSI(); locationEstimator.ignoreUnknownNetworks(); return locationEstimator; } private ApGaussianRecord createMockApGaussianRecord(String SSID, String BSSID, Double mean, Double std, String place, String zone){ ApGaussianRecord apGaussianRecord = new ApGaussianRecord(); apGaussianRecord.setZone(zone); apGaussianRecord.setPlace(place); apGaussianRecord.setStd(std); apGaussianRecord.setMean(mean); apGaussianRecord.setBssid(BSSID); apGaussianRecord.setSsid(SSID); return apGaussianRecord; } // Receive data from Background Service ******************************************************** private void handleGaussianResult(ArrayList<ApGaussianRecord> gaussianRecords){ mGaussianRecords = new ArrayList<ApGaussianRecord>(gaussianRecords); //Toast.makeText(rootView.getContext(), "Gaussians received.", Toast.LENGTH_SHORT).show(); } private void handleScanResult(ArrayList<ArrayList<NetworkInfoObject>> networkScans) { Toast.makeText(rootView.getContext(),"Scan Results ready",Toast.LENGTH_SHORT).show(); initBayessianLocation(networkScans); initWekaLocation(networkScans); updateScanResultsList(mLocationEstimator); mCardViewScanResult.setVisibility(View.VISIBLE); } private void updateScanResultsList(LocationEstimator locationEstimator){ ViewGroup.LayoutParams layoutParams = mExpandableListAP.getLayoutParams(); int nNetworks = mLocationEstimator.getNetworkScans().size(); int nParents = nNetworks * dpToPx(19); layoutParams.height = nParents; //mCardViewScanResult.setLayoutParams(layoutParams); mExpandableListAP.setLayoutParams(layoutParams); setExpListScanResultData(locationEstimator); mExpandableListAP.setAdapter(new ExpandableListAdapterRSSI(rootView.getContext(), groupItem, childItem)); mExpandableListAP.setOnGroupClickListener(new ExpDrawerGroupClickListener()); } public int dpToPx(int dp) { DisplayMetrics displayMetrics = rootView.getContext().getResources().getDisplayMetrics(); int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); return px; } private class ExpDrawerGroupClickListener implements ExpandableListView.OnGroupClickListener { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { /* if (parent.isGroupExpanded(groupPosition)){ parent.collapseGroup(groupPosition); }else { parent.expandGroup(groupPosition, true); } return true; */ ViewGroup.LayoutParams layoutParams = parent.getLayoutParams(); int nNetworks = mLocationEstimator.getNetworkScans().size(); int nParents = nNetworks * dpToPx(19); NetworkInfoObject parentNetwork = mLocationEstimator.getNetworkScans().get(groupPosition); int nNetworkChildren = mLocationEstimator.getGaussianRecordsOfNetwork(parentNetwork).size(); int nChildren = nNetworkChildren * dpToPx(19); if (parent.isGroupExpanded(groupPosition)){ parent.collapseGroup(groupPosition); if ((layoutParams.height - nChildren) < nParents){ layoutParams.height = nParents; } else { layoutParams.height = layoutParams.height - nChildren; } }else { parent.expandGroup(groupPosition, true); layoutParams.height = layoutParams.height + nChildren; } parent.setLayoutParams(layoutParams); return true; } } private void setExpListScanResultData(LocationEstimator locationEstimator){ groupItem.clear(); childItem.clear(); for (NetworkInfoObject networkInfoObject : locationEstimator.getNetworkScans()){ groupItem.add(networkInfoObject); ArrayList<ApGaussianRecord> child = locationEstimator.getGaussianRecordsOfNetwork(networkInfoObject); //Sorting according to Zone name Collections.sort(child, new Comparator<ApGaussianRecord>() { @Override public int compare(ApGaussianRecord item1, ApGaussianRecord item2) { return item1.getZone().compareTo(item2.getZone()); } }); childItem.add(child); } } // Bayessian calculations ********************************************************************** private void initBayessianLocation(ArrayList<ArrayList<NetworkInfoObject>> networkScans){ mNetworkScans = new ArrayList<ArrayList<NetworkInfoObject>>(networkScans); mLocationEstimator = new LocationEstimator(mNetworkScans, mGaussianRecords); //mLocationEstimator = mockLocationEstimator(); pmfFinalBayessian = mLocationEstimator.calculateLocationBayessian(); pmfIntermediateResultsBayessian = mLocationEstimator.calculateLocationBayessian_IntermediatePMFs(); currentPlaceBayessian = mLocationEstimator.determineCurrentPlace(); networkIdCount = 0; mProgressBar.setIndeterminate(false); mCardViewBayessian.setVisibility(View.VISIBLE); mButtonCalculateLocationUsingNextNetwork_Bayessian.setEnabled(true); mButtonCalculateLocation_Bayessian.setEnabled(true); } private void calculateNextAPBayessian(){ if (currentPlaceBayessian == null){ refreshBayessianCard(pmfFinalBayessian, "Unknown" , -1); } else { refreshBayessianCard(pmfIntermediateResultsBayessian.get(networkIdCount), currentPlaceBayessian, networkIdCount); if (networkIdCount < (mLocationEstimator.getNetworkScans().size()-1)){ networkIdCount++; } else { networkIdCount = 0; } } } private void calculateFinalLocationBayessian(){ if (currentPlaceBayessian == null){ refreshBayessianCard(pmfFinalBayessian, "Unknown" , -1); } else { int index = -1; if (pmfFinalBayessian != null) { index = findNetworkWithBestResult(); } refreshBayessianCard(pmfFinalBayessian, currentPlaceBayessian, index); } } private int findNetworkWithBestResult(){ String zone = "Unknown"; Double max = 0.0; if (pmfFinalBayessian.size() > 0) { zone = (String) pmfFinalBayessian.keySet().toArray()[0]; max = pmfFinalBayessian.get(zone); } int index = -1; for (int i = 0; i < pmfIntermediateResultsBayessian.size(); i++){ Double maxProb = pmfIntermediateResultsBayessian.get(i).get(zone); if (max.equals(maxProb)){ return i; } } return index; } // Weka Calculations *************************************************************************** private void initWekaLocation(ArrayList<ArrayList<NetworkInfoObject>> networkScans){ WekaNetworkScansObject wekaNetworkScansObject = new WekaNetworkScansObject(networkScans); String features = wekaNetworkScansObject.getFeatures(); Text ft = new Text(); ft.setValue(features); LocationFeaturesRecord locationFeaturesRecord = new LocationFeaturesRecord(); locationFeaturesRecord.setLocationFeatures(ft); locationFeaturesRecord.setTimestamp(Utils.getCurrentTimestamp()); locationFeaturesRecord.setUsername(PreferenceManager .getDefaultSharedPreferences(rootView.getContext()) .getString(UserPreferences.USERNAME, "TBD")); RequestLocationEvaluationWekaAsyncTask LocationEvaluationWekaAsyncTask = new RequestLocationEvaluationWekaAsyncTask(); LocationEvaluationWekaAsyncTask.delegate = this; LocationEvaluationWekaAsyncTask.execute(locationFeaturesRecord); } public void processFinishRequestLocationEvaluationWeka(LocationFeaturesRecord result){ String predictionResult = result.getLocationFeatures().getValue(); String[] probabilities = predictionResult.split("\\|"); pmfFinalWeka = new HashMap<String, Double>(); for (String placeZoneProb : probabilities){ String[] parts = placeZoneProb.split(","); String[] locationInfo = parts[0].split("-"); currentPlaceWeka = locationInfo[0]; String zoneWeka = locationInfo[1]; Double prob = Double.valueOf(parts[1]); pmfFinalWeka.put(zoneWeka, prob); } mCardViewWeka.setVisibility(View.VISIBLE); mButtonCalculateLocation_Weka.setEnabled(true); } private void calculateFinalLocationWeka(){ if (currentPlaceBayessian == null){ refreshWekaCard(pmfFinalWeka, "Unknown"); } else { refreshWekaCard(pmfFinalWeka, currentPlaceWeka); } } // Service connection methods ****************************************************************** @Override public void onServiceDisconnected(ComponentName name) { Log.i(TAG, "Sensor Service: onServiceDisconnected"); if (mServiceMessenger != null) { mServiceMessenger = null; } } @Override public void onServiceConnected(ComponentName name, IBinder service) { Log.i(TAG, "Sensor Service: onServiceConnected"); mServiceMessenger = new Messenger(service); try { Message msg = Message.obtain(null, MdpWorkerService.MSG_REGISTER_CLIENT); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { // In this case the service has crashed before we could even do anything with it } sendMessageToService(MdpWorkerService.MSG_LOCATION_GAUSSIANS); } private void automaticBinding() { if (MdpWorkerService.isRunning()){ doBindService(); } else{ startServiceNetworkScan(); doBindService(); } } private void automaticUnbinding() { stopServiceNetworkScan(); } public void startServiceNetworkScan(){ Log.i(TAG, "MdpWorkerService : START"); Intent intent = new Intent(this.getActivity(), MdpWorkerService.class); this.getActivity().startService(intent); } public void stopServiceNetworkScan(){ Log.i(TAG, "MdpWorkerService : Unbind"); doUnbindService(); } private void doBindService() { this.getActivity().bindService(new Intent(this.getActivity(), MdpWorkerService.class), mConnection, 0); mIsBound = true; } private void doUnbindService() { if (mIsBound) { // If we have received the service, and hence registered with it, then now is the time to unregister. if (mServiceMessenger != null) { try { Message msg = Message.obtain(null, MdpWorkerService.MSG_UNREGISTER_CLIENT); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { // There is nothing special we need to do if the service has crashed. } } // Detach our existing connection. this.getActivity().unbindService(mConnection); mIsBound = false; } } private void sendMessageToService(int command) { if (mIsBound) { if (mServiceMessenger != null) { try { Message msg = Message .obtain(null, command); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } } } } private class IncomingMessageHandler extends Handler { @Override public void handleMessage(Message msg) { Log.d(TAG, "IncomingHandler:handleMessage"); switch (msg.what) { case MdpWorkerService.MSG_LOCATION_STEP_BY_STEP: @SuppressWarnings("unchecked") ArrayList<ArrayList<NetworkInfoObject>> scanResult = (ArrayList<ArrayList<NetworkInfoObject>> ) msg.getData() .getSerializable(MdpWorkerService.ARG_LOCATION_STEP_BY_STEP); handleScanResult(scanResult); break; case MdpWorkerService.MSG_LOCATION_GAUSSIANS: @SuppressWarnings("unchecked") ArrayList<ApGaussianRecord> gaussianRecords = (ArrayList<ApGaussianRecord> ) msg.getData() .getSerializable(MdpWorkerService.ARG_LOCATION_GAUSSIANS); handleGaussianResult(gaussianRecords); break; default: super.handleMessage(msg); } } } }
UTF-8
Java
31,633
java
LocatorFragment.java
Java
[ { "context": "tworkInfoObject network1 = new NetworkInfoObject(\"OO:AA::BB:CC:DD\", \"Network 1\", -75.00);\n NetworkInfo", "end": 13580, "score": 0.9820370674133301, "start": 13571, "tag": "IP_ADDRESS", "value": "OO:AA::BB" }, { "context": "tworkInfoObject network2 = new NetworkInfoObject(\"O1:AA::BB:CC:DD\", \"Network 2\", -85.00);\n NetworkInfoO", "end": 13680, "score": 0.9593129754066467, "start": 13671, "tag": "IP_ADDRESS", "value": "O1:AA::BB" }, { "context": "tworkInfoObject network3 = new NetworkInfoObject(\"O2:AA::BB:CC:DD\", \"Network 3\", -95.00);\n NetworkInfo", "end": 13780, "score": 0.9616661071777344, "start": 13771, "tag": "IP_ADDRESS", "value": "O2:AA::BB" }, { "context": "tworkInfoObject network4 = new NetworkInfoObject(\"O3:AA::BB:CC:DD\", \"Network 4\", -65.00);\n NetworkInfo", "end": 13880, "score": 0.9676563143730164, "start": 13871, "tag": "IP_ADDRESS", "value": "O3:AA::BB" }, { "context": "workInfoObject network5 = new NetworkInfoObject(\"O4:AA::BB:CC:DD\", \"Network 5\", -55.00);\n ArrayList<N", "end": 13980, "score": 0.9914606809616089, "start": 13972, "tag": "IP_ADDRESS", "value": "4:AA::BB" }, { "context": "workInfoObject network1b = new NetworkInfoObject(\"OO:AA::BB:CC:DD\", \"Network 1\", -77.00);\n NetworkInfoO", "end": 14176, "score": 0.9468445777893066, "start": 14167, "tag": "IP_ADDRESS", "value": "OO:AA::BB" }, { "context": "workInfoObject network2b = new NetworkInfoObject(\"O1:AA::BB:CC:DD\", \"Network 2\", -87.00);\n NetworkInfo", "end": 14277, "score": 0.908952534198761, "start": 14268, "tag": "IP_ADDRESS", "value": "O1:AA::BB" }, { "context": "workInfoObject network3b = new NetworkInfoObject(\"O2:AA::BB:CC:DD\", \"Network 3\", -97.00);\n NetworkInfoObj", "end": 14381, "score": 0.964523434638977, "start": 14369, "tag": "IP_ADDRESS", "value": "O2:AA::BB:CC" }, { "context": "workInfoObject network4b = new NetworkInfoObject(\"O3:AA::BB:CC:DD\", \"Network 4\", -67.00);\n ArrayList<Netw", "end": 14482, "score": 0.893917441368103, "start": 14470, "tag": "IP_ADDRESS", "value": "O3:AA::BB:CC" }, { "context": " apGaussianRecord1a = createMockApGaussianRecord(\"OO:AA::BB:CC:DD\", \"Network 1\", -75.00, 1.00, \"Home\", \"Kitche", "end": 15186, "score": 0.888256847858429, "start": 15177, "tag": "IP_ADDRESS", "value": "OO:AA::BB" }, { "context": "apGaussianRecord2a = createMockApGaussianRecord(\"O0:AA::BB:CC:DD\", \"Network 1\", -85.00, 1.00, \"Home\", \"Room A\")", "end": 15328, "score": 0.9382189512252808, "start": 15317, "tag": "IP_ADDRESS", "value": "0:AA::BB:CC" }, { "context": "apGaussianRecord3a = createMockApGaussianRecord(\"O0:AA::BB:CC:DD\", \"Network 1\", -95.00, 1.00, \"Home\", \"Room B", "end": 15463, "score": 0.9282438158988953, "start": 15455, "tag": "IP_ADDRESS", "value": "0:AA::BB" }, { "context": "apGaussianRecord1b = createMockApGaussianRecord(\"O1:AA::BB:CC:DD\", \"Network 2\", -75.00, 1.00, \"Home\", \"Kitche", "end": 15601, "score": 0.9233536720275879, "start": 15593, "tag": "IP_ADDRESS", "value": "1:AA::BB" }, { "context": "apGaussianRecord2b = createMockApGaussianRecord(\"O1:AA::BB:CC:DD\", \"Network 2\", -85.00, 1.00, \"Home\", \"Room A", "end": 15740, "score": 0.9434521198272705, "start": 15732, "tag": "IP_ADDRESS", "value": "1:AA::BB" }, { "context": "apGaussianRecord3b = createMockApGaussianRecord(\"O1:AA::BB:CC:DD\", \"Network 2\", -95.00, 1.00, \"Home\", \"Room B", "end": 15878, "score": 0.964743435382843, "start": 15870, "tag": "IP_ADDRESS", "value": "1:AA::BB" }, { "context": "apGaussianRecord1c = createMockApGaussianRecord(\"O1:AA::BB:CC:DD\", \"Network 2\", -75.00, 1.00, \"Home\", \"Kitche", "end": 16016, "score": 0.9196300506591797, "start": 16008, "tag": "IP_ADDRESS", "value": "1:AA::BB" }, { "context": "apGaussianRecord2c = createMockApGaussianRecord(\"O2:AA::BB:CC:DD\", \"Network 3\", -85.00, 1.00, \"Home\", \"Room A", "end": 16155, "score": 0.9149064421653748, "start": 16147, "tag": "IP_ADDRESS", "value": "2:AA::BB" }, { "context": "apGaussianRecord3c = createMockApGaussianRecord(\"O2:AA::BB:CC:DD\", \"Network 3\", -95.00, 1.00, \"Home\", \"Room B", "end": 16293, "score": 0.8746943473815918, "start": 16285, "tag": "IP_ADDRESS", "value": "2:AA::BB" }, { "context": "apGaussianRecord1d = createMockApGaussianRecord(\"O2:AA::BB:CC:DD\", \"Network 3\", -75.00, 1.00, \"Home\", \"Kitche", "end": 16431, "score": 0.9160156846046448, "start": 16423, "tag": "IP_ADDRESS", "value": "2:AA::BB" }, { "context": "apGaussianRecord2d = createMockApGaussianRecord(\"O5:AA::BB:CC:DD\", \"Network 6\", -85.00, 1.00, \"Home\", \"Room ", "end": 16570, "score": 0.9210673570632935, "start": 16562, "tag": "IP_ADDRESS", "value": "5:AA::BB" }, { "context": "apGaussianRecord3d = createMockApGaussianRecord(\"O5:AA::BB:CC:DD\", \"Network 6\", -95.00, 1.00, \"Home\", \"Room B\")", "end": 16711, "score": 0.8530126810073853, "start": 16700, "tag": "IP_ADDRESS", "value": "5:AA::BB:CC" }, { "context": "apGaussianRecord1e = createMockApGaussianRecord(\"O4:AA::BB:CC:DD\", \"Network 5\", -59.00, 1.00, \"Home\", \"Kitche", "end": 16846, "score": 0.8420829176902771, "start": 16838, "tag": "IP_ADDRESS", "value": "4:AA::BB" }, { "context": "apGaussianRecord2e = createMockApGaussianRecord(\"O4:AA::BB:CC:DD\", \"Network 5\", -85.00, 1.00, \"Home\", \"Room ", "end": 16985, "score": 0.9053786396980286, "start": 16977, "tag": "IP_ADDRESS", "value": "4:AA::BB" }, { "context": "apGaussianRecord3e = createMockApGaussianRecord(\"O4:AA::BB:CC:DD\", \"Network 5\", -95.00, 1.00, \"Home\", \"Room ", "end": 17123, "score": 0.9056664705276489, "start": 17115, "tag": "IP_ADDRESS", "value": "4:AA::BB" } ]
null
[]
package tudelft.mdp.locationTracker; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.app.Fragment; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.preference.PreferenceManager; import android.util.DisplayMetrics; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ExpandableListView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import it.gmariotti.cardslib.library.view.CardView; import tudelft.mdp.MdpWorkerService; import tudelft.mdp.R; import tudelft.mdp.backend.endpoints.radioMapFingerprintEndpoint.model.ApGaussianRecord; import tudelft.mdp.backend.endpoints.wekaObjectRecordEndpoint.model.LocationFeaturesRecord; import tudelft.mdp.backend.endpoints.wekaObjectRecordEndpoint.model.Text; import tudelft.mdp.enums.UserPreferences; import tudelft.mdp.ui.ExpandableListAdapterRSSI; import tudelft.mdp.ui.LocatorBayessianCard; import tudelft.mdp.ui.LocatorNewScanCard; import tudelft.mdp.ui.LocatorScanResultCard; import tudelft.mdp.ui.LocatorWekaCard; import tudelft.mdp.utils.Utils; import tudelft.mdp.weka.WekaNetworkScansObject; public class LocatorFragment extends Fragment implements ServiceConnection, RequestLocationEvaluationWekaAsyncTask.RequestLocationEvaluationWekaAsyncResponse{ private Messenger mServiceMessenger = null; private boolean mIsBound; private final Messenger mMessenger = new Messenger(new IncomingMessageHandler()); private ServiceConnection mConnection = this; private View rootView; private CardView mCardViewNewScan; private CardView mCardViewBayessian; private CardView mCardViewWeka; private CardView mCardViewScanResult; private LocatorScanResultCard mCardScanResult; private LocatorNewScanCard mCardNewScan; private LocatorBayessianCard mCardBayessian; private LocatorWekaCard mCardWeka; private Button mButtonRequestNewNetworkScan; private ProgressBar mProgressBar; // Bayessian Card private Button mButtonCalculateLocationUsingNextNetwork_Bayessian; private Button mButtonCalculateLocation_Bayessian; private Button mButtonCalculateLocation_Weka; private TextView mTextViewCurrentPlace_Weka; private TextView mTextViewZone_Weka; private TextView mTextViewProbability_Weka; private TextView mTextViewCurrentPlace_Bayessian; private TextView mTextViewZone_Bayessian; private TextView mTextViewProbability_Bayessian; private TextView mTextViewNetwork_Bayessian; private TextView mTextViewNetworkId_Bayessian; private LinearLayout mLinearLayoutBayessian; private LocationEstimator mLocationEstimator = new LocationEstimator(); private ArrayList<ArrayList<NetworkInfoObject>> mNetworkScans = new ArrayList<ArrayList<NetworkInfoObject>>(); private ArrayList<ApGaussianRecord> mGaussianRecords = new ArrayList<ApGaussianRecord>(); private HashMap<String,Double> pmfFinalBayessian = new HashMap<String, Double>(); private HashMap<String,Double> pmfFinalWeka = new HashMap<String, Double>(); private ArrayList<HashMap<String,Double>> pmfIntermediateResultsBayessian = new ArrayList<HashMap<String, Double>>(); private int networkIdCount; private String currentPlaceBayessian = "TBD"; private String currentPlaceWeka = "TBD"; private ExpandableListView mExpandableListAP; private ArrayList<NetworkInfoObject> groupItem = new ArrayList<NetworkInfoObject>(); private ArrayList<Object> childItem = new ArrayList<Object>(); private static final String TAG = "MDP-LocatorFragment"; public LocatorFragment() { // Required empty public constructor } // Lifecycle methods *************************************************************************** @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 rootView = inflater.inflate(R.layout.fragment_locator, container, false); configureCardsInit(); automaticBinding(); return rootView; } @Override public void onDestroy() { super.onDestroy(); try { if (mIsBound) { automaticUnbinding(); } } catch (Throwable t) { Log.e(TAG, "Failed to unbind from the service", t); } } // Configure Cards ***************************************************************************** private void configureCardsInit(){ configureNewScanCard(); configureBayessianCard(); configureWekaCard(); configureScanResultsCard(); } private void configureNewScanCard(){ mCardViewNewScan = (CardView) rootView.findViewById(R.id.cardNewScan); mCardNewScan = new LocatorNewScanCard(rootView.getContext()); mCardNewScan.setShadow(true); mCardViewNewScan.setCard(mCardNewScan); mProgressBar = (ProgressBar) mCardViewNewScan.findViewById(R.id.progressBar); mButtonRequestNewNetworkScan = (Button) mCardViewNewScan.findViewById(R.id.btnNewScan); mButtonRequestNewNetworkScan.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(rootView.getContext(), "Requesting new scan...", Toast.LENGTH_SHORT).show(); sendMessageToService(MdpWorkerService.MSG_LOCATION_STEP_BY_STEP); mProgressBar.setIndeterminate(true); refreshWekaCard(new HashMap<String, Double>(), "TBD"); mCardViewWeka.setVisibility(View.INVISIBLE); refreshBayessianCard(new HashMap<String, Double>(), "TBD", 0); mCardViewBayessian.setVisibility(View.INVISIBLE); mCardViewScanResult.setVisibility(View.INVISIBLE); } }); } private void configureScanResultsCard(){ mCardViewScanResult = (CardView) rootView.findViewById(R.id.cardScanResults); mCardScanResult = new LocatorScanResultCard(rootView.getContext()); mCardScanResult.setShadow(true); mCardViewScanResult.setCard(mCardScanResult); mExpandableListAP = (ExpandableListView) mCardViewScanResult.findViewById(R.id.ap_exp); //mExpandableListAP = (ExpandableListView) rootView.findViewById(R.id.ap_exp1); updateScanResultsList(mockLocationEstimator()); mCardViewScanResult.setVisibility(View.INVISIBLE); } private void configureWekaCard(){ mCardWeka = new LocatorWekaCard(rootView.getContext()); mCardWeka.init(); mCardWeka.setShadow(true); mCardViewWeka = (CardView) rootView.findViewById(R.id.cardWeka); mCardViewWeka.setCard(mCardWeka); mButtonCalculateLocation_Weka = (Button) mCardViewWeka.findViewById(R.id.btnFinalResultWeka); mButtonCalculateLocation_Weka.setEnabled(false); mTextViewCurrentPlace_Weka = (TextView) mCardViewWeka.findViewById(R.id.twPlace); mTextViewZone_Weka = (TextView) mCardViewWeka.findViewById(R.id.twZone); mTextViewProbability_Weka = (TextView) mCardViewWeka.findViewById(R.id.twProb); mButtonCalculateLocation_Weka.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Toast.makeText(rootView.getContext(), "Calculating final location...", Toast.LENGTH_SHORT).show(); calculateFinalLocationWeka(); } }); refreshWekaCard(new HashMap<String, Double>(), "TBD"); mCardViewWeka.setVisibility(View.INVISIBLE); } private void configureBayessianCard(){ mCardBayessian = new LocatorBayessianCard(rootView.getContext()); mCardBayessian.init(); mCardBayessian.setShadow(true); mCardViewBayessian = (CardView) rootView.findViewById(R.id.cardBayessian); mCardViewBayessian.setCard(mCardBayessian); mButtonCalculateLocationUsingNextNetwork_Bayessian = (Button) mCardViewBayessian.findViewById(R.id.btnNextAP); mButtonCalculateLocation_Bayessian = (Button) mCardViewBayessian.findViewById(R.id.btnFinalResultBayessian); mButtonCalculateLocationUsingNextNetwork_Bayessian.setEnabled(false); mButtonCalculateLocation_Bayessian.setEnabled(false); mTextViewCurrentPlace_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twPlace); mTextViewZone_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twZone); mTextViewProbability_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twProb); mTextViewNetwork_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twNetworkName); mTextViewNetworkId_Bayessian = (TextView) mCardViewBayessian.findViewById(R.id.twNetworkNumber); mLinearLayoutBayessian = (LinearLayout) mCardViewBayessian.findViewById(R.id.resultBayessian); mButtonCalculateLocationUsingNextNetwork_Bayessian.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Toast.makeText(rootView.getContext(), "Calculating location...", Toast.LENGTH_SHORT).show(); calculateNextAPBayessian(); } }); mButtonCalculateLocation_Bayessian.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Toast.makeText(rootView.getContext(), "Calculating final location...", Toast.LENGTH_SHORT).show(); calculateFinalLocationBayessian(); } }); refreshBayessianCard(new HashMap<String, Double>(), "TBD", 0); mCardViewBayessian.setVisibility(View.INVISIBLE); } private void refreshWekaCard( HashMap<String, Double> updatedResults, String currentPlace){ String zone = "Unknown"; Double max = 0.0; HashMap<String, Double> sortedPMF = new HashMap<String, Double>(); if (updatedResults != null){ if (updatedResults.size() > 0) { //mLinearLayoutBayessian.setVisibility(View.VISIBLE); sortedPMF = LocationEstimator.sortByProbability(updatedResults); zone = (String) sortedPMF.keySet().toArray()[0]; max = sortedPMF.get(zone); } else { //mLinearLayoutBayessian.setVisibility(View.INVISIBLE); } } mTextViewCurrentPlace_Weka.setText(currentPlace); mTextViewZone_Weka.setText(zone); mTextViewProbability_Weka.setText(String.format("%.2f",max * 100) + "%"); mCardWeka.setCurrentPlace(currentPlace); mCardWeka.updateItems(sortedPMF); } private void refreshBayessianCard( HashMap<String, Double> updatedResults, String currentPlace, int index){ String networkId; String networkName; if ( index < mLocationEstimator.getNetworkScans().size() && index >= 0){ networkId = "[" + (index + 1) + "/"+ mLocationEstimator.getNetworkScans().size() +"]"; networkName = mLocationEstimator.getNetworkScans().get(index).getSSID(); } else { networkId = "[-]"; networkName = "Undetermined"; } String zone = "Unknown"; Double max = 0.0; HashMap<String, Double> sortedPMF = new HashMap<String, Double>(); if (updatedResults != null){ if (updatedResults.size() > 0) { //mLinearLayoutBayessian.setVisibility(View.VISIBLE); sortedPMF = LocationEstimator.sortByProbability(updatedResults); zone = (String) sortedPMF.keySet().toArray()[0]; max = sortedPMF.get(zone); } else { //mLinearLayoutBayessian.setVisibility(View.INVISIBLE); } } mTextViewCurrentPlace_Bayessian.setText(currentPlace); mTextViewZone_Bayessian.setText(zone); mTextViewProbability_Bayessian.setText(String.format("%.2f",max * 100) + "%"); mTextViewNetworkId_Bayessian.setText(networkId); mTextViewNetwork_Bayessian.setText(networkName); mCardBayessian.setCurrentPlace(currentPlace); mCardBayessian.updateItems(sortedPMF); } private HashMap<String, Double> mockZoneInfo (){ HashMap<String, Double> mockPMF = new HashMap<String, Double>(); mockPMF.put("Room A", 0.15); mockPMF.put("Room B", 0.7532); mockPMF.put("Room C", 0.05); mockPMF.put("Room D", 0.03); mockPMF.put("Room E", 0.02); return mockPMF; } private LocationEstimator mockLocationEstimator(){ LocationEstimator locationEstimator = new LocationEstimator(); ArrayList<ArrayList<NetworkInfoObject>> mNetworkScansRawMock = new ArrayList<ArrayList<NetworkInfoObject>>(); ArrayList<ApGaussianRecord> mGaussianRecordsMock = new ArrayList<ApGaussianRecord>(); NetworkInfoObject network1 = new NetworkInfoObject("OO:AA::BB:CC:DD", "Network 1", -75.00); NetworkInfoObject network2 = new NetworkInfoObject("O1:AA::BB:CC:DD", "Network 2", -85.00); NetworkInfoObject network3 = new NetworkInfoObject("O2:AA::BB:CC:DD", "Network 3", -95.00); NetworkInfoObject network4 = new NetworkInfoObject("O3:AA::BB:CC:DD", "Network 4", -65.00); NetworkInfoObject network5 = new NetworkInfoObject("Ofdf8:f53e:61e4::18:CC:DD", "Network 5", -55.00); ArrayList<NetworkInfoObject> networkInfoObjects = new ArrayList<NetworkInfoObject>(); NetworkInfoObject network1b = new NetworkInfoObject("OO:AA::BB:CC:DD", "Network 1", -77.00); NetworkInfoObject network2b = new NetworkInfoObject("O1:AA::BB:CC:DD", "Network 2", -87.00); NetworkInfoObject network3b = new NetworkInfoObject("O2:AA::BB:CC:DD", "Network 3", -97.00); NetworkInfoObject network4b = new NetworkInfoObject("O3:AA::BB:CC:DD", "Network 4", -67.00); ArrayList<NetworkInfoObject> networkInfoObjectsB = new ArrayList<NetworkInfoObject>(); networkInfoObjects.add(network1); networkInfoObjects.add(network2); networkInfoObjects.add(network3); networkInfoObjects.add(network4); networkInfoObjects.add(network5); mNetworkScansRawMock.add(networkInfoObjects); networkInfoObjectsB.add(network1b); networkInfoObjectsB.add(network2b); networkInfoObjectsB.add(network3b); networkInfoObjectsB.add(network4b); mNetworkScansRawMock.add(networkInfoObjectsB); ApGaussianRecord apGaussianRecord1a = createMockApGaussianRecord("OO:AA::BB:CC:DD", "Network 1", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2a = createMockApGaussianRecord("Ofc00:db20:35b:7399::5:DD", "Network 1", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3a = createMockApGaussianRecord("Ofd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:CC:DD", "Network 1", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1b = createMockApGaussianRecord("Ofd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:CC:DD", "Network 2", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2b = createMockApGaussianRecord("Ofd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:CC:DD", "Network 2", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3b = createMockApGaussianRecord("Ofd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:CC:DD", "Network 2", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1c = createMockApGaussianRecord("Ofd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b:CC:DD", "Network 2", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2c = createMockApGaussianRecord("Ofc00:e968:6179::de52:7100:CC:DD", "Network 3", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3c = createMockApGaussianRecord("Ofc00:e968:6179::de52:7100:CC:DD", "Network 3", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1d = createMockApGaussianRecord("Ofc00:e968:6179::de52:7100:CC:DD", "Network 3", -75.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2d = createMockApGaussianRecord("Ofc00:db20:35b:7399::5:CC:DD", "Network 6", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3d = createMockApGaussianRecord("Ofd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b:DD", "Network 6", -95.00, 1.00, "Home", "Room B"); ApGaussianRecord apGaussianRecord1e = createMockApGaussianRecord("Ofdf8:f53e:61e4::18:CC:DD", "Network 5", -59.00, 1.00, "Home", "Kitchen"); ApGaussianRecord apGaussianRecord2e = createMockApGaussianRecord("Ofdf8:f53e:61e4::18:CC:DD", "Network 5", -85.00, 1.00, "Home", "Room A"); ApGaussianRecord apGaussianRecord3e = createMockApGaussianRecord("Ofdf8:f53e:61e4::18:CC:DD", "Network 5", -95.00, 1.00, "Home", "Room B"); mGaussianRecordsMock.add(apGaussianRecord1a); mGaussianRecordsMock.add(apGaussianRecord2a); mGaussianRecordsMock.add(apGaussianRecord3a); mGaussianRecordsMock.add(apGaussianRecord1b); mGaussianRecordsMock.add(apGaussianRecord2b); mGaussianRecordsMock.add(apGaussianRecord3b); mGaussianRecordsMock.add(apGaussianRecord1c); mGaussianRecordsMock.add(apGaussianRecord2c); mGaussianRecordsMock.add(apGaussianRecord3c); mGaussianRecordsMock.add(apGaussianRecord1d); mGaussianRecordsMock.add(apGaussianRecord2d); mGaussianRecordsMock.add(apGaussianRecord3d); mGaussianRecordsMock.add(apGaussianRecord1e); mGaussianRecordsMock.add(apGaussianRecord2e); mGaussianRecordsMock.add(apGaussianRecord3e); locationEstimator.setNetworkScansRaw(mNetworkScansRawMock); locationEstimator.setGaussianRecords(mGaussianRecordsMock); locationEstimator.consolidateNetworkScans(); locationEstimator.sortNetworksByRSSI(); locationEstimator.ignoreUnknownNetworks(); return locationEstimator; } private ApGaussianRecord createMockApGaussianRecord(String SSID, String BSSID, Double mean, Double std, String place, String zone){ ApGaussianRecord apGaussianRecord = new ApGaussianRecord(); apGaussianRecord.setZone(zone); apGaussianRecord.setPlace(place); apGaussianRecord.setStd(std); apGaussianRecord.setMean(mean); apGaussianRecord.setBssid(BSSID); apGaussianRecord.setSsid(SSID); return apGaussianRecord; } // Receive data from Background Service ******************************************************** private void handleGaussianResult(ArrayList<ApGaussianRecord> gaussianRecords){ mGaussianRecords = new ArrayList<ApGaussianRecord>(gaussianRecords); //Toast.makeText(rootView.getContext(), "Gaussians received.", Toast.LENGTH_SHORT).show(); } private void handleScanResult(ArrayList<ArrayList<NetworkInfoObject>> networkScans) { Toast.makeText(rootView.getContext(),"Scan Results ready",Toast.LENGTH_SHORT).show(); initBayessianLocation(networkScans); initWekaLocation(networkScans); updateScanResultsList(mLocationEstimator); mCardViewScanResult.setVisibility(View.VISIBLE); } private void updateScanResultsList(LocationEstimator locationEstimator){ ViewGroup.LayoutParams layoutParams = mExpandableListAP.getLayoutParams(); int nNetworks = mLocationEstimator.getNetworkScans().size(); int nParents = nNetworks * dpToPx(19); layoutParams.height = nParents; //mCardViewScanResult.setLayoutParams(layoutParams); mExpandableListAP.setLayoutParams(layoutParams); setExpListScanResultData(locationEstimator); mExpandableListAP.setAdapter(new ExpandableListAdapterRSSI(rootView.getContext(), groupItem, childItem)); mExpandableListAP.setOnGroupClickListener(new ExpDrawerGroupClickListener()); } public int dpToPx(int dp) { DisplayMetrics displayMetrics = rootView.getContext().getResources().getDisplayMetrics(); int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); return px; } private class ExpDrawerGroupClickListener implements ExpandableListView.OnGroupClickListener { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { /* if (parent.isGroupExpanded(groupPosition)){ parent.collapseGroup(groupPosition); }else { parent.expandGroup(groupPosition, true); } return true; */ ViewGroup.LayoutParams layoutParams = parent.getLayoutParams(); int nNetworks = mLocationEstimator.getNetworkScans().size(); int nParents = nNetworks * dpToPx(19); NetworkInfoObject parentNetwork = mLocationEstimator.getNetworkScans().get(groupPosition); int nNetworkChildren = mLocationEstimator.getGaussianRecordsOfNetwork(parentNetwork).size(); int nChildren = nNetworkChildren * dpToPx(19); if (parent.isGroupExpanded(groupPosition)){ parent.collapseGroup(groupPosition); if ((layoutParams.height - nChildren) < nParents){ layoutParams.height = nParents; } else { layoutParams.height = layoutParams.height - nChildren; } }else { parent.expandGroup(groupPosition, true); layoutParams.height = layoutParams.height + nChildren; } parent.setLayoutParams(layoutParams); return true; } } private void setExpListScanResultData(LocationEstimator locationEstimator){ groupItem.clear(); childItem.clear(); for (NetworkInfoObject networkInfoObject : locationEstimator.getNetworkScans()){ groupItem.add(networkInfoObject); ArrayList<ApGaussianRecord> child = locationEstimator.getGaussianRecordsOfNetwork(networkInfoObject); //Sorting according to Zone name Collections.sort(child, new Comparator<ApGaussianRecord>() { @Override public int compare(ApGaussianRecord item1, ApGaussianRecord item2) { return item1.getZone().compareTo(item2.getZone()); } }); childItem.add(child); } } // Bayessian calculations ********************************************************************** private void initBayessianLocation(ArrayList<ArrayList<NetworkInfoObject>> networkScans){ mNetworkScans = new ArrayList<ArrayList<NetworkInfoObject>>(networkScans); mLocationEstimator = new LocationEstimator(mNetworkScans, mGaussianRecords); //mLocationEstimator = mockLocationEstimator(); pmfFinalBayessian = mLocationEstimator.calculateLocationBayessian(); pmfIntermediateResultsBayessian = mLocationEstimator.calculateLocationBayessian_IntermediatePMFs(); currentPlaceBayessian = mLocationEstimator.determineCurrentPlace(); networkIdCount = 0; mProgressBar.setIndeterminate(false); mCardViewBayessian.setVisibility(View.VISIBLE); mButtonCalculateLocationUsingNextNetwork_Bayessian.setEnabled(true); mButtonCalculateLocation_Bayessian.setEnabled(true); } private void calculateNextAPBayessian(){ if (currentPlaceBayessian == null){ refreshBayessianCard(pmfFinalBayessian, "Unknown" , -1); } else { refreshBayessianCard(pmfIntermediateResultsBayessian.get(networkIdCount), currentPlaceBayessian, networkIdCount); if (networkIdCount < (mLocationEstimator.getNetworkScans().size()-1)){ networkIdCount++; } else { networkIdCount = 0; } } } private void calculateFinalLocationBayessian(){ if (currentPlaceBayessian == null){ refreshBayessianCard(pmfFinalBayessian, "Unknown" , -1); } else { int index = -1; if (pmfFinalBayessian != null) { index = findNetworkWithBestResult(); } refreshBayessianCard(pmfFinalBayessian, currentPlaceBayessian, index); } } private int findNetworkWithBestResult(){ String zone = "Unknown"; Double max = 0.0; if (pmfFinalBayessian.size() > 0) { zone = (String) pmfFinalBayessian.keySet().toArray()[0]; max = pmfFinalBayessian.get(zone); } int index = -1; for (int i = 0; i < pmfIntermediateResultsBayessian.size(); i++){ Double maxProb = pmfIntermediateResultsBayessian.get(i).get(zone); if (max.equals(maxProb)){ return i; } } return index; } // Weka Calculations *************************************************************************** private void initWekaLocation(ArrayList<ArrayList<NetworkInfoObject>> networkScans){ WekaNetworkScansObject wekaNetworkScansObject = new WekaNetworkScansObject(networkScans); String features = wekaNetworkScansObject.getFeatures(); Text ft = new Text(); ft.setValue(features); LocationFeaturesRecord locationFeaturesRecord = new LocationFeaturesRecord(); locationFeaturesRecord.setLocationFeatures(ft); locationFeaturesRecord.setTimestamp(Utils.getCurrentTimestamp()); locationFeaturesRecord.setUsername(PreferenceManager .getDefaultSharedPreferences(rootView.getContext()) .getString(UserPreferences.USERNAME, "TBD")); RequestLocationEvaluationWekaAsyncTask LocationEvaluationWekaAsyncTask = new RequestLocationEvaluationWekaAsyncTask(); LocationEvaluationWekaAsyncTask.delegate = this; LocationEvaluationWekaAsyncTask.execute(locationFeaturesRecord); } public void processFinishRequestLocationEvaluationWeka(LocationFeaturesRecord result){ String predictionResult = result.getLocationFeatures().getValue(); String[] probabilities = predictionResult.split("\\|"); pmfFinalWeka = new HashMap<String, Double>(); for (String placeZoneProb : probabilities){ String[] parts = placeZoneProb.split(","); String[] locationInfo = parts[0].split("-"); currentPlaceWeka = locationInfo[0]; String zoneWeka = locationInfo[1]; Double prob = Double.valueOf(parts[1]); pmfFinalWeka.put(zoneWeka, prob); } mCardViewWeka.setVisibility(View.VISIBLE); mButtonCalculateLocation_Weka.setEnabled(true); } private void calculateFinalLocationWeka(){ if (currentPlaceBayessian == null){ refreshWekaCard(pmfFinalWeka, "Unknown"); } else { refreshWekaCard(pmfFinalWeka, currentPlaceWeka); } } // Service connection methods ****************************************************************** @Override public void onServiceDisconnected(ComponentName name) { Log.i(TAG, "Sensor Service: onServiceDisconnected"); if (mServiceMessenger != null) { mServiceMessenger = null; } } @Override public void onServiceConnected(ComponentName name, IBinder service) { Log.i(TAG, "Sensor Service: onServiceConnected"); mServiceMessenger = new Messenger(service); try { Message msg = Message.obtain(null, MdpWorkerService.MSG_REGISTER_CLIENT); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { // In this case the service has crashed before we could even do anything with it } sendMessageToService(MdpWorkerService.MSG_LOCATION_GAUSSIANS); } private void automaticBinding() { if (MdpWorkerService.isRunning()){ doBindService(); } else{ startServiceNetworkScan(); doBindService(); } } private void automaticUnbinding() { stopServiceNetworkScan(); } public void startServiceNetworkScan(){ Log.i(TAG, "MdpWorkerService : START"); Intent intent = new Intent(this.getActivity(), MdpWorkerService.class); this.getActivity().startService(intent); } public void stopServiceNetworkScan(){ Log.i(TAG, "MdpWorkerService : Unbind"); doUnbindService(); } private void doBindService() { this.getActivity().bindService(new Intent(this.getActivity(), MdpWorkerService.class), mConnection, 0); mIsBound = true; } private void doUnbindService() { if (mIsBound) { // If we have received the service, and hence registered with it, then now is the time to unregister. if (mServiceMessenger != null) { try { Message msg = Message.obtain(null, MdpWorkerService.MSG_UNREGISTER_CLIENT); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { // There is nothing special we need to do if the service has crashed. } } // Detach our existing connection. this.getActivity().unbindService(mConnection); mIsBound = false; } } private void sendMessageToService(int command) { if (mIsBound) { if (mServiceMessenger != null) { try { Message msg = Message .obtain(null, command); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } } } } private class IncomingMessageHandler extends Handler { @Override public void handleMessage(Message msg) { Log.d(TAG, "IncomingHandler:handleMessage"); switch (msg.what) { case MdpWorkerService.MSG_LOCATION_STEP_BY_STEP: @SuppressWarnings("unchecked") ArrayList<ArrayList<NetworkInfoObject>> scanResult = (ArrayList<ArrayList<NetworkInfoObject>> ) msg.getData() .getSerializable(MdpWorkerService.ARG_LOCATION_STEP_BY_STEP); handleScanResult(scanResult); break; case MdpWorkerService.MSG_LOCATION_GAUSSIANS: @SuppressWarnings("unchecked") ArrayList<ApGaussianRecord> gaussianRecords = (ArrayList<ApGaussianRecord> ) msg.getData() .getSerializable(MdpWorkerService.ARG_LOCATION_GAUSSIANS); handleGaussianResult(gaussianRecords); break; default: super.handleMessage(msg); } } } }
31,930
0.663864
0.654412
754
40.953583
34.594227
138
false
false
0
0
0
0
0
0
0.779841
false
false
12
85485833773407b5108506ae73190988d6f2d623
21,157,008,964,231
d46f4a7aeed7a4554d7f56ccf559fc75fccac5e8
/eureka-client/src/main/java/com/netflix/discovery/shared/resolver/aws/ConfigClusterResolver.java
0bc9fcaf54e0870d6ba7a36a7a730945ab252ed2
[ "Apache-2.0" ]
permissive
kevin0016/eureka
https://github.com/kevin0016/eureka
5662fa0345551f458bf35df89300c983cac3de47
bfa5a54f325d8bb2e3a88152c4b8970928c39106
refs/heads/master
2020-06-04T06:44:34.798000
2019-07-03T10:18:08
2019-07-03T10:18:08
191,909,845
1
1
Apache-2.0
true
2019-06-14T08:54:17
2019-06-14T08:54:16
2019-06-14T06:37:42
2019-06-13T18:29:49
11,726
0
0
0
null
false
false
package com.netflix.discovery.shared.resolver.aws; import com.netflix.appinfo.InstanceInfo; import com.netflix.discovery.EurekaClientConfig; import com.netflix.discovery.endpoint.EndpointUtils; import com.netflix.discovery.shared.resolver.ClusterResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * A resolver that on-demand resolves from configuration what the endpoints should be. * * @author David Liu */ public class ConfigClusterResolver implements ClusterResolver<AwsEndpoint> { private static final Logger logger = LoggerFactory.getLogger(ConfigClusterResolver.class); private final EurekaClientConfig clientConfig; private final InstanceInfo myInstanceInfo; public ConfigClusterResolver(EurekaClientConfig clientConfig, InstanceInfo myInstanceInfo) { this.clientConfig = clientConfig; this.myInstanceInfo = myInstanceInfo; } @Override public String getRegion() { return clientConfig.getRegion(); } @Override public List<AwsEndpoint> getClusterEndpoints() { if (clientConfig.shouldUseDnsForFetchingServiceUrls()) { if (logger.isInfoEnabled()) { logger.info("Resolving eureka endpoints via DNS: {}", getDNSName()); } return getClusterEndpointsFromDns(); } else { logger.info("Resolving eureka endpoints via configuration"); return getClusterEndpointsFromConfig(); } } private List<AwsEndpoint> getClusterEndpointsFromDns() { String discoveryDnsName = getDNSName(); int port = Integer.parseInt(clientConfig.getEurekaServerPort()); // cheap enough so just re-use DnsTxtRecordClusterResolver dnsResolver = new DnsTxtRecordClusterResolver( getRegion(), discoveryDnsName, true, port, false, clientConfig.getEurekaServerURLContext() ); List<AwsEndpoint> endpoints = dnsResolver.getClusterEndpoints(); if (endpoints.isEmpty()) { logger.error("Cannot resolve to any endpoints for the given dnsName: {}", discoveryDnsName); } return endpoints; } private List<AwsEndpoint> getClusterEndpointsFromConfig() { String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion()); String myZone = InstanceInfo.getZone(availZones, myInstanceInfo); Map<String, List<String>> serviceUrls = EndpointUtils .getServiceUrlsMapFromConfig(clientConfig, myZone, clientConfig.shouldPreferSameZoneEureka()); List<AwsEndpoint> endpoints = new ArrayList<>(); for (String zone : serviceUrls.keySet()) { for (String url : serviceUrls.get(zone)) { try { endpoints.add(new AwsEndpoint(url, getRegion(), zone)); } catch (Exception ignore) { logger.warn("Invalid eureka server URI: {}; removing from the server pool", url); } } } logger.debug("Config resolved to {}", endpoints); if (endpoints.isEmpty()) { logger.error("Cannot resolve to any endpoints from provided configuration: {}", serviceUrls); } return endpoints; } private String getDNSName() { return "txt." + getRegion() + '.' + clientConfig.getEurekaServerDNSName(); } }
UTF-8
Java
3,533
java
ConfigClusterResolver.java
Java
[ { "context": "ration what the endpoints should be.\n *\n * @author David Liu\n */\npublic class ConfigClusterResolver implements", "end": 503, "score": 0.99916011095047, "start": 494, "tag": "NAME", "value": "David Liu" } ]
null
[]
package com.netflix.discovery.shared.resolver.aws; import com.netflix.appinfo.InstanceInfo; import com.netflix.discovery.EurekaClientConfig; import com.netflix.discovery.endpoint.EndpointUtils; import com.netflix.discovery.shared.resolver.ClusterResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * A resolver that on-demand resolves from configuration what the endpoints should be. * * @author <NAME> */ public class ConfigClusterResolver implements ClusterResolver<AwsEndpoint> { private static final Logger logger = LoggerFactory.getLogger(ConfigClusterResolver.class); private final EurekaClientConfig clientConfig; private final InstanceInfo myInstanceInfo; public ConfigClusterResolver(EurekaClientConfig clientConfig, InstanceInfo myInstanceInfo) { this.clientConfig = clientConfig; this.myInstanceInfo = myInstanceInfo; } @Override public String getRegion() { return clientConfig.getRegion(); } @Override public List<AwsEndpoint> getClusterEndpoints() { if (clientConfig.shouldUseDnsForFetchingServiceUrls()) { if (logger.isInfoEnabled()) { logger.info("Resolving eureka endpoints via DNS: {}", getDNSName()); } return getClusterEndpointsFromDns(); } else { logger.info("Resolving eureka endpoints via configuration"); return getClusterEndpointsFromConfig(); } } private List<AwsEndpoint> getClusterEndpointsFromDns() { String discoveryDnsName = getDNSName(); int port = Integer.parseInt(clientConfig.getEurekaServerPort()); // cheap enough so just re-use DnsTxtRecordClusterResolver dnsResolver = new DnsTxtRecordClusterResolver( getRegion(), discoveryDnsName, true, port, false, clientConfig.getEurekaServerURLContext() ); List<AwsEndpoint> endpoints = dnsResolver.getClusterEndpoints(); if (endpoints.isEmpty()) { logger.error("Cannot resolve to any endpoints for the given dnsName: {}", discoveryDnsName); } return endpoints; } private List<AwsEndpoint> getClusterEndpointsFromConfig() { String[] availZones = clientConfig.getAvailabilityZones(clientConfig.getRegion()); String myZone = InstanceInfo.getZone(availZones, myInstanceInfo); Map<String, List<String>> serviceUrls = EndpointUtils .getServiceUrlsMapFromConfig(clientConfig, myZone, clientConfig.shouldPreferSameZoneEureka()); List<AwsEndpoint> endpoints = new ArrayList<>(); for (String zone : serviceUrls.keySet()) { for (String url : serviceUrls.get(zone)) { try { endpoints.add(new AwsEndpoint(url, getRegion(), zone)); } catch (Exception ignore) { logger.warn("Invalid eureka server URI: {}; removing from the server pool", url); } } } logger.debug("Config resolved to {}", endpoints); if (endpoints.isEmpty()) { logger.error("Cannot resolve to any endpoints from provided configuration: {}", serviceUrls); } return endpoints; } private String getDNSName() { return "txt." + getRegion() + '.' + clientConfig.getEurekaServerDNSName(); } }
3,530
0.656666
0.6561
101
33.980198
30.911877
110
false
false
0
0
0
0
0
0
0.534653
false
false
12
cf2189beebee252c8f7ec6085ecd72e74ae71b1d
15,418,932,654,692
e5146dac05624ef06c737f0f34f136f2f7bcd881
/src/model/dao/AdminDAO.java
99b75605777db71e60853808d11786a891b2a07d
[ "MIT" ]
permissive
BillScott1024/CourseSystem
https://github.com/BillScott1024/CourseSystem
ae850193d964b0a899d545476498c64d1d20a4c4
5c23fe9b308aa04b3b19c8ef48a12ab02d5cf338
refs/heads/master
2021-09-04T15:52:09.077000
2018-01-20T03:14:14
2018-01-20T03:14:14
118,201,767
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.dao; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import model.vo.Admin; import model.vo.Student; import util.db.DBManager; public class AdminDAO { public List<Admin> queryAdminByName(String inID) throws Exception { List<Admin> adList = new ArrayList<Admin>(); String sql; DBManager db=new DBManager(); ResultSet rs = null; sql = "select id,name,password,age,sex,phone from admin where id = '"+ inID +"'"; try { rs = db.executeQuery(sql); while(rs.next()) { Admin ad = new Admin(); ad.setAdminid(rs.getString("id")); ad.setUserName(rs.getString("name")); ad.setAge(rs.getInt("age")); ad.setSex(rs.getString("sex")); ad.setPassword(rs.getString("password")); ad.setPhone(rs.getString("phone")); adList.add(ad); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ db.close(); } return adList; } public boolean inertAdmin(Admin admin) { String strSql; int ret = 0;; DBManager db = new DBManager(); strSql = "insert into student(id,学生姓名,密码,年龄,性别,联系方式) values('" + admin.getAdminid() + "','" + admin.getPassword() + "',"+ admin.getAge() +",'" + admin.getSex() + "','"+ admin.getPhone() + "')"; try { ret = db.executeUpdate(strSql); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { db.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(ret > 0) return true; else return false; } }
GB18030
Java
1,671
java
AdminDAO.java
Java
[]
null
[]
package model.dao; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import model.vo.Admin; import model.vo.Student; import util.db.DBManager; public class AdminDAO { public List<Admin> queryAdminByName(String inID) throws Exception { List<Admin> adList = new ArrayList<Admin>(); String sql; DBManager db=new DBManager(); ResultSet rs = null; sql = "select id,name,password,age,sex,phone from admin where id = '"+ inID +"'"; try { rs = db.executeQuery(sql); while(rs.next()) { Admin ad = new Admin(); ad.setAdminid(rs.getString("id")); ad.setUserName(rs.getString("name")); ad.setAge(rs.getInt("age")); ad.setSex(rs.getString("sex")); ad.setPassword(rs.getString("password")); ad.setPhone(rs.getString("phone")); adList.add(ad); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ db.close(); } return adList; } public boolean inertAdmin(Admin admin) { String strSql; int ret = 0;; DBManager db = new DBManager(); strSql = "insert into student(id,学生姓名,密码,年龄,性别,联系方式) values('" + admin.getAdminid() + "','" + admin.getPassword() + "',"+ admin.getAge() +",'" + admin.getSex() + "','"+ admin.getPhone() + "')"; try { ret = db.executeUpdate(strSql); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { db.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(ret > 0) return true; else return false; } }
1,671
0.61899
0.617772
81
19.283951
18.979673
83
false
false
0
0
0
0
0
0
2.432099
false
false
12
dce0ad9e4e733d5a43b6de48ef7ca3e319636664
36,558,761,649,930
3cdfe43e65c67c547b997b523d60d8a7ea7a157d
/entity/Order.java
f74f3ad51da436746684e14cfe2ba92ab996133a
[]
no_license
zhouhuajuan/cat2
https://github.com/zhouhuajuan/cat2
2966c87cb46c50f5471509599085758e0ebd8dc8
bee06c61f995bb4956327bf14d7f1cbaae754f94
refs/heads/master
2021-05-24T11:53:22.706000
2020-04-26T13:46:12
2020-04-26T13:46:12
253,547,518
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zhj.event.entity; import java.sql.Timestamp; public class Order { private Integer gameId; private String date; private String hostTeam; private String guestTeam; private int price; public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } private Integer id; private Integer userId; public String getDate() { return date; } public String getGuestTeam() { return guestTeam; } public void setGuestTeam(String guestTeam) { this.guestTeam = guestTeam; } public String getHostTeam() { return hostTeam; } public void setHostTeam(String hostTeam) { this.hostTeam = hostTeam; } public void setDate(String date) { this.date = date; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public Integer getGameId() { return gameId; } public void setGameId(Integer gameId) { this.gameId = gameId; } public Order(Integer userId,Integer gameId){ this.userId = userId; this.gameId = gameId; } }
UTF-8
Java
1,368
java
Order.java
Java
[]
null
[]
package com.zhj.event.entity; import java.sql.Timestamp; public class Order { private Integer gameId; private String date; private String hostTeam; private String guestTeam; private int price; public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } private Integer id; private Integer userId; public String getDate() { return date; } public String getGuestTeam() { return guestTeam; } public void setGuestTeam(String guestTeam) { this.guestTeam = guestTeam; } public String getHostTeam() { return hostTeam; } public void setHostTeam(String hostTeam) { this.hostTeam = hostTeam; } public void setDate(String date) { this.date = date; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public Integer getGameId() { return gameId; } public void setGameId(Integer gameId) { this.gameId = gameId; } public Order(Integer userId,Integer gameId){ this.userId = userId; this.gameId = gameId; } }
1,368
0.592105
0.592105
75
17.24
14.871754
48
false
false
0
0
0
0
0
0
0.346667
false
false
12
2f6447b5c7e065e887820eecdde2c1452dce5bb5
23,003,844,881,984
64c2598afd9f6e2e6654df8800513abeaa6fde4b
/game-analysis/src/main/java/PlayerTimes.java
d22c7d2ee3565c533375cb50657b4d6279102e7d
[]
no_license
yanqin111/exercises
https://github.com/yanqin111/exercises
0d9a3688168acd0416748124a3bbba026271d6ee
98cfae3c8c5cbff02f74a6cbf78f7dc34137a0dc
refs/heads/master
2020-04-22T22:18:02.581000
2019-02-15T08:47:09
2019-02-15T08:47:09
170,703,133
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.Serializable; /** * 玩家游戏次数 * @author page */ public class PlayerTimes implements Serializable { /** * qqhao */ private String qqId; /** * 游戏id */ private String playerId; /** * 对局总次数 */ private Long count; public PlayerTimes() { this.count = 0L; this.qqId = ""; this.playerId = ""; } ; public PlayerTimes(String qqId, String playerId, Long count) { this.qqId = qqId; this.playerId = playerId; this.count = count; } public String getQqId() { return qqId; } public void setQqId(String qqId) { this.qqId = qqId; } public String getPlayerId() { return playerId; } public void setPlayerId(String playerId) { this.playerId = playerId; } public Long getCount() { return count; } public void setCount(Long count) { this.count = count; } }
UTF-8
Java
1,005
java
PlayerTimes.java
Java
[ { "context": "rt java.io.Serializable;\n\n/**\n * 玩家游戏次数\n * @author page\n */\npublic class PlayerTimes implements Serializa", "end": 59, "score": 0.9948990345001221, "start": 55, "tag": "USERNAME", "value": "page" } ]
null
[]
import java.io.Serializable; /** * 玩家游戏次数 * @author page */ public class PlayerTimes implements Serializable { /** * qqhao */ private String qqId; /** * 游戏id */ private String playerId; /** * 对局总次数 */ private Long count; public PlayerTimes() { this.count = 0L; this.qqId = ""; this.playerId = ""; } ; public PlayerTimes(String qqId, String playerId, Long count) { this.qqId = qqId; this.playerId = playerId; this.count = count; } public String getQqId() { return qqId; } public void setQqId(String qqId) { this.qqId = qqId; } public String getPlayerId() { return playerId; } public void setPlayerId(String playerId) { this.playerId = playerId; } public Long getCount() { return count; } public void setCount(Long count) { this.count = count; } }
1,005
0.537283
0.536261
60
15.316667
14.853161
66
false
false
0
0
0
0
0
0
0.316667
false
false
12
7f1faf0ee95d40d0d439d077e59850f07a55be67
34,995,393,572,898
ddb910c30f1c96ebc782851191a220eaa28ceb34
/src/lin/xidian/core/VideoReplyListener.java
85d0d6364c71ad553c8d938bc06c693482518429
[]
no_license
wuce7758/chat
https://github.com/wuce7758/chat
f16a099fc3418d4cd2a990d9e2bc05d3de5390cb
a16d5e64f318cfe4842b93f35181e5df7bc00a33
refs/heads/master
2021-01-18T20:31:27.296000
2014-06-30T14:19:40
2014-06-30T14:19:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lin.xidian.core; public interface VideoReplyListener { public void videoReplyEvent(long id,String state); }
UTF-8
Java
118
java
VideoReplyListener.java
Java
[]
null
[]
package lin.xidian.core; public interface VideoReplyListener { public void videoReplyEvent(long id,String state); }
118
0.805085
0.805085
6
18.666666
19.635569
51
false
false
0
0
0
0
0
0
0.666667
false
false
12
7361b704c3ee005d00d4ac9fedf0cdb298dd5959
31,619,549,301,330
89bac37e80efef6f1dcd859c9b7b154a010ef9b5
/src/main/java/edu/oca/java/se8/certification/practice/test/chapter4/_17.java
c7afa6b06ebc7889cb3e019d58624b9c69ff441f
[]
no_license
Fox-McCloud-MX/OCA-Java-SE8-Certification
https://github.com/Fox-McCloud-MX/OCA-Java-SE8-Certification
33ed3d116b3cb65fcf0b3c53ef052eeb24c4dad0
cf3e9698f7d98be7ca1d656c975acf31631191b8
refs/heads/master
2021-05-18T04:48:07.796000
2019-08-29T05:55:18
2019-08-29T05:55:18
251,108,010
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.oca.java.se8.certification.practice.test.chapter4; import java.util.Arrays; public class _17 { public static void main(String[] args) { String[] os = new String[]{"Mac", "Linux", "Windows"}; Arrays.sort(os); System.out.println("os: " + Arrays.asList(os)); System.out.println(Arrays.binarySearch(os, "Mac")); } }
UTF-8
Java
367
java
_17.java
Java
[]
null
[]
package edu.oca.java.se8.certification.practice.test.chapter4; import java.util.Arrays; public class _17 { public static void main(String[] args) { String[] os = new String[]{"Mac", "Linux", "Windows"}; Arrays.sort(os); System.out.println("os: " + Arrays.asList(os)); System.out.println(Arrays.binarySearch(os, "Mac")); } }
367
0.629428
0.618529
13
27.23077
24.795017
62
false
false
0
0
0
0
0
0
0.692308
false
false
12
50ad26846700aac1a1125bca5854a21001014ebd
38,740,605,050,477
1897f66b054472522dba7e459f62f2f68d04e2d1
/service/src/main/java/exception/UserServiceInvalidDataException.java
98e05f82debec22dc28a4fa72a918781ea643840
[]
no_license
egorozhmegov/RWS
https://github.com/egorozhmegov/RWS
af109467d6a4a85d0fb5900a6874d43eea2e66b3
7d7a0001ef611d39665e018c210e7f3a78772a10
refs/heads/master
2021-08-22T14:37:58.638000
2017-11-30T12:07:43
2017-11-30T12:07:43
104,366,113
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exception; public class UserServiceInvalidDataException extends ServiceException { public UserServiceInvalidDataException(String message) { super(message); } }
UTF-8
Java
185
java
UserServiceInvalidDataException.java
Java
[]
null
[]
package exception; public class UserServiceInvalidDataException extends ServiceException { public UserServiceInvalidDataException(String message) { super(message); } }
185
0.772973
0.772973
7
25.428572
26.70932
71
false
false
0
0
0
0
0
0
0.285714
false
false
12
95ece2a96a10c4136d9ac370b121b22e110a4a38
15,118,284,917,156
c02210607440a77c1392d9d4b0f29740a7b9cb79
/core/src/com/xipu/game/DialogBox.java
d22b04f7385e9b81c87455cf5b3e55959fa6caa1
[]
no_license
XiPu99/Shenshui
https://github.com/XiPu99/Shenshui
ec57a2988680f2d43b9f6e682e3efe1ad024f83f
33809b471e8afa7e372e4b78961926f12e24b04e
refs/heads/master
2021-07-16T14:26:32.565000
2020-07-04T18:22:06
2020-07-04T18:22:06
183,248,574
0
0
null
false
2019-05-18T03:35:48
2019-04-24T14:42:59
2019-05-18T00:13:04
2019-05-18T03:35:48
15,463
0
0
1
C++
false
false
package com.xipu.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.scenes.scene2d.*; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Align; import com.kyper.yarn.Dialogue; public class DialogBox extends Actor { private static final float TEXT_ANIMATION_FREQUENCY = 0.05f; private static final float DIALOG_BOX_WIDTH_PROPORTION = 0.7f; private static final int DEFAULT_FONT_SIZE = 20; private static final String DEFAULT_FONT_FILE_PATH = "Zpix.ttf"; private static final String EMPTY_STRING = ""; private Stack stack; private String currentDialogText; private StringBuilder displayedCharactersSoFar = new StringBuilder(); private Label dialogTextArea; private float stateTime; private int caretIndex = 0; private Dialogue dialogue; public DialogBox(Stage stage) { // load dialog DialogueData data = new DialogueData("test_dialog_box"); this.dialogue = new Dialogue(data); this.dialogue.loadFile("dialog.json"); // set up dialog box UI widget stack = new Stack(); stack.setWidth(DIALOG_BOX_WIDTH_PROPORTION * Gdx.graphics.getWidth()); Image bg = new Image(StageUtility.loadTextureFromPath("bg.png")); stack.add(bg); GUI.centerHorizontally(stack); // use table to organize the layout of the portrait and the dialog text area Table overlay = new Table(); // add character portrait Image image = new Image(StageUtility.loadTextureFromPath("portrait.png")); overlay.add(image).left().padLeft(30).width(100).height(100).center(); // add dialog text area Label.LabelStyle labelStyle = new Label.LabelStyle(generateBitMapFontFromCharacters(FreeTypeFontGenerator.DEFAULT_CHARS), Color.BLACK); dialogTextArea = new Label(EMPTY_STRING, labelStyle); dialogTextArea.setWrap(true); dialogTextArea.setAlignment(Align.topLeft); dialogTextArea.setDebug(true); overlay.add(dialogTextArea).expandX().left().top().fill().spaceLeft(40); stack.add(overlay); stack.setDebug(true); this.setDebug(true); this.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { updateDialogue(); return true; } }); // need to set bounds here so that the click listener can fire when there is mouse click within the bound this.setBounds(stack.getX(), stack.getY(), stack.getWidth(), stack.getHeight()); startDialog(); // start getting the first line from the dialogue } @Override public void act(float delta) { super.act(delta); stateTime += delta; if (stateTime > TEXT_ANIMATION_FREQUENCY) { stateTime = 0; displayOneMoreCharacterIfPossible(); } } private void startDialog(){ this.dialogue.start(); updateDialogue(); } private void resetDialogText() { dialogTextArea.setText(EMPTY_STRING); dialogTextArea.setStyle(new Label.LabelStyle(generateBitMapFontFromCharacters(currentDialogText), Color.BLACK)); caretIndex = 0; displayedCharactersSoFar.setLength(0); } private BitmapFont generateBitMapFontFromCharacters(String characters) { FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal(DEFAULT_FONT_FILE_PATH)); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); parameter.characters = characters; parameter.size = DEFAULT_FONT_SIZE; BitmapFont font = generator.generateFont(parameter); generator.dispose(); return font; } void updateDialogue() { if (!dialogue.isRunning()) { throw new RuntimeException("Still updating dialogue when it's already stopped"); } if (dialogue.isNextLine()) { Dialogue.LineResult lineResult = dialogue.getNextAsLine(); currentDialogText = lineResult.getText(); System.out.println(currentDialogText); resetDialogText(); } else if (dialogue.isNextCommand()) { System.out.println("Command!"); } else if (dialogue.isNextOptions()) { Dialogue.OptionResult optionResult = dialogue.getNextAsOptions(); optionResult.choose(0); } else if (dialogue.isNextComplete()) { Dialogue.NodeCompleteResult completeResult = dialogue.getNextAsComplete(); if (completeResult.next_node == null){ System.out.println("Dialog ends!"); dialogue.stop(); this.setVisible(false); } else{ updateDialogue(); } } else { throw new RuntimeException("Invalid dialogue's next content"); } } @Override public void draw(Batch batch, float parentAlpha) { // super.draw(batch, parentAlpha); // stack.setDebug(true, true); // stack.debugAll(); // overlay.setDebug(true); ShapeRenderer shapeRenderer = new ShapeRenderer(); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); // stack.drawDebug(shapeRenderer); // overlay.debugAll(); // overlay.drawDebug(shapeRenderer); // label.drawDebug(shapeRenderer); shapeRenderer.end(); stack.draw(batch, parentAlpha); } private boolean displayFinished() { return caretIndex >= currentDialogText.length(); } private void displayOneMoreCharacterIfPossible() { if (displayFinished()) { return; } displayedCharactersSoFar.append(currentDialogText.charAt(caretIndex++)); dialogTextArea.setText(displayedCharactersSoFar.toString()); } }
UTF-8
Java
6,369
java
DialogBox.java
Java
[]
null
[]
package com.xipu.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.scenes.scene2d.*; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.badlogic.gdx.utils.Align; import com.kyper.yarn.Dialogue; public class DialogBox extends Actor { private static final float TEXT_ANIMATION_FREQUENCY = 0.05f; private static final float DIALOG_BOX_WIDTH_PROPORTION = 0.7f; private static final int DEFAULT_FONT_SIZE = 20; private static final String DEFAULT_FONT_FILE_PATH = "Zpix.ttf"; private static final String EMPTY_STRING = ""; private Stack stack; private String currentDialogText; private StringBuilder displayedCharactersSoFar = new StringBuilder(); private Label dialogTextArea; private float stateTime; private int caretIndex = 0; private Dialogue dialogue; public DialogBox(Stage stage) { // load dialog DialogueData data = new DialogueData("test_dialog_box"); this.dialogue = new Dialogue(data); this.dialogue.loadFile("dialog.json"); // set up dialog box UI widget stack = new Stack(); stack.setWidth(DIALOG_BOX_WIDTH_PROPORTION * Gdx.graphics.getWidth()); Image bg = new Image(StageUtility.loadTextureFromPath("bg.png")); stack.add(bg); GUI.centerHorizontally(stack); // use table to organize the layout of the portrait and the dialog text area Table overlay = new Table(); // add character portrait Image image = new Image(StageUtility.loadTextureFromPath("portrait.png")); overlay.add(image).left().padLeft(30).width(100).height(100).center(); // add dialog text area Label.LabelStyle labelStyle = new Label.LabelStyle(generateBitMapFontFromCharacters(FreeTypeFontGenerator.DEFAULT_CHARS), Color.BLACK); dialogTextArea = new Label(EMPTY_STRING, labelStyle); dialogTextArea.setWrap(true); dialogTextArea.setAlignment(Align.topLeft); dialogTextArea.setDebug(true); overlay.add(dialogTextArea).expandX().left().top().fill().spaceLeft(40); stack.add(overlay); stack.setDebug(true); this.setDebug(true); this.addListener(new ClickListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { updateDialogue(); return true; } }); // need to set bounds here so that the click listener can fire when there is mouse click within the bound this.setBounds(stack.getX(), stack.getY(), stack.getWidth(), stack.getHeight()); startDialog(); // start getting the first line from the dialogue } @Override public void act(float delta) { super.act(delta); stateTime += delta; if (stateTime > TEXT_ANIMATION_FREQUENCY) { stateTime = 0; displayOneMoreCharacterIfPossible(); } } private void startDialog(){ this.dialogue.start(); updateDialogue(); } private void resetDialogText() { dialogTextArea.setText(EMPTY_STRING); dialogTextArea.setStyle(new Label.LabelStyle(generateBitMapFontFromCharacters(currentDialogText), Color.BLACK)); caretIndex = 0; displayedCharactersSoFar.setLength(0); } private BitmapFont generateBitMapFontFromCharacters(String characters) { FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal(DEFAULT_FONT_FILE_PATH)); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); parameter.characters = characters; parameter.size = DEFAULT_FONT_SIZE; BitmapFont font = generator.generateFont(parameter); generator.dispose(); return font; } void updateDialogue() { if (!dialogue.isRunning()) { throw new RuntimeException("Still updating dialogue when it's already stopped"); } if (dialogue.isNextLine()) { Dialogue.LineResult lineResult = dialogue.getNextAsLine(); currentDialogText = lineResult.getText(); System.out.println(currentDialogText); resetDialogText(); } else if (dialogue.isNextCommand()) { System.out.println("Command!"); } else if (dialogue.isNextOptions()) { Dialogue.OptionResult optionResult = dialogue.getNextAsOptions(); optionResult.choose(0); } else if (dialogue.isNextComplete()) { Dialogue.NodeCompleteResult completeResult = dialogue.getNextAsComplete(); if (completeResult.next_node == null){ System.out.println("Dialog ends!"); dialogue.stop(); this.setVisible(false); } else{ updateDialogue(); } } else { throw new RuntimeException("Invalid dialogue's next content"); } } @Override public void draw(Batch batch, float parentAlpha) { // super.draw(batch, parentAlpha); // stack.setDebug(true, true); // stack.debugAll(); // overlay.setDebug(true); ShapeRenderer shapeRenderer = new ShapeRenderer(); shapeRenderer.begin(ShapeRenderer.ShapeType.Line); // stack.drawDebug(shapeRenderer); // overlay.debugAll(); // overlay.drawDebug(shapeRenderer); // label.drawDebug(shapeRenderer); shapeRenderer.end(); stack.draw(batch, parentAlpha); } private boolean displayFinished() { return caretIndex >= currentDialogText.length(); } private void displayOneMoreCharacterIfPossible() { if (displayFinished()) { return; } displayedCharactersSoFar.append(currentDialogText.charAt(caretIndex++)); dialogTextArea.setText(displayedCharactersSoFar.toString()); } }
6,369
0.660386
0.655676
168
36.910713
28.097795
143
false
false
0
0
0
0
0
0
0.666667
false
false
12
599256951f61ab6417ac1dd04926cd66e19018b3
16,312,285,824,903
0a2cf537c95575f9241c97159bd6180ce01b849a
/DivecraftsBungee/src/main/java/io/clonalejandro/DivecraftsBungee/utils/TimeUtils.java
dfeb0eacb078b3cdba8ba9f10ebbefe362e07845
[]
no_license
Divecrafts/Divecrafts
https://github.com/Divecrafts/Divecrafts
59d93a4b3a4b33efaa33ed41ec72302dac836bd8
73d7350aa24015b5178f372f9f3b3ab9f44a0127
refs/heads/master
2022-11-19T17:05:54.321000
2020-07-22T17:30:02
2020-07-22T17:30:02
261,819,988
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.clonalejandro.DivecraftsBungee.utils; public class TimeUtils { public static int getTimeInMilliSeconds(int n, int data){ switch (data){ case 0: return n * 1000; case 1: return getTimeInMilliSeconds(n * 60, 0); case 2: return getTimeInMilliSeconds(n * 60, 1); case 3: return getTimeInMilliSeconds(n * 24, 2); case 4: return getTimeInMilliSeconds(n * 7, 3); case 5: return getTimeInMilliSeconds(n * 30, 4); //30 Días como media de mes case 6: return getTimeInMilliSeconds(n * 12, 5); default: return -1; } } public static int parseData(char time){ switch (time){ case 's': return 0; case 'm': return 1; case 'h': return 2; case 'd': return 3; case 'w': return 4; case 'o': return 5; case 'y': return 6; default: return 7; } } }
UTF-8
Java
1,237
java
TimeUtils.java
Java
[ { "context": "package io.clonalejandro.DivecraftsBungee.utils;\n\npublic class TimeUtils {", "end": 24, "score": 0.6189534068107605, "start": 11, "tag": "USERNAME", "value": "clonalejandro" } ]
null
[]
package io.clonalejandro.DivecraftsBungee.utils; public class TimeUtils { public static int getTimeInMilliSeconds(int n, int data){ switch (data){ case 0: return n * 1000; case 1: return getTimeInMilliSeconds(n * 60, 0); case 2: return getTimeInMilliSeconds(n * 60, 1); case 3: return getTimeInMilliSeconds(n * 24, 2); case 4: return getTimeInMilliSeconds(n * 7, 3); case 5: return getTimeInMilliSeconds(n * 30, 4); //30 Días como media de mes case 6: return getTimeInMilliSeconds(n * 12, 5); default: return -1; } } public static int parseData(char time){ switch (time){ case 's': return 0; case 'm': return 1; case 'h': return 2; case 'd': return 3; case 'w': return 4; case 'o': return 5; case 'y': return 6; default: return 7; } } }
1,237
0.424757
0.393204
46
25.869566
17.806458
84
false
false
0
0
0
0
0
0
0.521739
false
false
12
e82648fa6071995befc62c26adb919c9c6aae86e
2,078,764,173,170
60361911ee6c56e40d37f7003ae58dc509b6048c
/Repaso/src/excepciones/CancionNoValidaException.java
c9afcd99b6e2d6c0541dd458f197e49a2775bd4c
[]
no_license
albacj/Proyectos-de-Java
https://github.com/albacj/Proyectos-de-Java
ab8a7a26cb8f061341c0154eb46133c2d85c3f68
707ccf17320a0bb6655d07dbc72d6624fb8e7e8e
refs/heads/master
2021-10-07T23:47:08.307000
2018-12-05T18:40:12
2018-12-05T18:40:12
113,064,777
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package excepciones; public class CancionNoValidaException extends RuntimeException{ private static final long serialVersionUID = 1L; public CancionNoValidaException() { super(); } public CancionNoValidaException(String info) { super(info); } }
UTF-8
Java
262
java
CancionNoValidaException.java
Java
[]
null
[]
package excepciones; public class CancionNoValidaException extends RuntimeException{ private static final long serialVersionUID = 1L; public CancionNoValidaException() { super(); } public CancionNoValidaException(String info) { super(info); } }
262
0.763359
0.759542
15
16.466667
20.841839
63
false
false
0
0
0
0
0
0
1.066667
false
false
12
54f8de4c9377d99d647ac9573a0a803309f247df
6,408,091,259,232
962a7921ecd93c3c65894aeeb1310b344cf29cb8
/JavaProgramming/src/ch06/exam07/BoardExample.java
9e8d88465e3d7b2d669c20d34cbf85a6745b978a
[]
no_license
anobbb/MyRepository
https://github.com/anobbb/MyRepository
b37b6a39eb954d5a7ae1f89beacdb796b1ba0252
66abc2879f57b982a53ec4279998cb665939b5d5
refs/heads/master
2022-03-29T22:54:01.934000
2016-11-22T08:08:46
2016-11-22T08:08:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ch06.exam07; public class BoardExample { public static void main(String[] args) { Board b1 = new Board(3); Board b2 = new Board(1, "제목"); Board b3 = new Board("제목", 1); } }
UTF-8
Java
217
java
BoardExample.java
Java
[]
null
[]
package ch06.exam07; public class BoardExample { public static void main(String[] args) { Board b1 = new Board(3); Board b2 = new Board(1, "제목"); Board b3 = new Board("제목", 1); } }
217
0.583732
0.535885
13
14.076923
15.107113
41
false
false
0
0
0
0
0
0
1.230769
false
false
12
a4c957d30d51114ec20c4a4c8d42383d975c675e
18,313,740,592,723
79d1e482222e332fda24d716c0a845e48af40afe
/engine-dao/src/main/java/com/graduate/engine/mapper/ActMilestoneMapper.java
4002a65fdb281f220728c12ef40778c242d63bc0
[]
no_license
ChenjyJIM/workflow-engine
https://github.com/ChenjyJIM/workflow-engine
709645eda0e84a8a9067682a1b84425cf0e1a71d
9de5b6835572b85e1438a2f96160c85d3ca81f9f
refs/heads/master
2022-12-22T03:37:12.183000
2019-03-02T07:58:49
2019-03-02T07:58:49
171,108,914
0
0
null
false
2022-12-16T04:44:39
2019-02-17T10:30:06
2019-03-02T07:58:57
2022-12-16T04:44:37
985
0
0
2
Java
false
false
package com.graduate.engine.mapper; import com.graduate.engine.model.ActMilestone; import org.springframework.stereotype.Repository; @Repository public interface ActMilestoneMapper { int deleteByPrimaryKey(Integer milestoneId); int insert(ActMilestone record); int insertSelective(ActMilestone record); ActMilestone selectByPrimaryKey(Integer milestoneId); int updateByPrimaryKeySelective(ActMilestone record); int updateByPrimaryKey(ActMilestone record); }
UTF-8
Java
488
java
ActMilestoneMapper.java
Java
[]
null
[]
package com.graduate.engine.mapper; import com.graduate.engine.model.ActMilestone; import org.springframework.stereotype.Repository; @Repository public interface ActMilestoneMapper { int deleteByPrimaryKey(Integer milestoneId); int insert(ActMilestone record); int insertSelective(ActMilestone record); ActMilestone selectByPrimaryKey(Integer milestoneId); int updateByPrimaryKeySelective(ActMilestone record); int updateByPrimaryKey(ActMilestone record); }
488
0.807377
0.807377
19
24.736841
22.980179
57
false
false
0
0
0
0
0
0
0.473684
false
false
12
4f7d1ad5d5794951ceb0c9315f62747fac9c6f2a
781,684,110,756
25e7d0e68d47f76e806bd1fcf971a1ba913c1368
/src/main/java/restaurants/entities/Customer.java
71be1e8155309e87cfc6a20cac6d9b708da2dfcb
[]
no_license
BeneAlgirdas/PSK
https://github.com/BeneAlgirdas/PSK
a900c5bb99ed80aad8824e5b0cad71ac70aecdf1
ee4f8c02245f1305bb35c02644fbb951db4f6ae6
refs/heads/master
2023-04-28T16:59:49.958000
2021-05-19T12:39:30
2021-05-19T12:39:30
351,546,541
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package restaurants.entities; import javax.persistence.*; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.HashSet; import java.util.Objects; import java.util.Set; @Entity @NamedQueries({ @NamedQuery(name = "Customer.findAll", query = "select a from Customer as a") }) @Table(name = "CUSTOMER") public class Customer implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Size(max = 50) @Column(name = "NAME") private String name; public Customer() { } public Customer(String name) { this.name = name; } @ManyToMany(cascade = { CascadeType.ALL }) @JoinTable( name = "CUSTOMER_RESTAURANT", joinColumns = { @JoinColumn(name = "CUSTOMER_ID") }, inverseJoinColumns = { @JoinColumn(name = "RESTAURANT_ID") } ) Set<Restaurant> restaurants = new HashSet<>(); public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Customer customer = (Customer) o; return Objects.equals(id, customer.id) && Objects.equals(name, customer.name); } @Override public int hashCode() { return Objects.hash(id, name); } public Set<Restaurant> getRestaurants() { return restaurants; } public void setRestaurants(Set<Restaurant> restaurants) { this.restaurants = restaurants; } }
UTF-8
Java
1,790
java
Customer.java
Java
[]
null
[]
package restaurants.entities; import javax.persistence.*; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.HashSet; import java.util.Objects; import java.util.Set; @Entity @NamedQueries({ @NamedQuery(name = "Customer.findAll", query = "select a from Customer as a") }) @Table(name = "CUSTOMER") public class Customer implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Size(max = 50) @Column(name = "NAME") private String name; public Customer() { } public Customer(String name) { this.name = name; } @ManyToMany(cascade = { CascadeType.ALL }) @JoinTable( name = "CUSTOMER_RESTAURANT", joinColumns = { @JoinColumn(name = "CUSTOMER_ID") }, inverseJoinColumns = { @JoinColumn(name = "RESTAURANT_ID") } ) Set<Restaurant> restaurants = new HashSet<>(); public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Customer customer = (Customer) o; return Objects.equals(id, customer.id) && Objects.equals(name, customer.name); } @Override public int hashCode() { return Objects.hash(id, name); } public Set<Restaurant> getRestaurants() { return restaurants; } public void setRestaurants(Set<Restaurant> restaurants) { this.restaurants = restaurants; } }
1,790
0.611732
0.610615
76
22.552631
20.306465
85
false
false
0
0
0
0
0
0
0.394737
false
false
12
51c34ce88abccb47a3c113e2b41cc78746b97c24
22,900,765,687,413
bc9cf76a7c7eca580262b4e48e7901488e1dc03a
/IdeaProgrammist/Adapters_observer_MVC_lesson6/src/Magazines_and_Tanks/task5/TankGame/Tanks/Tiger.java
b41e98fbc76d9c41226df794092b74959443c5b4
[]
no_license
SergeyParfentiev/Lesson9_HomeWork_task2
https://github.com/SergeyParfentiev/Lesson9_HomeWork_task2
98f576220900b77057166641b44d77616db9d5a6
0159409d02aff531156ba6d09eede82dfaf810a3
HEAD
2016-08-12T12:58:49.354000
2016-03-04T20:25:26
2016-03-04T20:25:26
53,140,070
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Magazines_and_Tanks.task5.TankGame.Tanks; import Magazines_and_Tanks.task5.TankGame.ObjectsOnField.BattleField; import javax.imageio.ImageIO; import java.awt.*; import java.io.File; import java.io.IOException; /** * Created by Byblik272 on 18/11/2015. */ public class Tiger extends AbstractTank { private int armor; public Tiger(BattleField bf) { super(bf); tankColor = new Color(255, 0, 0); towerColor = new Color(0, 255, 0); armor = 1; setImage(); } public Tiger(BattleField bf, int x, int y, Direction direction) { super(bf, x, y, direction); tankColor = new Color(255, 0, 0); towerColor = new Color(0, 255, 0); armor = 1; setImage(); } private void setImage() { images = new Image[4]; try { images[0] = ImageIO.read(new File("Tiger_UP.png").getAbsoluteFile()); images[1] = ImageIO.read(new File("Tiger_DOWN.png").getAbsoluteFile()); images[2] = ImageIO.read(new File("Tiger_LEFT.png").getAbsoluteFile()); images[3] = ImageIO.read(new File("Tiger_RIGHT.png").getAbsoluteFile()); }catch (IOException e) { throw new IllegalStateException("Can`t find tank image"); } } @Override public void destroy() { if (armor > 0) { armor--; } else { super.destroy(); } } @Override public Action setUp() { return getAction(); } }
UTF-8
Java
1,518
java
Tiger.java
Java
[ { "context": "le;\nimport java.io.IOException;\n\n/**\n * Created by Byblik272 on 18/11/2015.\n */\n\npublic class Tiger extends Ab", "end": 249, "score": 0.999636709690094, "start": 240, "tag": "USERNAME", "value": "Byblik272" } ]
null
[]
package Magazines_and_Tanks.task5.TankGame.Tanks; import Magazines_and_Tanks.task5.TankGame.ObjectsOnField.BattleField; import javax.imageio.ImageIO; import java.awt.*; import java.io.File; import java.io.IOException; /** * Created by Byblik272 on 18/11/2015. */ public class Tiger extends AbstractTank { private int armor; public Tiger(BattleField bf) { super(bf); tankColor = new Color(255, 0, 0); towerColor = new Color(0, 255, 0); armor = 1; setImage(); } public Tiger(BattleField bf, int x, int y, Direction direction) { super(bf, x, y, direction); tankColor = new Color(255, 0, 0); towerColor = new Color(0, 255, 0); armor = 1; setImage(); } private void setImage() { images = new Image[4]; try { images[0] = ImageIO.read(new File("Tiger_UP.png").getAbsoluteFile()); images[1] = ImageIO.read(new File("Tiger_DOWN.png").getAbsoluteFile()); images[2] = ImageIO.read(new File("Tiger_LEFT.png").getAbsoluteFile()); images[3] = ImageIO.read(new File("Tiger_RIGHT.png").getAbsoluteFile()); }catch (IOException e) { throw new IllegalStateException("Can`t find tank image"); } } @Override public void destroy() { if (armor > 0) { armor--; } else { super.destroy(); } } @Override public Action setUp() { return getAction(); } }
1,518
0.577075
0.550066
60
24.299999
23.557943
84
false
false
0
0
0
0
0
0
0.666667
false
false
12
d298793d524b11a0aeaeae1bc4890850383aafbc
5,136,780,890,571
401835499b9fbaa56426d578a32da8b19ec02a8b
/server/src/main/java/com/microsoft/outlook/IConverterApplicationPreferences.java
5a186dd6419861cb292b9c65dfb6409b5ed6930f
[]
no_license
scottlogic-alex/reactivegame
https://github.com/scottlogic-alex/reactivegame
aadc3427ed2748272ffb9b5ee7c0571d054d5b62
0ff23fa2c005197b40236b022fd4d931621c30a7
refs/heads/master
2023-05-10T12:57:42.292000
2019-07-05T10:27:49
2019-07-05T10:27:49
178,168,530
0
1
null
false
2023-04-30T18:39:59
2019-03-28T09:19:05
2019-07-05T10:28:00
2023-04-30T18:39:55
6,273
0
0
11
Java
false
false
package com.microsoft.outlook; import com4j.Com4jObject; import com4j.IID; import com4j.VTID; @IID("{000C03D5-0000-0000-C000-000000000046}") public interface IConverterApplicationPreferences extends Com4jObject { // Methods: /** * @return Returns a value of type int */ @VTID(3) int hrGetLcid(); /** * @return Returns a value of type int */ @VTID(4) int hrGetHwnd(); /** * @return Returns a value of type java.lang.String */ @VTID(5) String hrGetApplication(); /** * @return Returns a value of type int */ @VTID(6) int hrCheckFormat(); // Properties: }
UTF-8
Java
623
java
IConverterApplicationPreferences.java
Java
[]
null
[]
package com.microsoft.outlook; import com4j.Com4jObject; import com4j.IID; import com4j.VTID; @IID("{000C03D5-0000-0000-C000-000000000046}") public interface IConverterApplicationPreferences extends Com4jObject { // Methods: /** * @return Returns a value of type int */ @VTID(3) int hrGetLcid(); /** * @return Returns a value of type int */ @VTID(4) int hrGetHwnd(); /** * @return Returns a value of type java.lang.String */ @VTID(5) String hrGetApplication(); /** * @return Returns a value of type int */ @VTID(6) int hrCheckFormat(); // Properties: }
623
0.640449
0.579454
43
13.488372
16.962849
71
false
false
0
0
0
0
0
0
0.186047
false
false
12
36b9ba2553c471efa6204c0725547cc08252fb2d
13,950,053,778,927
a75a4027e72821e8d18c2fa123bae5c2a481c205
/app/src/main/java/com/pixaura/model/Location.java
8c55c6abdbf2210b720d8f62a266a768bb0df540
[]
no_license
e7mac/jamsnap-android
https://github.com/e7mac/jamsnap-android
e417f931ba000878fa090c65fd1e327747d835a5
c6e259dd7099e338cf197edc6d8eeb157b617c97
refs/heads/master
2016-09-10T13:58:56.766000
2014-05-27T00:20:48
2014-05-27T00:20:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pixaura.model; import java.util.ArrayList; public class Location { public int id; public float latitude; public float longitude; public String locality; public String city; @Override public int hashCode() { return id; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Location other = (Location) obj; return id == other.id; } @SuppressWarnings("serial") public static class List extends ArrayList<Location> { } }
UTF-8
Java
714
java
Location.java
Java
[]
null
[]
package com.pixaura.model; import java.util.ArrayList; public class Location { public int id; public float latitude; public float longitude; public String locality; public String city; @Override public int hashCode() { return id; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Location other = (Location) obj; return id == other.id; } @SuppressWarnings("serial") public static class List extends ArrayList<Location> { } }
714
0.554622
0.554622
36
18.833334
14.176467
58
false
false
0
0
0
0
0
0
0.361111
false
false
12
2623abda39ded67b97d975a3fb2ab06d5ada32b0
26,766,236,200,793
e17e29d0701368c8936264463085515a7ec459ce
/src/animalgames/abstractfactory/FactoryProducer.java
9a3903886033c50ee2b0bc862d435c22b88d25a7
[]
no_license
ShaRuichen/animalgames
https://github.com/ShaRuichen/animalgames
cf064f1274515ec72759627eddc61ad160016572
84d7c2ca2aaa89089913d098a49b4ffe87bbb763
refs/heads/master
2023-01-21T06:23:31.982000
2020-11-28T13:59:44
2020-11-28T13:59:44
312,751,946
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package animalgames.abstractfactory; public class FactoryProducer { // 选择对应工厂来完成创建 public static AbstractFactory getFactory(String choice) { if (choice.equalsIgnoreCase("ANIMAL")) { return new AnimalFactory(); } else if (choice.equalsIgnoreCase("FM")) { return new FmFactory(); } return null; } }
UTF-8
Java
353
java
FactoryProducer.java
Java
[]
null
[]
package animalgames.abstractfactory; public class FactoryProducer { // 选择对应工厂来完成创建 public static AbstractFactory getFactory(String choice) { if (choice.equalsIgnoreCase("ANIMAL")) { return new AnimalFactory(); } else if (choice.equalsIgnoreCase("FM")) { return new FmFactory(); } return null; } }
353
0.691843
0.691843
13
24.538462
18.545641
59
false
false
0
0
0
0
0
0
0.307692
false
false
12
5866fc7f610ef335bfdd7887502c9c5bb744932d
22,050,362,100,154
392e1747a54d1edcfc934dab031c7a14a1822944
/iflow/backend/src/main/java/com/pth/iflow/backend/BackendApp.java
ef8a7cf7b4e14a8f91a573f7b5a6ac88584d174e
[]
no_license
hamidrezaseifi/iflow-java
https://github.com/hamidrezaseifi/iflow-java
dcd745251502d42890d95c55a4af1d86f0019d19
2bfb61f0b22f9768769b320a85c79d661c02a3d6
refs/heads/develop
2023-01-10T10:42:57.228000
2020-03-04T13:44:42
2020-03-04T13:44:42
190,767,957
0
0
null
false
2023-01-07T13:09:42
2019-06-07T15:33:59
2020-03-04T13:44:46
2023-01-07T13:09:41
181,120
0
0
32
JavaScript
false
false
package com.pth.iflow.backend; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import com.pth.iflow.common.rest.XmlRestConfig; @SpringBootApplication public class BackendApp implements ApplicationListener<ApplicationReadyEvent> { private static final Logger logger = LoggerFactory.getLogger(BackendApp.class); @Configuration @Import(XmlRestConfig.class) static class Config { } public static void main(final String[] args) { BackendApp.logger.info("Starting iFlow Backend application..."); final SpringApplication springApplication = new SpringApplication(BackendApp.class); springApplication.run(args); } @Override public void onApplicationEvent(final ApplicationReadyEvent event) { } }
UTF-8
Java
1,127
java
BackendApp.java
Java
[]
null
[]
package com.pth.iflow.backend; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import com.pth.iflow.common.rest.XmlRestConfig; @SpringBootApplication public class BackendApp implements ApplicationListener<ApplicationReadyEvent> { private static final Logger logger = LoggerFactory.getLogger(BackendApp.class); @Configuration @Import(XmlRestConfig.class) static class Config { } public static void main(final String[] args) { BackendApp.logger.info("Starting iFlow Backend application..."); final SpringApplication springApplication = new SpringApplication(BackendApp.class); springApplication.run(args); } @Override public void onApplicationEvent(final ApplicationReadyEvent event) { } }
1,127
0.794144
0.792369
38
28.657894
28.228649
88
false
false
0
0
0
0
0
0
0.368421
false
false
12
2c5945aa9573e3698ad984288da3254d865770f7
25,718,264,169,963
07d8035be107669b512d0a884a438a3f2e89ca76
/final-example/final-example-web/src/main/java/org/ifinal/finalframework/example/FinalApplication.java
c886a5a8c5aa8b7f3b0e0393aad7df3653cd8469
[ "Apache-2.0" ]
permissive
liniukesi/final-frameworks
https://github.com/liniukesi/final-frameworks
71f239e3708ebf05e02ac0e376a1c70a3a73b906
22a6d45ecab565403f691b36de9e02cbffff5bcb
refs/heads/master
2023-02-19T02:17:53.532000
2021-01-15T13:37:02
2021-01-15T13:37:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.ifinal.finalframework.example; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.ApplicationListener; import org.springframework.context.event.EventListener; /** * @author likly * @version 1.0.0 * @since 1.0.0 */ @Slf4j @SpringBootApplication public class FinalApplication extends SpringBootServletInitializer { public static void main(final String[] args) { SpringApplication application = new SpringApplication(FinalApplication.class); application.addListeners(new ApplicationListener<ApplicationReadyEvent>() { @Override public void onApplicationEvent(final ApplicationReadyEvent event) { logger.info("onReady from ApplicationListener"); } }); application.run(args); } @EventListener public void onReady(final ApplicationReadyEvent readyEvent) { logger.info("onReady from @EventListener"); } @Override protected SpringApplicationBuilder configure(final SpringApplicationBuilder builder) { return builder.sources(FinalApplication.class); } }
UTF-8
Java
1,458
java
FinalApplication.java
Java
[ { "context": "ework.context.event.EventListener;\n\n/**\n * @author likly\n * @version 1.0.0\n * @since 1.0.0\n */\n@Slf4j\n@Spr", "end": 548, "score": 0.9995501041412354, "start": 543, "tag": "USERNAME", "value": "likly" } ]
null
[]
package org.ifinal.finalframework.example; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.ApplicationListener; import org.springframework.context.event.EventListener; /** * @author likly * @version 1.0.0 * @since 1.0.0 */ @Slf4j @SpringBootApplication public class FinalApplication extends SpringBootServletInitializer { public static void main(final String[] args) { SpringApplication application = new SpringApplication(FinalApplication.class); application.addListeners(new ApplicationListener<ApplicationReadyEvent>() { @Override public void onApplicationEvent(final ApplicationReadyEvent event) { logger.info("onReady from ApplicationListener"); } }); application.run(args); } @EventListener public void onReady(final ApplicationReadyEvent readyEvent) { logger.info("onReady from @EventListener"); } @Override protected SpringApplicationBuilder configure(final SpringApplicationBuilder builder) { return builder.sources(FinalApplication.class); } }
1,458
0.756516
0.750343
46
30.695652
29.963652
90
false
false
0
0
0
0
0
0
0.326087
false
false
12
a1ebab6b9d6adeb3683e2600e177f04b6bb8af95
17,755,394,806,275
c7b6ebf8b062ced913962c83ab55b06aaba74361
/src/main/java/cn/com/crazyit/web/controller/view/ViewPriceController.java
04c26c378984369890b78d09d10da170906dcdbb
[]
no_license
CrazyApes/jumao
https://github.com/CrazyApes/jumao
72fff7e44773b44bdd933f9ca08f5582fb640fbb
605baaea848848462ecc88db342814dc4615076b
refs/heads/master
2021-01-20T08:27:28.954000
2017-08-24T14:49:55
2017-08-24T14:49:55
90,148,952
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.crazyit.web.controller.view; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; /** * @author Zack * Created on 2017/6/10. */ @Controller @RequestMapping(value = ViewPriceController.URL_MAPPING, produces = "text/html;charset=utf-8") public class ViewPriceController { protected static final String URL_MAPPING = "/prices"; private final Logger LOG = LoggerFactory.getLogger(ViewMenuController.class); @GetMapping(value = "/page") public String menuPage() { return "/view/price/price_page"; } }
UTF-8
Java
731
java
ViewPriceController.java
Java
[ { "context": "eb.bind.annotation.RequestMapping;\n\n/**\n * @author Zack\n * Created on 2017/6/10.\n */\n@Controll", "end": 291, "score": 0.9113634824752808, "start": 290, "tag": "NAME", "value": "Z" }, { "context": ".bind.annotation.RequestMapping;\n\n/**\n * @author Zack\n * Created on 2017/6/10.\n */\n@Controller\n", "end": 294, "score": 0.7334355711936951, "start": 291, "tag": "USERNAME", "value": "ack" } ]
null
[]
package cn.com.crazyit.web.controller.view; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; /** * @author Zack * Created on 2017/6/10. */ @Controller @RequestMapping(value = ViewPriceController.URL_MAPPING, produces = "text/html;charset=utf-8") public class ViewPriceController { protected static final String URL_MAPPING = "/prices"; private final Logger LOG = LoggerFactory.getLogger(ViewMenuController.class); @GetMapping(value = "/page") public String menuPage() { return "/view/price/price_page"; } }
731
0.745554
0.731874
25
28.24
26.767563
94
false
false
0
0
0
0
0
0
0.44
false
false
12
b616c7c59ab961f06bf8956f846e838eabd21d8f
19,954,418,060,311
2183a59b70f6e3e92d0b145484c16898dfe15366
/QuakeListAdapter.java
d651922b72acb8e497a15707767656ba7ab88ddb
[]
no_license
GusWng/WhatAmI
https://github.com/GusWng/WhatAmI
07bdd50368a73934732f24ea959a397993344e6d
963991546cfe16c833c270c28fb55025674b35c7
refs/heads/master
2021-01-24T12:30:40.126000
2018-05-15T07:38:29
2018-05-15T07:38:29
82,483,362
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.guswng.quakeport; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class QuakeListAdapter extends ArrayAdapter<QuakeClass> { public QuakeListAdapter(MainActivity context, ArrayList<QuakeClass> earthquakes){ super(context,0, earthquakes); } @Override public View getView(int position, View convertView, ViewGroup parent) { View listItemView = convertView; if(listItemView == null){ listItemView = LayoutInflater.from(getContext()).inflate( R.layout.list_item, parent, false ); } /** * currentQuakeItem is the current item from the list */ QuakeClass currentQuakeItem = getItem(position); /** * setting the Text inside of each list item */ //Magnitude TextView magnitude = (TextView) listItemView.findViewById(R.id.magId); magnitude.setText(String.valueOf(currentQuakeItem.getmMag())); //Location TextView location = (TextView) listItemView.findViewById(R.id.locId); location.setText(currentQuakeItem.getmLocation()); //Date and Time Date dateObject = new Date(currentQuakeItem.getmTimeInMilliseconds()); TextView dateView = listItemView.findViewById(R.id.dateId); TextView timeView = listItemView.findViewById(R.id.timeId); String formattedDate = formatDate(dateObject); String formattedTime = formatTime(dateObject); dateView.setText(formattedDate); timeView.setText(formattedTime); return listItemView; } private String formatDate(Date dateObject){ SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM, yyyy"); return dateFormat.format(dateObject); } private String formatTime(Date dateObject){ SimpleDateFormat timeFormat = new SimpleDateFormat("h: mm a"); return timeFormat.format(dateObject); } }
UTF-8
Java
2,203
java
QuakeListAdapter.java
Java
[]
null
[]
package com.example.guswng.quakeport; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class QuakeListAdapter extends ArrayAdapter<QuakeClass> { public QuakeListAdapter(MainActivity context, ArrayList<QuakeClass> earthquakes){ super(context,0, earthquakes); } @Override public View getView(int position, View convertView, ViewGroup parent) { View listItemView = convertView; if(listItemView == null){ listItemView = LayoutInflater.from(getContext()).inflate( R.layout.list_item, parent, false ); } /** * currentQuakeItem is the current item from the list */ QuakeClass currentQuakeItem = getItem(position); /** * setting the Text inside of each list item */ //Magnitude TextView magnitude = (TextView) listItemView.findViewById(R.id.magId); magnitude.setText(String.valueOf(currentQuakeItem.getmMag())); //Location TextView location = (TextView) listItemView.findViewById(R.id.locId); location.setText(currentQuakeItem.getmLocation()); //Date and Time Date dateObject = new Date(currentQuakeItem.getmTimeInMilliseconds()); TextView dateView = listItemView.findViewById(R.id.dateId); TextView timeView = listItemView.findViewById(R.id.timeId); String formattedDate = formatDate(dateObject); String formattedTime = formatTime(dateObject); dateView.setText(formattedDate); timeView.setText(formattedTime); return listItemView; } private String formatDate(Date dateObject){ SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM, yyyy"); return dateFormat.format(dateObject); } private String formatTime(Date dateObject){ SimpleDateFormat timeFormat = new SimpleDateFormat("h: mm a"); return timeFormat.format(dateObject); } }
2,203
0.679982
0.679528
72
29.597221
26.57205
85
false
false
0
0
0
0
0
0
0.527778
false
false
12
195e545667b39f901c224d429d87d944a276f567
28,054,726,393,842
0fb51038e0cd45fe19d4b689b280b7641ba3d954
/Bucky/JavaTutorials - GameDevelopment/src/de/leicheronline/java/bucky/gamedevelopment/tutorial13/Flori.java
46841012c4dbaf0fc714f6e7f93c56e95339bc43
[]
no_license
digitalpanic/javauebungen
https://github.com/digitalpanic/javauebungen
15294de444900fdd5171bb81cb53c98beca35c1b
2331e0c83d3494a513a5ac21643dc080873e18cb
refs/heads/master
2021-01-25T05:58:09.856000
2019-03-24T13:04:10
2019-03-24T13:04:10
32,381,936
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.leicheronline.java.bucky.gamedevelopment.tutorial13; import java.awt.*; import javax.swing.ImageIcon; import javax.swing.JFrame; public class Flori extends JFrame { public static void main(String[] args) { DisplayMode dm = new DisplayMode(800, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN); Flori f = new Flori(); f.run(dm); } private Screen screen; private Image bg; private Animation a; /** * Loads Pictures from Computer to Java and adds Scenes * */ public void loadPics() { bg = new ImageIcon("C:\\DEV\\Java\\Spielewiese\\TEMP\\back.jpg") .getImage(); Image face1 = new ImageIcon( "C:\\DEV\\Java\\Spielewiese\\TEMP\\face.png").getImage(); Image face2 = new ImageIcon( "C:\\DEV\\Java\\Spielewiese\\TEMP\\face2.png").getImage(); a = new Animation(); a.addScene(face1, 250); a.addScene(face2, 250); } /** * Run Methode * * Sets the Monitor to Fullscreen, Loads the pics, Starts the Movie * * @param dm */ public void run(DisplayMode dm) { screen = new Screen(); try { screen.setFullScreen(dm, new JFrame()); loadPics(); movieLoop(); } finally { screen.restoreScreen(); } } /** * Movie Loop * */ public void movieLoop() { long startingTime = System.currentTimeMillis(); long cumTime = startingTime; while (cumTime - startingTime < 5000) { long timePassed = System.currentTimeMillis() - cumTime; cumTime += timePassed; a.update(timePassed); Graphics g = screen.getFullScreenWindow().getGraphics(); draw(g); g.dispose(); try { Thread.sleep(20); } catch (Exception ex) { } } } /** * Draw Method * * @param g */ public void draw(Graphics g) { g.drawImage(bg, 0, 0, null); g.drawImage(a.getImage(), 0, 0, null); } }
UTF-8
Java
1,880
java
Flori.java
Java
[]
null
[]
package de.leicheronline.java.bucky.gamedevelopment.tutorial13; import java.awt.*; import javax.swing.ImageIcon; import javax.swing.JFrame; public class Flori extends JFrame { public static void main(String[] args) { DisplayMode dm = new DisplayMode(800, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN); Flori f = new Flori(); f.run(dm); } private Screen screen; private Image bg; private Animation a; /** * Loads Pictures from Computer to Java and adds Scenes * */ public void loadPics() { bg = new ImageIcon("C:\\DEV\\Java\\Spielewiese\\TEMP\\back.jpg") .getImage(); Image face1 = new ImageIcon( "C:\\DEV\\Java\\Spielewiese\\TEMP\\face.png").getImage(); Image face2 = new ImageIcon( "C:\\DEV\\Java\\Spielewiese\\TEMP\\face2.png").getImage(); a = new Animation(); a.addScene(face1, 250); a.addScene(face2, 250); } /** * Run Methode * * Sets the Monitor to Fullscreen, Loads the pics, Starts the Movie * * @param dm */ public void run(DisplayMode dm) { screen = new Screen(); try { screen.setFullScreen(dm, new JFrame()); loadPics(); movieLoop(); } finally { screen.restoreScreen(); } } /** * Movie Loop * */ public void movieLoop() { long startingTime = System.currentTimeMillis(); long cumTime = startingTime; while (cumTime - startingTime < 5000) { long timePassed = System.currentTimeMillis() - cumTime; cumTime += timePassed; a.update(timePassed); Graphics g = screen.getFullScreenWindow().getGraphics(); draw(g); g.dispose(); try { Thread.sleep(20); } catch (Exception ex) { } } } /** * Draw Method * * @param g */ public void draw(Graphics g) { g.drawImage(bg, 0, 0, null); g.drawImage(a.getImage(), 0, 0, null); } }
1,880
0.609043
0.592553
93
18.215054
18.692675
68
false
false
0
0
0
0
0
0
1.892473
false
false
12
ae8240356275a33ecca2db679c2bcaf763b71dad
30,339,648,996,966
5160696672521c8a37dff9c0729d4095424f6bc5
/domainEntity/src/main/java/com/loylty/application/entity/bo/tenant/Rule.java
387621453a5a1cf238c7da64e5a129eca9acd1a1
[]
no_license
GrandViewTech/tms
https://github.com/GrandViewTech/tms
b5bf0f8592d31f2430f12b5ca3b055585f511252
8559e359bc37b0a4dadc867ed15c4f1767fae1f8
refs/heads/master
2021-01-10T22:34:18.223000
2016-10-14T10:17:50
2016-10-14T10:17:50
69,578,115
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.loylty.application.entity.bo.tenant; import javax.persistence.Entity; import com.loylty.application.entity.bo.base.BaseMetadata; import com.loylty.application.entity.bo.constants.RuleType; import com.loylty.application.entity.bo.constants.Status; import com.mysql.cj.jdbc.Blob; @Entity public class Rule extends BaseMetadata { private static final long serialVersionUID = -6932424634101212950L; private String ruleName; private RuleType ruleType; private Blob blob; private Status status; public String getRuleName() { return ruleName; } public void setRuleName(String ruleName) { this.ruleName = ruleName; } public RuleType getRuleType() { return ruleType; } public void setRuleType(RuleType ruleType) { this.ruleType = ruleType; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public Blob getBlob() { return blob; } public void setBlob(Blob blob) { this.blob = blob; } @Override public String toString() { return "Rule [ruleName=" + ruleName + ", ruleType=" + ruleType + ", status=" + status + "]"; } }
UTF-8
Java
1,266
java
Rule.java
Java
[]
null
[]
package com.loylty.application.entity.bo.tenant; import javax.persistence.Entity; import com.loylty.application.entity.bo.base.BaseMetadata; import com.loylty.application.entity.bo.constants.RuleType; import com.loylty.application.entity.bo.constants.Status; import com.mysql.cj.jdbc.Blob; @Entity public class Rule extends BaseMetadata { private static final long serialVersionUID = -6932424634101212950L; private String ruleName; private RuleType ruleType; private Blob blob; private Status status; public String getRuleName() { return ruleName; } public void setRuleName(String ruleName) { this.ruleName = ruleName; } public RuleType getRuleType() { return ruleType; } public void setRuleType(RuleType ruleType) { this.ruleType = ruleType; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public Blob getBlob() { return blob; } public void setBlob(Blob blob) { this.blob = blob; } @Override public String toString() { return "Rule [ruleName=" + ruleName + ", ruleType=" + ruleType + ", status=" + status + "]"; } }
1,266
0.657978
0.64297
69
17.347826
19.625351
96
false
false
0
0
0
0
0
0
2.869565
false
false
12
7d0f47571454713d3edd41f088b93bdaef13cfbd
23,545,010,729,549
75adc9298f3c1b26b4d3985e7e94793759f3c6eb
/SawatAndroidClient/src/com/shami/devel/SawatAndroidClientActivity.java
336c68840541f07375a5bd5342950f2a6598d608
[]
no_license
h4ckroot/AndroidProjects
https://github.com/h4ckroot/AndroidProjects
c1dc0b734e778618458509cf556d9052c2e606bd
edefdb25ee546d75ef112425afd9027bcf7e7b86
refs/heads/master
2020-05-27T04:36:00.965000
2012-05-11T21:28:03
2012-05-11T21:28:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shami.devel; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioButton; import android.widget.Toast; import com.shami.devel.R.id; public class SawatAndroidClientActivity extends Activity { /** Called when the activity is first created. */ private String voted_for = ""; private String Device_UUID = ""; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Getting the UUID of the Device. DeviceUuidFactory uuidInstance = new DeviceUuidFactory(getApplicationContext()); Device_UUID = uuidInstance.getDeviceUuid().toString(); Button Vote = (Button) findViewById(id.Btn_Vote); Vote.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO get the UUID of the Device // TODO Set a new Record for this UUID in the Database along with the // TODO Selection // TODO increment number of voters for the selected Voter by one // Showing a Toast of the selected Candidate Context context = getApplicationContext(); CharSequence text = "You have voted for " + "\n" + voted_for + "\n" + "Your UUDI is " + " " + Device_UUID; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); final RadioButton candidate_1 = (RadioButton) findViewById(id.RB_candidate_1); final RadioButton candidate_2 = (RadioButton) findViewById(id.RB_candidate_2); final RadioButton candidate_3 = (RadioButton) findViewById(id.RB_candidate_3); final RadioButton candidate_4 = (RadioButton) findViewById(id.RB_candidate_4); final RadioButton candidate_5 = (RadioButton) findViewById(id.RB_candidate_5); final RadioButton candidate_6 = (RadioButton) findViewById(id.RB_candidate_6); final RadioButton candidate_7 = (RadioButton) findViewById(id.RB_candidate_7); final RadioButton candidate_8 = (RadioButton) findViewById(id.RB_candidate_8); final RadioButton candidate_9 = (RadioButton) findViewById(id.RB_candidate_9); final RadioButton candidate_10 = (RadioButton) findViewById(id.RB_candidate_10); final RadioButton candidate_11 = (RadioButton) findViewById(id.RB_candidate_11); final RadioButton candidate_12 = (RadioButton) findViewById(id.RB_candidate_12); final RadioButton candidate_13 = (RadioButton) findViewById(id.RB_candidate_13); candidate_1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_1_txt); } }); candidate_2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_1.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_2_txt); } }); candidate_3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_1.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_3_txt); } }); candidate_4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_1.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_4_txt); } }); candidate_5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_5_txt); } }); candidate_6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_1.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_6_txt); } }); candidate_7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_5.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_7_txt); } }); candidate_8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_5.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_8_txt); } }); candidate_9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_5.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_9_txt); } }); candidate_10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_5.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_10_txt); } }); candidate_11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_5.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_11_txt); } }); candidate_12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_5.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_12_txt); } }); candidate_13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_5.setChecked(false); voted_for = getString(R.string.candidate_13_txt); } }); } }
UTF-8
Java
10,793
java
SawatAndroidClientActivity.java
Java
[]
null
[]
package com.shami.devel; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioButton; import android.widget.Toast; import com.shami.devel.R.id; public class SawatAndroidClientActivity extends Activity { /** Called when the activity is first created. */ private String voted_for = ""; private String Device_UUID = ""; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Getting the UUID of the Device. DeviceUuidFactory uuidInstance = new DeviceUuidFactory(getApplicationContext()); Device_UUID = uuidInstance.getDeviceUuid().toString(); Button Vote = (Button) findViewById(id.Btn_Vote); Vote.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO get the UUID of the Device // TODO Set a new Record for this UUID in the Database along with the // TODO Selection // TODO increment number of voters for the selected Voter by one // Showing a Toast of the selected Candidate Context context = getApplicationContext(); CharSequence text = "You have voted for " + "\n" + voted_for + "\n" + "Your UUDI is " + " " + Device_UUID; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); final RadioButton candidate_1 = (RadioButton) findViewById(id.RB_candidate_1); final RadioButton candidate_2 = (RadioButton) findViewById(id.RB_candidate_2); final RadioButton candidate_3 = (RadioButton) findViewById(id.RB_candidate_3); final RadioButton candidate_4 = (RadioButton) findViewById(id.RB_candidate_4); final RadioButton candidate_5 = (RadioButton) findViewById(id.RB_candidate_5); final RadioButton candidate_6 = (RadioButton) findViewById(id.RB_candidate_6); final RadioButton candidate_7 = (RadioButton) findViewById(id.RB_candidate_7); final RadioButton candidate_8 = (RadioButton) findViewById(id.RB_candidate_8); final RadioButton candidate_9 = (RadioButton) findViewById(id.RB_candidate_9); final RadioButton candidate_10 = (RadioButton) findViewById(id.RB_candidate_10); final RadioButton candidate_11 = (RadioButton) findViewById(id.RB_candidate_11); final RadioButton candidate_12 = (RadioButton) findViewById(id.RB_candidate_12); final RadioButton candidate_13 = (RadioButton) findViewById(id.RB_candidate_13); candidate_1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_1_txt); } }); candidate_2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_1.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_2_txt); } }); candidate_3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_1.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_3_txt); } }); candidate_4.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_1.setChecked(false); candidate_5.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_4_txt); } }); candidate_5.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_5_txt); } }); candidate_6.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_5.setChecked(false); candidate_1.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_6_txt); } }); candidate_7.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_5.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_7_txt); } }); candidate_8.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_5.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_8_txt); } }); candidate_9.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_5.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_9_txt); } }); candidate_10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_5.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_10_txt); } }); candidate_11.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_5.setChecked(false); candidate_12.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_11_txt); } }); candidate_12.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_5.setChecked(false); candidate_13.setChecked(false); voted_for = getString(R.string.candidate_12_txt); } }); candidate_13.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub candidate_2.setChecked(false); candidate_3.setChecked(false); candidate_4.setChecked(false); candidate_1.setChecked(false); candidate_6.setChecked(false); candidate_7.setChecked(false); candidate_8.setChecked(false); candidate_9.setChecked(false); candidate_10.setChecked(false); candidate_11.setChecked(false); candidate_12.setChecked(false); candidate_5.setChecked(false); voted_for = getString(R.string.candidate_13_txt); } }); } }
10,793
0.712128
0.686927
333
31.414415
18.846848
82
false
false
0
0
0
0
0
0
3.723724
false
false
12
864201a770018608e2da60f5cbe3747d286dff7e
386,547,125,072
92ac123262f4d14e8800773ab1502d9a46986aab
/src/main/java/Runner/runnerClass.java
e34a8b87afcd0d9811a25a974792f27fcb9fe468
[]
no_license
romy8813/SeleniumWithCucumber
https://github.com/romy8813/SeleniumWithCucumber
01a67f9ab57819846e2a3c85b07393c939dbc529
c2f79cc789f55cb9f28ebed86de491d8c9aa33ce
refs/heads/master
2020-05-15T12:43:06.982000
2019-05-08T04:45:49
2019-05-08T04:45:49
182,274,856
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Runner; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features="/Users/rajeshsharma/Documents/workspace-sts-3.9.0.RELEASE/SeleniumWithCucumber/src/main/java/Features", glue={"step.definition"}, monochrome = true, //makes console output more readable //tags --- tells what tags to be executed plugin = {"pretty","html:target/report","json:target/cucumber.json"}, dryRun = false, strict = true) //any undefined steps are failed public class runnerClass { } //runner class
UTF-8
Java
699
java
runnerClass.java
Java
[ { "context": "mber.class)\t\t\t\t\n@CucumberOptions(features=\"/Users/rajeshsharma/Documents/workspace-sts-3.9.0.RELEASE/SeleniumWit", "end": 205, "score": 0.9979642629623413, "start": 193, "tag": "USERNAME", "value": "rajeshsharma" } ]
null
[]
package Runner; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features="/Users/rajeshsharma/Documents/workspace-sts-3.9.0.RELEASE/SeleniumWithCucumber/src/main/java/Features", glue={"step.definition"}, monochrome = true, //makes console output more readable //tags --- tells what tags to be executed plugin = {"pretty","html:target/report","json:target/cucumber.json"}, dryRun = false, strict = true) //any undefined steps are failed public class runnerClass { } //runner class
699
0.648069
0.643777
20
34
33.618446
130
false
false
0
0
0
0
0
0
1.1
false
false
12
edf12eb51ec81534ae11694853c3a27edaa5af6b
13,176,959,669,288
8f8bbd8d4890bce7b75e90c8933a115179f6607d
/src/main/java/com/dotuian/springmvc/dao/BaseDao.java
cc392eeaa026bda1a97b2b019f238623a4699157
[]
no_license
dotuian/MavenSpringMVC
https://github.com/dotuian/MavenSpringMVC
e0c78e5af9045b601a8e5fe8e8ef429d1ad65581
a4ef24ffdb30b6df02c879de19b68ba790d34eea
refs/heads/master
2016-09-05T12:41:25.306000
2015-08-19T05:34:00
2015-08-19T05:34:00
39,171,444
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dotuian.springmvc.dao; public interface BaseDao { }
UTF-8
Java
71
java
BaseDao.java
Java
[]
null
[]
package com.dotuian.springmvc.dao; public interface BaseDao { }
71
0.71831
0.71831
5
12.2
14.756694
34
false
false
0
0
0
0
0
0
0.2
false
false
12
7a3cc0498b281c6d6e27e552d02d6f1968bb235d
7,258,494,744,609
c9497fc0fd48ef307d14ed47c63447ddd520645f
/LuxorMC Core/src/main/java/com/faithfulmc/hardcorefactions/kit/argument/KitSetImageArgument.java
6f2643e57bb705e2789114d5ea23569c24ec033c
[ "Apache-2.0" ]
permissive
Tominous/Faithfulmc
https://github.com/Tominous/Faithfulmc
7fe0325f3a8437855cb231bf3f88e2bb98656abe
c057628cdbf770e2892b5bf0cdfccdcb54bc8bfa
refs/heads/master
2020-12-10T14:25:07.320000
2020-01-13T14:47:15
2020-01-13T14:47:15
233,617,706
2
0
Apache-2.0
true
2020-01-13T14:42:51
2020-01-13T14:42:51
2020-01-13T14:42:48
2019-03-02T16:34:59
39,871
0
0
0
null
false
false
package com.faithfulmc.hardcorefactions.kit.argument; import com.faithfulmc.framework.BasePlugin; import com.faithfulmc.hardcorefactions.ConfigurationService; import com.faithfulmc.hardcorefactions.HCF; import com.faithfulmc.hardcorefactions.kit.Kit; import com.faithfulmc.util.command.CommandArgument; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class KitSetImageArgument extends CommandArgument { private final HCF plugin; public KitSetImageArgument(final HCF plugin) { super("setimage", "Sets the image of kit in GUI to held item"); this.plugin = plugin; this.aliases = new String[]{"setitem", "setpic", "setpicture"}; this.permission = "base.command.kit.argument." + this.getName(); } @Override public String getUsage(final String label) { return '/' + label + ' ' + this.getName() + " <kitName>"; } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(ConfigurationService.RED + "This argument is only executable by players."); return true; } if (args.length < 2) { sender.sendMessage(ConfigurationService.RED + "Usage: " + this.getUsage(label)); return true; } final Player player = (Player) sender; final ItemStack stack = player.getItemInHand(); if (stack == null || stack.getType() == Material.AIR) { player.sendMessage(ConfigurationService.RED + "You are not holding anything."); return true; } final Kit kit = this.plugin.getKitManager().getKit(args[1]); if (kit == null) { sender.sendMessage(ConfigurationService.RED + "There is not a kit named " + args[1] + '.'); return true; } kit.setImage(stack.clone()); sender.sendMessage(ConfigurationService.GRAY + "Set image of kit " + ConfigurationService.YELLOW + kit.getDisplayName() + ConfigurationService.GRAY + " to " + ConfigurationService.YELLOW + BasePlugin.getPlugin().getItemDb().getName(stack) + ConfigurationService.GRAY + '.'); return true; } @Override public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { if (args.length != 2) { return Collections.emptyList(); } final List<Kit> kits = this.plugin.getKitManager().getKits(); final List<String> results = new ArrayList<>(kits.size()); for (Kit kit : kits) { results.add(kit.getName()); } return results; } }
UTF-8
Java
2,934
java
KitSetImageArgument.java
Java
[]
null
[]
package com.faithfulmc.hardcorefactions.kit.argument; import com.faithfulmc.framework.BasePlugin; import com.faithfulmc.hardcorefactions.ConfigurationService; import com.faithfulmc.hardcorefactions.HCF; import com.faithfulmc.hardcorefactions.kit.Kit; import com.faithfulmc.util.command.CommandArgument; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class KitSetImageArgument extends CommandArgument { private final HCF plugin; public KitSetImageArgument(final HCF plugin) { super("setimage", "Sets the image of kit in GUI to held item"); this.plugin = plugin; this.aliases = new String[]{"setitem", "setpic", "setpicture"}; this.permission = "base.command.kit.argument." + this.getName(); } @Override public String getUsage(final String label) { return '/' + label + ' ' + this.getName() + " <kitName>"; } @Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(ConfigurationService.RED + "This argument is only executable by players."); return true; } if (args.length < 2) { sender.sendMessage(ConfigurationService.RED + "Usage: " + this.getUsage(label)); return true; } final Player player = (Player) sender; final ItemStack stack = player.getItemInHand(); if (stack == null || stack.getType() == Material.AIR) { player.sendMessage(ConfigurationService.RED + "You are not holding anything."); return true; } final Kit kit = this.plugin.getKitManager().getKit(args[1]); if (kit == null) { sender.sendMessage(ConfigurationService.RED + "There is not a kit named " + args[1] + '.'); return true; } kit.setImage(stack.clone()); sender.sendMessage(ConfigurationService.GRAY + "Set image of kit " + ConfigurationService.YELLOW + kit.getDisplayName() + ConfigurationService.GRAY + " to " + ConfigurationService.YELLOW + BasePlugin.getPlugin().getItemDb().getName(stack) + ConfigurationService.GRAY + '.'); return true; } @Override public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) { if (args.length != 2) { return Collections.emptyList(); } final List<Kit> kits = this.plugin.getKitManager().getKits(); final List<String> results = new ArrayList<>(kits.size()); for (Kit kit : kits) { results.add(kit.getName()); } return results; } }
2,934
0.662577
0.661213
71
40.323944
41.794525
282
false
false
0
0
0
0
0
0
0.704225
false
false
12
11171724f8f53a3d44096e3e6cdedcce196b5cd7
19,636,590,508,727
1cc44c25abfd7b3f656cc9026a05f3081c394047
/oblig7/src/AbstraktSortertEnkelListe.java
5e1e1852f198e7bda3c956202243b409f8a62234
[]
no_license
dahltor/java
https://github.com/dahltor/java
6ef5477149dbcd9374f820a7b31ad9c6403d5062
22c5c09284bb07984064c02e9fdc62d91c8588a6
refs/heads/master
2016-09-09T22:34:21.868000
2016-06-02T07:21:03
2016-06-02T07:21:03
47,794,730
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public interface AbstraktSortertEnkelListe<T extends Comparable<T> & Lik> extends Iterable<T> { public void settInn(T objekt); public T finnObjekt(String nokkel); }
UTF-8
Java
168
java
AbstraktSortertEnkelListe.java
Java
[]
null
[]
public interface AbstraktSortertEnkelListe<T extends Comparable<T> & Lik> extends Iterable<T> { public void settInn(T objekt); public T finnObjekt(String nokkel); }
168
0.779762
0.779762
4
41
34.0294
95
false
false
0
0
0
0
0
0
1
false
false
12
1d3431fc13300119af9d0d4d76098a337d7b0bd3
37,941,741,107,921
9a3eaa2c0776c44bd78e974140581b4046280737
/LanVaadin/vaadin0/src/main/java/hello/Countrycodes.java
0f92e67935012676499a0114cb9df604b15bb97b
[]
no_license
lnguyen135/LanVaadin
https://github.com/lnguyen135/LanVaadin
ab7229005d3fc1453f5dfd1a654493a75e790656
334bbfae912d8660fb0e7581d603eaeb1690f785
refs/heads/master
2021-04-27T11:17:40.403000
2018-02-28T21:59:29
2018-02-28T21:59:29
122,558,125
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hello; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Countrycodes { @Id @GeneratedValue private Long country_ID; private String country_Name; private String text_Description; private String html_Description; private String image; protected Countrycodes() { } public Countrycodes(Long country_ID, String country_Name, String text_Description, String html_Description, String image ) { this.country_ID = country_ID; this.country_Name = country_Name; this.text_Description = text_Description; this.html_Description = html_Description; this.image = image; } public Long getCountry_ID() { return country_ID; } public void setCountry_ID(Long country_ID) { this.country_ID = country_ID; } public String getCountry_Name() { return country_Name; } public void setCountry_Name(String country_Name) { this.country_Name = country_Name; } public String getText_Description() { return text_Description; } public void setText_Description(String text_Description) { this.text_Description = text_Description; } public String getHtml_Description() { return html_Description; } public void setHtml_Description(String html_Description) { this.html_Description = html_Description; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } @Override public String toString() { return String.format("countrycodes[country_ID=%d, country_Name='%s', text_Description='%s', html_Description='%s', image='%s']", country_ID, country_Name, text_Description, html_Description, image); } }
UTF-8
Java
1,852
java
Countrycodes.java
Java
[]
null
[]
package hello; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Countrycodes { @Id @GeneratedValue private Long country_ID; private String country_Name; private String text_Description; private String html_Description; private String image; protected Countrycodes() { } public Countrycodes(Long country_ID, String country_Name, String text_Description, String html_Description, String image ) { this.country_ID = country_ID; this.country_Name = country_Name; this.text_Description = text_Description; this.html_Description = html_Description; this.image = image; } public Long getCountry_ID() { return country_ID; } public void setCountry_ID(Long country_ID) { this.country_ID = country_ID; } public String getCountry_Name() { return country_Name; } public void setCountry_Name(String country_Name) { this.country_Name = country_Name; } public String getText_Description() { return text_Description; } public void setText_Description(String text_Description) { this.text_Description = text_Description; } public String getHtml_Description() { return html_Description; } public void setHtml_Description(String html_Description) { this.html_Description = html_Description; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } @Override public String toString() { return String.format("countrycodes[country_ID=%d, country_Name='%s', text_Description='%s', html_Description='%s', image='%s']", country_ID, country_Name, text_Description, html_Description, image); } }
1,852
0.666307
0.666307
85
19.705883
25.266031
144
false
false
0
0
0
0
0
0
2.105882
false
false
6
770ca3700454628dd1557af0d6c4e9327eff54a0
39,333,310,528,898
9e45796c9bb7d167a31a06338551fd269ed9979b
/src/com/nimbus/engine/ecs/component/lib/CSpriteAnimation.java
5592bb8aba8b1d2b274a80842c247a1921ee45dc
[ "MIT" ]
permissive
fukurosan/nimbus
https://github.com/fukurosan/nimbus
9e0bda417ffaa2f6127c9142a5398d3406fdc116
8d9569d6a0e100f49621c1ec308ab9a8912a3a5b
refs/heads/master
2022-05-01T09:30:56.440000
2020-04-26T14:24:53
2020-04-26T14:24:53
254,668,873
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nimbus.engine.ecs.component.lib; import java.util.List; import com.nimbus.engine.ecs.component.IComponent; import com.nimbus.engine.graphics.image.Image; import com.nimbus.engine.graphics.image.ImageTile; public class CSpriteAnimation implements IComponent { private ImageTile spriteMap; private List<int[]> frames; private int currentFrame; private float animationTimer; private float speed; private String name; //The list is expected to contain integer tuples with a x and y tile value for each frame public CSpriteAnimation(ImageTile spriteMap, List<int[]> frames, float speed, String name) { this.spriteMap = spriteMap; this.frames = frames; this.currentFrame = 0; this.speed = speed; this.name = name; animationTimer = 0; } //The list is expected to contain integer tuples with a x and y tile value for each frame public CSpriteAnimation(ImageTile spriteMap, List<int[]> frames, float speed) { this.spriteMap = spriteMap; this.frames = frames; this.currentFrame = 0; this.speed = speed; this.name = null; animationTimer = 0; } public Image getSprite() { int tileY = frames.get(currentFrame)[0]; int tileX = frames.get(currentFrame)[1]; return spriteMap.getTileImage(tileX, tileY); } public void nextFrame() { if(currentFrame == frames.size() - 1) { currentFrame = 0; animationTimer = 0; } else { currentFrame++; } } public float getAnimationTimer() { return animationTimer; } public void setAnimationTimer(float animation) { this.animationTimer = animation; } public float getSpeed() { return speed; } public int getCurrentFrame() { return currentFrame; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
UTF-8
Java
1,780
java
CSpriteAnimation.java
Java
[]
null
[]
package com.nimbus.engine.ecs.component.lib; import java.util.List; import com.nimbus.engine.ecs.component.IComponent; import com.nimbus.engine.graphics.image.Image; import com.nimbus.engine.graphics.image.ImageTile; public class CSpriteAnimation implements IComponent { private ImageTile spriteMap; private List<int[]> frames; private int currentFrame; private float animationTimer; private float speed; private String name; //The list is expected to contain integer tuples with a x and y tile value for each frame public CSpriteAnimation(ImageTile spriteMap, List<int[]> frames, float speed, String name) { this.spriteMap = spriteMap; this.frames = frames; this.currentFrame = 0; this.speed = speed; this.name = name; animationTimer = 0; } //The list is expected to contain integer tuples with a x and y tile value for each frame public CSpriteAnimation(ImageTile spriteMap, List<int[]> frames, float speed) { this.spriteMap = spriteMap; this.frames = frames; this.currentFrame = 0; this.speed = speed; this.name = null; animationTimer = 0; } public Image getSprite() { int tileY = frames.get(currentFrame)[0]; int tileX = frames.get(currentFrame)[1]; return spriteMap.getTileImage(tileX, tileY); } public void nextFrame() { if(currentFrame == frames.size() - 1) { currentFrame = 0; animationTimer = 0; } else { currentFrame++; } } public float getAnimationTimer() { return animationTimer; } public void setAnimationTimer(float animation) { this.animationTimer = animation; } public float getSpeed() { return speed; } public int getCurrentFrame() { return currentFrame; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
1,780
0.720787
0.71573
78
21.820513
21.822561
93
false
false
0
0
0
0
0
0
1.717949
false
false
6
f4797c02bf1b2ca5f46105c8661ef4a30c777012
32,366,873,565,567
2330f593d966d9f2abeb50e25ad58c00d8899596
/src/BookEnterer.java
dce8d3edb31fbdb0ecb4b7ff051fea2f591513fe
[]
no_license
cknibbe/Bookmaster-Library-DB
https://github.com/cknibbe/Bookmaster-Library-DB
cd100f350c9c65d981b98d8b662d1b7826429608
a165abdcf801db81e611ab69a5786024aa45e70e
refs/heads/master
2021-01-17T21:51:50.516000
2016-02-02T22:25:31
2016-02-02T22:25:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.GridBagLayout; import javax.swing.JLabel; import java.awt.GridBagConstraints; import javax.swing.JButton; import java.awt.Insets; import javax.swing.JTextField; import javax.swing.JComboBox; import javax.swing.JSpinner; import javax.swing.JTextArea; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; @SuppressWarnings("serial") public class BookEnterer extends JFrame implements ActionListener { private JPanel contentPane; private JTextField isbnField; private JTextField titleField; private JTextField authorField; private JTextField keywordsField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { BookEnterer frame = new BookEnterer(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public BookEnterer() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 400); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); contentPane.add(panel, BorderLayout.CENTER); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0}; gbl_panel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0}; gbl_panel.columnWeights = new double[]{0.0, 1.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); JLabel lblIsbn = new JLabel("ISBN"); GridBagConstraints gbc_lblIsbn = new GridBagConstraints(); gbc_lblIsbn.anchor = GridBagConstraints.EAST; gbc_lblIsbn.insets = new Insets(0, 0, 5, 5); gbc_lblIsbn.gridx = 0; gbc_lblIsbn.gridy = 0; panel.add(lblIsbn, gbc_lblIsbn); isbnField = new JTextField(); GridBagConstraints gbc_isbnField = new GridBagConstraints(); gbc_isbnField.insets = new Insets(0, 0, 5, 5); gbc_isbnField.fill = GridBagConstraints.HORIZONTAL; gbc_isbnField.gridx = 1; gbc_isbnField.gridy = 0; panel.add(isbnField, gbc_isbnField); isbnField.setColumns(10); JButton btnCheck = new JButton("Check"); GridBagConstraints gbc_btnCheck = new GridBagConstraints(); gbc_btnCheck.insets = new Insets(0, 0, 5, 0); gbc_btnCheck.gridx = 3; gbc_btnCheck.gridy = 0; panel.add(btnCheck, gbc_btnCheck); JLabel lblTitle = new JLabel("Title"); GridBagConstraints gbc_lblTitle = new GridBagConstraints(); gbc_lblTitle.anchor = GridBagConstraints.EAST; gbc_lblTitle.insets = new Insets(0, 0, 5, 5); gbc_lblTitle.gridx = 0; gbc_lblTitle.gridy = 1; panel.add(lblTitle, gbc_lblTitle); titleField = new JTextField(); GridBagConstraints gbc_titleField = new GridBagConstraints(); gbc_titleField.fill = GridBagConstraints.BOTH; gbc_titleField.insets = new Insets(0, 0, 5, 5); gbc_titleField.gridx = 1; gbc_titleField.gridy = 1; panel.add(titleField, gbc_titleField); titleField.setColumns(10); JLabel lblAuthor = new JLabel("Author"); GridBagConstraints gbc_lblAuthor = new GridBagConstraints(); gbc_lblAuthor.anchor = GridBagConstraints.EAST; gbc_lblAuthor.insets = new Insets(0, 0, 5, 5); gbc_lblAuthor.gridx = 2; gbc_lblAuthor.gridy = 1; panel.add(lblAuthor, gbc_lblAuthor); authorField = new JTextField(); GridBagConstraints gbc_authorField = new GridBagConstraints(); gbc_authorField.insets = new Insets(0, 0, 5, 0); gbc_authorField.fill = GridBagConstraints.HORIZONTAL; gbc_authorField.gridx = 3; gbc_authorField.gridy = 1; panel.add(authorField, gbc_authorField); authorField.setColumns(10); JLabel lblGenre = new JLabel("Genre"); GridBagConstraints gbc_lblGenre = new GridBagConstraints(); gbc_lblGenre.insets = new Insets(0, 0, 5, 5); gbc_lblGenre.anchor = GridBagConstraints.EAST; gbc_lblGenre.gridx = 0; gbc_lblGenre.gridy = 2; panel.add(lblGenre, gbc_lblGenre); JComboBox genreComboBox = new JComboBox(); GridBagConstraints gbc_genreComboBox = new GridBagConstraints(); gbc_genreComboBox.insets = new Insets(0, 0, 5, 5); gbc_genreComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_genreComboBox.gridx = 1; gbc_genreComboBox.gridy = 2; panel.add(genreComboBox, gbc_genreComboBox); JLabel lblLevel = new JLabel("Level"); GridBagConstraints gbc_lblLevel = new GridBagConstraints(); gbc_lblLevel.insets = new Insets(0, 0, 5, 5); gbc_lblLevel.gridx = 2; gbc_lblLevel.gridy = 2; panel.add(lblLevel, gbc_lblLevel); JSpinner levelSpinner = new JSpinner(); GridBagConstraints gbc_levelSpinner = new GridBagConstraints(); gbc_levelSpinner.fill = GridBagConstraints.HORIZONTAL; gbc_levelSpinner.insets = new Insets(0, 0, 5, 0); gbc_levelSpinner.gridx = 3; gbc_levelSpinner.gridy = 2; panel.add(levelSpinner, gbc_levelSpinner); JLabel lblKeywords = new JLabel("Keywords"); GridBagConstraints gbc_lblKeywords = new GridBagConstraints(); gbc_lblKeywords.anchor = GridBagConstraints.EAST; gbc_lblKeywords.insets = new Insets(0, 0, 5, 5); gbc_lblKeywords.gridx = 0; gbc_lblKeywords.gridy = 3; panel.add(lblKeywords, gbc_lblKeywords); keywordsField = new JTextField(); keywordsField.setToolTipText("Enter the Keywords in a comma-seperated list"); GridBagConstraints gbc_keywordsField = new GridBagConstraints(); gbc_keywordsField.insets = new Insets(0, 0, 5, 0); gbc_keywordsField.gridwidth = 3; gbc_keywordsField.fill = GridBagConstraints.HORIZONTAL; gbc_keywordsField.gridx = 1; gbc_keywordsField.gridy = 3; panel.add(keywordsField, gbc_keywordsField); keywordsField.setColumns(10); JLabel lblSummary = new JLabel("Summary"); GridBagConstraints gbc_lblSummary = new GridBagConstraints(); gbc_lblSummary.insets = new Insets(0, 0, 5, 5); gbc_lblSummary.gridx = 0; gbc_lblSummary.gridy = 4; panel.add(lblSummary, gbc_lblSummary); JTextArea summaryTextArea = new JTextArea(); GridBagConstraints gbc_summaryTextArea = new GridBagConstraints(); gbc_summaryTextArea.gridwidth = 4; gbc_summaryTextArea.insets = new Insets(0, 0, 5, 5); gbc_summaryTextArea.fill = GridBagConstraints.BOTH; gbc_summaryTextArea.gridx = 0; gbc_summaryTextArea.gridy = 5; panel.add(summaryTextArea, gbc_summaryTextArea); JButton submitButton = new JButton("Submit"); submitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); GridBagConstraints gbc_submitButton = new GridBagConstraints(); gbc_submitButton.gridx = 3; gbc_submitButton.gridy = 6; panel.add(submitButton, gbc_submitButton); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } }
UTF-8
Java
6,986
java
BookEnterer.java
Java
[]
null
[]
import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.GridBagLayout; import javax.swing.JLabel; import java.awt.GridBagConstraints; import javax.swing.JButton; import java.awt.Insets; import javax.swing.JTextField; import javax.swing.JComboBox; import javax.swing.JSpinner; import javax.swing.JTextArea; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; @SuppressWarnings("serial") public class BookEnterer extends JFrame implements ActionListener { private JPanel contentPane; private JTextField isbnField; private JTextField titleField; private JTextField authorField; private JTextField keywordsField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { BookEnterer frame = new BookEnterer(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public BookEnterer() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 400); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JPanel panel = new JPanel(); contentPane.add(panel, BorderLayout.CENTER); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0}; gbl_panel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0}; gbl_panel.columnWeights = new double[]{0.0, 1.0, 0.0, 1.0, Double.MIN_VALUE}; gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE}; panel.setLayout(gbl_panel); JLabel lblIsbn = new JLabel("ISBN"); GridBagConstraints gbc_lblIsbn = new GridBagConstraints(); gbc_lblIsbn.anchor = GridBagConstraints.EAST; gbc_lblIsbn.insets = new Insets(0, 0, 5, 5); gbc_lblIsbn.gridx = 0; gbc_lblIsbn.gridy = 0; panel.add(lblIsbn, gbc_lblIsbn); isbnField = new JTextField(); GridBagConstraints gbc_isbnField = new GridBagConstraints(); gbc_isbnField.insets = new Insets(0, 0, 5, 5); gbc_isbnField.fill = GridBagConstraints.HORIZONTAL; gbc_isbnField.gridx = 1; gbc_isbnField.gridy = 0; panel.add(isbnField, gbc_isbnField); isbnField.setColumns(10); JButton btnCheck = new JButton("Check"); GridBagConstraints gbc_btnCheck = new GridBagConstraints(); gbc_btnCheck.insets = new Insets(0, 0, 5, 0); gbc_btnCheck.gridx = 3; gbc_btnCheck.gridy = 0; panel.add(btnCheck, gbc_btnCheck); JLabel lblTitle = new JLabel("Title"); GridBagConstraints gbc_lblTitle = new GridBagConstraints(); gbc_lblTitle.anchor = GridBagConstraints.EAST; gbc_lblTitle.insets = new Insets(0, 0, 5, 5); gbc_lblTitle.gridx = 0; gbc_lblTitle.gridy = 1; panel.add(lblTitle, gbc_lblTitle); titleField = new JTextField(); GridBagConstraints gbc_titleField = new GridBagConstraints(); gbc_titleField.fill = GridBagConstraints.BOTH; gbc_titleField.insets = new Insets(0, 0, 5, 5); gbc_titleField.gridx = 1; gbc_titleField.gridy = 1; panel.add(titleField, gbc_titleField); titleField.setColumns(10); JLabel lblAuthor = new JLabel("Author"); GridBagConstraints gbc_lblAuthor = new GridBagConstraints(); gbc_lblAuthor.anchor = GridBagConstraints.EAST; gbc_lblAuthor.insets = new Insets(0, 0, 5, 5); gbc_lblAuthor.gridx = 2; gbc_lblAuthor.gridy = 1; panel.add(lblAuthor, gbc_lblAuthor); authorField = new JTextField(); GridBagConstraints gbc_authorField = new GridBagConstraints(); gbc_authorField.insets = new Insets(0, 0, 5, 0); gbc_authorField.fill = GridBagConstraints.HORIZONTAL; gbc_authorField.gridx = 3; gbc_authorField.gridy = 1; panel.add(authorField, gbc_authorField); authorField.setColumns(10); JLabel lblGenre = new JLabel("Genre"); GridBagConstraints gbc_lblGenre = new GridBagConstraints(); gbc_lblGenre.insets = new Insets(0, 0, 5, 5); gbc_lblGenre.anchor = GridBagConstraints.EAST; gbc_lblGenre.gridx = 0; gbc_lblGenre.gridy = 2; panel.add(lblGenre, gbc_lblGenre); JComboBox genreComboBox = new JComboBox(); GridBagConstraints gbc_genreComboBox = new GridBagConstraints(); gbc_genreComboBox.insets = new Insets(0, 0, 5, 5); gbc_genreComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_genreComboBox.gridx = 1; gbc_genreComboBox.gridy = 2; panel.add(genreComboBox, gbc_genreComboBox); JLabel lblLevel = new JLabel("Level"); GridBagConstraints gbc_lblLevel = new GridBagConstraints(); gbc_lblLevel.insets = new Insets(0, 0, 5, 5); gbc_lblLevel.gridx = 2; gbc_lblLevel.gridy = 2; panel.add(lblLevel, gbc_lblLevel); JSpinner levelSpinner = new JSpinner(); GridBagConstraints gbc_levelSpinner = new GridBagConstraints(); gbc_levelSpinner.fill = GridBagConstraints.HORIZONTAL; gbc_levelSpinner.insets = new Insets(0, 0, 5, 0); gbc_levelSpinner.gridx = 3; gbc_levelSpinner.gridy = 2; panel.add(levelSpinner, gbc_levelSpinner); JLabel lblKeywords = new JLabel("Keywords"); GridBagConstraints gbc_lblKeywords = new GridBagConstraints(); gbc_lblKeywords.anchor = GridBagConstraints.EAST; gbc_lblKeywords.insets = new Insets(0, 0, 5, 5); gbc_lblKeywords.gridx = 0; gbc_lblKeywords.gridy = 3; panel.add(lblKeywords, gbc_lblKeywords); keywordsField = new JTextField(); keywordsField.setToolTipText("Enter the Keywords in a comma-seperated list"); GridBagConstraints gbc_keywordsField = new GridBagConstraints(); gbc_keywordsField.insets = new Insets(0, 0, 5, 0); gbc_keywordsField.gridwidth = 3; gbc_keywordsField.fill = GridBagConstraints.HORIZONTAL; gbc_keywordsField.gridx = 1; gbc_keywordsField.gridy = 3; panel.add(keywordsField, gbc_keywordsField); keywordsField.setColumns(10); JLabel lblSummary = new JLabel("Summary"); GridBagConstraints gbc_lblSummary = new GridBagConstraints(); gbc_lblSummary.insets = new Insets(0, 0, 5, 5); gbc_lblSummary.gridx = 0; gbc_lblSummary.gridy = 4; panel.add(lblSummary, gbc_lblSummary); JTextArea summaryTextArea = new JTextArea(); GridBagConstraints gbc_summaryTextArea = new GridBagConstraints(); gbc_summaryTextArea.gridwidth = 4; gbc_summaryTextArea.insets = new Insets(0, 0, 5, 5); gbc_summaryTextArea.fill = GridBagConstraints.BOTH; gbc_summaryTextArea.gridx = 0; gbc_summaryTextArea.gridy = 5; panel.add(summaryTextArea, gbc_summaryTextArea); JButton submitButton = new JButton("Submit"); submitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); GridBagConstraints gbc_submitButton = new GridBagConstraints(); gbc_submitButton.gridx = 3; gbc_submitButton.gridy = 6; panel.add(submitButton, gbc_submitButton); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } }
6,986
0.728027
0.705697
208
32.58654
19.653543
91
false
false
0
0
0
0
0
0
2.908654
false
false
6
0b683b3606e32156cb34665957d660980d9a3ead
32,366,873,561,314
42b6e80e3e67e2be898c4ff1142133b7cd48f22d
/Mic4PC_PC/Mic4PC/src/components/SysTray.java
d09638fb21447e43d75fef9624bf766e7e5ef3bb
[]
no_license
dyglcc/AndroidBluetoothDemo
https://github.com/dyglcc/AndroidBluetoothDemo
3d8b950d361b9387ee6058462941045f4d5c416a
0c23b7974d4042fee5b5d2feabfe3c0e5e740987
refs/heads/master
2016-08-11T09:16:08.577000
2016-02-24T06:00:54
2016-02-24T06:00:54
52,130,939
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package components; import java.awt.MenuItem; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.UIManager; /** * @author royen * @since 2010.2.10 */ public class SysTray { public void show(){ try{ // UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception ex) { ex.printStackTrace(); } /** �жϱ���ϵͳ�Ƿ�֧������ */ if(SystemTray.isSupported()){ this.tray(); } else{ JOptionPane.showMessageDialog(null,"sdfasdfffffffffffffffff"); } } /** ������ش��� */ private void tray(){ /** ��ñ�����ϵͳ���̵�ʵ�� */ tray = SystemTray.getSystemTray(); URL imageUrl=SysTray.class.getResource("system.gif"); /** ��������ͼ�� */ ImageIcon icon = new ImageIcon(imageUrl); /** �����Ҽ�����ʽ�˵� */ PopupMenu pop = new PopupMenu(); // ����һ���Ҽ�����ʽ�˵� /** �Ҽ�����ʽ�˵���ѡ�� */ MenuItem exit = new MenuItem("exit"); MenuItem about = new MenuItem("about"); pop.add(exit); pop.add(about); trayIcon = new TrayIcon(icon.getImage(), "0000000000000000", pop); try{ /** ������ͼ����ӵ�ϵͳ������ʵ���� */ tray.add(trayIcon); // } catch(Exception e){ e.printStackTrace(); } /** ��������¼� */ trayIcon.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if(e.getClickCount()==2){ JOptionPane.showMessageDialog(null,"Copyright @2010 Royen\nAll Right Reserved\nauthor fairyRT\nversion 1.0\n","about",JOptionPane.INFORMATION_MESSAGE); } } }); /** �˳��˵����¼� */ exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try{ //bluetooth.getBluetooth().closeServer(); tray.remove(trayIcon); tray=null; System.gc(); System.exit(0); } catch(Exception ex){ ex.printStackTrace(); } } }); /** ���ڲ˵����¼� */ about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null,"Copyright @2013 \nAll Right Reserved\nauthor fairyRT\nversion 1.0\n","about",JOptionPane.INFORMATION_MESSAGE); } }); } /** ����ͼ�� */ private TrayIcon trayIcon = null; /** ������ϵͳ���̵�ʵ�� */ private SystemTray tray = null; }
UTF-8
Java
3,126
java
SysTray.java
Java
[ { "context": "\r\nimport javax.swing.UIManager;\r\n\r\n/**\r\n * @author royen\r\n * @since 2010.2.10\r\n */\r\npublic class SysTray {", "end": 423, "score": 0.999525785446167, "start": 418, "tag": "USERNAME", "value": "royen" }, { "context": "OptionPane.showMessageDialog(null,\"Copyright @2010 Royen\\nAll Right Reserved\\nauthor fairyRT\\nversion 1.0\\", "end": 1856, "score": 0.8087024688720703, "start": 1851, "tag": "USERNAME", "value": "Royen" }, { "context": "\"Copyright @2010 Royen\\nAll Right Reserved\\nauthor fairyRT\\nversion 1.0\\n\",\"about\",JOptionPane.INFORMATION_M", "end": 1892, "score": 0.9716001152992249, "start": 1885, "tag": "USERNAME", "value": "fairyRT" }, { "context": "null,\"Copyright @2013 \\nAll Right Reserved\\nauthor fairyRT\\nversion 1.0\\n\",\"about\",JOptionPane.INFORMATION_M", "end": 2588, "score": 0.9883607029914856, "start": 2581, "tag": "USERNAME", "value": "fairyRT" } ]
null
[]
package components; import java.awt.MenuItem; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.TrayIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.UIManager; /** * @author royen * @since 2010.2.10 */ public class SysTray { public void show(){ try{ // UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception ex) { ex.printStackTrace(); } /** �жϱ���ϵͳ�Ƿ�֧������ */ if(SystemTray.isSupported()){ this.tray(); } else{ JOptionPane.showMessageDialog(null,"sdfasdfffffffffffffffff"); } } /** ������ش��� */ private void tray(){ /** ��ñ�����ϵͳ���̵�ʵ�� */ tray = SystemTray.getSystemTray(); URL imageUrl=SysTray.class.getResource("system.gif"); /** ��������ͼ�� */ ImageIcon icon = new ImageIcon(imageUrl); /** �����Ҽ�����ʽ�˵� */ PopupMenu pop = new PopupMenu(); // ����һ���Ҽ�����ʽ�˵� /** �Ҽ�����ʽ�˵���ѡ�� */ MenuItem exit = new MenuItem("exit"); MenuItem about = new MenuItem("about"); pop.add(exit); pop.add(about); trayIcon = new TrayIcon(icon.getImage(), "0000000000000000", pop); try{ /** ������ͼ����ӵ�ϵͳ������ʵ���� */ tray.add(trayIcon); // } catch(Exception e){ e.printStackTrace(); } /** ��������¼� */ trayIcon.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if(e.getClickCount()==2){ JOptionPane.showMessageDialog(null,"Copyright @2010 Royen\nAll Right Reserved\nauthor fairyRT\nversion 1.0\n","about",JOptionPane.INFORMATION_MESSAGE); } } }); /** �˳��˵����¼� */ exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try{ //bluetooth.getBluetooth().closeServer(); tray.remove(trayIcon); tray=null; System.gc(); System.exit(0); } catch(Exception ex){ ex.printStackTrace(); } } }); /** ���ڲ˵����¼� */ about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null,"Copyright @2013 \nAll Right Reserved\nauthor fairyRT\nversion 1.0\n","about",JOptionPane.INFORMATION_MESSAGE); } }); } /** ����ͼ�� */ private TrayIcon trayIcon = null; /** ������ϵͳ���̵�ʵ�� */ private SystemTray tray = null; }
3,126
0.58396
0.569638
115
22.286957
25.381872
156
false
false
0
0
0
0
0
0
2.6
false
false
6
4d17de948029a38e92a1ce86a42ef4d8e30f648d
24,936,580,141,918
cf2ec21000965015352dfea2feaf05c0bd5abbce
/EasyDataLabeler_ex/app/src/main/java/com/example/easydatalabeler/Person.java
4a3e17e4a21bf8e2a0f67e672fbf5d6fe08e3456
[]
no_license
dvij542/EasyDataLabeler
https://github.com/dvij542/EasyDataLabeler
198caee56430d8892907c5045037b6452d7e6f0b
f8c2cafd7ba4255c2a06077612726f532a3f705e
refs/heads/master
2022-12-03T19:47:38.481000
2020-08-10T18:13:39
2020-08-10T18:13:39
266,774,551
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.easydatalabeler; public class Person{ public String name; public String phone_no; public String email; public String password; }
UTF-8
Java
166
java
Person.java
Java
[]
null
[]
package com.example.easydatalabeler; public class Person{ public String name; public String phone_no; public String email; public String password; }
166
0.728916
0.728916
8
19.75
11.934718
36
false
false
0
0
0
0
0
0
0.625
false
false
6
1eb8ac838c23803ac09788e5c7159e8bfa608eda
5,531,917,916,161
5a74feb049b8361e8b5f8ca9af6fe121fe96a3b4
/Tareas/T084/src/Main.java
7264e2c3d978e827e109f8f7e01158dc7c86bf0d
[]
no_license
jmsaborido/pro-1daw
https://github.com/jmsaborido/pro-1daw
99dc052fa3dcb37f7a16dbf51c9ceb2a12d3945b
87f2eb35d617b3f845d4f01e0dae32edae49f475
refs/heads/master
2022-02-16T03:11:36.134000
2019-09-20T10:00:04
2019-09-20T10:00:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Main { public static void main(String[] args) { System.out.println(contar("aeiou", "programacion")); } /** * nombre contar * descripcion cuenta cuantos caracteres de una cadena hay en otra cadena. * @param caracteres es la cadena de caracteres que queremos buscar (No nulo, no vacio, cada caracter es unico) * @param texto es la cadena en la que se van a buscar los caracteres (No nulo, no vacio) * @return devuelve el parametro contador que cuenta el numero de repeticiones. */ private static int contar(String caracteres, String texto) { assert texto != null : "Error: La cadena no puede ser nula."; assert !texto.isEmpty() : "Error: La cadena no puede ser vacia."; assert caracteres != null : "Error: La cadena no puede ser nula."; assert !caracteres.isEmpty() : "Error: La cadena no puede ser vacia."; int contador = 0; for (int i = 0; i < caracteres.length(); i++) { for (int j = i; j < caracteres.length(); j++) { if (i != j) { if ((caracteres.charAt(j) == caracteres.charAt(i))) { System.err.println( "Error: Has pasado caracteres repetidos."); return 0; } } } } for (int i = 0; i < texto.length(); i++) { for (int j = 0; j < caracteres.length(); j++) { if ((caracteres.charAt(j) == texto.charAt(i))) { contador++; } } } return contador; } }
UTF-8
Java
1,679
java
Main.java
Java
[]
null
[]
public class Main { public static void main(String[] args) { System.out.println(contar("aeiou", "programacion")); } /** * nombre contar * descripcion cuenta cuantos caracteres de una cadena hay en otra cadena. * @param caracteres es la cadena de caracteres que queremos buscar (No nulo, no vacio, cada caracter es unico) * @param texto es la cadena en la que se van a buscar los caracteres (No nulo, no vacio) * @return devuelve el parametro contador que cuenta el numero de repeticiones. */ private static int contar(String caracteres, String texto) { assert texto != null : "Error: La cadena no puede ser nula."; assert !texto.isEmpty() : "Error: La cadena no puede ser vacia."; assert caracteres != null : "Error: La cadena no puede ser nula."; assert !caracteres.isEmpty() : "Error: La cadena no puede ser vacia."; int contador = 0; for (int i = 0; i < caracteres.length(); i++) { for (int j = i; j < caracteres.length(); j++) { if (i != j) { if ((caracteres.charAt(j) == caracteres.charAt(i))) { System.err.println( "Error: Has pasado caracteres repetidos."); return 0; } } } } for (int i = 0; i < texto.length(); i++) { for (int j = 0; j < caracteres.length(); j++) { if ((caracteres.charAt(j) == texto.charAt(i))) { contador++; } } } return contador; } }
1,679
0.515783
0.512805
45
35.222221
32.211723
116
false
false
0
0
0
0
0
0
0.511111
false
false
6
fb207ef431b1c16054dd80e950910bbf24ed0130
8,589,971,011
22adf8db5c72f6edce3c30901b1c3cb80edba8d1
/particleFilters/motionModel/MainActivity.java
f2a1b40e06134f88cb2c8f262cc25a7c1e5385dd
[]
no_license
gerardomoyers/SmartPhoneSensing
https://github.com/gerardomoyers/SmartPhoneSensing
d6b2bea8fc01f499d59965f9a95bb6e9526776ca
ae49cc6251f6fb04b16391a0a4c65e9ce169400e
refs/heads/master
2022-12-17T05:55:17.924000
2019-06-26T07:37:40
2019-06-26T07:37:40
296,265,930
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.example6; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; import android.graphics.drawable.shapes.RectShape; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Environment; import android.support.annotation.Nullable; import android.util.Log; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.MarginLayoutParams; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import android.hardware.GeomagneticField; import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; /** * Smart Phone Sensing Example 6. Object movement and interaction on canvas. */ public class MainActivity extends Activity implements OnClickListener { /** * The buttons. */ private Button up, left, right, down; /** * The text view. */ private TextView textView; /** * The shape. */ private ShapeDrawable drawable; /** * The canvas. */ private Canvas canvas; /** * The walls. */ private List<ShapeDrawable> walls; private Context context; private SensorManager sensorManager; private Sensor senAccelerometer; private Sensor senStepCounter; private Sensor senStepDetector; private Sensor senRotation; private Sensor mag; private Sensor mRotationSensor; int stepsTaken; int reportedSteps; int stepDetector; float[] angle; int totalSteps; int lastSteps; long lastDetected; long now; long timeout = 1000000; private TextView countText; private TextView detectText; private TextView accelText; float[] rMat = new float[9]; float[] iMat = new float[9]; float[] gData = new float[3]; // accelerometer float[] mData = new float[3]; // magnetometer private float mAzimuth = 0; // degree private float mAzimuthInitial = 0; float[] orientation = new float[3]; double offset; double realAngle = 0; @Nullable private Rotation calibrationDirection; @Nullable private Rotation latestDirection; List<Double> x = new ArrayList<Double>(); List<Double> y = new ArrayList<Double>(); Double[] xUpdated = new Double[]{(double) 0, (double) 0, (double) 0, (double) 0, (double) 0}; Double[] yUpdated = new Double[]{(double) 0, (double) 0, (double) 0, (double) 0, (double) 0}; final SensorEventListener thiss = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; int numm = 1000; // Perform differing functionality depending upon // the sensor type (caller) switch (event.sensor.getType()) { case Sensor.TYPE_STEP_COUNTER: now = event.timestamp; if (reportedSteps < 1) { // Log the initial value reportedSteps = (int) event.values[0]; } stepsTaken = (int) event.values[0] - reportedSteps; break; case Sensor.TYPE_STEP_DETECTOR: new CountDownTimer(20000, 1000) { public void onTick(long millisUntilFinished) { } public void onFinish() { stepDetector = 0; } }.start(); // Increment the step detector count stepDetector++; //showToast("Det: " + stepDetector); // Output the value to the simple GUI // detectText.setText("Det: " + stepDetector); break; case Sensor.TYPE_ACCELEROMETER: // Get the accelerometer values and set them to a string with 2dp String x = String.format("%.02f", event.values[0]); String y = String.format("%.02f", event.values[1]); String z = String.format("%.02f", event.values[2]); gData = event.values.clone(); // Output the string to the GUI //showToast("Acc:" + x + "," + y + "," + z); //accelText.setText("Acc:" + x + "," + y + "," + z); break; case Sensor.TYPE_MAGNETIC_FIELD: mData = event.values.clone(); break; case Sensor.TYPE_ROTATION_VECTOR: Rotation rotation = new Rotation( (double) event.values[3], // quaternion scalar (double) event.values[0], // quaternion x (double) event.values[1], // quaternion y (double) event.values[2], // quaternion z false); // no need to normalise if (calibrationDirection == null) { // Save the first sensor value obtained as the calibration value calibrationDirection = rotation; if (SensorManager.getRotationMatrix(rMat, iMat, gData, mData)) { Float azz = SensorManager.getOrientation(rMat, orientation)[0]; mAzimuthInitial = (float) ((Math.toDegrees(azz) + 360) % 360.0); Log.e("this", "" + mAzimuth); } } else { // Apply the reverse of the calibration direction to the newly // obtained direction to obtain the direction the user is facing // relative to his/her original direction latestDirection = calibrationDirection.applyInverseTo(rotation); double value = latestDirection.getAngles(RotationOrder.XYX)[1] * 360; if (value > 1040) { value = 1040; } if (value < 40) { value = 40; } double resize = (value - 40) * (360 - 0) / (double) (1040 - 40) + 0.0; if (SensorManager.getRotationMatrix(rMat, iMat, gData, mData)) { Float azz = SensorManager.getOrientation(rMat, orientation)[0]; mAzimuth = (float) ((Math.toDegrees(azz) + 360) % 360.0); } if (mAzimuth > mAzimuthInitial || mAzimuth <90) { realAngle = -resize / 2.0; //rotating CW } else if (mAzimuth < mAzimuthInitial) { realAngle = resize / 2.0; } Log.e("here", ""+mAzimuth); //realAngle = mAzimuth-mAzimuthInitial; Log.e("trial", "" + realAngle); } break; } } @Override public void onAccuracyChanged(Sensor sensorEvent, int accuracy) { } }; public void StdGaussian() { double r, x, y; // find a uniform random point (x, y) inside unit circle do { x = 2.0 * Math.random() - 1.0; y = 2.0 * Math.random() - 1.0; r = x*x + y*y; } while (r > 1 || r == 0); // loop executed 4 / pi = 1.273.. times on average // http://en.wikipedia.org/wiki/Box-Muller_transformshow // apply the Box-Muller formula to get standard Gaussian z offset = x * Math.sqrt(-2.0 * Math.log(r) / r); // print it to standard output }; @Override protected void onCreate(Bundle savedInstanceState) { Sensor mStepCounterSensor; SensorManager mSensorManager; super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final int SENSOR_DELAY = 500 * 1000; // 500ms // set the buttons up = (Button) findViewById(R.id.button1); left = (Button) findViewById(R.id.button2); right = (Button) findViewById(R.id.button3); down = (Button) findViewById(R.id.button4); // set the text view textView = (TextView) findViewById(R.id.textView1); // set listeners up.setOnClickListener(this); down.setOnClickListener(this); left.setOnClickListener(this); right.setOnClickListener(this); //MOTION MODEL context = this; // Properties to store step data stepsTaken = 0; reportedSteps = 0; stepDetector = 0; // GUI Components to display data TextView countText; TextView detectText; TextView accelText; // Reference/Assign the sensor manager sensorManager = (SensorManager) context.getSystemService(SENSOR_SERVICE); // Reference/Assign the sensors senAccelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); senStepCounter = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); senStepDetector = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR); senRotation = sensorManager.getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR); mag = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); mRotationSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR); // Register the sensors for event callback showToast("Registering sensors!"); // Register the listeners. Used for receiving notifications from // the SensorManager when sensor values have changed. //sensorManager.registerListener(thiss, senStepCounter, SENSOR_DELAY); sensorManager.registerListener(thiss, senStepDetector, SensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(thiss, senAccelerometer, SENSOR_DELAY); sensorManager.registerListener(thiss, senRotation, SensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(thiss, mag, SensorManager.SENSOR_DELAY_FASTEST); sensorManager.registerListener(thiss, mRotationSensor, SensorManager.SENSOR_DELAY_NORMAL); for (int i=0 ; i<5 ; i++) { x.add((double) 0); y.add((double) 0); xUpdated[i] = (double) 0; yUpdated[i] = (double) 0; } } @Override public void onClick(View v) { //calculate distance Double[] distance = new Double[]{(double) 0, (double) 0, (double) 0, (double) 0, (double) 0}; //where was I? use of x and y //gauss = noise for (int j = 0; j < 5; j++) { StdGaussian(); double div = offset / 10.0; distance[j] = stepDetector * (1.65 * 0.4 + div); showToast("I moved in magnitude"+ distance[j]); } for (int i = 0; i < 5; i++) { xUpdated[i] = xUpdated[i] + distance[i] * Math.cos(Math.toRadians(realAngle)); yUpdated[i] = yUpdated[i] + distance[i] * Math.sin(Math.toRadians(realAngle)); showToast("x: "+ xUpdated[i]); showToast("y: "+ yUpdated[i]); } } @Override public void onResume() { super.onResume(); // Register the sensors sensorManager.registerListener(thiss, senStepCounter, SensorManager.SENSOR_DELAY_NORMAL); } // Simple function that can be used to display toasts public void showToast(final String message) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } }); } }
UTF-8
Java
13,012
java
MainActivity.java
Java
[]
null
[]
package com.example.example6; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; import android.graphics.drawable.shapes.RectShape; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Environment; import android.support.annotation.Nullable; import android.util.Log; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.MarginLayoutParams; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import android.hardware.GeomagneticField; import org.apache.commons.math3.geometry.euclidean.threed.Rotation; import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; /** * Smart Phone Sensing Example 6. Object movement and interaction on canvas. */ public class MainActivity extends Activity implements OnClickListener { /** * The buttons. */ private Button up, left, right, down; /** * The text view. */ private TextView textView; /** * The shape. */ private ShapeDrawable drawable; /** * The canvas. */ private Canvas canvas; /** * The walls. */ private List<ShapeDrawable> walls; private Context context; private SensorManager sensorManager; private Sensor senAccelerometer; private Sensor senStepCounter; private Sensor senStepDetector; private Sensor senRotation; private Sensor mag; private Sensor mRotationSensor; int stepsTaken; int reportedSteps; int stepDetector; float[] angle; int totalSteps; int lastSteps; long lastDetected; long now; long timeout = 1000000; private TextView countText; private TextView detectText; private TextView accelText; float[] rMat = new float[9]; float[] iMat = new float[9]; float[] gData = new float[3]; // accelerometer float[] mData = new float[3]; // magnetometer private float mAzimuth = 0; // degree private float mAzimuthInitial = 0; float[] orientation = new float[3]; double offset; double realAngle = 0; @Nullable private Rotation calibrationDirection; @Nullable private Rotation latestDirection; List<Double> x = new ArrayList<Double>(); List<Double> y = new ArrayList<Double>(); Double[] xUpdated = new Double[]{(double) 0, (double) 0, (double) 0, (double) 0, (double) 0}; Double[] yUpdated = new Double[]{(double) 0, (double) 0, (double) 0, (double) 0, (double) 0}; final SensorEventListener thiss = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; int numm = 1000; // Perform differing functionality depending upon // the sensor type (caller) switch (event.sensor.getType()) { case Sensor.TYPE_STEP_COUNTER: now = event.timestamp; if (reportedSteps < 1) { // Log the initial value reportedSteps = (int) event.values[0]; } stepsTaken = (int) event.values[0] - reportedSteps; break; case Sensor.TYPE_STEP_DETECTOR: new CountDownTimer(20000, 1000) { public void onTick(long millisUntilFinished) { } public void onFinish() { stepDetector = 0; } }.start(); // Increment the step detector count stepDetector++; //showToast("Det: " + stepDetector); // Output the value to the simple GUI // detectText.setText("Det: " + stepDetector); break; case Sensor.TYPE_ACCELEROMETER: // Get the accelerometer values and set them to a string with 2dp String x = String.format("%.02f", event.values[0]); String y = String.format("%.02f", event.values[1]); String z = String.format("%.02f", event.values[2]); gData = event.values.clone(); // Output the string to the GUI //showToast("Acc:" + x + "," + y + "," + z); //accelText.setText("Acc:" + x + "," + y + "," + z); break; case Sensor.TYPE_MAGNETIC_FIELD: mData = event.values.clone(); break; case Sensor.TYPE_ROTATION_VECTOR: Rotation rotation = new Rotation( (double) event.values[3], // quaternion scalar (double) event.values[0], // quaternion x (double) event.values[1], // quaternion y (double) event.values[2], // quaternion z false); // no need to normalise if (calibrationDirection == null) { // Save the first sensor value obtained as the calibration value calibrationDirection = rotation; if (SensorManager.getRotationMatrix(rMat, iMat, gData, mData)) { Float azz = SensorManager.getOrientation(rMat, orientation)[0]; mAzimuthInitial = (float) ((Math.toDegrees(azz) + 360) % 360.0); Log.e("this", "" + mAzimuth); } } else { // Apply the reverse of the calibration direction to the newly // obtained direction to obtain the direction the user is facing // relative to his/her original direction latestDirection = calibrationDirection.applyInverseTo(rotation); double value = latestDirection.getAngles(RotationOrder.XYX)[1] * 360; if (value > 1040) { value = 1040; } if (value < 40) { value = 40; } double resize = (value - 40) * (360 - 0) / (double) (1040 - 40) + 0.0; if (SensorManager.getRotationMatrix(rMat, iMat, gData, mData)) { Float azz = SensorManager.getOrientation(rMat, orientation)[0]; mAzimuth = (float) ((Math.toDegrees(azz) + 360) % 360.0); } if (mAzimuth > mAzimuthInitial || mAzimuth <90) { realAngle = -resize / 2.0; //rotating CW } else if (mAzimuth < mAzimuthInitial) { realAngle = resize / 2.0; } Log.e("here", ""+mAzimuth); //realAngle = mAzimuth-mAzimuthInitial; Log.e("trial", "" + realAngle); } break; } } @Override public void onAccuracyChanged(Sensor sensorEvent, int accuracy) { } }; public void StdGaussian() { double r, x, y; // find a uniform random point (x, y) inside unit circle do { x = 2.0 * Math.random() - 1.0; y = 2.0 * Math.random() - 1.0; r = x*x + y*y; } while (r > 1 || r == 0); // loop executed 4 / pi = 1.273.. times on average // http://en.wikipedia.org/wiki/Box-Muller_transformshow // apply the Box-Muller formula to get standard Gaussian z offset = x * Math.sqrt(-2.0 * Math.log(r) / r); // print it to standard output }; @Override protected void onCreate(Bundle savedInstanceState) { Sensor mStepCounterSensor; SensorManager mSensorManager; super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final int SENSOR_DELAY = 500 * 1000; // 500ms // set the buttons up = (Button) findViewById(R.id.button1); left = (Button) findViewById(R.id.button2); right = (Button) findViewById(R.id.button3); down = (Button) findViewById(R.id.button4); // set the text view textView = (TextView) findViewById(R.id.textView1); // set listeners up.setOnClickListener(this); down.setOnClickListener(this); left.setOnClickListener(this); right.setOnClickListener(this); //MOTION MODEL context = this; // Properties to store step data stepsTaken = 0; reportedSteps = 0; stepDetector = 0; // GUI Components to display data TextView countText; TextView detectText; TextView accelText; // Reference/Assign the sensor manager sensorManager = (SensorManager) context.getSystemService(SENSOR_SERVICE); // Reference/Assign the sensors senAccelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); senStepCounter = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); senStepDetector = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR); senRotation = sensorManager.getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR); mag = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); mRotationSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR); // Register the sensors for event callback showToast("Registering sensors!"); // Register the listeners. Used for receiving notifications from // the SensorManager when sensor values have changed. //sensorManager.registerListener(thiss, senStepCounter, SENSOR_DELAY); sensorManager.registerListener(thiss, senStepDetector, SensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(thiss, senAccelerometer, SENSOR_DELAY); sensorManager.registerListener(thiss, senRotation, SensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(thiss, mag, SensorManager.SENSOR_DELAY_FASTEST); sensorManager.registerListener(thiss, mRotationSensor, SensorManager.SENSOR_DELAY_NORMAL); for (int i=0 ; i<5 ; i++) { x.add((double) 0); y.add((double) 0); xUpdated[i] = (double) 0; yUpdated[i] = (double) 0; } } @Override public void onClick(View v) { //calculate distance Double[] distance = new Double[]{(double) 0, (double) 0, (double) 0, (double) 0, (double) 0}; //where was I? use of x and y //gauss = noise for (int j = 0; j < 5; j++) { StdGaussian(); double div = offset / 10.0; distance[j] = stepDetector * (1.65 * 0.4 + div); showToast("I moved in magnitude"+ distance[j]); } for (int i = 0; i < 5; i++) { xUpdated[i] = xUpdated[i] + distance[i] * Math.cos(Math.toRadians(realAngle)); yUpdated[i] = yUpdated[i] + distance[i] * Math.sin(Math.toRadians(realAngle)); showToast("x: "+ xUpdated[i]); showToast("y: "+ yUpdated[i]); } } @Override public void onResume() { super.onResume(); // Register the sensors sensorManager.registerListener(thiss, senStepCounter, SensorManager.SENSOR_DELAY_NORMAL); } // Simple function that can be used to display toasts public void showToast(final String message) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } }); } }
13,012
0.567015
0.55395
434
28.983871
27.785919
105
false
false
0
0
0
0
0
0
0.576037
false
false
6
28f957caa51e9ee911c33dcc351f8fa14f2f8ef9
8,014,408,989,176
152a33c2a95eeb0207b84fbc1304379b6ffef3f2
/processor/src/main/java/com/linecorp/decaton/processor/runtime/PropertySupplier.java
25568e55d35471ee78ad76ee21e7c46382dfdc12
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-protobuf" ]
permissive
line/decaton
https://github.com/line/decaton
78e5b841f923f874aa2e998006486a3d7c8801bd
cb16d36723642b9e74c8148f345b5b5e864c9655
refs/heads/master
2023-08-30T22:03:42.550000
2023-08-17T08:33:21
2023-08-17T08:33:21
245,131,903
310
58
Apache-2.0
false
2023-08-08T09:39:55
2020-03-05T10:22:36
2023-07-20T13:41:35
2023-08-08T09:39:53
10,559
290
51
18
Java
false
false
/* * Copyright 2020 LINE Corporation * * LINE Corporation 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: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.linecorp.decaton.processor.runtime; import java.util.Optional; /** * Represents interface of suppliers that provides a {@link Property} accordingly to the * {@link PropertyDefinition} passed as an argument. */ @FunctionalInterface public interface PropertySupplier { /** * Returns a {@link Property} associated to the given {@link PropertyDefinition} in underlying system. * * @param definition the {@link PropertyDefinition} of the property wants to bind to the returned * {@link Property}. * @param <T> the type of the property * @return a {@link Property} associated to the value provided by underlying system. */ <T> Optional<Property<T>> getProperty(PropertyDefinition<T> definition); }
UTF-8
Java
1,387
java
PropertySupplier.java
Java
[]
null
[]
/* * Copyright 2020 LINE Corporation * * LINE Corporation 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: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package com.linecorp.decaton.processor.runtime; import java.util.Optional; /** * Represents interface of suppliers that provides a {@link Property} accordingly to the * {@link PropertyDefinition} passed as an argument. */ @FunctionalInterface public interface PropertySupplier { /** * Returns a {@link Property} associated to the given {@link PropertyDefinition} in underlying system. * * @param definition the {@link PropertyDefinition} of the property wants to bind to the returned * {@link Property}. * @param <T> the type of the property * @return a {@link Property} associated to the value provided by underlying system. */ <T> Optional<Property<T>> getProperty(PropertyDefinition<T> definition); }
1,387
0.731795
0.726027
36
37.527779
34.260834
106
false
false
0
0
0
0
0
0
0.222222
false
false
6
5ebff6a33cec27c5c66c2cfd1726140ecc18c4f6
14,353,780,746,403
d444387afb50418b60e36aceb7714f2ea049a150
/src/main/java/io/github/jaredpetersen/kafkaconnectredis/sink/writer/record/RedisSetCommand.java
9cfbfbd711b08e3ad43c2544dc8b71766eca644e
[ "MIT" ]
permissive
greentealc/kafka-connect-redis
https://github.com/greentealc/kafka-connect-redis
a0e9f8f24920e26f498c7d7287309f25dd10e465
69baf7156a160ff83ddd291dcec06bc8297c6cff
refs/heads/main
2023-06-23T17:13:28.136000
2021-07-23T06:18:13
2021-07-23T06:18:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.jaredpetersen.kafkaconnectredis.sink.writer.record; import lombok.Builder; import lombok.Value; @Value @Builder public class RedisSetCommand implements RedisCommand { Command command = Command.SET; Payload payload; @Value @lombok.Builder public static class Payload { public enum Condition { NX, XX } String key; String value; Expiration expiration; Condition condition; @Value @lombok.Builder public static class Expiration { public enum Type { EX, PX, KEEPTTL } Type type; long time; } } }
UTF-8
Java
582
java
RedisSetCommand.java
Java
[ { "context": "package io.github.jaredpetersen.kafkaconnectredis.sink.writer.record;\n\nimport lom", "end": 31, "score": 0.9996271133422852, "start": 18, "tag": "USERNAME", "value": "jaredpetersen" } ]
null
[]
package io.github.jaredpetersen.kafkaconnectredis.sink.writer.record; import lombok.Builder; import lombok.Value; @Value @Builder public class RedisSetCommand implements RedisCommand { Command command = Command.SET; Payload payload; @Value @lombok.Builder public static class Payload { public enum Condition { NX, XX } String key; String value; Expiration expiration; Condition condition; @Value @lombok.Builder public static class Expiration { public enum Type { EX, PX, KEEPTTL } Type type; long time; } } }
582
0.694158
0.694158
31
17.774193
16.71335
69
false
false
0
0
0
0
0
0
0.451613
false
false
6
0e64eb3f4d51b824d33acb620d3d8a5bf512f150
20,675,972,573,545
808050ad2010c3db4e8e5d9b87b2f43811eff68b
/src/main/java/com/vue/cms/entity/PageResult.java
500f128b6442e1f9ae7538d4368c17426b7586ee
[]
no_license
HsuHans/practice-vuejs
https://github.com/HsuHans/practice-vuejs
89f8f526fd123fcbd00b98caf78c937c5226f3d0
0ba98b3530d5de3b77e543083142e531ae6d3fd0
refs/heads/master
2022-12-13T04:02:20.045000
2020-03-25T06:31:11
2020-03-25T06:31:11
246,904,107
0
0
null
false
2022-12-05T13:08:05
2020-03-12T18:25:46
2020-03-25T06:31:22
2022-12-05T13:08:04
17,109
0
0
13
JavaScript
false
false
package com.vue.cms.entity; import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; public class PageResult<T> implements Serializable { private static final long serialVersionUID = 1L; protected int totalPage; protected int currentPage; protected long totalRecord; protected int start; protected int end; protected int size; protected List<T> rows; public PageResult() { super(); rows = new ArrayList<T>(); } public PageResult(List<T> result) { this.currentPage = 1; this.totalPage = 1; this.totalRecord = result.size(); this.size = result.size(); this.rows = result; this.start = this.size * (this.currentPage - 1) + 1; this.end = this.size * (currentPage - 1) + rows.size(); } public PageResult(List<T> rows, int currpage, int rangeSize) { this.currentPage = currpage + 1; // 目前分頁數 (0 - n) this.totalRecord = rows.size();// 總筆數 this.totalPage = (int) Math.ceil(new BigDecimal(this.totalRecord) .divide(new BigDecimal(this.size), 3, BigDecimal.ROUND_UP).doubleValue()); // 總頁數 this.size = rangeSize; // 每頁筆數 this.start = rangeSize * (this.currentPage - 1) + 1; this.end = Math.min(rangeSize * (this.currentPage - 1) + rangeSize, rows.size()); this.rows = new ArrayList<T>(); if (this.currentPage == this.totalPage) { int lastIdx = (int) this.totalRecord - 1; if (this.totalRecord == this.start) { this.rows.add(rows.get(lastIdx)); } else { for (int i = (start - 1); i <= lastIdx; i++) { this.rows.add(rows.get(i)); } } } else { if (rows != null && rows.size() > 0) { for (int i = (start - 1); i <= (end - 1); i++) { this.rows.add(rows.get(i)); } } } } public PageResult(List<T> rows, int currentPage, int size, long totalRecord){ this.rows = rows; this.currentPage = currentPage; this.totalRecord = totalRecord; // 總筆數 this.size = size; // 每頁筆數 if(totalRecord > 0){ this.totalPage = (int)Math.ceil(new BigDecimal(totalRecord).divide(new BigDecimal(this.size), 3 , BigDecimal.ROUND_UP).doubleValue()); // 總頁數 this.start = size * (currentPage - 1) + 1; this.end = rows.size() > 0 ? start + rows.size() -1 : start; }else{ this.totalPage = 0; this.start = 0; this.end = 0; } } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public long getTotalRecord() { return totalRecord; } public void setTotalRecord(long totalRecord) { this.totalRecord = totalRecord; } public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(int end) { this.end = end; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public List<T> getRows() { return rows; } public void setRows(List<T> rows) { this.rows = rows; } }
UTF-8
Java
3,154
java
PageResult.java
Java
[]
null
[]
package com.vue.cms.entity; import java.io.Serializable; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; public class PageResult<T> implements Serializable { private static final long serialVersionUID = 1L; protected int totalPage; protected int currentPage; protected long totalRecord; protected int start; protected int end; protected int size; protected List<T> rows; public PageResult() { super(); rows = new ArrayList<T>(); } public PageResult(List<T> result) { this.currentPage = 1; this.totalPage = 1; this.totalRecord = result.size(); this.size = result.size(); this.rows = result; this.start = this.size * (this.currentPage - 1) + 1; this.end = this.size * (currentPage - 1) + rows.size(); } public PageResult(List<T> rows, int currpage, int rangeSize) { this.currentPage = currpage + 1; // 目前分頁數 (0 - n) this.totalRecord = rows.size();// 總筆數 this.totalPage = (int) Math.ceil(new BigDecimal(this.totalRecord) .divide(new BigDecimal(this.size), 3, BigDecimal.ROUND_UP).doubleValue()); // 總頁數 this.size = rangeSize; // 每頁筆數 this.start = rangeSize * (this.currentPage - 1) + 1; this.end = Math.min(rangeSize * (this.currentPage - 1) + rangeSize, rows.size()); this.rows = new ArrayList<T>(); if (this.currentPage == this.totalPage) { int lastIdx = (int) this.totalRecord - 1; if (this.totalRecord == this.start) { this.rows.add(rows.get(lastIdx)); } else { for (int i = (start - 1); i <= lastIdx; i++) { this.rows.add(rows.get(i)); } } } else { if (rows != null && rows.size() > 0) { for (int i = (start - 1); i <= (end - 1); i++) { this.rows.add(rows.get(i)); } } } } public PageResult(List<T> rows, int currentPage, int size, long totalRecord){ this.rows = rows; this.currentPage = currentPage; this.totalRecord = totalRecord; // 總筆數 this.size = size; // 每頁筆數 if(totalRecord > 0){ this.totalPage = (int)Math.ceil(new BigDecimal(totalRecord).divide(new BigDecimal(this.size), 3 , BigDecimal.ROUND_UP).doubleValue()); // 總頁數 this.start = size * (currentPage - 1) + 1; this.end = rows.size() > 0 ? start + rows.size() -1 : start; }else{ this.totalPage = 0; this.start = 0; this.end = 0; } } public int getTotalPage() { return totalPage; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getCurrentPage() { return currentPage; } public void setCurrentPage(int currentPage) { this.currentPage = currentPage; } public long getTotalRecord() { return totalRecord; } public void setTotalRecord(long totalRecord) { this.totalRecord = totalRecord; } public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getEnd() { return end; } public void setEnd(int end) { this.end = end; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } public List<T> getRows() { return rows; } public void setRows(List<T> rows) { this.rows = rows; } }
3,154
0.654317
0.645941
136
21.82353
22.351761
144
false
false
0
0
0
0
0
0
1.955882
false
false
6
3c382a9a508a0ed4772aa33b3c85383f1c61bdc4
7,619,272,036,045
d0d7b7869811cbae80d95181e84fd22c75ac5354
/platforms/src/dfdictionary/io/DFObjectParser.java
658cfea48db81f9f96e6e3dd2c507b1a4ac6df98
[]
no_license
tvarney/dfle
https://github.com/tvarney/dfle
5e74f8bea1e5050e4d74a0e1d675d0fdd6f94919
e2866824d352ab294a26dab8fd71eb98d41d4ddf
refs/heads/master
2021-01-15T13:48:47.806000
2013-07-03T00:55:10
2013-07-03T00:55:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dfdictionary.io; import dfdictionary.object.DFObject; import dfdictionary.object.DFSymbol; import dfdictionary.object.DFTag; import dfdictionary.object.DFWord; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.util.LinkedList; import java.util.List; /** * * @author tvarney */ public class DFObjectParser { protected BufferedReader reader; protected String obj_type; protected DFTag[] tags; protected int offset; protected long line_num; public DFObjectParser(String fname) throws FileNotFoundException { this(new File(fname)); } public DFObjectParser(File f) throws FileNotFoundException { this(new FileReader(f)); } public DFObjectParser(Reader reader) { this(new BufferedReader(reader)); } public DFObjectParser(BufferedReader reader) { this.reader = reader; offset = 0; line_num = 0; obj_type = null; tags = null; } protected void getObjType() throws IOException { String line; while(tags == null && (line = reader.readLine()) != null) { tags = DFTag.getTags(line); line_num++; } offset = 0; if(!tags[offset].tag.equals(DFTag.OBJ)) { /* Syntax error */ } if(tags[offset].data == null) { throw new SyntaxException("No Object data", line_num); } /*TODO: Log extra data error on object tag */ obj_type = tags[offset].data[0]; //System.out.printf("Object Type: %s\n", obj_type); } public DFObject next() throws IOException { DFObject obj; List<DFTag> data; DFTag nt; if(obj_type == null) { getObjType(); if(!obj_type.equals(DFTag.LANG_OBJ)) { //System.err.printf("Error parsing object type\n"); return null; } } obj = null; data = new LinkedList<DFTag>(); while(obj == null && (nt = nextTag()) != null) { if(nt.tag.equals(DFTag.WORD)) { obj = new DFWord(nt.data[0]); }else if(nt.tag.equals(DFTag.SYMBOL)) { obj = new DFSymbol(nt.data[0]); }else { /* Syntax Error */ } } if(obj == null) return null; while((nt = nextTag()) != null) { if(nt.tag.equals(DFTag.WORD) || nt.tag.equals(DFTag.SYMBOL)) { offset--; //< Go back so we get the same tag next time break; } data.add(nt); } DFTag[] blah = new DFTag[data.size()]; if(data == null) { System.err.printf("data is null\n"); System.err.flush(); }else if(blah == null) { System.err.printf("blah is null\n"); System.err.flush(); } if(obj != null) { obj.set(data.toArray(blah)); }else { System.err.printf("Object is null?!?\n"); } return obj; } protected DFTag nextTag() throws IOException { String line; if(tags == null || offset >= tags.length) { tags = null; offset = 0; do { line = reader.readLine(); if(line == null) { return null; } tags = DFTag.getTags(line); } while(tags == null); } offset++; return tags[offset - 1]; } public void close() { try { reader.close(); obj_type = null; tags = null; offset = 0; }catch(Exception e) { } } }
UTF-8
Java
4,071
java
DFObjectParser.java
Java
[ { "context": "kedList;\nimport java.util.List;\n\n/**\n *\n * @author tvarney\n */\npublic class DFObjectParser {\n protected B", "end": 517, "score": 0.99947190284729, "start": 510, "tag": "USERNAME", "value": "tvarney" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dfdictionary.io; import dfdictionary.object.DFObject; import dfdictionary.object.DFSymbol; import dfdictionary.object.DFTag; import dfdictionary.object.DFWord; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.util.LinkedList; import java.util.List; /** * * @author tvarney */ public class DFObjectParser { protected BufferedReader reader; protected String obj_type; protected DFTag[] tags; protected int offset; protected long line_num; public DFObjectParser(String fname) throws FileNotFoundException { this(new File(fname)); } public DFObjectParser(File f) throws FileNotFoundException { this(new FileReader(f)); } public DFObjectParser(Reader reader) { this(new BufferedReader(reader)); } public DFObjectParser(BufferedReader reader) { this.reader = reader; offset = 0; line_num = 0; obj_type = null; tags = null; } protected void getObjType() throws IOException { String line; while(tags == null && (line = reader.readLine()) != null) { tags = DFTag.getTags(line); line_num++; } offset = 0; if(!tags[offset].tag.equals(DFTag.OBJ)) { /* Syntax error */ } if(tags[offset].data == null) { throw new SyntaxException("No Object data", line_num); } /*TODO: Log extra data error on object tag */ obj_type = tags[offset].data[0]; //System.out.printf("Object Type: %s\n", obj_type); } public DFObject next() throws IOException { DFObject obj; List<DFTag> data; DFTag nt; if(obj_type == null) { getObjType(); if(!obj_type.equals(DFTag.LANG_OBJ)) { //System.err.printf("Error parsing object type\n"); return null; } } obj = null; data = new LinkedList<DFTag>(); while(obj == null && (nt = nextTag()) != null) { if(nt.tag.equals(DFTag.WORD)) { obj = new DFWord(nt.data[0]); }else if(nt.tag.equals(DFTag.SYMBOL)) { obj = new DFSymbol(nt.data[0]); }else { /* Syntax Error */ } } if(obj == null) return null; while((nt = nextTag()) != null) { if(nt.tag.equals(DFTag.WORD) || nt.tag.equals(DFTag.SYMBOL)) { offset--; //< Go back so we get the same tag next time break; } data.add(nt); } DFTag[] blah = new DFTag[data.size()]; if(data == null) { System.err.printf("data is null\n"); System.err.flush(); }else if(blah == null) { System.err.printf("blah is null\n"); System.err.flush(); } if(obj != null) { obj.set(data.toArray(blah)); }else { System.err.printf("Object is null?!?\n"); } return obj; } protected DFTag nextTag() throws IOException { String line; if(tags == null || offset >= tags.length) { tags = null; offset = 0; do { line = reader.readLine(); if(line == null) { return null; } tags = DFTag.getTags(line); } while(tags == null); } offset++; return tags[offset - 1]; } public void close() { try { reader.close(); obj_type = null; tags = null; offset = 0; }catch(Exception e) { } } }
4,071
0.503562
0.501351
154
25.435064
16.754889
74
false
false
0
0
0
0
0
0
0.493506
false
false
6
8b88ba4ffaf2f429d1755402ee31c96e1e190816
10,041,633,597,180
887ed3047fa4b50763919bfdd7d4d3b88da5de9a
/Spring-AOP/src/main/java/com/test/springAOP/config/MyAspect.java
f3729bdab7bb3c42ca5a6cc835ab39ad4073a751
[]
no_license
JolyouLu/Spring-study
https://github.com/JolyouLu/Spring-study
97c8db2fcb20197256cc75ce1c48874920077d2b
f07e672fdf14664182d7c0ec94b61704ac51dae1
refs/heads/master
2022-07-07T02:05:23.098000
2020-04-17T01:08:37
2020-04-17T01:08:37
231,781,068
0
0
null
false
2022-06-21T02:34:38
2020-01-04T14:59:23
2020-04-17T01:08:40
2022-06-21T02:34:34
31
0
0
4
Java
false
false
package com.test.springAOP.config; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.stereotype.Component; /** * @Author: LZJ * @Date: 2020/1/29 17:15 * @Version 1.0 */ @Aspect //声明一个切面 @Component public class MyAspect { //@Pointcut定义一个切点,切入到哪里 execution最小可以指定到 方法返回参数传入参数 @Pointcut("execution(* com.test.springAOP.dao.Dao.*(..))") public void pointCutExecution(){} //within 最小可以指定到类 @Pointcut("within(com.test.springAOP.dao.*)") public void pointCutWithin(){} //args 入参为String和Integer的方法会被切入 @Pointcut("args(java.lang.String,java.lang.Integer)") public void pointCutArgs(){} //this 如果从spring拿出的对象是目标对象IndexDao 就切入 即使用了CGlib代理的bean @Pointcut("this(com.test.springAOP.dao.IndexDao)") public void pointCutThis(){} //target 如果从spring拿出的对象是IndexDao的代理对象 就切入 即使用了jdk动态代理的bean @Pointcut("target(com.test.springAOP.dao.IndexDao)") public void pointCutTarget(){} //@annotation 有MyAnno的方法 这个注解会被切入 @Pointcut("@annotation(com.test.springAOP.anno.MyAnno)") public void pointCutAtAnnotation(){} //@within 有MyAnno的类上 这个注解会被切入 @Pointcut("@within(com.test.springAOP.anno.MyAnno)") public void pointCutAtWithin(){} //在连接点方法之前加入该通知 @Before("pointCutThis()") public void before(){ System.out.println("before"); } //在连接点方法之后加入该通知 @After("pointCutThis()") public void after(){ System.out.println("after"); } //在连接点方法抛异常后前加入该通知 @AfterThrowing("pointCutThis()") public void afterThrowing(){ System.out.println("afterThrowing"); } //在连接点方法之后加入该通知 正常执行完毕后会执行 @AfterReturning("pointCutThis()") public void afterReturning(){ System.out.println("afterReturning"); } //在连接点方法之前加入该通知 @Before("pointCutThis()") public void before(JoinPoint joinPoint){ //joinPoint 可以获取当前切入点的对象 Object[] args = joinPoint.getArgs(); System.out.println(args); } //环绕通知 @Around("pointCutThis()") public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { //proceedingJoinPoint 用于环绕通知proceedingJoinPoint.proceed()执行对象方法 System.out.println("start"); Object retVal = proceedingJoinPoint.proceed(); System.out.println("end"); return retVal; } }
UTF-8
Java
2,870
java
MyAspect.java
Java
[ { "context": "ngframework.stereotype.Component;\n\n/**\n * @Author: LZJ\n * @Date: 2020/1/29 17:15\n * @Version 1.0\n */\n@As", "end": 223, "score": 0.9996705651283264, "start": 220, "tag": "USERNAME", "value": "LZJ" } ]
null
[]
package com.test.springAOP.config; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.stereotype.Component; /** * @Author: LZJ * @Date: 2020/1/29 17:15 * @Version 1.0 */ @Aspect //声明一个切面 @Component public class MyAspect { //@Pointcut定义一个切点,切入到哪里 execution最小可以指定到 方法返回参数传入参数 @Pointcut("execution(* com.test.springAOP.dao.Dao.*(..))") public void pointCutExecution(){} //within 最小可以指定到类 @Pointcut("within(com.test.springAOP.dao.*)") public void pointCutWithin(){} //args 入参为String和Integer的方法会被切入 @Pointcut("args(java.lang.String,java.lang.Integer)") public void pointCutArgs(){} //this 如果从spring拿出的对象是目标对象IndexDao 就切入 即使用了CGlib代理的bean @Pointcut("this(com.test.springAOP.dao.IndexDao)") public void pointCutThis(){} //target 如果从spring拿出的对象是IndexDao的代理对象 就切入 即使用了jdk动态代理的bean @Pointcut("target(com.test.springAOP.dao.IndexDao)") public void pointCutTarget(){} //@annotation 有MyAnno的方法 这个注解会被切入 @Pointcut("@annotation(com.test.springAOP.anno.MyAnno)") public void pointCutAtAnnotation(){} //@within 有MyAnno的类上 这个注解会被切入 @Pointcut("@within(com.test.springAOP.anno.MyAnno)") public void pointCutAtWithin(){} //在连接点方法之前加入该通知 @Before("pointCutThis()") public void before(){ System.out.println("before"); } //在连接点方法之后加入该通知 @After("pointCutThis()") public void after(){ System.out.println("after"); } //在连接点方法抛异常后前加入该通知 @AfterThrowing("pointCutThis()") public void afterThrowing(){ System.out.println("afterThrowing"); } //在连接点方法之后加入该通知 正常执行完毕后会执行 @AfterReturning("pointCutThis()") public void afterReturning(){ System.out.println("afterReturning"); } //在连接点方法之前加入该通知 @Before("pointCutThis()") public void before(JoinPoint joinPoint){ //joinPoint 可以获取当前切入点的对象 Object[] args = joinPoint.getArgs(); System.out.println(args); } //环绕通知 @Around("pointCutThis()") public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { //proceedingJoinPoint 用于环绕通知proceedingJoinPoint.proceed()执行对象方法 System.out.println("start"); Object retVal = proceedingJoinPoint.proceed(); System.out.println("end"); return retVal; } }
2,870
0.682196
0.676789
88
26.318182
20.474789
84
false
false
0
0
0
0
0
0
0.181818
false
false
6
ee4db544596f03b11e4a509be429442a0e0ce352
18,485,539,269,638
f4fd2a30e389bc0b76b52c0426b8076abcdc2b59
/src/main/java/NLPUtils/utils/DEPTreeUtils.java
f227b9d0148e56ab173161b8d7184cf126c83029
[ "Apache-2.0" ]
permissive
henryYHC/NLPUtils
https://github.com/henryYHC/NLPUtils
529138a438030368e61d5ac5f3fa75abacf07b03
5bb60ac063d55816fc9ff1b0e1e7cd521464fa12
refs/heads/master
2018-01-09T12:00:21.028000
2015-11-24T21:23:39
2015-11-24T21:23:39
44,750,543
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright 2015, Emory University * * 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 NLPUtils.utils; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import edu.emory.clir.clearnlp.dependency.DEPLibEn; import edu.emory.clir.clearnlp.dependency.DEPNode; import edu.emory.clir.clearnlp.ner.BILOU; import edu.emory.clir.clearnlp.pos.POSLibEn; import edu.emory.clir.clearnlp.util.DSUtils; /** * @author Yu-Hsin(Henry) Chen ({@code yu-hsin.chen@emory.edu}) * @version 1.0 * @since Oct 23, 2015 */ public class DEPTreeUtils { public static final String DEPModSuffix = "mod"; public static final String ignoredBILOUTag = BILOU.O.toString(); public static final Set<String> ignoredWordForm = DSUtils.toHashSet("—", "’s", "n’t", "'", "-", "_", ",", "(", ")", "\"", ".", ":"); public static final Set<String> ignoredDEPLabels = DSUtils.toHashSet(DEPLibEn.DEP_APPOS, DEPLibEn.DEP_PUNCT, DEPLibEn.DEP_AUX, DEPLibEn.DEP_RELCL, DEPLibEn.DEP_POSS, DEPLibEn.DEP_DET, DEPLibEn.DEP_CASE); public static List<DEPNode> stripSubTree(List<DEPNode> l_subNodes){ DEPNode node; Set<DEPNode> removingHeadNodes = new HashSet<>(); for(int i = l_subNodes.size()-1; i >= 0; i--){ node = l_subNodes.get(i); // Remove selected DEP Labels if(!node.isLabel(DEPLibEn.DEP_COMPOUND)) removingHeadNodes.addAll(node.getDependentListByLabel(ignoredDEPLabels)); // Remove selected word forms & modifiers if(ignoredWordForm.contains(node.getLowerSimplifiedWordForm()) || POSLibEn.isAdjective(node.getPOSTag())) l_subNodes.remove(i); } if(!removingHeadNodes.isEmpty()) for(DEPNode n : removingHeadNodes) l_subNodes.removeAll(n.getSubNodeSet()); return l_subNodes; } public static DEPNode getHead(List<DEPNode> nodes){ if(nodes.size() > 0){ Set<Integer> s_ids = nodes.stream().map(n -> n.getID()).collect(Collectors.toSet()); for(DEPNode n : nodes) if(!s_ids.contains(n.getHead().getID())) return n; } return null; } }
UTF-8
Java
2,581
java
DEPTreeUtils.java
Java
[ { "context": "mory.clir.clearnlp.util.DSUtils;\n\n/**\n * @author \tYu-Hsin(Henry) Chen ({@code yu-hsin.chen@emory.edu})\n * @version\t1.0\n", "end": 1009, "score": 0.9751262664794922, "start": 990, "tag": "NAME", "value": "Yu-Hsin(Henry) Chen" }, { "context": "tils;\n\n/**\n * @author \tYu-Hsin(Henry) Chen ({@code yu-hsin.chen@emory.edu})\n * @version\t1.0\n * @since \tOct 23, 2015\n */\npub", "end": 1040, "score": 0.9999294877052307, "start": 1018, "tag": "EMAIL", "value": "yu-hsin.chen@emory.edu" } ]
null
[]
/** * Copyright 2015, Emory University * * 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 NLPUtils.utils; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import edu.emory.clir.clearnlp.dependency.DEPLibEn; import edu.emory.clir.clearnlp.dependency.DEPNode; import edu.emory.clir.clearnlp.ner.BILOU; import edu.emory.clir.clearnlp.pos.POSLibEn; import edu.emory.clir.clearnlp.util.DSUtils; /** * @author <NAME> ({@code <EMAIL>}) * @version 1.0 * @since Oct 23, 2015 */ public class DEPTreeUtils { public static final String DEPModSuffix = "mod"; public static final String ignoredBILOUTag = BILOU.O.toString(); public static final Set<String> ignoredWordForm = DSUtils.toHashSet("—", "’s", "n’t", "'", "-", "_", ",", "(", ")", "\"", ".", ":"); public static final Set<String> ignoredDEPLabels = DSUtils.toHashSet(DEPLibEn.DEP_APPOS, DEPLibEn.DEP_PUNCT, DEPLibEn.DEP_AUX, DEPLibEn.DEP_RELCL, DEPLibEn.DEP_POSS, DEPLibEn.DEP_DET, DEPLibEn.DEP_CASE); public static List<DEPNode> stripSubTree(List<DEPNode> l_subNodes){ DEPNode node; Set<DEPNode> removingHeadNodes = new HashSet<>(); for(int i = l_subNodes.size()-1; i >= 0; i--){ node = l_subNodes.get(i); // Remove selected DEP Labels if(!node.isLabel(DEPLibEn.DEP_COMPOUND)) removingHeadNodes.addAll(node.getDependentListByLabel(ignoredDEPLabels)); // Remove selected word forms & modifiers if(ignoredWordForm.contains(node.getLowerSimplifiedWordForm()) || POSLibEn.isAdjective(node.getPOSTag())) l_subNodes.remove(i); } if(!removingHeadNodes.isEmpty()) for(DEPNode n : removingHeadNodes) l_subNodes.removeAll(n.getSubNodeSet()); return l_subNodes; } public static DEPNode getHead(List<DEPNode> nodes){ if(nodes.size() > 0){ Set<Integer> s_ids = nodes.stream().map(n -> n.getID()).collect(Collectors.toSet()); for(DEPNode n : nodes) if(!s_ids.contains(n.getHead().getID())) return n; } return null; } }
2,553
0.706796
0.699417
70
35.785713
36.721691
223
false
false
0
0
0
0
0
0
2.2
false
false
6
73ae0aa2d677deb1edaf17e841e78dc8a72ac88f
36,481,452,216,016
ac3a7a8d120d4e281431329c8c9d388fcfb94342
/src/test/java/com/leetcode/algorithm/hard/besttimetobuyandsellstockiv/SolutionTest.java
3f1ed6a13301aaa9e2cdef80c5058ad1a234f8a9
[ "MIT" ]
permissive
paulxi/LeetCodeJava
https://github.com/paulxi/LeetCodeJava
c69014c24cda48f80a25227b7ac09c6c5d6cfadc
10b4430629314c7cfedaae02c7dc4c2318ea6256
refs/heads/master
2021-04-03T08:03:16.305000
2021-03-02T06:20:24
2021-03-02T06:20:24
125,126,097
3
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.leetcode.algorithm.hard.besttimetobuyandsellstockiv; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class SolutionTest { @Test public void testCase1() { Solution solution = new Solution(); assertEquals(2, solution.maxProfit(2, new int[] {2, 4, 1})); } @Test public void testCase2() { Solution solution = new Solution(); assertEquals(7, solution.maxProfit(2, new int[] {3, 2, 6, 5, 0, 3})); } }
UTF-8
Java
494
java
SolutionTest.java
Java
[]
null
[]
package com.leetcode.algorithm.hard.besttimetobuyandsellstockiv; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class SolutionTest { @Test public void testCase1() { Solution solution = new Solution(); assertEquals(2, solution.maxProfit(2, new int[] {2, 4, 1})); } @Test public void testCase2() { Solution solution = new Solution(); assertEquals(7, solution.maxProfit(2, new int[] {3, 2, 6, 5, 0, 3})); } }
494
0.696356
0.665992
19
25
24.865957
73
false
false
0
0
0
0
0
0
0.947368
false
false
6
61430cd3482c7debe856bf99af911dc0825be4ac
36,481,452,215,683
edbb3c799d6cf25aab13b81190b9c88e8d8a0ed5
/src/test/java/com/danavalerie/util/ref/RefTest.java
0d8132b28d796044dcf0be2c0107b57e695518fe
[ "Apache-2.0" ]
permissive
DanaValerie/dana-util
https://github.com/DanaValerie/dana-util
a07c8df79b02142fff22f9257299ad800a14c88c
a12ed200d08d290926b020c3ceb7a7e243493720
refs/heads/master
2021-01-18T23:08:18.505000
2017-12-03T02:02:00
2017-12-03T02:02:00
87,091,583
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.danavalerie.util.ref; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class RefTest { @Test public void testRef() { final Ref<String> ref = new Ref<>(); assertThat(ref.get()).isNull(); ref.set("foo"); assertThat(ref.get()).isEqualTo("foo"); ref.set("bar"); assertThat(ref.get()).isEqualTo("bar"); ref.set(null); assertThat(ref.get()).isNull(); ref.set("baz"); assertThat(ref.get()).isEqualTo("baz"); } }
UTF-8
Java
553
java
RefTest.java
Java
[]
null
[]
package com.danavalerie.util.ref; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class RefTest { @Test public void testRef() { final Ref<String> ref = new Ref<>(); assertThat(ref.get()).isNull(); ref.set("foo"); assertThat(ref.get()).isEqualTo("foo"); ref.set("bar"); assertThat(ref.get()).isEqualTo("bar"); ref.set(null); assertThat(ref.get()).isNull(); ref.set("baz"); assertThat(ref.get()).isEqualTo("baz"); } }
553
0.582278
0.582278
23
23.043478
18.183792
57
false
false
0
0
0
0
0
0
0.565217
false
false
6
fb8cd37ac32901034e14ad27d2931338278b814e
23,691,039,631,713
86a79a38994251024cdcc43848cb691e3722f2f0
/src/main/java/com/example/web/global/entity/BaseEntity.java
8026010c16812d27063b8cea86f35bf36817d7f8
[]
no_license
DENEB1593/my-web
https://github.com/DENEB1593/my-web
c5db945158abcfc6a500146b0888ff7b5a65eb7e
be6bf2910649c0ffbf63dfc86721fbd7b39b7912
refs/heads/main
2023-08-23T11:27:19.561000
2021-10-11T14:04:15
2021-10-11T14:04:15
415,592,710
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.web.global.entity; import lombok.Getter; import java.time.LocalDateTime; @Getter public class BaseEntity { private LocalDateTime createdAt; private LocalDateTime updatedAt; private String deleteYn; }
UTF-8
Java
235
java
BaseEntity.java
Java
[]
null
[]
package com.example.web.global.entity; import lombok.Getter; import java.time.LocalDateTime; @Getter public class BaseEntity { private LocalDateTime createdAt; private LocalDateTime updatedAt; private String deleteYn; }
235
0.778723
0.778723
12
18.583334
15.146277
38
false
false
0
0
0
0
0
0
0.5
false
false
6
24552035b7d82c9941dd3ab5e1e7919f558d718c
14,276,471,347,596
398500cb87e08687348976ac84ea9c24a477e111
/O2OShop/src/com/jspgou/cms/dao/ShopConfigDao.java
12598513f9f6ff78c1e9522d0e92f5959c8cc29f
[]
no_license
jerryandjudy/sqo2o
https://github.com/jerryandjudy/sqo2o
d57764c017da7882591a1766e5c4804bf3af844d
a00822ee61227aa7e7a533182133bb349a272b2e
refs/heads/master
2020-05-20T19:23:19.362000
2016-01-19T03:57:24
2016-01-19T03:57:24
62,887,018
1
0
null
true
2016-07-08T12:27:51
2016-07-08T12:27:51
2016-01-19T02:47:28
2016-01-19T03:58:26
37,498
0
0
0
null
null
null
package com.jspgou.cms.dao; import com.jspgou.common.hibernate3.Updater; import com.jspgou.cms.entity.ShopConfig; /** * This class should preserve. * @preserve */ public interface ShopConfigDao { public ShopConfig findById(Long id); public ShopConfig save(ShopConfig bean); public ShopConfig updateByUpdater(Updater<ShopConfig> updater); public ShopConfig deleteById(Long id); }
UTF-8
Java
404
java
ShopConfigDao.java
Java
[]
null
[]
package com.jspgou.cms.dao; import com.jspgou.common.hibernate3.Updater; import com.jspgou.cms.entity.ShopConfig; /** * This class should preserve. * @preserve */ public interface ShopConfigDao { public ShopConfig findById(Long id); public ShopConfig save(ShopConfig bean); public ShopConfig updateByUpdater(Updater<ShopConfig> updater); public ShopConfig deleteById(Long id); }
404
0.752475
0.75
18
20.555555
20.174852
64
false
false
0
0
0
0
0
0
0.611111
false
false
6
f9bd28e797317114e9fc7ca925d6a3c674f09fd4
35,338,990,923,254
268228ab5dfddb3bba5e5248e4b2cb9e961d7e97
/src/main/java/com/intellij/aws/cloudformation/CloudFormationFileType.java
3caa209bf67f17b24bc43016711e3427307bbe3f
[ "Apache-2.0" ]
permissive
krishnan-mani/idea-cloudformation
https://github.com/krishnan-mani/idea-cloudformation
d8784426a5bf864cabec8ef79b186220efd8d7d8
21f5547f5972607cf814c192bd336e297b5c2ba5
refs/heads/master
2020-12-11T01:39:49.410000
2015-09-19T17:19:41
2015-09-19T17:19:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.intellij.aws.cloudformation; import com.google.common.base.Charsets; import com.intellij.icons.AllIcons; import com.intellij.json.JsonLanguage; import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile; import com.intellij.openapi.util.io.ByteSequence; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileSystem; import com.intellij.openapi.vfs.newvfs.FileSystemInterface; import com.intellij.openapi.vfs.newvfs.impl.StubVirtualFile; import com.intellij.util.Processor; import org.apache.commons.lang.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Collections; public class CloudFormationFileType extends LanguageFileType implements FileTypeIdentifiableByVirtualFile { public static final CloudFormationFileType INSTANCE = new CloudFormationFileType(); private static final String EXTENSION = "template"; private static final byte[] BYTES_TO_DETECT_CFN_FILE = CloudFormationSections.FormatVersion.getBytes(Charsets.US_ASCII); public CloudFormationFileType() { super(JsonLanguage.INSTANCE); } @NotNull @Override public String getName() { return "AWSCloudFormation"; } @NotNull @Override public String getDescription() { return "AWS CloudFormation templates"; } @NotNull @Override public String getDefaultExtension() { return ""; } @Nullable @Override public Icon getIcon() { return AllIcons.FileTypes.Json; } @Override public boolean isMyFileType(@NotNull VirtualFile file) { return CloudFormationFileType.EXTENSION.equalsIgnoreCase(file.getExtension()) && detectFromContent(file); } private boolean detectFromContent(@NotNull VirtualFile file) { if (file instanceof StubVirtualFile) { // Helps New -> File get correct file type return true; } VirtualFileSystem virtualFileSystem; try { virtualFileSystem = file.getFileSystem(); } catch (UnsupportedOperationException ignored) { return false; } if (!(virtualFileSystem instanceof FileSystemInterface)) { return false; } try { final FileSystemInterface fileSystem = (FileSystemInterface) virtualFileSystem; final InputStream inputStream = fileSystem.getInputStream(file); try { byte[] bytes = new byte[1024]; int n = inputStream.read(bytes, 0, bytes.length); return n > 0 && findArray(bytes, BYTES_TO_DETECT_CFN_FILE) >= 0; } finally { inputStream.close(); } } catch (IOException ignored) { return false; } } private static int findArray(byte[] array, byte[] subArray) { return Collections.indexOfSubList(Arrays.asList(ArrayUtils.toObject(array)), Arrays.asList(ArrayUtils.toObject(subArray))); } }
UTF-8
Java
3,026
java
CloudFormationFileType.java
Java
[]
null
[]
package com.intellij.aws.cloudformation; import com.google.common.base.Charsets; import com.intellij.icons.AllIcons; import com.intellij.json.JsonLanguage; import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile; import com.intellij.openapi.util.io.ByteSequence; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileSystem; import com.intellij.openapi.vfs.newvfs.FileSystemInterface; import com.intellij.openapi.vfs.newvfs.impl.StubVirtualFile; import com.intellij.util.Processor; import org.apache.commons.lang.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Collections; public class CloudFormationFileType extends LanguageFileType implements FileTypeIdentifiableByVirtualFile { public static final CloudFormationFileType INSTANCE = new CloudFormationFileType(); private static final String EXTENSION = "template"; private static final byte[] BYTES_TO_DETECT_CFN_FILE = CloudFormationSections.FormatVersion.getBytes(Charsets.US_ASCII); public CloudFormationFileType() { super(JsonLanguage.INSTANCE); } @NotNull @Override public String getName() { return "AWSCloudFormation"; } @NotNull @Override public String getDescription() { return "AWS CloudFormation templates"; } @NotNull @Override public String getDefaultExtension() { return ""; } @Nullable @Override public Icon getIcon() { return AllIcons.FileTypes.Json; } @Override public boolean isMyFileType(@NotNull VirtualFile file) { return CloudFormationFileType.EXTENSION.equalsIgnoreCase(file.getExtension()) && detectFromContent(file); } private boolean detectFromContent(@NotNull VirtualFile file) { if (file instanceof StubVirtualFile) { // Helps New -> File get correct file type return true; } VirtualFileSystem virtualFileSystem; try { virtualFileSystem = file.getFileSystem(); } catch (UnsupportedOperationException ignored) { return false; } if (!(virtualFileSystem instanceof FileSystemInterface)) { return false; } try { final FileSystemInterface fileSystem = (FileSystemInterface) virtualFileSystem; final InputStream inputStream = fileSystem.getInputStream(file); try { byte[] bytes = new byte[1024]; int n = inputStream.read(bytes, 0, bytes.length); return n > 0 && findArray(bytes, BYTES_TO_DETECT_CFN_FILE) >= 0; } finally { inputStream.close(); } } catch (IOException ignored) { return false; } } private static int findArray(byte[] array, byte[] subArray) { return Collections.indexOfSubList(Arrays.asList(ArrayUtils.toObject(array)), Arrays.asList(ArrayUtils.toObject(subArray))); } }
3,026
0.745208
0.742895
100
29.26
28.737299
127
false
false
0
0
0
0
0
0
0.48
false
false
6
720555d429719f159f37aed639b91cc23bde46ad
35,150,012,354,584
d646191a912ba7d145f12844abda4796b304ded9
/src/main/java/gof/web/ShopController.java
50f83c88232c636f75d4f7e80e7d6c13d50f1f9b
[]
no_license
Fozzzz/gof
https://github.com/Fozzzz/gof
f9bd26aadd90fb515c45afd0370a9f23bd71aa77
b9276bb7945eb0ca2438234cdaa245409cdaa6ac
refs/heads/master
2020-07-31T07:14:56.148000
2016-11-24T02:14:31
2016-11-24T02:14:31
73,605,865
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gof.web; import gof.entity.Page; import gof.entity.Shop; import gof.service.ShopService; import gof.service.impl.ShopServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpSession; import java.util.List; /** * Created by Administrator on 2016/11/15. */ @Controller public class ShopController { @Autowired private ShopService shopService; //前台部分 @RequestMapping("shop/get.action") public String get(Page page, Model model){ page.setPageNumber(4); page=shopService.get(page); model.addAttribute("page",page); return "../front/Second/Lj-Shop"; } //后台部分 @RequestMapping("/getShops.do") public String getBack(Model model,HttpSession session){ model.addAttribute("admin", session.getAttribute("admin")); List<Shop> shops=shopService.getBack(); model.addAttribute("shops",shops); model.addAttribute("subpage", "shop_list"); return "frame"; } @RequestMapping("/postShop.do") public String add1(Model model,HttpSession session){ model.addAttribute("admin", session.getAttribute("admin")); model.addAttribute("subpage", "shop_add"); return "frame"; } @RequestMapping("/postShop2.do") public String add(Shop shop,Model model,HttpSession session){ shopService.post(shop); return getBack(model,session); } //修改 @RequestMapping("/putShop.do") public String put1(Shop shop,Model model,HttpSession session){ model.addAttribute("admin", session.getAttribute("admin")); shop= shopService.getOne(shop); model.addAttribute("shop",shop); model.addAttribute("subpage", "shop_edit"); return "frame"; } @RequestMapping("/putShop2.do") public String edit(Shop shop,Model model,HttpSession session){ shopService.put(shop); return getBack(model,session); } @RequestMapping("/deleteShop.do") public String delete(Shop shop,Model model,HttpSession session){ shopService.delete(shop); return getBack(model,session); } }
UTF-8
Java
2,319
java
ShopController.java
Java
[ { "context": "Session;\nimport java.util.List;\n\n/**\n * Created by Administrator on 2016/11/15.\n */\n@Controller\n\npublic class Shop", "end": 447, "score": 0.8419229984283447, "start": 434, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package gof.web; import gof.entity.Page; import gof.entity.Shop; import gof.service.ShopService; import gof.service.impl.ShopServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpSession; import java.util.List; /** * Created by Administrator on 2016/11/15. */ @Controller public class ShopController { @Autowired private ShopService shopService; //前台部分 @RequestMapping("shop/get.action") public String get(Page page, Model model){ page.setPageNumber(4); page=shopService.get(page); model.addAttribute("page",page); return "../front/Second/Lj-Shop"; } //后台部分 @RequestMapping("/getShops.do") public String getBack(Model model,HttpSession session){ model.addAttribute("admin", session.getAttribute("admin")); List<Shop> shops=shopService.getBack(); model.addAttribute("shops",shops); model.addAttribute("subpage", "shop_list"); return "frame"; } @RequestMapping("/postShop.do") public String add1(Model model,HttpSession session){ model.addAttribute("admin", session.getAttribute("admin")); model.addAttribute("subpage", "shop_add"); return "frame"; } @RequestMapping("/postShop2.do") public String add(Shop shop,Model model,HttpSession session){ shopService.post(shop); return getBack(model,session); } //修改 @RequestMapping("/putShop.do") public String put1(Shop shop,Model model,HttpSession session){ model.addAttribute("admin", session.getAttribute("admin")); shop= shopService.getOne(shop); model.addAttribute("shop",shop); model.addAttribute("subpage", "shop_edit"); return "frame"; } @RequestMapping("/putShop2.do") public String edit(Shop shop,Model model,HttpSession session){ shopService.put(shop); return getBack(model,session); } @RequestMapping("/deleteShop.do") public String delete(Shop shop,Model model,HttpSession session){ shopService.delete(shop); return getBack(model,session); } }
2,319
0.680731
0.675076
76
29.25
21.31723
68
false
false
0
0
0
0
0
0
0.763158
false
false
6
61db5feef6686bb8f5d3c7da0936a0b5c8e6f0fc
10,230,612,128,956
a25fc3597759635bbcbb2150120f3ac79e8508dc
/crm/satchi-crm-core/src/main/java/com/fongwell/satchi/crm/core/order/domain/aggregate/Shipping.java
ad3467716ede975d7b19a006ce04dfbe30a67896
[]
no_license
yaozhiqiang1/gittest
https://github.com/yaozhiqiang1/gittest
f0f4b0c8a6f489776368e363276e392253afd9a6
7f8d40b335fab03d2679b9d144dfa4db2a63e1d0
refs/heads/master
2020-03-18T06:53:59.975000
2018-07-25T11:46:09
2018-07-25T11:46:09
134,420,378
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fongwell.satchi.crm.core.order.domain.aggregate; import com.fongwell.satchi.crm.core.customer.domain.value.AddressValue; import com.fongwell.satchi.crm.core.order.domain.value.ShippingState; import com.fongwell.satchi.crm.core.support.ddd.AbstractAggregateRoot; import javax.persistence.*; /** * Created by docker on 4/20/18. */ @Entity @Table(name = "crm_shipping", indexes = @Index(name = "crm_shipping_orderId_idx", columnList = "order_id")) public class Shipping extends AbstractAggregateRoot { @Column(name = "order_id") private long orderId; @Embedded @AttributeOverrides({ @AttributeOverride(name = "province", column = @Column(name = "province", length = 20)), @AttributeOverride(name = "city", column = @Column(name = "city", length = 20)), @AttributeOverride(name = "district", column = @Column(name = "district", length = 20)), @AttributeOverride(name = "address", column = @Column(name = "address")), @AttributeOverride(name = "postcode", column = @Column(name = "postcode", length = 10)) }) private AddressValue address; @Column(name = "customer_id") private long customerId; private String trackingNumber; private String trackingName; @Enumerated(EnumType.STRING) @Column(name = "state", length = 10) private ShippingState state; public Shipping(final long customerId, final long orderId, final AddressValue address) { this.customerId = customerId; this.address = address; this.orderId = orderId; state = ShippingState.pending; } Shipping() { } public void setState(final ShippingState state) { this.state = state; } public void setTrackingNumber(final String trackingNumber) { this.trackingNumber = trackingNumber; } public void setTrackingName(final String trackingName) { this.trackingName = trackingName; } }
UTF-8
Java
1,974
java
Shipping.java
Java
[ { "context": "t;\n\nimport javax.persistence.*;\n\n/**\n * Created by docker on 4/20/18.\n */\n@Entity\n@Table(name = \"crm_shippi", "end": 329, "score": 0.9986346364021301, "start": 323, "tag": "USERNAME", "value": "docker" } ]
null
[]
package com.fongwell.satchi.crm.core.order.domain.aggregate; import com.fongwell.satchi.crm.core.customer.domain.value.AddressValue; import com.fongwell.satchi.crm.core.order.domain.value.ShippingState; import com.fongwell.satchi.crm.core.support.ddd.AbstractAggregateRoot; import javax.persistence.*; /** * Created by docker on 4/20/18. */ @Entity @Table(name = "crm_shipping", indexes = @Index(name = "crm_shipping_orderId_idx", columnList = "order_id")) public class Shipping extends AbstractAggregateRoot { @Column(name = "order_id") private long orderId; @Embedded @AttributeOverrides({ @AttributeOverride(name = "province", column = @Column(name = "province", length = 20)), @AttributeOverride(name = "city", column = @Column(name = "city", length = 20)), @AttributeOverride(name = "district", column = @Column(name = "district", length = 20)), @AttributeOverride(name = "address", column = @Column(name = "address")), @AttributeOverride(name = "postcode", column = @Column(name = "postcode", length = 10)) }) private AddressValue address; @Column(name = "customer_id") private long customerId; private String trackingNumber; private String trackingName; @Enumerated(EnumType.STRING) @Column(name = "state", length = 10) private ShippingState state; public Shipping(final long customerId, final long orderId, final AddressValue address) { this.customerId = customerId; this.address = address; this.orderId = orderId; state = ShippingState.pending; } Shipping() { } public void setState(final ShippingState state) { this.state = state; } public void setTrackingNumber(final String trackingNumber) { this.trackingNumber = trackingNumber; } public void setTrackingName(final String trackingName) { this.trackingName = trackingName; } }
1,974
0.670213
0.662614
64
29.84375
31.266605
107
false
false
0
0
0
0
0
0
0.5625
false
false
6
dbd54525c93fcb8264ead05fe7d3c9a0914777f0
21,328,807,657,946
ec31a067e57992c0755e5e4c6ce81e9484e63d32
/src/map/Direction.java
b60cde9fecb2f0243e8170c283a10360e9fd2a1b
[]
no_license
sanaAyrml/AP_15
https://github.com/sanaAyrml/AP_15
865d203390d26961d9bdbc4d1ba6f6960edfc70b
8037dd7b0f193fe83155ab32bf400a0b73cd7729
refs/heads/master
2021-01-08T23:13:49.553000
2020-02-21T16:11:37
2020-02-21T16:11:37
242,171,135
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package map; import java.io.Serializable; public enum Direction implements Serializable{ UP, DOWN, RIGHT, LEFT, NONE, REACHED, DIE; }
UTF-8
Java
164
java
Direction.java
Java
[]
null
[]
package map; import java.io.Serializable; public enum Direction implements Serializable{ UP, DOWN, RIGHT, LEFT, NONE, REACHED, DIE; }
164
0.634146
0.634146
13
11.615385
12.060989
46
false
false
0
0
0
0
0
0
0.692308
false
false
6
e70f4b272a9e46348d54c7f530346c4845d84f2d
13,889,924,278,929
df27c703814794daddeed07e1ccb21b8a865b94d
/src/postOffice/Main.java
25783d30b3616b236ded6a372dc9606e5deefce6
[]
no_license
djokicpn/cs103
https://github.com/djokicpn/cs103
a139ba278719e7fbbe3f48f2fadf016ce13f490a
08a9a02bde0a2ea51f5f64d5264d7526a6d45015
refs/heads/master
2017-12-07T11:46:14.360000
2016-02-22T15:55:27
2016-02-22T15:55:27
52,285,006
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package postOffice; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import db.Customer; import javafx.application.Application; import javafx.stage.Stage; import moneyControl.BankAccountGUI; public class Main extends Application { public static void main(String[] args) { Application.launch(); } @Override public void start(Stage primaryStage) throws Exception { // new BankAccountGUI(new Stage()); new Gui(new Stage()); MyQue<Customer> s = new MyQue<>(); // SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); // Session session = sessionFactory.openSession(); // // List<Customer> listOfCustomers = session.createCriteria(Customer.class).list(); // for(Customer c : listOfCustomers) // s.enqueue(c); // // System.out.println(s); // // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); } }
UTF-8
Java
1,300
java
Main.java
Java
[]
null
[]
package postOffice; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import db.Customer; import javafx.application.Application; import javafx.stage.Stage; import moneyControl.BankAccountGUI; public class Main extends Application { public static void main(String[] args) { Application.launch(); } @Override public void start(Stage primaryStage) throws Exception { // new BankAccountGUI(new Stage()); new Gui(new Stage()); MyQue<Customer> s = new MyQue<>(); // SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); // Session session = sessionFactory.openSession(); // // List<Customer> listOfCustomers = session.createCriteria(Customer.class).list(); // for(Customer c : listOfCustomers) // s.enqueue(c); // // System.out.println(s); // // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); // s.dequeue(); // System.out.println(s); } }
1,300
0.669231
0.669231
57
20.807018
19.425467
90
false
false
0
0
0
0
0
0
1.631579
false
false
6
2ad87688fb608d2513701cbf8b29aeef3d3a013d
35,072,702,956,075
80c7018fc245aac5e292efd7821771b97767c1ef
/Battleships3/src/ships/BattleShip.java
d3354d04ea3042ce87aeb0512347524c6776f249
[]
no_license
BennRobinson/Battleships
https://github.com/BennRobinson/Battleships
3570457823ea19595b27753c4ad864b7dff26de8
edf4127c6d733bdc29ee815293a0285e57c1e870
refs/heads/master
2020-07-01T07:22:46.544000
2019-08-07T16:48:38
2019-08-07T16:48:38
201,088,383
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// package name package ships; // this class represents a BattleShip public class BattleShip extends Ship{ // Constructor public BattleShip() { super(4); } }
UTF-8
Java
200
java
BattleShip.java
Java
[]
null
[]
// package name package ships; // this class represents a BattleShip public class BattleShip extends Ship{ // Constructor public BattleShip() { super(4); } }
200
0.59
0.585
13
13.384615
12.487153
37
false
false
0
0
0
0
0
0
0.230769
false
false
6
5711cdd917143822e389f5f62214ff796dcb8283
19,516,331,404,009
8457e452b2ae66727bc6df2c1ac9d179f4da9cac
/src/TestHelper.java
ff133d7aabd0570a6b9c400205cbd55b3ebc7788
[]
no_license
Aleksandrooo/bookinguz
https://github.com/Aleksandrooo/bookinguz
45d9bcff377c5456e251fc9a7949fa3e696ddc9d
26db1893ec0b859fb8867329c6e5d3c6006eb705
refs/heads/master
2016-09-05T12:43:41.076000
2015-02-13T18:58:43
2015-02-13T18:58:43
30,660,586
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.junit.Assert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import java.util.List; /** * Created by user on 2/11/15. */ public class TestHelper { public static WebElement waitElement(String path) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { s = BaseTest.webDriver.findElements(By.xpath(path)).size(); if (BaseTest.webDriver.findElements(By.xpath(path)).size() > 0) { WebElement we = BaseTest.webDriver.findElements(By.xpath(path)).get(0); return we; } Thread.sleep(100); timepassed += 100; } Assert.fail(); return null; } public static List<WebElement> waitElements(String path) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { s = BaseTest.webDriver.findElements(By.xpath(path)).size(); if (BaseTest.webDriver.findElements(By.xpath(path)).size() > 0) { List<WebElement> we = BaseTest.webDriver.findElements(By.xpath(path)); return we; } Thread.sleep(100); timepassed += 100; } Assert.fail(); return null; } public static void waitValue(WebDriver webDriver, String path, String val) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { if (webDriver.findElements(By.xpath(path)).size() > 0) { WebElement we = webDriver.findElements(By.xpath(path)).get(0); if(val.equals(we.getAttribute("value"))) { return; } } Thread.sleep(100); timepassed += 100; } Assert.fail(); } public static void waitText(WebDriver webDriver, String path, String val) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { if (webDriver.findElements(By.xpath(path)).size() > 0) { WebElement we = webDriver.findElements(By.xpath(path)).get(0); if(val.equals(we.getText())) { return; } } Thread.sleep(100); timepassed += 100; } Assert.fail(); } }
UTF-8
Java
2,496
java
TestHelper.java
Java
[ { "context": "lement;\n\nimport java.util.List;\n\n/**\n * Created by user on 2/11/15.\n */\n\npublic class TestHelper {\n\n p", "end": 180, "score": 0.9977853298187256, "start": 176, "tag": "USERNAME", "value": "user" } ]
null
[]
import org.junit.Assert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import java.util.List; /** * Created by user on 2/11/15. */ public class TestHelper { public static WebElement waitElement(String path) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { s = BaseTest.webDriver.findElements(By.xpath(path)).size(); if (BaseTest.webDriver.findElements(By.xpath(path)).size() > 0) { WebElement we = BaseTest.webDriver.findElements(By.xpath(path)).get(0); return we; } Thread.sleep(100); timepassed += 100; } Assert.fail(); return null; } public static List<WebElement> waitElements(String path) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { s = BaseTest.webDriver.findElements(By.xpath(path)).size(); if (BaseTest.webDriver.findElements(By.xpath(path)).size() > 0) { List<WebElement> we = BaseTest.webDriver.findElements(By.xpath(path)); return we; } Thread.sleep(100); timepassed += 100; } Assert.fail(); return null; } public static void waitValue(WebDriver webDriver, String path, String val) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { if (webDriver.findElements(By.xpath(path)).size() > 0) { WebElement we = webDriver.findElements(By.xpath(path)).get(0); if(val.equals(we.getAttribute("value"))) { return; } } Thread.sleep(100); timepassed += 100; } Assert.fail(); } public static void waitText(WebDriver webDriver, String path, String val) throws InterruptedException { int timeout = 30000, timepassed = 0, s; while(timepassed < timeout) { if (webDriver.findElements(By.xpath(path)).size() > 0) { WebElement we = webDriver.findElements(By.xpath(path)).get(0); if(val.equals(we.getText())) { return; } } Thread.sleep(100); timepassed += 100; } Assert.fail(); } }
2,496
0.560497
0.536458
76
31.842106
28.174761
109
false
false
0
0
0
0
0
0
0.592105
false
false
6
c210b7a1692fe1c7fbe439f3d281e4830f2ab422
21,440,476,754,635
e630225bd33dde12490f10f9b589437f0da5dbaf
/src/br/com/juliocnsouza/ocpjp/_2resource_bundle/ResourceBundleTest.java
e6711aa881e1ce2d5c2b466e815d5431dce1e512
[ "MIT" ]
permissive
juliocnsouzadev/ocpjp
https://github.com/juliocnsouzadev/ocpjp
f98685456b75a8c8b8e8c6ebe944781304376fe2
170870ed6bede9eec92fd1b66492c623933e6085
refs/heads/master
2021-01-18T22:45:32.875000
2016-04-27T12:28:47
2016-04-27T12:28:47
17,824,458
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.juliocnsouza.ocpjp._2resource_bundle; import java.util.Locale; import java.util.ResourceBundle; /** * ResourceBundleTest.java -> Job: * <p> * @since 02/02/2015 * @version 1.0 * @author Julio Cesar Nunes de Souza (julio.souza@mobilitasistemas.com.br) */ public class ResourceBundleTest { public static void main( String[] args ) { Locale localeEN = new Locale( "en" ); Locale localeFR = new Locale( "fr" ); ResourceBundle rb = ResourceBundle.getBundle( "Labels" , localeEN ); System.out.println( rb.getString( "hello" ) ); rb = ResourceBundle.getBundle( "Labels" , localeFR ); System.out.println( rb.getString( "hello" ) ); } }
UTF-8
Java
711
java
ResourceBundleTest.java
Java
[ { "context": "p>\n * @since 02/02/2015\n * @version 1.0\n * @author Julio Cesar Nunes de Souza (julio.souza@mobilitasistemas.com.br)\n */\npublic ", "end": 233, "score": 0.9998750686645508, "start": 207, "tag": "NAME", "value": "Julio Cesar Nunes de Souza" }, { "context": "ersion 1.0\n * @author Julio Cesar Nunes de Souza (julio.souza@mobilitasistemas.com.br)\n */\npublic class ResourceBundleTest {\n\n publi", "end": 270, "score": 0.9999352693557739, "start": 235, "tag": "EMAIL", "value": "julio.souza@mobilitasistemas.com.br" } ]
null
[]
package br.com.juliocnsouza.ocpjp._2resource_bundle; import java.util.Locale; import java.util.ResourceBundle; /** * ResourceBundleTest.java -> Job: * <p> * @since 02/02/2015 * @version 1.0 * @author <NAME> (<EMAIL>) */ public class ResourceBundleTest { public static void main( String[] args ) { Locale localeEN = new Locale( "en" ); Locale localeFR = new Locale( "fr" ); ResourceBundle rb = ResourceBundle.getBundle( "Labels" , localeEN ); System.out.println( rb.getString( "hello" ) ); rb = ResourceBundle.getBundle( "Labels" , localeFR ); System.out.println( rb.getString( "hello" ) ); } }
663
0.652602
0.637131
27
25.333334
25.126347
76
false
false
0
0
0
0
0
0
0.407407
false
false
6
4c4449c233e3f41df20c4ce0d8beaa0073146737
24,592,982,747,664
48fc16f6bc4ebec14ce19f1cef8831d2522b7f43
/app/src/main/java/com/example/cameron/sql_testing/MainActivity.java
c47bd88e7332bcee6c558ba1f8cfb0defa41e7bb
[]
no_license
marcelnerd/FRC_Auto_Scouting
https://github.com/marcelnerd/FRC_Auto_Scouting
13cfd67a9e3e944951b744205f69cab9beef43da
0854cfff3f2a3012a00e693c2c3741271d21d507
refs/heads/master
2020-03-25T18:56:44.642000
2019-01-09T14:04:11
2019-01-09T14:04:11
144,057,404
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cameron.sql_testing; import android.content.Context; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class MainActivity extends FragmentActivity { public static Context c; // Static context that can be accessed from other classes public DatabaseContainer container = new DatabaseContainer(this); Button button; TBAHandler handler; ListView list; private static int currentMatch = 1; @Override protected void onCreate(Bundle savedInstanceState) { c = getBaseContext(); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = findViewById(R.id.button); list = findViewById(R.id.listMain); handler = new TBAHandler(this); //handler.getMatchData(String.format("/match/%1$s_qm%2$d", "2018_mndu", 1)); //Log.v("minto", handler.helper.getAllEntries()); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { handler.getMatchData(String.format("/match/%1$s_qm%2$d", "2018mndu", currentMatch)); } }); //handler.helper.onUpgrade(handler.helper.getWritableDatabase(), 4, 5); for(int i = 1; i < 80; i++) { handler.getMatchData(String.format("/match/%1$s_qm%2$d", "2018mndu", i)); } FrodoCursorAdapter todoAdapter = new FrodoCursorAdapter(this, TBAHandler.helper.getAllEntriesCursor()); list.setAdapter(todoAdapter); } public static void setCurrentMatch(int c) { currentMatch = c; } public static int getCurrentMatch() { return currentMatch; } }
UTF-8
Java
1,931
java
MainActivity.java
Java
[ { "context": "package com.example.cameron.sql_testing;\n\nimport android.content.Context;\nimp", "end": 27, "score": 0.7808493375778198, "start": 23, "tag": "USERNAME", "value": "eron" } ]
null
[]
package com.example.cameron.sql_testing; import android.content.Context; import android.support.design.widget.BottomNavigationView; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class MainActivity extends FragmentActivity { public static Context c; // Static context that can be accessed from other classes public DatabaseContainer container = new DatabaseContainer(this); Button button; TBAHandler handler; ListView list; private static int currentMatch = 1; @Override protected void onCreate(Bundle savedInstanceState) { c = getBaseContext(); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = findViewById(R.id.button); list = findViewById(R.id.listMain); handler = new TBAHandler(this); //handler.getMatchData(String.format("/match/%1$s_qm%2$d", "2018_mndu", 1)); //Log.v("minto", handler.helper.getAllEntries()); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { handler.getMatchData(String.format("/match/%1$s_qm%2$d", "2018mndu", currentMatch)); } }); //handler.helper.onUpgrade(handler.helper.getWritableDatabase(), 4, 5); for(int i = 1; i < 80; i++) { handler.getMatchData(String.format("/match/%1$s_qm%2$d", "2018mndu", i)); } FrodoCursorAdapter todoAdapter = new FrodoCursorAdapter(this, TBAHandler.helper.getAllEntriesCursor()); list.setAdapter(todoAdapter); } public static void setCurrentMatch(int c) { currentMatch = c; } public static int getCurrentMatch() { return currentMatch; } }
1,931
0.675298
0.661833
59
31.728813
27.754877
111
false
false
0
0
0
0
0
0
0.745763
false
false
6
30de0ae6274b65f01f165dad38a4f1c1e8172051
30,803,505,457,233
15475bdf7dd21551ebade05a40a601ae02dceed4
/HackBookWeb/src/com/lubbock/model/file/exception/ProFileIsLostException.java
047d2e345188e437b85ca998d92f2e44752169c7
[]
no_license
Lubbock/HackBook
https://github.com/Lubbock/HackBook
ea626aaa3821912046e5bc4a946fada9e20dd8cd
1251f5b7a72ff1863007b93e6d20afd05aa18102
refs/heads/master
2016-03-31T06:38:46.358000
2015-09-19T02:48:18
2015-09-19T02:48:18
42,755,632
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lubbock.model.file.exception; public class ProFileIsLostException extends Exception{ /** * */ private static final long serialVersionUID = 1L; public ProFileIsLostException(String msg) { super(msg); } }
UTF-8
Java
231
java
ProFileIsLostException.java
Java
[]
null
[]
package com.lubbock.model.file.exception; public class ProFileIsLostException extends Exception{ /** * */ private static final long serialVersionUID = 1L; public ProFileIsLostException(String msg) { super(msg); } }
231
0.731602
0.727273
14
15.5
20.342602
54
false
false
0
0
0
0
0
0
0.857143
false
false
6
7594e2f1e092226f7f25bb68c6ad94f6156991cd
21,191,368,650,219
3f8b021c6b0f81fe244800f012d481a8ba24c272
/core/target/java/org/apache/spark/scheduler/SparkListenerExecutorMetricsUpdate.java
8358761a8839a02f21b4441838096d1144828b07
[]
no_license
maligulzar/bdd-temp-1.2.1
https://github.com/maligulzar/bdd-temp-1.2.1
f91032b0b474715426912fdf4d09804bc3f4f336
c1da0ab872904b99c9f0238a4a83762a861b8034
refs/heads/master
2015-08-24T04:33:51.369000
2015-05-14T21:04:57
2015-05-14T21:04:57
35,351,111
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.spark.scheduler; /** * Periodic updates from executors. * @param execId executor id * @param taskMetrics sequence of (task id, stage id, stage attempt, metrics) */ public class SparkListenerExecutorMetricsUpdate implements org.apache.spark.scheduler.SparkListenerEvent, scala.Product, scala.Serializable { public java.lang.String execId () { throw new RuntimeException(); } public scala.collection.Seq<scala.Tuple4<java.lang.Object, java.lang.Object, java.lang.Object, org.apache.spark.executor.TaskMetrics>> taskMetrics () { throw new RuntimeException(); } // not preceding public SparkListenerExecutorMetricsUpdate (java.lang.String execId, scala.collection.Seq<scala.Tuple4<java.lang.Object, java.lang.Object, java.lang.Object, org.apache.spark.executor.TaskMetrics>> taskMetrics) { throw new RuntimeException(); } }
UTF-8
Java
856
java
SparkListenerExecutorMetricsUpdate.java
Java
[]
null
[]
package org.apache.spark.scheduler; /** * Periodic updates from executors. * @param execId executor id * @param taskMetrics sequence of (task id, stage id, stage attempt, metrics) */ public class SparkListenerExecutorMetricsUpdate implements org.apache.spark.scheduler.SparkListenerEvent, scala.Product, scala.Serializable { public java.lang.String execId () { throw new RuntimeException(); } public scala.collection.Seq<scala.Tuple4<java.lang.Object, java.lang.Object, java.lang.Object, org.apache.spark.executor.TaskMetrics>> taskMetrics () { throw new RuntimeException(); } // not preceding public SparkListenerExecutorMetricsUpdate (java.lang.String execId, scala.collection.Seq<scala.Tuple4<java.lang.Object, java.lang.Object, java.lang.Object, org.apache.spark.executor.TaskMetrics>> taskMetrics) { throw new RuntimeException(); } }
856
0.780374
0.778037
12
70.333336
76.551003
246
false
false
0
0
0
0
0
0
1.333333
false
false
6
8e7206b13a0cf6da679f65e804fa3022f5eb7435
26,955,214,766,290
e1bc0917cd30980f2af5db8b8767cbe60ac2bed7
/app/src/main/java/com/stage/designpatterntest/MyApp.java
73cdca7971f336529aa6c45ed92c2344f423ead5
[]
no_license
xiaodengzi0812/DesignPatternTest
https://github.com/xiaodengzi0812/DesignPatternTest
97c4936d6621ff9d11bd86af05de14dbb659efdc
dbe8f2d78f614ea9ba8cf9d362fbcf49970dad0c
refs/heads/master
2021-08-07T12:43:04.697000
2017-11-08T05:55:48
2017-11-08T05:55:48
100,594,507
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stage.designpatterntest; import android.app.Application; /** * @author Djk * @Title: * @Time: 2017/8/17. * @Version:1.0.0 */ public class MyApp extends Application { private static MyApp myApp; public static MyApp getInstance() { return myApp; } @Override public void onCreate() { super.onCreate(); myApp = this; } }
UTF-8
Java
388
java
MyApp.java
Java
[ { "context": ";\n\nimport android.app.Application;\n\n/**\n * @author Djk\n * @Title:\n * @Time: 2017/8/17.\n * @Version:1.0.0", "end": 89, "score": 0.999496579170227, "start": 86, "tag": "USERNAME", "value": "Djk" } ]
null
[]
package com.stage.designpatterntest; import android.app.Application; /** * @author Djk * @Title: * @Time: 2017/8/17. * @Version:1.0.0 */ public class MyApp extends Application { private static MyApp myApp; public static MyApp getInstance() { return myApp; } @Override public void onCreate() { super.onCreate(); myApp = this; } }
388
0.613402
0.587629
25
14.52
13.538449
40
false
false
0
0
0
0
0
0
0.24
false
false
6
9040211a44d79b24bf9eb3afeb6687f818395f4c
26,955,214,766,326
bd390bbe0e630eb402066955cc5d68cb7919521e
/src/day27/CommonArrayTasks.java
03b78e3619846e263699f64831d6013c2f3b4bed
[]
no_license
msarikoc/Spring2019Online_Project
https://github.com/msarikoc/Spring2019Online_Project
77bfb8904ff2571ba2d2006a0b1cb6b35f4e5024
ef73f76911447763ed538f51b8dbbcd2440987a4
refs/heads/master
2020-05-27T17:16:45.311000
2019-05-26T17:24:52
2019-05-26T17:24:52
188,717,403
1
0
null
true
2019-05-26T18:22:44
2019-05-26T18:22:44
2019-05-26T17:25:12
2019-05-26T17:25:10
10,265
0
0
0
null
false
false
package day27; import java.util.Arrays; import java.util.Scanner; public class CommonArrayTasks { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("Enter 5 numbers "); int [] numbers = {scan.nextInt(),scan.nextInt() ,scan.nextInt(),scan.nextInt(), scan.nextInt() }; System.out.println(Arrays.toString(numbers)); int sum= 0; for( int each : numbers) { sum += each ; } System.out.println("sum is : "+ sum); // assume first item is the max before comparing with all items int max = numbers[0] ; for(int eachNum : numbers) { if(eachNum > max) { max = eachNum ; } } System.out.println("max is : "+ max); int min = numbers[0] ; for (int eachNumber : numbers) { if(eachNumber<min) { min = eachNumber ; } } System.out.println("min is : "+ min); } }
UTF-8
Java
921
java
CommonArrayTasks.java
Java
[]
null
[]
package day27; import java.util.Arrays; import java.util.Scanner; public class CommonArrayTasks { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("Enter 5 numbers "); int [] numbers = {scan.nextInt(),scan.nextInt() ,scan.nextInt(),scan.nextInt(), scan.nextInt() }; System.out.println(Arrays.toString(numbers)); int sum= 0; for( int each : numbers) { sum += each ; } System.out.println("sum is : "+ sum); // assume first item is the max before comparing with all items int max = numbers[0] ; for(int eachNum : numbers) { if(eachNum > max) { max = eachNum ; } } System.out.println("max is : "+ max); int min = numbers[0] ; for (int eachNumber : numbers) { if(eachNumber<min) { min = eachNumber ; } } System.out.println("min is : "+ min); } }
921
0.590662
0.584148
52
16.711538
16.878908
66
false
false
0
0
0
0
0
0
2.423077
false
false
6
b9eb1a1b152c9b01319c1964e7e4567111d6f396
11,991,548,707,901
46d89aed615d35191ab561fa5081e33f96e203b4
/src/Projet_Java_mud/MServerInt.java
270e762cebf36fd7fc58a294706f00fb337edf87
[]
no_license
NathanClostres/ProjetJava
https://github.com/NathanClostres/ProjetJava
be1b6c1386e5743a4c8c454b3f6cd6d431b97326
afe83dfd53549763a61c5233806a0d83c9312b49
refs/heads/master
2020-04-12T11:01:43.584000
2018-12-21T14:57:49
2018-12-21T14:57:49
162,447,717
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package Projet_Java_mud; import java.rmi.Remote; import java.rmi.RemoteException; public interface MServerInt extends Remote{ public String GetNewMsgs (String NomJ , Room R, int size) throws RemoteException; public int WriteMsg (String Msg, String NomJ, Room R) throws RemoteException; }
UTF-8
Java
300
java
MServerInt.java
Java
[]
null
[]
package Projet_Java_mud; import java.rmi.Remote; import java.rmi.RemoteException; public interface MServerInt extends Remote{ public String GetNewMsgs (String NomJ , Room R, int size) throws RemoteException; public int WriteMsg (String Msg, String NomJ, Room R) throws RemoteException; }
300
0.773333
0.773333
11
26.272728
30.409601
85
false
false
0
0
0
0
0
0
0.818182
false
false
6
612735a005908eae9ac6c9a1c2a2bc72b78572e8
19,447,611,932,315
19f323f12e67158ad085113acd8f777fd459558e
/dropwizard-couchbase-rest/src/main/java/com/tesco/dropwizard/OrderConfiguration.java
860351b977fba4854f24b0948b080281b46f865e
[]
no_license
sindhurii/jenkins-test
https://github.com/sindhurii/jenkins-test
92ad0f42c5b6a8223a3afabc868091a6575d6c40
123279c60ffa6fd16ba0b87d165534fbcf081bc8
refs/heads/master
2020-12-05T16:06:16.425000
2016-09-16T12:25:29
2016-09-16T12:25:29
66,832,214
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tesco.dropwizard; import io.dropwizard.Configuration; /** * * @author sindhuri * */ public class OrderConfiguration extends Configuration { private String bucketName; public String getBucketName() { return bucketName; } public void setBucketName(String bucketName) { this.bucketName = bucketName; } }
UTF-8
Java
333
java
OrderConfiguration.java
Java
[ { "context": "rt io.dropwizard.Configuration;\n/**\n * \n * @author sindhuri\n *\n */\npublic class OrderConfiguration extends Co", "end": 94, "score": 0.9905198216438293, "start": 86, "tag": "USERNAME", "value": "sindhuri" } ]
null
[]
package com.tesco.dropwizard; import io.dropwizard.Configuration; /** * * @author sindhuri * */ public class OrderConfiguration extends Configuration { private String bucketName; public String getBucketName() { return bucketName; } public void setBucketName(String bucketName) { this.bucketName = bucketName; } }
333
0.738739
0.738739
21
14.857142
17.15555
55
false
false
0
0
0
0
0
0
0.714286
false
false
6
bce807f4a99ce9be05362336417d061f22721bfd
26,310,969,672,899
d8dd89c3b0e08a4772d41fa3db14275512d5f75d
/app/src/main/java/com/example/acer/utils/Bean.java
aa8bb5cff7c951f26aa5520eea7930a8a44b395f
[]
no_license
Prologueyan/MymusicPlayer
https://github.com/Prologueyan/MymusicPlayer
1418e345e70cceab14e2a055e537c631af27912e
d094e2719bb3179b3e471cb613b99a19f57e92a7
refs/heads/master
2021-05-04T10:36:41.098000
2016-03-08T10:36:18
2016-03-08T10:36:18
53,205,569
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.acer.utils; /** * Created by acer on 2016/2/28. */ public class Bean { public String songName; public String artist; public String getSongName() { return songName; } public String getArtist() { return artist; } public void setSongName(String songName) { this.songName = songName; } public void setArtist(String artist) { this.artist = artist; } }
UTF-8
Java
450
java
Bean.java
Java
[ { "context": "package com.example.acer.utils;\n\n/**\n * Created by acer on 2016/2/28.\n */\npublic class Bean {\n\n public", "end": 55, "score": 0.9996452331542969, "start": 51, "tag": "USERNAME", "value": "acer" } ]
null
[]
package com.example.acer.utils; /** * Created by acer on 2016/2/28. */ public class Bean { public String songName; public String artist; public String getSongName() { return songName; } public String getArtist() { return artist; } public void setSongName(String songName) { this.songName = songName; } public void setArtist(String artist) { this.artist = artist; } }
450
0.606667
0.591111
29
14.517241
15.117062
46
false
false
0
0
0
0
0
0
0.241379
false
false
6
b7b23a7a808a17eff795d9f86047c6477d6075c3
11,527,692,240,044
b79fc7ef44fa55460735a3b9c61a8595e9b80099
/Java/src/ija/project/Path.java
313fca1375b0bc0af61b2a85026dcc56c6f62999
[]
no_license
Xenodium36/Public-projects
https://github.com/Xenodium36/Public-projects
404a65749b0566796ab37cc979a85c68ce0a218b
237720e00e7fb6c5aeb57704f4012fc3af1ebc69
refs/heads/master
2023-06-10T10:20:32.038000
2023-06-06T20:08:21
2023-06-06T20:08:21
377,093,917
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ija.project; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.ArrayList; import java.util.List; /** * Defining path for carts * Contains list of coordinates, which takes cart */ public class Path { private List<Coordinate> path = new ArrayList<>(); public Path() {} public Path(List<Coordinate> path) { this.path = path; } public List<Coordinate> getPath() { return path; } public void setPath(List<Coordinate> path) { this.path = path; } public void addToPath(List<Coordinate> path){ this.path.addAll(path); } private double getDistance(Coordinate a, Coordinate b){ return Math.sqrt(Math.pow(a.getX() - b.getX(), 2) + Math.pow(a.getY() - b.getY(), 2)); } /** * @param distance Driven distance by cart on path * @return new coordinates, where cart should be drawn */ public Coordinate getCoordinateByDistance(double distance){ double length = 0; Coordinate a = null; Coordinate b = null; for(int i = 0; i < path.size() - 1; i++){ a = path.get(i); b = path.get(i + 1); if (length + getDistance(a,b) >= distance){ break; } length +=getDistance(a,b); } if (a == null || b == null){ return null; } double driven = (distance - length)/getDistance(a,b); return new Coordinate(a.getX() + (b.getX() - a.getX()) * driven, a.getY() + (b.getY() - a.getY()) * driven); } /** * * @return length of whole path, that cart should drive */ @JsonIgnore public double getPathSize(){ double size = 0; for(int i = 0; i < path.size() - 1; i++){ size += getDistance(path.get(i), path.get(i+1)); } return size; } }
UTF-8
Java
1,957
java
Path.java
Java
[]
null
[]
package ija.project; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.ArrayList; import java.util.List; /** * Defining path for carts * Contains list of coordinates, which takes cart */ public class Path { private List<Coordinate> path = new ArrayList<>(); public Path() {} public Path(List<Coordinate> path) { this.path = path; } public List<Coordinate> getPath() { return path; } public void setPath(List<Coordinate> path) { this.path = path; } public void addToPath(List<Coordinate> path){ this.path.addAll(path); } private double getDistance(Coordinate a, Coordinate b){ return Math.sqrt(Math.pow(a.getX() - b.getX(), 2) + Math.pow(a.getY() - b.getY(), 2)); } /** * @param distance Driven distance by cart on path * @return new coordinates, where cart should be drawn */ public Coordinate getCoordinateByDistance(double distance){ double length = 0; Coordinate a = null; Coordinate b = null; for(int i = 0; i < path.size() - 1; i++){ a = path.get(i); b = path.get(i + 1); if (length + getDistance(a,b) >= distance){ break; } length +=getDistance(a,b); } if (a == null || b == null){ return null; } double driven = (distance - length)/getDistance(a,b); return new Coordinate(a.getX() + (b.getX() - a.getX()) * driven, a.getY() + (b.getY() - a.getY()) * driven); } /** * * @return length of whole path, that cart should drive */ @JsonIgnore public double getPathSize(){ double size = 0; for(int i = 0; i < path.size() - 1; i++){ size += getDistance(path.get(i), path.get(i+1)); } return size; } }
1,957
0.529382
0.524272
73
24.80822
23.998663
116
false
false
0
0
0
0
0
0
0.547945
false
false
6
fc5a9eb663493a1a0665625de8ec2a3fdf01eac8
18,056,042,531,269
761806a584765f776ef0056b030ebacc59b33f45
/com/epam/task02/EventFactory.java
942fc55661bf3c4625127a22412528cd498fb0e0
[]
no_license
YanaBalakir/JAVA_Basic
https://github.com/YanaBalakir/JAVA_Basic
7232b699b7d401b0461b303b247096952a3d7a45
db9b03f58cb661e4701b7ac0fcef8fbd46597644
refs/heads/master
2021-05-08T06:18:33.558000
2018-11-04T19:23:16
2018-11-04T19:23:16
106,603,738
0
2
null
false
2018-08-02T09:05:59
2017-10-11T20:07:18
2018-07-29T21:51:07
2018-08-02T09:05:59
100
0
2
1
Java
false
null
package com.epam.task02; import java.util.ArrayList; public class EventFactory { public static ArrayList<Event> createEvents() { ArrayList<Event> minskEvents = new ArrayList<Event>(); EventsPropertiesReader.getEventsProperties(); int i = 1; while (EventsPropertiesReader.getEventName(i) != null) { minskEvents.add(new Event( EventsPropertiesReader.getId(i), EventsPropertiesReader.getEventName(i), EventsPropertiesReader.getEventDescription(i), EventsPropertiesReader.getEventDate(i), EventsPropertiesReader.getPlace(i), TicketsFactory.createTickets(EventsPropertiesReader.getId(i), EventsPropertiesReader.getTicketsLimit(i)) )); i++; } return minskEvents; } }
UTF-8
Java
906
java
EventFactory.java
Java
[]
null
[]
package com.epam.task02; import java.util.ArrayList; public class EventFactory { public static ArrayList<Event> createEvents() { ArrayList<Event> minskEvents = new ArrayList<Event>(); EventsPropertiesReader.getEventsProperties(); int i = 1; while (EventsPropertiesReader.getEventName(i) != null) { minskEvents.add(new Event( EventsPropertiesReader.getId(i), EventsPropertiesReader.getEventName(i), EventsPropertiesReader.getEventDescription(i), EventsPropertiesReader.getEventDate(i), EventsPropertiesReader.getPlace(i), TicketsFactory.createTickets(EventsPropertiesReader.getId(i), EventsPropertiesReader.getTicketsLimit(i)) )); i++; } return minskEvents; } }
906
0.596026
0.592715
27
31.555555
29.81838
124
false
false
0
0
0
0
0
0
0.518519
false
false
6
975f0c4378d1a17e85c8cc7e90f0397ef0ffd268
6,511,170,442,079
2848808263646fdbbc96d939ea6ae74f405e5165
/src/main/java/cn/hp/dao/LogMapper.java
5a1fc86489243815a9bfc2c0ec825b1389b60164
[]
no_license
TopGradeModel/springSecurity
https://github.com/TopGradeModel/springSecurity
b5b69d521bdac53730e039be7898268952f8aa18
fb8074a460bab6478669e70d9e890ce88a7174a8
refs/heads/master
2022-12-23T21:54:15.807000
2019-10-23T09:20:14
2019-10-23T09:20:14
217,016,883
0
0
null
false
2022-12-16T07:15:46
2019-10-23T09:16:53
2019-10-23T09:23:47
2022-12-16T07:15:43
7,917
0
0
11
JavaScript
false
false
package cn.hp.dao; import cn.hp.domain.SysLog; public interface LogMapper { //添加日志信息 void saveLog(SysLog log); }
UTF-8
Java
139
java
LogMapper.java
Java
[]
null
[]
package cn.hp.dao; import cn.hp.domain.SysLog; public interface LogMapper { //添加日志信息 void saveLog(SysLog log); }
139
0.677165
0.677165
9
12.111111
11.901862
28
false
false
0
0
0
0
0
0
0.555556
false
false
6
f257bace5cfa94b9949b0ea1daf262c58568d4b4
30,520,037,628,488
5d4bbce1073983732b41251d3bded3dc8b49f5f0
/src/main/java/com/haulmont/testtask/services/PatientService.java
c25f153476bba652d5e1a9689bd3b5e7bb7d3cd0
[]
no_license
jacketBain/testtask
https://github.com/jacketBain/testtask
8e3a09b032cb0841425e35d7833a060b29b575b9
1e9ba6d2017defd45e41cfb6286a00971192fe7e
refs/heads/master
2022-12-15T08:41:49.171000
2020-09-13T13:21:05
2020-09-13T13:21:05
292,349,470
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.haulmont.testtask.services; import com.haulmont.testtask.dao.impl.PatientDAO; import com.haulmont.testtask.entity.Doctor; import com.haulmont.testtask.entity.Patient; import java.util.List; public class PatientService { private PatientDAO patientDAO = new PatientDAO(); public PatientService() { } public Patient findPatient(Long id) { return patientDAO.findById(id); } public void savePatient(Patient patient){ patientDAO.save(patient); } public void deletePatient(Patient patient) { patientDAO.delete(patient); } public void updatePatient(Patient patient) { patientDAO.update(patient); } public List<Patient> findAllPatients() { return patientDAO.findAll(); } }
UTF-8
Java
777
java
PatientService.java
Java
[]
null
[]
package com.haulmont.testtask.services; import com.haulmont.testtask.dao.impl.PatientDAO; import com.haulmont.testtask.entity.Doctor; import com.haulmont.testtask.entity.Patient; import java.util.List; public class PatientService { private PatientDAO patientDAO = new PatientDAO(); public PatientService() { } public Patient findPatient(Long id) { return patientDAO.findById(id); } public void savePatient(Patient patient){ patientDAO.save(patient); } public void deletePatient(Patient patient) { patientDAO.delete(patient); } public void updatePatient(Patient patient) { patientDAO.update(patient); } public List<Patient> findAllPatients() { return patientDAO.findAll(); } }
777
0.696268
0.696268
35
21.228571
19.760113
53
false
false
0
0
0
0
0
0
0.314286
false
false
6
5e4a87c7e60a699cd94dd416d6fa60bcaa998499
23,768,349,018,566
836dd7cfcee5a0c82007b844a642973fded064e1
/Session5Assignment1.java
b956ec4b1e614349d8545da779e23c238946be9e
[]
no_license
garshriv/Session-5_Assignment-1-Task-
https://github.com/garshriv/Session-5_Assignment-1-Task-
f6aea34148a959e54a1fb093689d927f404224e1
4afab19636090ef9d5f4999093a803a8cdc64a8e
refs/heads/master
2020-04-14T23:07:31.114000
2019-01-05T07:20:08
2019-01-05T07:20:08
164,190,769
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package magento.com; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Session5Assignment1 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("https://www.jcpenney.com/"); //driver.switchTo().alert().dismiss(); WebElement searchshirt = driver.findElement(By.xpath("//a[@id='closeButton']")); searchshirt.click(); driver.switchTo().defaultContent(); searchshirt = driver.findElement(By.xpath("//input[@id='searchInputId']")); searchshirt.sendKeys("mens big tall tshirts"); searchshirt= driver.findElement(By.xpath("//button[@title='search']")); searchshirt.click(); WebElement item = driver.findElement(By.xpath("//a[@href='/p/stafford-4-pk-heavyweight-v-neck-t-shirts-big-tall/pp5002910727?pTmplType=regular&catId=SearchResults&searchTerm=mens+big+tall+tshirts&N=507&badge=onlyatjcp']//img[@class='productDisplay_image--default']")); item.click(); item = driver.findElement(By.xpath("//select[@id='SIZE_RANGE']")); } }
UTF-8
Java
1,313
java
Session5Assignment1.java
Java
[]
null
[]
package magento.com; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Session5Assignment1 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("https://www.jcpenney.com/"); //driver.switchTo().alert().dismiss(); WebElement searchshirt = driver.findElement(By.xpath("//a[@id='closeButton']")); searchshirt.click(); driver.switchTo().defaultContent(); searchshirt = driver.findElement(By.xpath("//input[@id='searchInputId']")); searchshirt.sendKeys("mens big tall tshirts"); searchshirt= driver.findElement(By.xpath("//button[@title='search']")); searchshirt.click(); WebElement item = driver.findElement(By.xpath("//a[@href='/p/stafford-4-pk-heavyweight-v-neck-t-shirts-big-tall/pp5002910727?pTmplType=regular&catId=SearchResults&searchTerm=mens+big+tall+tshirts&N=507&badge=onlyatjcp']//img[@class='productDisplay_image--default']")); item.click(); item = driver.findElement(By.xpath("//select[@id='SIZE_RANGE']")); } }
1,313
0.704494
0.690784
34
36.676472
48.933762
270
false
false
0
0
0
0
0
0
1.735294
false
false
6
f7c36c3695194d6d4ea5f2100f20d7b39ae7e6c7
18,133,351,979,034
b0394fd8e545ac54fcd47d1fe826617cee44b771
/src/main/java/com/paralainer/timezonebot/DarkSkyWeatherService.java
ec4fe6e4552fdf46a1c7c86f901cddc1b244ad7b
[]
no_license
paralainer/timezonebot
https://github.com/paralainer/timezonebot
2fe134ed0aed4dab7f85540aa95012b37e8401b0
724759c99f81227dad2ca83968d28a6dee690485
refs/heads/master
2021-01-20T07:51:28.941000
2017-05-13T06:23:33
2017-05-13T06:23:33
90,052,512
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.paralainer.timezonebot; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.HashMap; import java.util.Map; /** * Created by stalov on 12/05/2017. */ public class DarkSkyWeatherService implements WeatherService { private static final Map<String, String> EMOJI_MAPPING = new HashMap<>(); static { EMOJI_MAPPING.put("clear-day", "☀"); EMOJI_MAPPING.put("clear-night", "🌛"); EMOJI_MAPPING.put("rain", "\uD83C\uDF27"); EMOJI_MAPPING.put("snow", "❄️ ☃"); EMOJI_MAPPING.put("sleet", "\uD83C\uDF27 \uD83C\uDF28"); EMOJI_MAPPING.put("wind", "\uD83D\uDCA8"); EMOJI_MAPPING.put("fog", "\uD83C\uDF2B"); EMOJI_MAPPING.put("cloudy", "☁️"); EMOJI_MAPPING.put("partly-cloudy-day", "🌤"); EMOJI_MAPPING.put("partly-cloudy-night", "☁️🌛"); EMOJI_MAPPING.put("hail", "\uD83C\uDF27"); EMOJI_MAPPING.put("thunderstorm", "⛈"); EMOJI_MAPPING.put("tornado", "\uD83C\uDF2A"); } private String key; public DarkSkyWeatherService(String key) { this.key = key; } @Override public WeatherInfo getWeather(String coordinates) { try { URL url = new URL("https://api.darksky.net/forecast/" + key + "/" + coordinates); JsonObject result = getJson(url.openConnection().getInputStream()); String timezone = result.get("timezone").getAsString(); JsonObject currentWeather = result.getAsJsonObject("currently"); String emoji = getEmoji(currentWeather.get("icon").getAsString()); int temp = (int) fahrenheitToCelsius(currentWeather.get("temperature").getAsDouble()); return new WeatherInfo( " " + emoji + " " + temp + "℃", timezone ); } catch (Exception e) { e.printStackTrace(System.out); return null; } } private double fahrenheitToCelsius(double t) { return (t - 32) / 1.8; } private String getEmoji(String icon) { String s = EMOJI_MAPPING.get(icon); if (s == null) { System.out.println("No emoji for " + icon); return ""; } return s; } private JsonObject getJson(InputStream inputStream) { JsonParser parser = new JsonParser(); return parser.parse(new InputStreamReader(inputStream)).getAsJsonObject(); } }
UTF-8
Java
2,585
java
DarkSkyWeatherService.java
Java
[ { "context": ".HashMap;\nimport java.util.Map;\n\n/**\n * Created by stalov on 12/05/2017.\n */\npublic class DarkSkyWeatherSer", "end": 264, "score": 0.9995905756950378, "start": 258, "tag": "USERNAME", "value": "stalov" } ]
null
[]
package com.paralainer.timezonebot; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.HashMap; import java.util.Map; /** * Created by stalov on 12/05/2017. */ public class DarkSkyWeatherService implements WeatherService { private static final Map<String, String> EMOJI_MAPPING = new HashMap<>(); static { EMOJI_MAPPING.put("clear-day", "☀"); EMOJI_MAPPING.put("clear-night", "🌛"); EMOJI_MAPPING.put("rain", "\uD83C\uDF27"); EMOJI_MAPPING.put("snow", "❄️ ☃"); EMOJI_MAPPING.put("sleet", "\uD83C\uDF27 \uD83C\uDF28"); EMOJI_MAPPING.put("wind", "\uD83D\uDCA8"); EMOJI_MAPPING.put("fog", "\uD83C\uDF2B"); EMOJI_MAPPING.put("cloudy", "☁️"); EMOJI_MAPPING.put("partly-cloudy-day", "🌤"); EMOJI_MAPPING.put("partly-cloudy-night", "☁️🌛"); EMOJI_MAPPING.put("hail", "\uD83C\uDF27"); EMOJI_MAPPING.put("thunderstorm", "⛈"); EMOJI_MAPPING.put("tornado", "\uD83C\uDF2A"); } private String key; public DarkSkyWeatherService(String key) { this.key = key; } @Override public WeatherInfo getWeather(String coordinates) { try { URL url = new URL("https://api.darksky.net/forecast/" + key + "/" + coordinates); JsonObject result = getJson(url.openConnection().getInputStream()); String timezone = result.get("timezone").getAsString(); JsonObject currentWeather = result.getAsJsonObject("currently"); String emoji = getEmoji(currentWeather.get("icon").getAsString()); int temp = (int) fahrenheitToCelsius(currentWeather.get("temperature").getAsDouble()); return new WeatherInfo( " " + emoji + " " + temp + "℃", timezone ); } catch (Exception e) { e.printStackTrace(System.out); return null; } } private double fahrenheitToCelsius(double t) { return (t - 32) / 1.8; } private String getEmoji(String icon) { String s = EMOJI_MAPPING.get(icon); if (s == null) { System.out.println("No emoji for " + icon); return ""; } return s; } private JsonObject getJson(InputStream inputStream) { JsonParser parser = new JsonParser(); return parser.parse(new InputStreamReader(inputStream)).getAsJsonObject(); } }
2,585
0.59507
0.580595
85
29.070589
26.069494
98
false
false
0
0
0
0
0
0
0.647059
false
false
6
28d3d8c3b5bbf0da3c4dc86e29be379213b5e309
11,622,181,574,413
e7876f4316b1692f274c36f35133119fa12256f8
/mvideo-android-new/app/src/main/java/com/itpa/mvideo/misc/Pinpad.java
0926f97409e8b98023d8dd7194a8dfa144333f23
[]
no_license
HPDRC/Mvideo
https://github.com/HPDRC/Mvideo
2f922b6c646905a26688e06c41bf3cb7a676742c
e43d7b0489afdda0eadc466ed88569d1acef3d90
refs/heads/master
2020-04-03T00:58:22.915000
2018-10-27T02:13:59
2018-10-27T02:13:59
154,914,527
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.itpa.mvideo.misc; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.ArrayList; public class Pinpad { public interface PinpadCallback { void onAllPinCompleted(String code); } private String code = ""; private ArrayList<TextView> pinBoxes; private TextView pinTitle; private String titleText; public Pinpad(final ArrayList<Button> pinButtons, final ArrayList<TextView> pinBoxes, final TextView pinTitle, final Button delButton, final PinpadCallback callback) { final String deleteText = delButton.getText().toString(); this.pinBoxes = pinBoxes; this.pinTitle = pinTitle; this.titleText = pinTitle.getText().toString(); updateDisplay(); for (Button btn: pinButtons) { btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // update code Button button = (Button) view; String text = button.getText().toString(); if (text.equals(deleteText)) { if (code.length() > 0) code = code.substring(0, code.length() - 1); } else { int x = Integer.parseInt(text); if (code.length() < pinBoxes.size()) { code += Integer.toString(x); } } if (code.length() >= pinBoxes.size()) { callback.onAllPinCompleted(code); code = ""; } // update display updateDisplay(); } }); } } private void updateDisplay() { int pinBoxCount = pinBoxes.size(); for (int i=0; i<code.length(); i++) { pinBoxes.get(i).setText("*"); } for (int i=code.length(); i<pinBoxCount; i++) { pinBoxes.get(i).setText(""); } pinTitle.setText(code.length() == 0 ? titleText : ""); } public void clear() { code = ""; updateDisplay(); } }
UTF-8
Java
2,304
java
Pinpad.java
Java
[]
null
[]
package com.itpa.mvideo.misc; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.ArrayList; public class Pinpad { public interface PinpadCallback { void onAllPinCompleted(String code); } private String code = ""; private ArrayList<TextView> pinBoxes; private TextView pinTitle; private String titleText; public Pinpad(final ArrayList<Button> pinButtons, final ArrayList<TextView> pinBoxes, final TextView pinTitle, final Button delButton, final PinpadCallback callback) { final String deleteText = delButton.getText().toString(); this.pinBoxes = pinBoxes; this.pinTitle = pinTitle; this.titleText = pinTitle.getText().toString(); updateDisplay(); for (Button btn: pinButtons) { btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // update code Button button = (Button) view; String text = button.getText().toString(); if (text.equals(deleteText)) { if (code.length() > 0) code = code.substring(0, code.length() - 1); } else { int x = Integer.parseInt(text); if (code.length() < pinBoxes.size()) { code += Integer.toString(x); } } if (code.length() >= pinBoxes.size()) { callback.onAllPinCompleted(code); code = ""; } // update display updateDisplay(); } }); } } private void updateDisplay() { int pinBoxCount = pinBoxes.size(); for (int i=0; i<code.length(); i++) { pinBoxes.get(i).setText("*"); } for (int i=code.length(); i<pinBoxCount; i++) { pinBoxes.get(i).setText(""); } pinTitle.setText(code.length() == 0 ? titleText : ""); } public void clear() { code = ""; updateDisplay(); } }
2,304
0.498698
0.496528
73
30.561644
25.905512
171
false
false
0
0
0
0
0
0
0.534247
false
false
6
5962fbfc77a30f5a534838b50521501b0ab655a9
17,051,020,190,606
a103c215912b20603d924036668e0029bb58639f
/appfarmacia/src/main/java/com/example/igormoraes/appfarmacia/Constants.java
5c0a9cf65dd36ca7cbd97421fc120deaa85c2309
[]
no_license
running-android-dev01/AppTcc
https://github.com/running-android-dev01/AppTcc
77b19abd81b647a55ea7c1531b7a1244b077425c
3601c518c3c08d4d0631ba550de00b6e1f484476
refs/heads/master
2021-05-23T05:49:58.590000
2018-04-11T20:03:51
2018-04-11T20:03:51
94,934,164
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.igormoraes.appfarmacia; public class Constants { public static String NOME_BANCO = "appfarmacia.db"; }
UTF-8
Java
129
java
Constants.java
Java
[]
null
[]
package com.example.igormoraes.appfarmacia; public class Constants { public static String NOME_BANCO = "appfarmacia.db"; }
129
0.75969
0.75969
6
20.5
22.09638
55
false
false
0
0
0
0
0
0
0.333333
false
false
6
39f0f07ba50896b62b775ebf67e330f925c6a033
28,080,496,191,499
55486e812e2449fe8bcc8c972b2e721a231083a0
/Assignments/DatTLQ/MyCar/src/ronbi2810/NhapXe.java
56076ae8d9d683a65b805863bfec68bcb65300ad
[]
no_license
FASTTRACKSE/FFSE1703.JavaCore
https://github.com/FASTTRACKSE/FFSE1703.JavaCore
15bdcfe15fbdf7fbc94a99c11f58b940149f0b01
14ba6725f3424724cf5ac20c57321162ae9ddd0a
refs/heads/master
2021-07-11T20:33:02.506000
2018-12-28T01:06:07
2018-12-28T01:06:07
125,818,158
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ronbi2810; import java.util.Scanner; public class NhapXe { public static void main(String[] args) { Car car1,car2; Car[] mycar; // Khai bao xe 1 car1= new Car(); car1.setCarMaker("BMW"); car1.setCarModel("750I"); car1.setCarCorlor("Black"); car1.setCarYear(2017); // khai bao xe 2 car2= new Car(); car2.setCarMaker("Audi"); car2.setCarModel("A8L"); car2.setCarCorlor("White"); car2.setCarYear(2016); //Khai bao mang xe mycar = new Car[10]; mycar[0]=car1; mycar[1]=car2; System.out.println("Danh sach xe cua toi"); for(int i=0;i<2;i++) { System.out.println( mycar[i].getCarMaker()+"\t"+mycar[i].getCarModel()+"\t"+mycar[i].getCarColor()); } } }
UTF-8
Java
713
java
NhapXe.java
Java
[]
null
[]
package ronbi2810; import java.util.Scanner; public class NhapXe { public static void main(String[] args) { Car car1,car2; Car[] mycar; // Khai bao xe 1 car1= new Car(); car1.setCarMaker("BMW"); car1.setCarModel("750I"); car1.setCarCorlor("Black"); car1.setCarYear(2017); // khai bao xe 2 car2= new Car(); car2.setCarMaker("Audi"); car2.setCarModel("A8L"); car2.setCarCorlor("White"); car2.setCarYear(2016); //Khai bao mang xe mycar = new Car[10]; mycar[0]=car1; mycar[1]=car2; System.out.println("Danh sach xe cua toi"); for(int i=0;i<2;i++) { System.out.println( mycar[i].getCarMaker()+"\t"+mycar[i].getCarModel()+"\t"+mycar[i].getCarColor()); } } }
713
0.635344
0.582048
34
19.970589
18.42231
103
false
false
0
0
0
0
0
0
2.264706
false
false
6
525b87c1a29d0565f3ad286c389d07d8f69140f9
21,199,958,589,017
c28cde82117d7822b5e4883814502d798fdcd100
/TreeGrammars/src/tsg/TSNodeLabelStructure.java
e40dd5dd8ef935745806d3cd15ecf0cb57fe1eb0
[ "MIT" ]
permissive
kercos/TreeGrammars
https://github.com/kercos/TreeGrammars
bc1f547ea596c7ab4a5e94d01f9816d360b7a73c
79d46e8565e4144feb367fd4615388435d27f42d
refs/heads/master
2021-01-10T20:58:23.397000
2015-09-04T12:51:26
2015-09-04T12:51:26
30,068,484
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tsg; import java.io.File; import java.io.PrintWriter; import java.util.ArrayList; import java.util.BitSet; import java.util.LinkedHashSet; import java.util.ListIterator; import java.util.Scanner; import tsg.corpora.Wsj; import util.PrintProgress; import util.file.FileUtil; public class TSNodeLabelStructure { public TSNodeLabelIndex[] structure; int length; //root is in position 0 public TSNodeLabelStructure(String s) throws Exception { structure = (new TSNodeLabelIndex(s)).collectAllNodesInArray(); length = structure.length; } public TSNodeLabelStructure(TSNodeLabelIndex t) { structure = t.collectAllNodesInArray(); length = structure.length; } public TSNodeLabelStructure(TSNodeLabel t) { TSNodeLabelIndex ti = new TSNodeLabelIndex(t); structure = ti.collectAllNodesInArray(); length = structure.length; } public String toString() { StringBuilder result = new StringBuilder("["); for(int i=0; i<length; i++) { result.append(structure[i].label()); if (i!=length-1) result.append(", "); } result.append("]"); return result.toString(); } public int length() { return length; } private int lexiconLength() { int result = 0; for(TSNodeLabelIndex n : structure) { if (n.isLexical) result++; } return result; } public TSNodeLabelIndex[] structure() { return structure; } public int hashCode() { return structure[0].hashCode(); } public boolean equals(Object o) { if (o==this) return true; if (o instanceof TSNodeLabelStructure) { TSNodeLabelStructure anOtherNodeStructure = (TSNodeLabelStructure) o; if (this.structure.length != anOtherNodeStructure.structure.length) return false; return structure[0].equals(anOtherNodeStructure.structure[0]); } return false; } public static ArrayList<TSNodeLabelStructure> readTreebank(File inputFile) throws Exception { return readTreebank(inputFile, FileUtil.defaultEncoding, Integer.MAX_VALUE); } public static ArrayList<TSNodeLabelStructure> readTreebank(File inputFile, int LL) throws Exception { return readTreebank(inputFile, FileUtil.defaultEncoding, LL); } public static ArrayList<TSNodeLabelStructure> readTreebank( File inputFile, String encoding, int LL) throws Exception { ArrayList<TSNodeLabelStructure> result = new ArrayList<TSNodeLabelStructure>(); Scanner scan = FileUtil.getScanner(inputFile, encoding); PrintProgress pp = new PrintProgress("Reading Treebank: "); while(scan.hasNextLine()) { String line = scan.nextLine(); if (line.equals("")) continue; pp.next(); TSNodeLabelStructure lineStructure = new TSNodeLabelStructure(line); if (lineStructure.lexiconLength() > LL) continue; result.add(lineStructure); //if (result.size()==1000) break; } pp.end(); return result; } public static void removeSemanticTagInTreebank(ArrayList<TSNodeLabelStructure> treebank) { for(TSNodeLabelStructure t : treebank) { t.structure[0].removeSemanticTags(); } } public static void makeTreebakWithNoDoubles( File inputFile, String encoding, File outputFile) throws Exception { LinkedHashSet<TSNodeLabelStructure> treebank = new LinkedHashSet<TSNodeLabelStructure>(); Scanner scan = FileUtil.getScanner(inputFile, encoding); PrintProgress pp = new PrintProgress("Reading Treebank: "); while(scan.hasNextLine()) { String line = scan.nextLine(); if (line.equals("")) continue; pp.next(); TSNodeLabelStructure lineStructure = new TSNodeLabelStructure(line); treebank.add(lineStructure); } pp.end(); pp = new PrintProgress("Writing Treebank: "); PrintWriter pw = FileUtil.getPrintWriter(outputFile, encoding); for(TSNodeLabelStructure t : treebank) { pp.next(); pw.println(t.structure[0]); } pp.end(); pw.close(); } public static void findEqualStructures(ArrayList<TSNodeLabelStructure> treebank, File outputFile) { PrintWriter pw = FileUtil.getPrintWriter(outputFile); int t1Index = -1; BitSet foundIndexes = new BitSet(treebank.size()); for(TSNodeLabelStructure t1 : treebank) { t1Index++; if (foundIndexes.get(t1Index)) continue; ListIterator<TSNodeLabelStructure> i2 = treebank.listIterator(t1Index+1); ArrayList<Integer> equals = new ArrayList<Integer>(); int t2Index = t1Index; while (i2.hasNext()) { t2Index++; TSNodeLabelStructure t2 = i2.next(); if (t1.structure[0].equals(t2.structure[0])) { equals.add(t2Index); foundIndexes.set(t2Index); } } if (!equals.isEmpty()) { pw.println(t1Index + ": " + equals); pw.println(t1.structure[0]); pw.println(); } } pw.close(); } public static int maxDepthTreebank(ArrayList<TSNodeLabelStructure> treebank) { int maxDepth = -1; for(TSNodeLabelStructure t : treebank) { int depth = t.structure[0].maxDepth(); if (depth>maxDepth) maxDepth = depth; } return maxDepth; } public static void main(String[] args) throws Exception { File inputFile = new File(Wsj.WsjOriginalCleaned + "wsj-02-21.mrg"); File outputFile = new File(Wsj.WsjOriginalCleaned + "wsj-02-21_noDoubles.mrg"); //ArrayList<TSNodeLabelStructure> treebank = // TSNodeLabelStructure.readTreebank(inputFile, FileUtil.defaultEncoding, 1000); //findEqualStructures(treebank, new File("tmp/equalStructures.txt")); makeTreebakWithNoDoubles(inputFile, FileUtil.defaultEncoding, outputFile); } }
UTF-8
Java
5,430
java
TSNodeLabelStructure.java
Java
[]
null
[]
package tsg; import java.io.File; import java.io.PrintWriter; import java.util.ArrayList; import java.util.BitSet; import java.util.LinkedHashSet; import java.util.ListIterator; import java.util.Scanner; import tsg.corpora.Wsj; import util.PrintProgress; import util.file.FileUtil; public class TSNodeLabelStructure { public TSNodeLabelIndex[] structure; int length; //root is in position 0 public TSNodeLabelStructure(String s) throws Exception { structure = (new TSNodeLabelIndex(s)).collectAllNodesInArray(); length = structure.length; } public TSNodeLabelStructure(TSNodeLabelIndex t) { structure = t.collectAllNodesInArray(); length = structure.length; } public TSNodeLabelStructure(TSNodeLabel t) { TSNodeLabelIndex ti = new TSNodeLabelIndex(t); structure = ti.collectAllNodesInArray(); length = structure.length; } public String toString() { StringBuilder result = new StringBuilder("["); for(int i=0; i<length; i++) { result.append(structure[i].label()); if (i!=length-1) result.append(", "); } result.append("]"); return result.toString(); } public int length() { return length; } private int lexiconLength() { int result = 0; for(TSNodeLabelIndex n : structure) { if (n.isLexical) result++; } return result; } public TSNodeLabelIndex[] structure() { return structure; } public int hashCode() { return structure[0].hashCode(); } public boolean equals(Object o) { if (o==this) return true; if (o instanceof TSNodeLabelStructure) { TSNodeLabelStructure anOtherNodeStructure = (TSNodeLabelStructure) o; if (this.structure.length != anOtherNodeStructure.structure.length) return false; return structure[0].equals(anOtherNodeStructure.structure[0]); } return false; } public static ArrayList<TSNodeLabelStructure> readTreebank(File inputFile) throws Exception { return readTreebank(inputFile, FileUtil.defaultEncoding, Integer.MAX_VALUE); } public static ArrayList<TSNodeLabelStructure> readTreebank(File inputFile, int LL) throws Exception { return readTreebank(inputFile, FileUtil.defaultEncoding, LL); } public static ArrayList<TSNodeLabelStructure> readTreebank( File inputFile, String encoding, int LL) throws Exception { ArrayList<TSNodeLabelStructure> result = new ArrayList<TSNodeLabelStructure>(); Scanner scan = FileUtil.getScanner(inputFile, encoding); PrintProgress pp = new PrintProgress("Reading Treebank: "); while(scan.hasNextLine()) { String line = scan.nextLine(); if (line.equals("")) continue; pp.next(); TSNodeLabelStructure lineStructure = new TSNodeLabelStructure(line); if (lineStructure.lexiconLength() > LL) continue; result.add(lineStructure); //if (result.size()==1000) break; } pp.end(); return result; } public static void removeSemanticTagInTreebank(ArrayList<TSNodeLabelStructure> treebank) { for(TSNodeLabelStructure t : treebank) { t.structure[0].removeSemanticTags(); } } public static void makeTreebakWithNoDoubles( File inputFile, String encoding, File outputFile) throws Exception { LinkedHashSet<TSNodeLabelStructure> treebank = new LinkedHashSet<TSNodeLabelStructure>(); Scanner scan = FileUtil.getScanner(inputFile, encoding); PrintProgress pp = new PrintProgress("Reading Treebank: "); while(scan.hasNextLine()) { String line = scan.nextLine(); if (line.equals("")) continue; pp.next(); TSNodeLabelStructure lineStructure = new TSNodeLabelStructure(line); treebank.add(lineStructure); } pp.end(); pp = new PrintProgress("Writing Treebank: "); PrintWriter pw = FileUtil.getPrintWriter(outputFile, encoding); for(TSNodeLabelStructure t : treebank) { pp.next(); pw.println(t.structure[0]); } pp.end(); pw.close(); } public static void findEqualStructures(ArrayList<TSNodeLabelStructure> treebank, File outputFile) { PrintWriter pw = FileUtil.getPrintWriter(outputFile); int t1Index = -1; BitSet foundIndexes = new BitSet(treebank.size()); for(TSNodeLabelStructure t1 : treebank) { t1Index++; if (foundIndexes.get(t1Index)) continue; ListIterator<TSNodeLabelStructure> i2 = treebank.listIterator(t1Index+1); ArrayList<Integer> equals = new ArrayList<Integer>(); int t2Index = t1Index; while (i2.hasNext()) { t2Index++; TSNodeLabelStructure t2 = i2.next(); if (t1.structure[0].equals(t2.structure[0])) { equals.add(t2Index); foundIndexes.set(t2Index); } } if (!equals.isEmpty()) { pw.println(t1Index + ": " + equals); pw.println(t1.structure[0]); pw.println(); } } pw.close(); } public static int maxDepthTreebank(ArrayList<TSNodeLabelStructure> treebank) { int maxDepth = -1; for(TSNodeLabelStructure t : treebank) { int depth = t.structure[0].maxDepth(); if (depth>maxDepth) maxDepth = depth; } return maxDepth; } public static void main(String[] args) throws Exception { File inputFile = new File(Wsj.WsjOriginalCleaned + "wsj-02-21.mrg"); File outputFile = new File(Wsj.WsjOriginalCleaned + "wsj-02-21_noDoubles.mrg"); //ArrayList<TSNodeLabelStructure> treebank = // TSNodeLabelStructure.readTreebank(inputFile, FileUtil.defaultEncoding, 1000); //findEqualStructures(treebank, new File("tmp/equalStructures.txt")); makeTreebakWithNoDoubles(inputFile, FileUtil.defaultEncoding, outputFile); } }
5,430
0.719521
0.710313
184
28.51087
25.576183
102
false
false
0
0
0
0
0
0
2.538043
false
false
6
1299333016128d8a3cbbd0b1776fca3cae75b8f8
7,602,092,147,100
cdcac1c0451517bf9560cc56248c1ea3c146d4b5
/src/Interface/Demonstration.java
08214971b04be96b7a580138317628cc2ac3db8e
[]
no_license
damlatato/Information-Retrieval-and-Web-Search-Project
https://github.com/damlatato/Information-Retrieval-and-Web-Search-Project
ba9e6c7aa21efb3321cf3a2ffe75747e37d20b62
6a124c8b6ab4fc9a06b716f7bcb0f0891165ea8f
refs/heads/master
2021-01-19T09:24:49.382000
2017-02-17T19:33:22
2017-02-17T19:33:22
82,106,460
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Interface; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Demonstration{ public static void main(String[] args) throws Exception{ SwingUtilities.invokeAndWait(new Runnable(){ public void run() { List<String> myWords = new ArrayList<String>(); FileReader input = null; String myLine = null; try { input = new FileReader("C:\\Users\\Tato\\Desktop\\FSS 2016\\Information Retrieval and Web Search\\terms\\Vocabulary_terms.txt"); BufferedReader bufRead = new BufferedReader(input); while ( (myLine = bufRead.readLine()) != null) { myWords.add(myLine); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // myWords.add("bike"); // // myWords.add("car"); // // myWords.add("cap"); // // myWords.add("cape"); // // myWords.add("canadian"); // // myWords.add("caprecious"); // // myWords.add("catepult"); StringSearchable searchable = new StringSearchable(myWords); AutocompleteJComboBox combo = new AutocompleteJComboBox(searchable); JFrame frame = new JFrame(); frame.add(combo); frame.pack(); frame.setSize(100, 100); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } }
UTF-8
Java
1,503
java
Demonstration.java
Java
[ { "context": "\t\t\t\ttry {\n\t\t\t\t\tinput = new FileReader(\"C:\\\\Users\\\\Tato\\\\Desktop\\\\FSS 2016\\\\Information Retrieval and ", "end": 585, "score": 0.6839538216590881, "start": 584, "tag": "USERNAME", "value": "T" }, { "context": "\t\t\ttry {\n\t\t\t\t\tinput = new FileReader(\"C:\\\\Users\\\\Tato\\\\Desktop\\\\FSS 2016\\\\Information Retrieval and Web", "end": 588, "score": 0.4879480004310608, "start": 585, "tag": "NAME", "value": "ato" } ]
null
[]
package Interface; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Demonstration{ public static void main(String[] args) throws Exception{ SwingUtilities.invokeAndWait(new Runnable(){ public void run() { List<String> myWords = new ArrayList<String>(); FileReader input = null; String myLine = null; try { input = new FileReader("C:\\Users\\Tato\\Desktop\\FSS 2016\\Information Retrieval and Web Search\\terms\\Vocabulary_terms.txt"); BufferedReader bufRead = new BufferedReader(input); while ( (myLine = bufRead.readLine()) != null) { myWords.add(myLine); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } // myWords.add("bike"); // // myWords.add("car"); // // myWords.add("cap"); // // myWords.add("cape"); // // myWords.add("canadian"); // // myWords.add("caprecious"); // // myWords.add("catepult"); StringSearchable searchable = new StringSearchable(myWords); AutocompleteJComboBox combo = new AutocompleteJComboBox(searchable); JFrame frame = new JFrame(); frame.add(combo); frame.pack(); frame.setSize(100, 100); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } }
1,503
0.664671
0.658017
65
22.123077
23.304346
133
false
false
0
0
0
0
0
0
2.584615
false
false
6
1a71bc8e06ac3ba8133508c654f37d6b3bc3fc78
10,788,957,881,070
97030d8447a5936229f7ec73c10d09dd663250a2
/Microservice-Proj2-currency-Exchange/src/main/java/com/saumya/controller/CurrencyExchangeController.java
dabe342fa636fb0d92e8ead1df84d2e8daacbc33
[]
no_license
Saumya143/Project
https://github.com/Saumya143/Project
6e9cd10d20ea367a46fc060ff9dac6161004c029
09ae2f4fc61a0b29013333e2ba71fd264b19c123
refs/heads/master
2020-12-05T06:13:23.216000
2020-01-06T06:17:23
2020-01-06T06:17:23
232,031,361
0
0
null
false
2020-10-13T18:39:12
2020-01-06T05:36:15
2020-01-06T06:18:14
2020-10-13T18:39:11
3,439
0
1
3
Java
false
false
package com.saumya.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import com.saumya.pojo.CurrencyExchangePojo; import com.saumya.service.CurrencyExchangeService; @RestController public class CurrencyExchangeController { @Autowired CurrencyExchangeService service; @GetMapping(value="/getCurrencyValue/from/{from}/to/{to}/quantity/{quantity}") public CurrencyExchangePojo showExchangeCurrencyValue(@PathVariable("from")String from, @PathVariable("to")String to,@PathVariable("quantity") Integer quantity ) { CurrencyExchangePojo totalExchangeValue = service.getTotalExchangeValue(from, to, quantity); return totalExchangeValue; } }
UTF-8
Java
864
java
CurrencyExchangeController.java
Java
[]
null
[]
package com.saumya.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import com.saumya.pojo.CurrencyExchangePojo; import com.saumya.service.CurrencyExchangeService; @RestController public class CurrencyExchangeController { @Autowired CurrencyExchangeService service; @GetMapping(value="/getCurrencyValue/from/{from}/to/{to}/quantity/{quantity}") public CurrencyExchangePojo showExchangeCurrencyValue(@PathVariable("from")String from, @PathVariable("to")String to,@PathVariable("quantity") Integer quantity ) { CurrencyExchangePojo totalExchangeValue = service.getTotalExchangeValue(from, to, quantity); return totalExchangeValue; } }
864
0.822917
0.822917
24
34.958332
39.021873
164
false
false
0
0
0
0
0
0
1.166667
false
false
6
ba5cb838acf8d4835a2bc599ea39e6b7a5f72cec
33,706,903,352,349
2c6cabde3a748e4d348b0ed6add2ddfef753d405
/src/test/java/report/Util.java
a568629a261c1d83258c8ba1b348e066baea0426
[]
no_license
urbanairship/bigtable-test-multiple-get
https://github.com/urbanairship/bigtable-test-multiple-get
5b314be273fdfb641e9b09289df5a9cca250d2fb
4c16ea11eb171b9089459a9b9b2da62be49f7c2b
refs/heads/master
2020-02-21T19:01:14.217000
2017-08-15T20:02:49
2017-08-15T20:02:49
99,744,289
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package report; import com.google.common.collect.ImmutableMap; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.Connection; import org.apache.log4j.Logger; import java.io.IOException; import java.util.Map; public class Util { private static final Logger log = Logger.getLogger(Util.class); public static void initializeTables(Connection connection) { try { ImmutableMap<HTableDescriptor, byte[][]> schema = BigtableSchema.getHBaseSchema(); for(Map.Entry<HTableDescriptor, byte[][]> entry : ((Map<HTableDescriptor, byte[][]>)schema).entrySet()) { try { connection.getAdmin().createTable(entry.getKey(), entry.getValue()); } catch (IOException e) { log.error("Failed creating table", e); } } } catch (Exception e) { log.error("Failed creating tables", e); } } }
UTF-8
Java
975
java
Util.java
Java
[]
null
[]
package report; import com.google.common.collect.ImmutableMap; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.Connection; import org.apache.log4j.Logger; import java.io.IOException; import java.util.Map; public class Util { private static final Logger log = Logger.getLogger(Util.class); public static void initializeTables(Connection connection) { try { ImmutableMap<HTableDescriptor, byte[][]> schema = BigtableSchema.getHBaseSchema(); for(Map.Entry<HTableDescriptor, byte[][]> entry : ((Map<HTableDescriptor, byte[][]>)schema).entrySet()) { try { connection.getAdmin().createTable(entry.getKey(), entry.getValue()); } catch (IOException e) { log.error("Failed creating table", e); } } } catch (Exception e) { log.error("Failed creating tables", e); } } }
975
0.62359
0.622564
29
32.620689
30.690237
117
false
false
0
0
0
0
0
0
0.62069
false
false
6
70da7204aa1f4d0d19a65209ef996e9fcd103341
12,266,426,612,782
41a2ac26d1cc5c409719867d9fdac4080477db68
/myFirstJavaProject/src/list/Arraylist.java
676a87bd3ac2f89fa7e7a04fe54b2e92fd3b5095
[]
no_license
Krishna1010102/Ds-algo-java
https://github.com/Krishna1010102/Ds-algo-java
2ce727f840a3f22deeb7d7b759a54e396636705b
03af88dcdaf389325a0918e4aab303ed72e1282a
refs/heads/main
2023-06-11T13:26:07.162000
2021-07-05T12:03:03
2021-07-05T12:03:03
383,035,475
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package list; import java.util.ArrayList; public class Arraylist { public static void main(String[] args) { ArrayList<Integer> arr=new ArrayList<>(); arr.add(10); arr.add(10); arr.add(10); arr.add(10); arr.add(10); arr.remove(3); Integer a[]=new Integer[arr.size()]; arr.toArray(a); System.out.println(arr); for(Integer c:a) { System.out.println(c); } } }
UTF-8
Java
393
java
Arraylist.java
Java
[]
null
[]
package list; import java.util.ArrayList; public class Arraylist { public static void main(String[] args) { ArrayList<Integer> arr=new ArrayList<>(); arr.add(10); arr.add(10); arr.add(10); arr.add(10); arr.add(10); arr.remove(3); Integer a[]=new Integer[arr.size()]; arr.toArray(a); System.out.println(arr); for(Integer c:a) { System.out.println(c); } } }
393
0.633588
0.605598
25
14.72
13.076758
43
false
false
0
0
0
0
0
0
1.76
false
false
6
b82ace29f668a174587884052791ae292cb44a70
21,526,376,114,260
9a93b513dfd3b8b39560bebbe75ca8c80a988262
/BewerbungHochschule/src/main/java/utils/Anrede.java
14675b3cc763d809227852bc40922ed7f015b58f
[ "Apache-2.0" ]
permissive
Baghir/camundaBPM
https://github.com/Baghir/camundaBPM
3445e764a13fdac0b7fe9b90c4598f52e5fbf211
834fac05616dd1d4956879050abe9e54c9577497
refs/heads/master
2020-04-15T17:36:24.131000
2018-07-02T19:16:54
2018-07-02T19:16:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package utils; public enum Anrede { /** * Enum for Anrede */ Frau, Herr }
UTF-8
Java
77
java
Anrede.java
Java
[]
null
[]
package utils; public enum Anrede { /** * Enum for Anrede */ Frau, Herr }
77
0.636364
0.636364
8
8.625
7.448783
20
false
false
0
0
0
0
0
0
0.25
false
false
6
7239a9d698b21ae36219a04d3e95b0cb6eedc86e
2,628,520,011,510
4ca88b2bcee6991237e29a4cf9e3a3c1690f7568
/src/main/java/com/bti360/sandbox/ws/Person.java
1e031293dc3676ad38d6b80231fa0e4c17ca50d0
[]
no_license
shaderaider/tddch
https://github.com/shaderaider/tddch
138c62e4a19a4d251ffa6be3cf1dbca707797aba
b70c4617df1419830aab481e86ad38402c180111
refs/heads/master
2016-09-07T17:23:34.479000
2013-06-11T23:17:48
2013-06-11T23:17:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bti360.sandbox.ws; import java.util.UUID; import com.google.gson.Gson; public class Person { private final UUID id; private final String name; private final int age; public Person(String name, int age) { this.id = UUID.randomUUID(); this.name = name; this.age = age; } public UUID getId() { return id; } public String getName() { return name; } public int getAge() { return age; } public String toString() { return new Gson().toJson(this); } public boolean equals(Object other) { if (this == other) return true; if (other instanceof Person == false) return false; Person that = (Person) other; return this.id.equals(that.id) && this.age == that.age && this.name.equals(that.name); } }
UTF-8
Java
762
java
Person.java
Java
[]
null
[]
package com.bti360.sandbox.ws; import java.util.UUID; import com.google.gson.Gson; public class Person { private final UUID id; private final String name; private final int age; public Person(String name, int age) { this.id = UUID.randomUUID(); this.name = name; this.age = age; } public UUID getId() { return id; } public String getName() { return name; } public int getAge() { return age; } public String toString() { return new Gson().toJson(this); } public boolean equals(Object other) { if (this == other) return true; if (other instanceof Person == false) return false; Person that = (Person) other; return this.id.equals(that.id) && this.age == that.age && this.name.equals(that.name); } }
762
0.65748
0.653543
47
15.212766
16.521986
88
false
false
0
0
0
0
0
0
1.510638
false
false
6
6400bbf7d96c7bdfbc8d1a077570e27e8fca9507
3,590,592,722,738
8c2b203d7c31ff110422ca6f396accce992e4a72
/src/main/java/com/johnkuper/epam/production/DeliveryService.java
88afd2c6231d87e88a834cb66d06a93127e83910
[]
no_license
JohnKuper/Task14_Spring
https://github.com/JohnKuper/Task14_Spring
14efd9aae5ea0315feb843c27c16ac4bd207c84f
b7f780b31252358daaa9fb9dcf5774515e034117
refs/heads/master
2021-03-12T22:14:37.627000
2014-11-04T19:40:29
2014-11-04T19:40:29
26,004,604
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.johnkuper.epam.production; public interface DeliveryService { void deliverDocument(); }
UTF-8
Java
104
java
DeliveryService.java
Java
[]
null
[]
package com.johnkuper.epam.production; public interface DeliveryService { void deliverDocument(); }
104
0.788462
0.788462
7
13.857142
16.18137
38
false
false
0
0
0
0
0
0
0.428571
false
false
6
cd005881e487c231854b183cf1710da7ab2fcb7b
3,590,592,724,731
8c39520696a849079e6622e967ad5792893ef459
/src/es/freefri/crawler/io/writer/CrawlerWriter.java
e25c5550f07f742189b13999dde07c80df0b8e81
[ "MIT" ]
permissive
freefri/simpleWebCrawler
https://github.com/freefri/simpleWebCrawler
af5db2846ee0376fed5b5f42098de190a95a2760
6a66e58474645fad0868fb660bb3e0eee9ef8fe6
refs/heads/master
2021-01-23T12:17:37.133000
2014-11-28T13:30:04
2014-11-28T13:30:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.freefri.crawler.io.writer; import java.util.Map; public interface CrawlerWriter { public void writeLine(Map line); }
UTF-8
Java
135
java
CrawlerWriter.java
Java
[]
null
[]
package es.freefri.crawler.io.writer; import java.util.Map; public interface CrawlerWriter { public void writeLine(Map line); }
135
0.755556
0.755556
8
15.875
16.259132
37
false
false
0
0
0
0
0
0
0.375
false
false
6
1d2efec4b0423f879408e8b315baec68180868fa
15,805,479,711,294
a33fc2c1ebdd157b7773bebfc88e2aacc4bd2011
/Sprint 5/TAM_DATABASE/src/java/restful/service/RoleService.java
009f8f87eacecca25de8adabb281230e5b1619a8
[]
no_license
emprogramacion/Project_C3_G51_TEAM6_EDR
https://github.com/emprogramacion/Project_C3_G51_TEAM6_EDR
1415c1daee2d509e943ca8d47d04be389dcec352
daf5c43dfa40184f000c4a458f9880276a2df166
refs/heads/main
2023-08-28T08:01:36.082000
2021-10-24T01:23:59
2021-10-24T01:23:59
409,080,052
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package restful.service; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; import java.util.ArrayList; import restful.Model.RoleModel; import restful.Model.Conexion; public class RoleService { public ArrayList<RoleModel> getRoles() { ArrayList<RoleModel> lista = new ArrayList<>(); Conexion conn = new Conexion(); String sql = "SELECT * FROM role"; try { Statement stm = conn.getCon().createStatement(); ResultSet rs = stm.executeQuery(sql); while (rs.next()) { RoleModel role = new RoleModel(); role.setId(rs.getInt("id")); role.setName(rs.getString("name")); role.setDescription(rs.getString("description")); lista.add(role); } } catch (SQLException e) { } return lista; } public RoleModel getRole(int id) { RoleModel role = new RoleModel(); Conexion conex = new Conexion(); String Sql = "SELECT * FROM role WHERE id = ?"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, id); ResultSet rs = pstm.executeQuery(); while (rs.next()) { role.setId(rs.getInt("id")); role.setName(rs.getString("name")); role.setDescription(rs.getString("description")); } } catch (SQLException e) { System.out.println(e); } return role; } public RoleModel addRole(RoleModel role) { Conexion conex = new Conexion(); String Sql = "INSERT INTO role(id,name,description)"; Sql = Sql + "values (?,?,?)"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, role.getId()); pstm.setString(2, role.getName()); pstm.setString(3, role.getDescription()); pstm.executeUpdate(); } catch (SQLException e) { System.out.println(e); return null; } return role; } public RoleModel updateRole(RoleModel role) { Conexion conn = new Conexion(); String sql = "UPDATE role SET name=?, description=? WHERE id= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setString(1, role.getName()); pstm.setString(2, role.getDescription()); pstm.setInt(3, role.getId()); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al modificar " + excepcion.getMessage()); return null; } return role; } public String delRole(int id) { Conexion conn = new Conexion(); String sql = "DELETE FROM role WHERE id= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setInt(1, id); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al eliminar " + excepcion.getMessage()); return "{\"Accion\":\"Error\"}"; } return "{\"Accion\":\"Registro Borrado\"}"; } }
UTF-8
Java
3,421
java
RoleService.java
Java
[]
null
[]
package restful.service; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; import java.util.ArrayList; import restful.Model.RoleModel; import restful.Model.Conexion; public class RoleService { public ArrayList<RoleModel> getRoles() { ArrayList<RoleModel> lista = new ArrayList<>(); Conexion conn = new Conexion(); String sql = "SELECT * FROM role"; try { Statement stm = conn.getCon().createStatement(); ResultSet rs = stm.executeQuery(sql); while (rs.next()) { RoleModel role = new RoleModel(); role.setId(rs.getInt("id")); role.setName(rs.getString("name")); role.setDescription(rs.getString("description")); lista.add(role); } } catch (SQLException e) { } return lista; } public RoleModel getRole(int id) { RoleModel role = new RoleModel(); Conexion conex = new Conexion(); String Sql = "SELECT * FROM role WHERE id = ?"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, id); ResultSet rs = pstm.executeQuery(); while (rs.next()) { role.setId(rs.getInt("id")); role.setName(rs.getString("name")); role.setDescription(rs.getString("description")); } } catch (SQLException e) { System.out.println(e); } return role; } public RoleModel addRole(RoleModel role) { Conexion conex = new Conexion(); String Sql = "INSERT INTO role(id,name,description)"; Sql = Sql + "values (?,?,?)"; try { PreparedStatement pstm = conex.getCon().prepareStatement(Sql); pstm.setInt(1, role.getId()); pstm.setString(2, role.getName()); pstm.setString(3, role.getDescription()); pstm.executeUpdate(); } catch (SQLException e) { System.out.println(e); return null; } return role; } public RoleModel updateRole(RoleModel role) { Conexion conn = new Conexion(); String sql = "UPDATE role SET name=?, description=? WHERE id= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setString(1, role.getName()); pstm.setString(2, role.getDescription()); pstm.setInt(3, role.getId()); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al modificar " + excepcion.getMessage()); return null; } return role; } public String delRole(int id) { Conexion conn = new Conexion(); String sql = "DELETE FROM role WHERE id= ?"; try { PreparedStatement pstm = conn.getCon().prepareStatement(sql); pstm.setInt(1, id); pstm.executeUpdate(); } catch (SQLException excepcion) { System.out.println("Ha ocurrido un error al eliminar " + excepcion.getMessage()); return "{\"Accion\":\"Error\"}"; } return "{\"Accion\":\"Registro Borrado\"}"; } }
3,421
0.546624
0.544285
108
30.675926
22.464304
95
false
false
0
0
0
0
0
0
0.666667
false
false
6