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
c7ed136b679a687ad28576dc1b89ed541cafd064
35,914,516,553,280
a06637f37e0222f39d7837d9d6b214ceaf47298d
/src/main/java/com/bti/service/ServicePriceGroupSetUp.java
dd3363bf5c8b778b7a0bcc33ce71916852d9c63f
[]
no_license
daminideokar/ERP_NOJUNIT1
https://github.com/daminideokar/ERP_NOJUNIT1
2665e7d95699b3fdf50d0a7cde3d71491ee31c2f
d7bfd33eb30d17f92658435378dd5db377d1e0b4
refs/heads/master
2020-03-18T14:27:07.778000
2018-05-25T13:24:21
2018-05-25T13:24:21
134,848,751
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * BTI - BAAN for Technology And Trade IntL. * Copyright © 2017 BTI. * * All rights reserved. * * THIS PRODUCT CONTAINS CONFIDENTIAL INFORMATION OF BTI. * USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE * PRIOR EXPRESS WRITTEN PERMISSION OF BTI. */ package com.bti.service; import java.util.ArrayList; import org.springframework.data.domain.PageRequest; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort.Direction; import org.springframework.stereotype.Service; import com.bti.model.PriceGroupSetUp; import com.bti.model.dto.DtoPriceGroupSetup; import com.bti.model.dto.DtoSearch; import com.bti.repository.RepositoryPriceGroupSetup; import com.bti.util.UtilDateAndTime; /** * Name of Project: BTI * Description: Service PriceGroupSetup * Created on: NOVEMBER 6,2017 * Modified on: * * @author goodtech */ @Service public class ServicePriceGroupSetUp { private static final Log LOG = LogFactory.getLog(ServicePriceGroupSetUp.class); @Autowired private RepositoryPriceGroupSetup repositoryPriceGroupSetup; /** * @param dtoPriceGroupSetup * @return */ public DtoSearch getAllPriceGroupSetup(DtoPriceGroupSetup dtoPriceGroupSetup) { LOG.info("In getall method of Price Group SetUp SetUp"); DtoSearch dtoSearch = new DtoSearch(); dtoSearch.setPageNumber(dtoPriceGroupSetup.getPageNumber()); dtoSearch.setPageSize(dtoPriceGroupSetup.getPageSize()); dtoSearch.setTotalCount((int) repositoryPriceGroupSetup.count()); List<PriceGroupSetUp> priceGroupSetUpList; if (dtoPriceGroupSetup.getPageNumber() != null && dtoPriceGroupSetup.getPageSize() != null) { Pageable pageable = new PageRequest(dtoPriceGroupSetup.getPageNumber(), dtoPriceGroupSetup.getPageSize(), Direction.DESC, "createDate"); priceGroupSetUpList = repositoryPriceGroupSetup.findBy(pageable); } else { priceGroupSetUpList = repositoryPriceGroupSetup.findByOrderByCreateDateDesc(); } List<DtoPriceGroupSetup> dtoPriceGroupSetupList = new ArrayList<>(); if (priceGroupSetUpList != null && priceGroupSetUpList.size() > 0) { for (PriceGroupSetUp priceGroupSetUp : priceGroupSetUpList) { dtoPriceGroupSetup = new DtoPriceGroupSetup(priceGroupSetUp); dtoPriceGroupSetupList.add(dtoPriceGroupSetup); } dtoSearch.setRecords(dtoPriceGroupSetupList); } return dtoSearch; } /** * @param dtoPriceGroupSetup * @return */ public DtoPriceGroupSetup saveOrUpdatePriceGroupSetup(DtoPriceGroupSetup dtoPriceGroupSetup) { LOG.info("In Save Or Update method of Price Group SetUp SetUp"); UtilDateAndTime utilDateAndTime = new UtilDateAndTime(); PriceGroupSetUp priceGroupSetUp; if (dtoPriceGroupSetup.getPriceGroupIndex() == 0) { priceGroupSetUp = new PriceGroupSetUp(); BeanUtils.copyProperties(dtoPriceGroupSetup, priceGroupSetUp); priceGroupSetUp.setCreateDate(utilDateAndTime.localToUTC()); } else { priceGroupSetUp = repositoryPriceGroupSetup.findOne(dtoPriceGroupSetup.getPriceGroupIndex()); priceGroupSetUp.setPriceGroupDescription(dtoPriceGroupSetup.getPriceGroupDescription()); priceGroupSetUp.setPriceGroupDescriptionArabic(dtoPriceGroupSetup.getPriceGroupDescriptionArabic()); priceGroupSetUp.setModifyDate(utilDateAndTime.localToUTC()); } priceGroupSetUp = repositoryPriceGroupSetup.save(priceGroupSetUp); BeanUtils.copyProperties(priceGroupSetUp, dtoPriceGroupSetup); return dtoPriceGroupSetup; } /** * @param dtoPriceGroupSetup * @return */ public DtoPriceGroupSetup getPriceGroupById(DtoPriceGroupSetup dtoPriceGroupSetup) { LOG.info("In getPriceGroupById method of Price Group SetUp SetUp"); PriceGroupSetUp priceGroupSetUp = repositoryPriceGroupSetup.getByPriceGroupId(dtoPriceGroupSetup.getPriceGroupId()); if (priceGroupSetUp == null) { return null; } BeanUtils.copyProperties(priceGroupSetUp, dtoPriceGroupSetup); return dtoPriceGroupSetup; } }
UTF-8
Java
4,310
java
ServicePriceGroupSetUp.java
Java
[ { "context": " NOVEMBER 6,2017\r\n * Modified on:\r\n * \r\n * @author goodtech\r\n */\r\n@Service\r\npublic class ServicePriceGroupSet", "end": 1137, "score": 0.9995282292366028, "start": 1129, "tag": "USERNAME", "value": "goodtech" } ]
null
[]
/** * BTI - BAAN for Technology And Trade IntL. * Copyright © 2017 BTI. * * All rights reserved. * * THIS PRODUCT CONTAINS CONFIDENTIAL INFORMATION OF BTI. * USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE * PRIOR EXPRESS WRITTEN PERMISSION OF BTI. */ package com.bti.service; import java.util.ArrayList; import org.springframework.data.domain.PageRequest; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort.Direction; import org.springframework.stereotype.Service; import com.bti.model.PriceGroupSetUp; import com.bti.model.dto.DtoPriceGroupSetup; import com.bti.model.dto.DtoSearch; import com.bti.repository.RepositoryPriceGroupSetup; import com.bti.util.UtilDateAndTime; /** * Name of Project: BTI * Description: Service PriceGroupSetup * Created on: NOVEMBER 6,2017 * Modified on: * * @author goodtech */ @Service public class ServicePriceGroupSetUp { private static final Log LOG = LogFactory.getLog(ServicePriceGroupSetUp.class); @Autowired private RepositoryPriceGroupSetup repositoryPriceGroupSetup; /** * @param dtoPriceGroupSetup * @return */ public DtoSearch getAllPriceGroupSetup(DtoPriceGroupSetup dtoPriceGroupSetup) { LOG.info("In getall method of Price Group SetUp SetUp"); DtoSearch dtoSearch = new DtoSearch(); dtoSearch.setPageNumber(dtoPriceGroupSetup.getPageNumber()); dtoSearch.setPageSize(dtoPriceGroupSetup.getPageSize()); dtoSearch.setTotalCount((int) repositoryPriceGroupSetup.count()); List<PriceGroupSetUp> priceGroupSetUpList; if (dtoPriceGroupSetup.getPageNumber() != null && dtoPriceGroupSetup.getPageSize() != null) { Pageable pageable = new PageRequest(dtoPriceGroupSetup.getPageNumber(), dtoPriceGroupSetup.getPageSize(), Direction.DESC, "createDate"); priceGroupSetUpList = repositoryPriceGroupSetup.findBy(pageable); } else { priceGroupSetUpList = repositoryPriceGroupSetup.findByOrderByCreateDateDesc(); } List<DtoPriceGroupSetup> dtoPriceGroupSetupList = new ArrayList<>(); if (priceGroupSetUpList != null && priceGroupSetUpList.size() > 0) { for (PriceGroupSetUp priceGroupSetUp : priceGroupSetUpList) { dtoPriceGroupSetup = new DtoPriceGroupSetup(priceGroupSetUp); dtoPriceGroupSetupList.add(dtoPriceGroupSetup); } dtoSearch.setRecords(dtoPriceGroupSetupList); } return dtoSearch; } /** * @param dtoPriceGroupSetup * @return */ public DtoPriceGroupSetup saveOrUpdatePriceGroupSetup(DtoPriceGroupSetup dtoPriceGroupSetup) { LOG.info("In Save Or Update method of Price Group SetUp SetUp"); UtilDateAndTime utilDateAndTime = new UtilDateAndTime(); PriceGroupSetUp priceGroupSetUp; if (dtoPriceGroupSetup.getPriceGroupIndex() == 0) { priceGroupSetUp = new PriceGroupSetUp(); BeanUtils.copyProperties(dtoPriceGroupSetup, priceGroupSetUp); priceGroupSetUp.setCreateDate(utilDateAndTime.localToUTC()); } else { priceGroupSetUp = repositoryPriceGroupSetup.findOne(dtoPriceGroupSetup.getPriceGroupIndex()); priceGroupSetUp.setPriceGroupDescription(dtoPriceGroupSetup.getPriceGroupDescription()); priceGroupSetUp.setPriceGroupDescriptionArabic(dtoPriceGroupSetup.getPriceGroupDescriptionArabic()); priceGroupSetUp.setModifyDate(utilDateAndTime.localToUTC()); } priceGroupSetUp = repositoryPriceGroupSetup.save(priceGroupSetUp); BeanUtils.copyProperties(priceGroupSetUp, dtoPriceGroupSetup); return dtoPriceGroupSetup; } /** * @param dtoPriceGroupSetup * @return */ public DtoPriceGroupSetup getPriceGroupById(DtoPriceGroupSetup dtoPriceGroupSetup) { LOG.info("In getPriceGroupById method of Price Group SetUp SetUp"); PriceGroupSetUp priceGroupSetUp = repositoryPriceGroupSetup.getByPriceGroupId(dtoPriceGroupSetup.getPriceGroupId()); if (priceGroupSetUp == null) { return null; } BeanUtils.copyProperties(priceGroupSetUp, dtoPriceGroupSetup); return dtoPriceGroupSetup; } }
4,310
0.763054
0.760501
130
31.146154
30.383982
118
false
false
0
0
0
0
0
0
1.523077
false
false
4
5439f7475b4b5e5efb8c1396db815c976d8cd6fe
2,551,210,621,578
77f2b1c30da6a4ed79e348a7921c1194ec4eb136
/wumin-core/src/main/java/com/wumin/core/web/controller/DataTypeController.java
78f82b6671ab219dcfca376edd7c9bc44116295b
[]
no_license
wumin123150/wumin
https://github.com/wumin123150/wumin
64f5c8e159e7b59da7c87bf0631d8c60d6be8b63
c67cb96f5a17fafc953b4ee644c3b59013038610
refs/heads/master
2021-01-20T13:12:28.019000
2018-05-13T02:29:26
2018-05-13T02:29:26
101,738,990
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wumin.core.web.controller; import com.wumin.core.entity.DataType; import com.wumin.core.service.DataTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Api(description = "数据类型管理") @Controller @RequestMapping(value = "/admin/dataType") public class DataTypeController { private static final String MENU = "dataDictionary"; private static final String ACTION_CREATE = "create"; private static final String ACTION_UPDATE = "update"; @Value("${system.theme:layui}") private String theme; @Autowired private DataTypeService dataTypeService; @ApiOperation(value = "数据类型列表页面", httpMethod = "GET") @RequiresRoles("admin") @RequestMapping public String list(Model model) { model.addAttribute("menu", MENU); return theme + "/dataDictionary/dataTypeList"; } @ApiOperation(value = "数据类型新增页面", httpMethod = "GET") @RequiresRoles("admin") @RequestMapping(value = "create", method = RequestMethod.GET) public String create(Model model) { model.addAttribute("menu", MENU); model.addAttribute("action", ACTION_CREATE); model.addAttribute("dataType", new DataType()); return theme + "/dataDictionary/dataTypeForm"; } @ApiOperation(value = "数据类型修改页面", httpMethod = "GET") @RequiresRoles("admin") @RequestMapping(value = "update/{id}", method = RequestMethod.GET) public String update(@PathVariable("id") Long id, Model model) { model.addAttribute("menu", MENU); model.addAttribute("action", ACTION_UPDATE); model.addAttribute("dataType", dataTypeService.get(id)); return theme + "/dataDictionary/dataTypeForm"; } }
UTF-8
Java
2,155
java
DataTypeController.java
Java
[]
null
[]
package com.wumin.core.web.controller; import com.wumin.core.entity.DataType; import com.wumin.core.service.DataTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Api(description = "数据类型管理") @Controller @RequestMapping(value = "/admin/dataType") public class DataTypeController { private static final String MENU = "dataDictionary"; private static final String ACTION_CREATE = "create"; private static final String ACTION_UPDATE = "update"; @Value("${system.theme:layui}") private String theme; @Autowired private DataTypeService dataTypeService; @ApiOperation(value = "数据类型列表页面", httpMethod = "GET") @RequiresRoles("admin") @RequestMapping public String list(Model model) { model.addAttribute("menu", MENU); return theme + "/dataDictionary/dataTypeList"; } @ApiOperation(value = "数据类型新增页面", httpMethod = "GET") @RequiresRoles("admin") @RequestMapping(value = "create", method = RequestMethod.GET) public String create(Model model) { model.addAttribute("menu", MENU); model.addAttribute("action", ACTION_CREATE); model.addAttribute("dataType", new DataType()); return theme + "/dataDictionary/dataTypeForm"; } @ApiOperation(value = "数据类型修改页面", httpMethod = "GET") @RequiresRoles("admin") @RequestMapping(value = "update/{id}", method = RequestMethod.GET) public String update(@PathVariable("id") Long id, Model model) { model.addAttribute("menu", MENU); model.addAttribute("action", ACTION_UPDATE); model.addAttribute("dataType", dataTypeService.get(id)); return theme + "/dataDictionary/dataTypeForm"; } }
2,155
0.754654
0.754654
61
33.344261
22.454971
68
false
false
0
0
0
0
0
0
0.672131
false
false
4
92f1ced6d9911b37c91d2b67b9a57ea10cd7937e
34,514,357,220,176
bb7be5b4175efccf3edad6e89aad95a589a9dc6c
/Si-Tech/AcctMgrOrder/.svn/pristine/92/92f1ced6d9911b37c91d2b67b9a57ea10cd7937e.svn-base
6fa6c7bfebda6bc36e5497377ae091ebe1786c1a
[]
no_license
BarryPro/JavaEE_Eclipse
https://github.com/BarryPro/JavaEE_Eclipse
5fde49bfcedf88d660319ab7c9da187f0eaddcea
df5bacbc094e49c693eb8b18f8b734835665b068
refs/heads/master
2021-06-25T04:21:16.572000
2017-09-13T04:10:01
2017-09-13T04:10:01
99,305,991
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sitech.acctmgr.app.dataorder; import java.sql.Connection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import com.sitech.acctmgr.app.common.AppProperties; import com.sitech.acctmgr.app.common.InterBusiConst; import com.sitech.acctmgr.app.common.JdbcConn; import com.sitech.acctmgr.common.AcctMgrError; import com.sitech.acctmgr.common.BaseBusi; import com.sitech.jcf.core.exception.BusiException; import com.sitech.jcf.ijdbc.sql.SqlTypes; import com.sitech.jcfx.util.DateUtil; public class SpecDataSynJL extends BaseBusi implements ISpecDataSyn { /** * Title 是否分省处理 * Description 部分业务为省个性化处理,单独封接口处理 * @return True:需要分省 False:不需要 */ public boolean isPerProvBusi() { //判断是否分省逻辑,暂时不处理 if (AppProperties.getConfigByMap("DATA_ISPERV").equals("true")) return true; else return false; } /** * Title 私有接口:个性化更新用户数据 * @param inTabOpMap * @return true or false */ public boolean updateCbUserStatus(Map<String, Object> inTabOpMap) { int iInstRows = 0; String sOpType = ""; String sBossRunCode = ""; //String sCrmRunCode = ""; Map<String, Object> colmsMap = new HashMap<String, Object>(); List<Map<String, Object>> list = null; Map<String, Object> tmpMap = null; sOpType = inTabOpMap.get("OP").toString(); colmsMap.putAll((Map<String, Object>) inTabOpMap.get("COLS")); String id_no = colmsMap.get("ID_NO").toString(); Map<String, Object> oprInfo = (Map<String, Object>) inTabOpMap.get("OPR_INFO"); Connection conn = (Connection) inTabOpMap.get("CONN"); JdbcConn jdbcConn = new JdbcConn(conn); /*1.新开户插入一条记录,不再做用户状态合成*/ if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_INSERT)) { /*插入操作直接返回,后续拼串执行插入*/ return true; } if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE)) { colmsMap.put("CRM_RUN_CODE", "a"); } colmsMap.put("CRM_RUN_TIME", DateUtil.format(new Date(), "yyyyMMddHHmmss")); colmsMap.put("REMARK", "CRM--BOSS数据同步接口插入记录"); colmsMap.put("OPT_SN", "-1"); colmsMap.put("IN_LOGIN_NO", "c2b"); colmsMap.put("IN_LOGIN_NO", "c2b"); /*查询BOSSRUNCODE 和 合成新状态*/ String sNewRunCode = ""; //sBossRunCode = (String) baseDao.queryForObject("BK_ur_bosstocrmstate_info.qBossRunCodeByIdNo", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_QUERY_RUNCODE_BY_IDNO); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); list = jdbcConn.select(); if(list != null && (list.size() == 1)){ tmpMap = list.get(0); sBossRunCode = tmpMap.get("BOSS_RUN_CODE").toString(); } else { log.error("query UR_BOSSTOCRMSTATE_INFO error,please check!"); return false; } /*9状态全部变为A状态 ACTION_ID=12461,传入的CRM_RUN_CODE为A @20150905*/ Map<String, Object> opr_info = (Map<String, Object>) inTabOpMap.get("OPR_INFO"); if (opr_info.get("ACTION_ID") != null && opr_info.get("ACTION_ID").toString().equals("12461")) { colmsMap.put("CRM_RUN_CODE", "A"); sBossRunCode = "A"; } colmsMap.put("BOSS_RUN_CODE", sBossRunCode); //sNewRunCode = (String) baseDao.queryForObject("BK_cs_runcode_comprule_dict.qRunCodeByBossAndCrmRun", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_QUERY_RUNCODE); jdbcConn.addParam("CRM_RUN_CODE", colmsMap.get("CRM_RUN_CODE").toString()); jdbcConn.addParam("BOSS_RUN_CODE", sBossRunCode); list = jdbcConn.select(); if(list != null && (list.size() == 1)){ tmpMap = list.get(0); sNewRunCode = (String) tmpMap.get("RUN_CODE"); } else { log.error("query CS_RUNCODE_COMPRULE_DICT error,please check!"); return false; } if (null == sBossRunCode || null == sNewRunCode) { log.error("query ur_bosstocrmstate_info error,please check!"); throw new BusiException(AcctMgrError.getErrorCode("0000","7005"), "数据同步省分查询执行错误!sBossRunCode="+sBossRunCode); } colmsMap.put("RUN_CODE", sNewRunCode); /*入历史*/ colmsMap.put("REMARK", "CRM--BOSS数据工单移入历史"); //baseDao.insert("BK_ur_bosstocrmstate_his.iBossToCrmMmByIdNo", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_UPDT_BTC); jdbcConn.addParam("OPT_SN", "-1"); jdbcConn.addParam("IN_LOGIN_NO", "c2b"); jdbcConn.addParam("REMARK", "CRM--BOSS数据同步接口插入记录"); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); /*将变更信息写入INT_BOSSTOCRMSTATE_CHG小表*/ /*2.更新操作 或 删除操作*/ if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_UPDATE) || sOpType.equals(InterBusiConst.DATA_OPER_TYPE_SPECIAL)) { /*更新CS_USERDETAIL_INFO表的RUN_CODE*/ //baseDao.update("BK_cs_userdetail_info.uRunCodeByIdNo", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_UPDT_DTE); //UPDATE CS_USERDETAIL_INFO SET OLD_RUN=RUN_CODE, OP_TIME=sysdate, //RUN_CODE=?, RUN_TIME=TO_DATE(?, 'YYYYMMDDHH24MISS'), OP_CODE=?, LOGIN_NO=? WHERE ID_NO=? jdbcConn.addParam("RUN_CODE", colmsMap.get("RUN_CODE").toString()); jdbcConn.addParam("RUN_TIME", colmsMap.get("CRM_RUN_TIME").toString()); jdbcConn.addParam("OP_CODE", colmsMap.get("OP_CODE").toString()); jdbcConn.addParam("LOGIN_NO", colmsMap.get("IN_LOGIN_NO").toString()); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); /*更新小表*/ //取得流水 String mmdd = DateUtil.format(new Date(), "MMdd").toString(); tmpMap = new HashMap<String, Object>(); tmpMap.put("SEQ_NAME", "SEQ_INT_DEAL_FLAG"); Map<String, Object> result = null; result = (Map<String, Object>) baseDao.queryForObject("BK_dual.qSequenceInter", tmpMap); String sIntSequenValue1 = result.get("NEXTVAL").toString()+mmdd; result = (Map<String, Object>) baseDao.queryForObject("BK_dual.qSequenceInter", tmpMap); String sIntSequenValue2 = result.get("NEXTVAL").toString()+mmdd; //更新ACCHG jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_INST_DTE_ACCHG); jdbcConn.addParam("SEQ_NO", sIntSequenValue1, SqlTypes.JLONG); jdbcConn.addParam("OP_FLAG", "2", SqlTypes.JINT);//更新 jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_INST_DTE_BICHG); jdbcConn.addParam("SEQ_NO", sIntSequenValue2, SqlTypes.JLONG); jdbcConn.addParam("OP_FLAG", "2", SqlTypes.JINT);//更新 jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); Map<String, Object> out_data = (Map<String, Object>) baseDao.queryForObject("BK_ur_user_info.qCoBrGrpbyIdNo", Long.parseLong(id_no)); String order_line_id = oprInfo.get("ORDER_LINE_ID")!=null?oprInfo.get("ORDER_LINE_ID").toString():""; String login_no = colmsMap.get("LOGIN_NO")!=null?colmsMap.get("LOGIN_NO").toString():""; String op_code = colmsMap.get("OP_CODE")!=null?colmsMap.get("OP_CODE").toString():""; //更新入bal_userchg_recd @20150922 wangzhia信控确认 String DATAODR_USERCHG_INST = "insert into bal_userchg_recd" + " (COMMAND_ID, TOTAL_DATE, PAY_SN, ID_NO, CONTRACT_NO, GROUP_ID, BRAND_ID, PHONE_NO," + " OLD_RUN, RUN_CODE, OP_TIME, OP_CODE, LOGIN_NO, LOGIN_GROUP, REMARK) " + "select SEQ_COMMON_ID.nextval, to_number(to_char(run_time, 'YYYYMMDD')), ?, ?, ?, ?, ?, ?," + " old_run, run_code, sysdate, ?, ?, ?, ? " + "from cs_userdetail_info where id_no = ?"; jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_USERCHG_INST); jdbcConn.addParam("PAY_SN", "0", SqlTypes.JLONG); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.addParam("CONTRACT_NO", out_data.get("CONTRACT_NO").toString(), SqlTypes.JLONG); jdbcConn.addParam("GROUP_ID", out_data.get("GROUP_ID").toString(), SqlTypes.JSTRING); jdbcConn.addParam("BRAND_ID", out_data.get("BRAND_ID").toString(), SqlTypes.JSTRING); jdbcConn.addParam("PHONE_NO", out_data.get("PHONE_NO").toString(), SqlTypes.JSTRING); jdbcConn.addParam("OP_CODE", op_code, SqlTypes.JSTRING); jdbcConn.addParam("LOGIN_NO", login_no, SqlTypes.JSTRING); jdbcConn.addParam("LOGIN_GROUP", "", SqlTypes.JSTRING); jdbcConn.addParam("REMARK", "crm->bossDataSyn:"+order_line_id, SqlTypes.JSTRING); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); } //设置修改的值,后边拼工单使用 //inTabOpMap.put("COLS", colmsMap); return true; } /** * Title 私有接口:更新用户数据 * @param inSynTabMap * @return */ public boolean updateCbUserFav(Map<String, Object> inTabOpMap) { String sOpType = ""; String sFavNum = ""; Map<String, Object> outTmpMap = new HashMap<String, Object>(); outTmpMap.putAll(inTabOpMap); sOpType = outTmpMap.get("OP").toString(); if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE) || sOpType.equals(InterBusiConst.DATA_OPER_TYPE_UPDATE)) { sFavNum = (String) baseDao.queryForObject("pd_userfav_info.qOrderCodeByIdNoColId", outTmpMap); } else if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_INSERT)) { Map<String, String> inMap = new HashMap<String, String>(); inMap.put("SEQ_NAME", "BILL_IDX_USERFAV_SEQUENCE");//从四川取过来BILL_IDX_USERFAV_SEQUENCE Map<String, String> rstMap = new HashMap<String, String>(); rstMap = (Map<String, String>) baseDao.queryForObject("BK_dual.qSequenceInter" ,inMap); sFavNum = rstMap.get("NEXTVAL").toString(); } outTmpMap.put("PD_FAVNUM", sFavNum); inTabOpMap.clear(); inTabOpMap.putAll(outTmpMap); return true; } /** * Title 私有接口:删除时入dead表 * @date 2015/03/30 * @param inSynTabMap * @return */ public boolean inConUserRelDead(Map<String, Object> inTabOpMap) { Map<String, Object> tmpMap = (Map<String, Object>) inTabOpMap.get("COLS"); Connection conn = (Connection) inTabOpMap.get("CONN"); JdbcConn jdbcConn = new JdbcConn(conn); String sOpType = inTabOpMap.get("OP").toString(); if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE)) { jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_INST_DEAD_CONUSER); jdbcConn.addParam("OP_CODE", "ctb"); jdbcConn.addParam("LOGIN_NO", "ctb"); jdbcConn.addParam("LOGIN_ACCEPT", "-1"); jdbcConn.addParam("REMARK", "crmToBoss数据同步"); jdbcConn.addParam("SERV_ACCT_ID", tmpMap.get("SERV_ACCT_ID").toString(), SqlTypes.JLONG); jdbcConn.execuse(); } return true; } /** * Title 表字段不同,boss侧自有字段,单独处理 */ public Map<String, Object> getProvSpecOptData(Map<String, Object> inDataMap , List<Map<String, Object>> inLstDest) { int iDealNum = 0; int iUserFavFlag = 0; int iCycleFlag = 0; String sEffDate = ""; String sCurFlag = ""; String sExpDate = ""; String sCycleBegin = ""; String sCycleEnd = ""; String sBeginDay = ""; String sCurTime = ""; Map<String, Object> inMap = null; Map<String, Object> outTmpMap = new HashMap<String, Object>(); Map<String, Object> mapCols = new HashMap<String, Object>(); String sTableName = inDataMap.get("TABLE_NAME").toString(); String sOpType = inDataMap.get("OP").toString(); mapCols = (Map<String, Object>) inDataMap.get("COLS"); log.debug("----sTableName="+sTableName+"soptype="+sOpType+mapCols.toString()); /*是否省份个性业务*/ if (isPerProvBusi()) { String sPhoneNo = ""; String sXhPhoneNo = ""; String sIdNo = ""; String sSyncFlag = ""; iDealNum = 1; if (sTableName.equalsIgnoreCase("PD_USERFAV_INFO")) { iUserFavFlag = 1; /*返回结果*/ outTmpMap.put("USERFAV_FLAG", iUserFavFlag); } if (sTableName.equalsIgnoreCase("UR_BILLDAY_INFO") || sTableName.equalsIgnoreCase("UR_BILLDAYDEAD_INFO")) { log.debug("---stablename==="+sTableName); iCycleFlag = 1; if (mapCols.get("DUR_FLAG") != null && mapCols.get("EFF_DATE") != null && mapCols.get("EXP_DATE") != null) { log.debug("---------iCycleFlag="+iCycleFlag); sCurFlag = mapCols.get("DUR_FLAG").toString(); sEffDate = mapCols.get("EFF_DATE").toString(); sExpDate = mapCols.get("EXP_DATE").toString(); log.debug("---------sCurFlag="+sCurFlag+" sEffDate="+sEffDate+" sExpDate="+sExpDate); sCycleBegin = sEffDate.substring(0, 6); if (sCurFlag.equals("1")) { log.debug("----CurFlag="+sCurFlag); sCycleEnd = DateUtil.toStringPlusMonths(sExpDate, -1, "yyyyMMddHHmmss").substring(0, 6); log.debug("---------------sCycleEnd="+sCycleEnd+" sExpDate="+sExpDate); } else if (sCurFlag.equals("4")) { sCycleEnd = sCycleBegin.substring(0, 6); } else { sCycleEnd = sExpDate.substring(0, 6); } log.debug("---------sCycleBegin="+sCycleBegin+" sCycleEnd="+sCycleEnd); if (sCurFlag.equals("0") || sCurFlag.equals("3")) { sBeginDay = "01"; } else { sBeginDay= sEffDate.substring(6, 8); } log.debug("---------sBeginDay="+sBeginDay); /*返回结果*/ outTmpMap.put("END_CYCLE", sCycleEnd); outTmpMap.put("BEGIN_DAY", sBeginDay); outTmpMap.put("BEGIN_CYCLE", sCycleBegin); } } //syncFlag=3,删除操作不删除,只做Special操作(根据主键更新该条数据) //syncFlag=4,预约删除正常删除,非预约的不删除,修改结束时间 sSyncFlag = getValueListDest("SYNC_FLAG", inLstDest); inDataMap.put("SYNC_FLAG", sSyncFlag); log.debug("---ssyncflaga="+sSyncFlag+mapCols); sCurTime = DateUtil.format(new Date(),"yyyyMMddHHmmss").toString(); if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE) && (sSyncFlag.equals("3") || sSyncFlag.equals("4"))) { if (mapCols.get("EFF_DATE") != null || mapCols.get("END_TIME") != null) { if (mapCols.get("EFF_DATE") != null) sEffDate = mapCols.get("EFF_DATE").toString(); else if (mapCols.get("END_TIME") != null) sEffDate = mapCols.get("END_TIME").toString(); if (sEffDate.compareTo(sCurTime) > 0 && sSyncFlag.equals("4")) { sOpType = InterBusiConst.DATA_OPER_TYPE_DELETE;//"D" } else { sOpType = InterBusiConst.DATA_OPER_TYPE_SPECIAL;//"X" outTmpMap.put("EXP_DATE", sCurTime); outTmpMap.put("END_TIME", sCurTime); } } else { sOpType = InterBusiConst.DATA_OPER_TYPE_SPECIAL;//"X" outTmpMap.put("EXP_DATE", sCurTime); outTmpMap.put("END_TIME", sCurTime); } /*返回结果*/ inDataMap.put("OP", sOpType); } }/*isPerProvBusi end*/ outTmpMap.put("DEAL_NUM", iDealNum); return outTmpMap; } /** * 私有接口:循环list,查询特定参数值 * @param sColName * @param inLstDest * @return */ private String getValueListDest(String sColName, List<Map<String, Object>> inLstDest) { String sColValue = ""; String sColumName = ""; if (inLstDest.size() != 0) for (Map<String, Object> mapCols : inLstDest) { Iterator iterator = mapCols.entrySet().iterator(); while (iterator.hasNext()) { sColumName = ""; sColValue = ""; Map.Entry<String, Object> entry = (Map.Entry<String, Object>) iterator.next(); sColumName = entry.getKey().toString(); if (sColumName.equalsIgnoreCase(sColName)) { sColValue = entry.getValue().toString(); return sColValue; } } } return sColValue; } @Override public boolean insertUserSync(Map<String, Object> mapCols) { log.debug("---usersyncstt--mapCols="+mapCols.toString()); /*当删除操作时,需要将用户数据插入ur_user_sync 表中*/ if (mapCols.get("COLS") != null) { log.debug("---usersyncstt--mapCols="+mapCols.get("COLS")); //baseDao.insert("BK_bal_user_sync.iUserSyncByCols", (Map<String, Object>)mapCols.get("COLS")); Map<String, Object> colMap = (Map<String, Object>)mapCols.get("COLS"); Connection conn = (Connection) mapCols.get("CONN"); JdbcConn jdbcConn = new JdbcConn(conn); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_USERSYNC_INST); jdbcConn.addParam("ID_NO", colMap.get("ID_NO").toString(), SqlTypes.JLONG); jdbcConn.execuse(); log.debug("---usersyncstt-end-colMap="+colMap.toString()); } return true; } }
UTF-8
Java
16,739
92f1ced6d9911b37c91d2b67b9a57ea10cd7937e.svn-base
Java
[]
null
[]
package com.sitech.acctmgr.app.dataorder; import java.sql.Connection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import com.sitech.acctmgr.app.common.AppProperties; import com.sitech.acctmgr.app.common.InterBusiConst; import com.sitech.acctmgr.app.common.JdbcConn; import com.sitech.acctmgr.common.AcctMgrError; import com.sitech.acctmgr.common.BaseBusi; import com.sitech.jcf.core.exception.BusiException; import com.sitech.jcf.ijdbc.sql.SqlTypes; import com.sitech.jcfx.util.DateUtil; public class SpecDataSynJL extends BaseBusi implements ISpecDataSyn { /** * Title 是否分省处理 * Description 部分业务为省个性化处理,单独封接口处理 * @return True:需要分省 False:不需要 */ public boolean isPerProvBusi() { //判断是否分省逻辑,暂时不处理 if (AppProperties.getConfigByMap("DATA_ISPERV").equals("true")) return true; else return false; } /** * Title 私有接口:个性化更新用户数据 * @param inTabOpMap * @return true or false */ public boolean updateCbUserStatus(Map<String, Object> inTabOpMap) { int iInstRows = 0; String sOpType = ""; String sBossRunCode = ""; //String sCrmRunCode = ""; Map<String, Object> colmsMap = new HashMap<String, Object>(); List<Map<String, Object>> list = null; Map<String, Object> tmpMap = null; sOpType = inTabOpMap.get("OP").toString(); colmsMap.putAll((Map<String, Object>) inTabOpMap.get("COLS")); String id_no = colmsMap.get("ID_NO").toString(); Map<String, Object> oprInfo = (Map<String, Object>) inTabOpMap.get("OPR_INFO"); Connection conn = (Connection) inTabOpMap.get("CONN"); JdbcConn jdbcConn = new JdbcConn(conn); /*1.新开户插入一条记录,不再做用户状态合成*/ if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_INSERT)) { /*插入操作直接返回,后续拼串执行插入*/ return true; } if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE)) { colmsMap.put("CRM_RUN_CODE", "a"); } colmsMap.put("CRM_RUN_TIME", DateUtil.format(new Date(), "yyyyMMddHHmmss")); colmsMap.put("REMARK", "CRM--BOSS数据同步接口插入记录"); colmsMap.put("OPT_SN", "-1"); colmsMap.put("IN_LOGIN_NO", "c2b"); colmsMap.put("IN_LOGIN_NO", "c2b"); /*查询BOSSRUNCODE 和 合成新状态*/ String sNewRunCode = ""; //sBossRunCode = (String) baseDao.queryForObject("BK_ur_bosstocrmstate_info.qBossRunCodeByIdNo", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_QUERY_RUNCODE_BY_IDNO); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); list = jdbcConn.select(); if(list != null && (list.size() == 1)){ tmpMap = list.get(0); sBossRunCode = tmpMap.get("BOSS_RUN_CODE").toString(); } else { log.error("query UR_BOSSTOCRMSTATE_INFO error,please check!"); return false; } /*9状态全部变为A状态 ACTION_ID=12461,传入的CRM_RUN_CODE为A @20150905*/ Map<String, Object> opr_info = (Map<String, Object>) inTabOpMap.get("OPR_INFO"); if (opr_info.get("ACTION_ID") != null && opr_info.get("ACTION_ID").toString().equals("12461")) { colmsMap.put("CRM_RUN_CODE", "A"); sBossRunCode = "A"; } colmsMap.put("BOSS_RUN_CODE", sBossRunCode); //sNewRunCode = (String) baseDao.queryForObject("BK_cs_runcode_comprule_dict.qRunCodeByBossAndCrmRun", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_QUERY_RUNCODE); jdbcConn.addParam("CRM_RUN_CODE", colmsMap.get("CRM_RUN_CODE").toString()); jdbcConn.addParam("BOSS_RUN_CODE", sBossRunCode); list = jdbcConn.select(); if(list != null && (list.size() == 1)){ tmpMap = list.get(0); sNewRunCode = (String) tmpMap.get("RUN_CODE"); } else { log.error("query CS_RUNCODE_COMPRULE_DICT error,please check!"); return false; } if (null == sBossRunCode || null == sNewRunCode) { log.error("query ur_bosstocrmstate_info error,please check!"); throw new BusiException(AcctMgrError.getErrorCode("0000","7005"), "数据同步省分查询执行错误!sBossRunCode="+sBossRunCode); } colmsMap.put("RUN_CODE", sNewRunCode); /*入历史*/ colmsMap.put("REMARK", "CRM--BOSS数据工单移入历史"); //baseDao.insert("BK_ur_bosstocrmstate_his.iBossToCrmMmByIdNo", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_UPDT_BTC); jdbcConn.addParam("OPT_SN", "-1"); jdbcConn.addParam("IN_LOGIN_NO", "c2b"); jdbcConn.addParam("REMARK", "CRM--BOSS数据同步接口插入记录"); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); /*将变更信息写入INT_BOSSTOCRMSTATE_CHG小表*/ /*2.更新操作 或 删除操作*/ if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_UPDATE) || sOpType.equals(InterBusiConst.DATA_OPER_TYPE_SPECIAL)) { /*更新CS_USERDETAIL_INFO表的RUN_CODE*/ //baseDao.update("BK_cs_userdetail_info.uRunCodeByIdNo", colmsMap); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_UPDT_DTE); //UPDATE CS_USERDETAIL_INFO SET OLD_RUN=RUN_CODE, OP_TIME=sysdate, //RUN_CODE=?, RUN_TIME=TO_DATE(?, 'YYYYMMDDHH24MISS'), OP_CODE=?, LOGIN_NO=? WHERE ID_NO=? jdbcConn.addParam("RUN_CODE", colmsMap.get("RUN_CODE").toString()); jdbcConn.addParam("RUN_TIME", colmsMap.get("CRM_RUN_TIME").toString()); jdbcConn.addParam("OP_CODE", colmsMap.get("OP_CODE").toString()); jdbcConn.addParam("LOGIN_NO", colmsMap.get("IN_LOGIN_NO").toString()); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); /*更新小表*/ //取得流水 String mmdd = DateUtil.format(new Date(), "MMdd").toString(); tmpMap = new HashMap<String, Object>(); tmpMap.put("SEQ_NAME", "SEQ_INT_DEAL_FLAG"); Map<String, Object> result = null; result = (Map<String, Object>) baseDao.queryForObject("BK_dual.qSequenceInter", tmpMap); String sIntSequenValue1 = result.get("NEXTVAL").toString()+mmdd; result = (Map<String, Object>) baseDao.queryForObject("BK_dual.qSequenceInter", tmpMap); String sIntSequenValue2 = result.get("NEXTVAL").toString()+mmdd; //更新ACCHG jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_INST_DTE_ACCHG); jdbcConn.addParam("SEQ_NO", sIntSequenValue1, SqlTypes.JLONG); jdbcConn.addParam("OP_FLAG", "2", SqlTypes.JINT);//更新 jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_INST_DTE_BICHG); jdbcConn.addParam("SEQ_NO", sIntSequenValue2, SqlTypes.JLONG); jdbcConn.addParam("OP_FLAG", "2", SqlTypes.JINT);//更新 jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); Map<String, Object> out_data = (Map<String, Object>) baseDao.queryForObject("BK_ur_user_info.qCoBrGrpbyIdNo", Long.parseLong(id_no)); String order_line_id = oprInfo.get("ORDER_LINE_ID")!=null?oprInfo.get("ORDER_LINE_ID").toString():""; String login_no = colmsMap.get("LOGIN_NO")!=null?colmsMap.get("LOGIN_NO").toString():""; String op_code = colmsMap.get("OP_CODE")!=null?colmsMap.get("OP_CODE").toString():""; //更新入bal_userchg_recd @20150922 wangzhia信控确认 String DATAODR_USERCHG_INST = "insert into bal_userchg_recd" + " (COMMAND_ID, TOTAL_DATE, PAY_SN, ID_NO, CONTRACT_NO, GROUP_ID, BRAND_ID, PHONE_NO," + " OLD_RUN, RUN_CODE, OP_TIME, OP_CODE, LOGIN_NO, LOGIN_GROUP, REMARK) " + "select SEQ_COMMON_ID.nextval, to_number(to_char(run_time, 'YYYYMMDD')), ?, ?, ?, ?, ?, ?," + " old_run, run_code, sysdate, ?, ?, ?, ? " + "from cs_userdetail_info where id_no = ?"; jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_USERCHG_INST); jdbcConn.addParam("PAY_SN", "0", SqlTypes.JLONG); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.addParam("CONTRACT_NO", out_data.get("CONTRACT_NO").toString(), SqlTypes.JLONG); jdbcConn.addParam("GROUP_ID", out_data.get("GROUP_ID").toString(), SqlTypes.JSTRING); jdbcConn.addParam("BRAND_ID", out_data.get("BRAND_ID").toString(), SqlTypes.JSTRING); jdbcConn.addParam("PHONE_NO", out_data.get("PHONE_NO").toString(), SqlTypes.JSTRING); jdbcConn.addParam("OP_CODE", op_code, SqlTypes.JSTRING); jdbcConn.addParam("LOGIN_NO", login_no, SqlTypes.JSTRING); jdbcConn.addParam("LOGIN_GROUP", "", SqlTypes.JSTRING); jdbcConn.addParam("REMARK", "crm->bossDataSyn:"+order_line_id, SqlTypes.JSTRING); jdbcConn.addParam("ID_NO", id_no, SqlTypes.JLONG); jdbcConn.execuse(); } //设置修改的值,后边拼工单使用 //inTabOpMap.put("COLS", colmsMap); return true; } /** * Title 私有接口:更新用户数据 * @param inSynTabMap * @return */ public boolean updateCbUserFav(Map<String, Object> inTabOpMap) { String sOpType = ""; String sFavNum = ""; Map<String, Object> outTmpMap = new HashMap<String, Object>(); outTmpMap.putAll(inTabOpMap); sOpType = outTmpMap.get("OP").toString(); if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE) || sOpType.equals(InterBusiConst.DATA_OPER_TYPE_UPDATE)) { sFavNum = (String) baseDao.queryForObject("pd_userfav_info.qOrderCodeByIdNoColId", outTmpMap); } else if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_INSERT)) { Map<String, String> inMap = new HashMap<String, String>(); inMap.put("SEQ_NAME", "BILL_IDX_USERFAV_SEQUENCE");//从四川取过来BILL_IDX_USERFAV_SEQUENCE Map<String, String> rstMap = new HashMap<String, String>(); rstMap = (Map<String, String>) baseDao.queryForObject("BK_dual.qSequenceInter" ,inMap); sFavNum = rstMap.get("NEXTVAL").toString(); } outTmpMap.put("PD_FAVNUM", sFavNum); inTabOpMap.clear(); inTabOpMap.putAll(outTmpMap); return true; } /** * Title 私有接口:删除时入dead表 * @date 2015/03/30 * @param inSynTabMap * @return */ public boolean inConUserRelDead(Map<String, Object> inTabOpMap) { Map<String, Object> tmpMap = (Map<String, Object>) inTabOpMap.get("COLS"); Connection conn = (Connection) inTabOpMap.get("CONN"); JdbcConn jdbcConn = new JdbcConn(conn); String sOpType = inTabOpMap.get("OP").toString(); if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE)) { jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_INST_DEAD_CONUSER); jdbcConn.addParam("OP_CODE", "ctb"); jdbcConn.addParam("LOGIN_NO", "ctb"); jdbcConn.addParam("LOGIN_ACCEPT", "-1"); jdbcConn.addParam("REMARK", "crmToBoss数据同步"); jdbcConn.addParam("SERV_ACCT_ID", tmpMap.get("SERV_ACCT_ID").toString(), SqlTypes.JLONG); jdbcConn.execuse(); } return true; } /** * Title 表字段不同,boss侧自有字段,单独处理 */ public Map<String, Object> getProvSpecOptData(Map<String, Object> inDataMap , List<Map<String, Object>> inLstDest) { int iDealNum = 0; int iUserFavFlag = 0; int iCycleFlag = 0; String sEffDate = ""; String sCurFlag = ""; String sExpDate = ""; String sCycleBegin = ""; String sCycleEnd = ""; String sBeginDay = ""; String sCurTime = ""; Map<String, Object> inMap = null; Map<String, Object> outTmpMap = new HashMap<String, Object>(); Map<String, Object> mapCols = new HashMap<String, Object>(); String sTableName = inDataMap.get("TABLE_NAME").toString(); String sOpType = inDataMap.get("OP").toString(); mapCols = (Map<String, Object>) inDataMap.get("COLS"); log.debug("----sTableName="+sTableName+"soptype="+sOpType+mapCols.toString()); /*是否省份个性业务*/ if (isPerProvBusi()) { String sPhoneNo = ""; String sXhPhoneNo = ""; String sIdNo = ""; String sSyncFlag = ""; iDealNum = 1; if (sTableName.equalsIgnoreCase("PD_USERFAV_INFO")) { iUserFavFlag = 1; /*返回结果*/ outTmpMap.put("USERFAV_FLAG", iUserFavFlag); } if (sTableName.equalsIgnoreCase("UR_BILLDAY_INFO") || sTableName.equalsIgnoreCase("UR_BILLDAYDEAD_INFO")) { log.debug("---stablename==="+sTableName); iCycleFlag = 1; if (mapCols.get("DUR_FLAG") != null && mapCols.get("EFF_DATE") != null && mapCols.get("EXP_DATE") != null) { log.debug("---------iCycleFlag="+iCycleFlag); sCurFlag = mapCols.get("DUR_FLAG").toString(); sEffDate = mapCols.get("EFF_DATE").toString(); sExpDate = mapCols.get("EXP_DATE").toString(); log.debug("---------sCurFlag="+sCurFlag+" sEffDate="+sEffDate+" sExpDate="+sExpDate); sCycleBegin = sEffDate.substring(0, 6); if (sCurFlag.equals("1")) { log.debug("----CurFlag="+sCurFlag); sCycleEnd = DateUtil.toStringPlusMonths(sExpDate, -1, "yyyyMMddHHmmss").substring(0, 6); log.debug("---------------sCycleEnd="+sCycleEnd+" sExpDate="+sExpDate); } else if (sCurFlag.equals("4")) { sCycleEnd = sCycleBegin.substring(0, 6); } else { sCycleEnd = sExpDate.substring(0, 6); } log.debug("---------sCycleBegin="+sCycleBegin+" sCycleEnd="+sCycleEnd); if (sCurFlag.equals("0") || sCurFlag.equals("3")) { sBeginDay = "01"; } else { sBeginDay= sEffDate.substring(6, 8); } log.debug("---------sBeginDay="+sBeginDay); /*返回结果*/ outTmpMap.put("END_CYCLE", sCycleEnd); outTmpMap.put("BEGIN_DAY", sBeginDay); outTmpMap.put("BEGIN_CYCLE", sCycleBegin); } } //syncFlag=3,删除操作不删除,只做Special操作(根据主键更新该条数据) //syncFlag=4,预约删除正常删除,非预约的不删除,修改结束时间 sSyncFlag = getValueListDest("SYNC_FLAG", inLstDest); inDataMap.put("SYNC_FLAG", sSyncFlag); log.debug("---ssyncflaga="+sSyncFlag+mapCols); sCurTime = DateUtil.format(new Date(),"yyyyMMddHHmmss").toString(); if (sOpType.equals(InterBusiConst.DATA_OPER_TYPE_DELETE) && (sSyncFlag.equals("3") || sSyncFlag.equals("4"))) { if (mapCols.get("EFF_DATE") != null || mapCols.get("END_TIME") != null) { if (mapCols.get("EFF_DATE") != null) sEffDate = mapCols.get("EFF_DATE").toString(); else if (mapCols.get("END_TIME") != null) sEffDate = mapCols.get("END_TIME").toString(); if (sEffDate.compareTo(sCurTime) > 0 && sSyncFlag.equals("4")) { sOpType = InterBusiConst.DATA_OPER_TYPE_DELETE;//"D" } else { sOpType = InterBusiConst.DATA_OPER_TYPE_SPECIAL;//"X" outTmpMap.put("EXP_DATE", sCurTime); outTmpMap.put("END_TIME", sCurTime); } } else { sOpType = InterBusiConst.DATA_OPER_TYPE_SPECIAL;//"X" outTmpMap.put("EXP_DATE", sCurTime); outTmpMap.put("END_TIME", sCurTime); } /*返回结果*/ inDataMap.put("OP", sOpType); } }/*isPerProvBusi end*/ outTmpMap.put("DEAL_NUM", iDealNum); return outTmpMap; } /** * 私有接口:循环list,查询特定参数值 * @param sColName * @param inLstDest * @return */ private String getValueListDest(String sColName, List<Map<String, Object>> inLstDest) { String sColValue = ""; String sColumName = ""; if (inLstDest.size() != 0) for (Map<String, Object> mapCols : inLstDest) { Iterator iterator = mapCols.entrySet().iterator(); while (iterator.hasNext()) { sColumName = ""; sColValue = ""; Map.Entry<String, Object> entry = (Map.Entry<String, Object>) iterator.next(); sColumName = entry.getKey().toString(); if (sColumName.equalsIgnoreCase(sColName)) { sColValue = entry.getValue().toString(); return sColValue; } } } return sColValue; } @Override public boolean insertUserSync(Map<String, Object> mapCols) { log.debug("---usersyncstt--mapCols="+mapCols.toString()); /*当删除操作时,需要将用户数据插入ur_user_sync 表中*/ if (mapCols.get("COLS") != null) { log.debug("---usersyncstt--mapCols="+mapCols.get("COLS")); //baseDao.insert("BK_bal_user_sync.iUserSyncByCols", (Map<String, Object>)mapCols.get("COLS")); Map<String, Object> colMap = (Map<String, Object>)mapCols.get("COLS"); Connection conn = (Connection) mapCols.get("CONN"); JdbcConn jdbcConn = new JdbcConn(conn); jdbcConn.setSqlBuffer(InterBusiConst.DATAODR_USERSYNC_INST); jdbcConn.addParam("ID_NO", colMap.get("ID_NO").toString(), SqlTypes.JLONG); jdbcConn.execuse(); log.debug("---usersyncstt-end-colMap="+colMap.toString()); } return true; } }
16,739
0.650147
0.644217
424
35.785378
27.347755
115
false
false
0
0
0
0
0
0
3.627358
false
false
4
da19df0411985eed48d2be0e55b2659e264be12b
38,835,094,329,415
98a06e226fb9d717e3a309aff72bdf8d920477cd
/TelegramMethods.java
746a6db2a5f9ede635c15e7a9bec4e134fa52dac
[]
no_license
majere/pepaka
https://github.com/majere/pepaka
b3936e7ec0f9c22ef85db64a0c642635bac36082
b2ec92cd9512fdd61ee9c8eb612fb95eb5c6c343
refs/heads/master
2021-08-23T20:04:50.300000
2017-12-06T10:03:37
2017-12-06T10:03:37
113,297,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample; import lombok.Setter; import java.net.URLEncoder; class TelegramMethods { @Setter private static String telegramUrl; static String getUpdates(){ try { return Http.sendGet(telegramUrl + "/getUpdates"); }catch(Exception e){return null;} } static void setOffset(long update_id){ try { Http.sendGet(telegramUrl + "/getUpdates?offset=" + update_id); }catch(Exception e){ e.printStackTrace(); } } static String sendMessage(long chat_id, String text){ String jsonAnswer = null; try { jsonAnswer = Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8")); } catch (Exception e) { e.printStackTrace(); } return jsonAnswer; } static void sendBtnMessage(long chat_id, String text){ try { Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&one_time_keyboard=true&reply_markup={\"keyboard\":[[{\"text\":\"!d4\"},{\"text\":\"!d6\"}],[{\"text\":\"!d8\"},{\"text\":\"!d20\"}]]}&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8")); } catch (Exception e) { e.printStackTrace(); } } static String sendInlineBtn(long chat_id, String text, String button){ String answer = null; try { answer = Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&text=" + text + "&one_time_keyboard=true&reply_markup={\"inline_keyboard\":[" + button + "]}"); } catch (Exception e) { e.printStackTrace(); } return answer; } static void removeKeyboard(long chat_id, String text){ try { Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&reply_markup={\"remove_keyboard\":true}&text=" + text); } catch (Exception e) { e.printStackTrace(); } } static String editMessageText(long chat_id, long message_id, String text, String button){ String answer = null; try { if(button != null) { answer = Http.sendGet(telegramUrl + "/editMessageText?chat_id=" + chat_id + "&message_id=" + message_id + "&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8") + "&one_time_keyboard=true&reply_markup={\"inline_keyboard\":[[" + button + "]]}"); }else{ answer = Http.sendGet(telegramUrl + "/editMessageText?chat_id=" + chat_id + "&message_id=" + message_id + "&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8")); } } catch (Exception e) { e.printStackTrace(); } return answer; } static void sendReply(long chat_id, long message_id, String text){ try { Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&reply_to_message_id=" + message_id + "&text=" + URLEncoder.encode(text, "UTF-8")); } catch (Exception e) { e.printStackTrace(); } } static void delMessage(long chat_id, long message_id){ try { Http.sendGet(telegramUrl + "/deleteMessage?chat_id=" + chat_id + "&message_id=" + message_id); } catch (Exception e) { System.out.printf("Не удалить сообщение"); } } static void getChatMember(long chat_id){ try { Http.sendGet(telegramUrl + "/getChatMember?chat_id=" + chat_id); } catch (Exception e) { e.printStackTrace(); } } static void leaveChat(String chat_id){ try { Http.sendGet(telegramUrl + "/leaveChat?chat_id=" + chat_id); }catch(Exception e){ e.printStackTrace(); } } static void sendSticker(long chat_id, String sticker_id){ try { Http.sendGet(telegramUrl + "/sendSticker?chat_id=" + chat_id + "&sticker=" + sticker_id); }catch(Exception e){ e.printStackTrace(); } } static void sendInvoice(long chat_id, String title, String description, String payload, String provider_token, String start_parameter, String currency, LabeledPrice labeledPrice){ try { Http.sendGet(telegramUrl + "/chat_id?chat_id=" + chat_id + "&title=" + title + "&description=" + description + "&payload=" + payload + "&provider_token=" + provider_token + "&start_parameter=" + start_parameter + "currency=" + currency); }catch(Exception e){ e.printStackTrace(); } } }
UTF-8
Java
4,642
java
TelegramMethods.java
Java
[]
null
[]
package sample; import lombok.Setter; import java.net.URLEncoder; class TelegramMethods { @Setter private static String telegramUrl; static String getUpdates(){ try { return Http.sendGet(telegramUrl + "/getUpdates"); }catch(Exception e){return null;} } static void setOffset(long update_id){ try { Http.sendGet(telegramUrl + "/getUpdates?offset=" + update_id); }catch(Exception e){ e.printStackTrace(); } } static String sendMessage(long chat_id, String text){ String jsonAnswer = null; try { jsonAnswer = Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8")); } catch (Exception e) { e.printStackTrace(); } return jsonAnswer; } static void sendBtnMessage(long chat_id, String text){ try { Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&one_time_keyboard=true&reply_markup={\"keyboard\":[[{\"text\":\"!d4\"},{\"text\":\"!d6\"}],[{\"text\":\"!d8\"},{\"text\":\"!d20\"}]]}&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8")); } catch (Exception e) { e.printStackTrace(); } } static String sendInlineBtn(long chat_id, String text, String button){ String answer = null; try { answer = Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&text=" + text + "&one_time_keyboard=true&reply_markup={\"inline_keyboard\":[" + button + "]}"); } catch (Exception e) { e.printStackTrace(); } return answer; } static void removeKeyboard(long chat_id, String text){ try { Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&reply_markup={\"remove_keyboard\":true}&text=" + text); } catch (Exception e) { e.printStackTrace(); } } static String editMessageText(long chat_id, long message_id, String text, String button){ String answer = null; try { if(button != null) { answer = Http.sendGet(telegramUrl + "/editMessageText?chat_id=" + chat_id + "&message_id=" + message_id + "&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8") + "&one_time_keyboard=true&reply_markup={\"inline_keyboard\":[[" + button + "]]}"); }else{ answer = Http.sendGet(telegramUrl + "/editMessageText?chat_id=" + chat_id + "&message_id=" + message_id + "&parse_mode=HTML&text=" + URLEncoder.encode(text, "UTF-8")); } } catch (Exception e) { e.printStackTrace(); } return answer; } static void sendReply(long chat_id, long message_id, String text){ try { Http.sendGet(telegramUrl + "/sendMessage?chat_id=" + chat_id + "&parse_mode=HTML&reply_to_message_id=" + message_id + "&text=" + URLEncoder.encode(text, "UTF-8")); } catch (Exception e) { e.printStackTrace(); } } static void delMessage(long chat_id, long message_id){ try { Http.sendGet(telegramUrl + "/deleteMessage?chat_id=" + chat_id + "&message_id=" + message_id); } catch (Exception e) { System.out.printf("Не удалить сообщение"); } } static void getChatMember(long chat_id){ try { Http.sendGet(telegramUrl + "/getChatMember?chat_id=" + chat_id); } catch (Exception e) { e.printStackTrace(); } } static void leaveChat(String chat_id){ try { Http.sendGet(telegramUrl + "/leaveChat?chat_id=" + chat_id); }catch(Exception e){ e.printStackTrace(); } } static void sendSticker(long chat_id, String sticker_id){ try { Http.sendGet(telegramUrl + "/sendSticker?chat_id=" + chat_id + "&sticker=" + sticker_id); }catch(Exception e){ e.printStackTrace(); } } static void sendInvoice(long chat_id, String title, String description, String payload, String provider_token, String start_parameter, String currency, LabeledPrice labeledPrice){ try { Http.sendGet(telegramUrl + "/chat_id?chat_id=" + chat_id + "&title=" + title + "&description=" + description + "&payload=" + payload + "&provider_token=" + provider_token + "&start_parameter=" + start_parameter + "currency=" + currency); }catch(Exception e){ e.printStackTrace(); } } }
4,642
0.572016
0.569853
121
37.214874
53.189388
270
false
false
0
0
0
0
0
0
0.528926
false
false
4
7f2d8c79ddae3cb71624aa0b5a05d70ae0709613
5,420,248,748,696
a1e7b1acfc6632a49d39ceca1ee975961bc472f1
/ netone-middleware/teach/JavaBase/src/oesee/teach/java/two/ListSample.java
1fd6c2a338850544c01e33f43b521367aa10a497
[]
no_license
rebider/netone-middleware
https://github.com/rebider/netone-middleware
32278b57823627fb649ff8b3ccfe5a087b4ce826
b8bcfa687d0f8179b8d7a137ad54a922641c58e6
refs/heads/master
2022-03-30T09:43:33.398000
2013-05-05T14:41:12
2013-05-05T14:41:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package oesee.teach.java.two; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ListSample { public static void main(String[] args) { List list = new ArrayList(); list.add("a"); list.add("b"); list.add("c"); for (Iterator iterator = list.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); } // for (int i = 0; i < args.length; i++) { // System.out.println(args[i]); // } } }
UTF-8
Java
521
java
ListSample.java
Java
[]
null
[]
package oesee.teach.java.two; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ListSample { public static void main(String[] args) { List list = new ArrayList(); list.add("a"); list.add("b"); list.add("c"); for (Iterator iterator = list.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); } // for (int i = 0; i < args.length; i++) { // System.out.println(args[i]); // } } }
521
0.616123
0.614203
23
20.652174
17.524166
66
false
false
0
0
0
0
0
0
1.826087
false
false
4
02593b13021611a92d580212d0347b21de1a328e
7,318,624,300,744
56231681020795939d183df16107b0771163e620
/miracom-mes-service/src/main/java/kr/co/miracom/mes/wip/model/subtype/WipOprDef.java
1106025dd8448f0a12e610789edb5dd4e0bdac6e
[]
no_license
gosangosango/testRepo
https://github.com/gosangosango/testRepo
ed20c2fe1864e9a82d8b1bd36d5782ce41bcf0c8
ca8767f57b69eab685ee0e765bf7b80524508611
refs/heads/master
2020-03-23T09:24:57.644000
2018-07-18T22:14:34
2018-07-18T22:14:34
141,386,250
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kr.co.miracom.mes.wip.model.subtype; import kr.co.miracom.dbist.annotation.DbistTable; import lombok.Data; @DbistTable(name = "MWIPOPRDEF") @Data public class WipOprDef { private String operCode; private String operDesc; }
UTF-8
Java
241
java
WipOprDef.java
Java
[]
null
[]
package kr.co.miracom.mes.wip.model.subtype; import kr.co.miracom.dbist.annotation.DbistTable; import lombok.Data; @DbistTable(name = "MWIPOPRDEF") @Data public class WipOprDef { private String operCode; private String operDesc; }
241
0.763485
0.763485
11
20.90909
16.7411
49
false
false
0
0
0
0
0
0
0.454545
false
false
4
8cdf5460c018c571f01c8b33453a5e5e7a81b4c3
20,220,706,055,560
7cb18d77099b9d8537f22f0af5056b1111755f38
/ahas/ahas-service-bridge/src/main/java/com/taobao/csp/third/ch/qos/logback/core/net/server/SSLServerSocketAppenderBase.java
6776c484fa4679408d5e74e7e8ea34a8b97c9cf0
[]
no_license
asa3311/guahas
https://github.com/asa3311/guahas
31fabf96be19a5301ed9df9a3d52e2ac479438ab
a07f72a462bf3addecc434707ae7ff5ae22e9ff3
refs/heads/master
2020-07-31T07:44:41.330000
2019-10-22T03:07:06
2019-10-22T03:07:06
210,527,524
1
0
null
false
2020-07-01T19:18:48
2019-09-24T06:24:38
2019-10-22T03:07:09
2020-07-01T19:18:47
160,109
0
1
4
Java
false
false
package com.taobao.csp.third.ch.qos.logback.core.net.server; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.ConfigurableSSLServerSocketFactory; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.SSLComponent; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.SSLConfiguration; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.SSLParametersConfiguration; import javax.net.ServerSocketFactory; import javax.net.ssl.SSLContext; public abstract class SSLServerSocketAppenderBase<E> extends AbstractServerSocketAppender<E> implements SSLComponent { private SSLConfiguration ssl; private ServerSocketFactory socketFactory; protected ServerSocketFactory getServerSocketFactory() { return this.socketFactory; } public void start() { try { SSLContext sslContext = this.getSsl().createContext(this); SSLParametersConfiguration parameters = this.getSsl().getParameters(); parameters.setContext(this.getContext()); this.socketFactory = new ConfigurableSSLServerSocketFactory(parameters, sslContext.getServerSocketFactory()); super.start(); } catch (Exception var3) { this.addError(var3.getMessage(), var3); } } public SSLConfiguration getSsl() { if (this.ssl == null) { this.ssl = new SSLConfiguration(); } return this.ssl; } public void setSsl(SSLConfiguration ssl) { this.ssl = ssl; } }
UTF-8
Java
1,453
java
SSLServerSocketAppenderBase.java
Java
[]
null
[]
package com.taobao.csp.third.ch.qos.logback.core.net.server; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.ConfigurableSSLServerSocketFactory; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.SSLComponent; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.SSLConfiguration; import com.taobao.csp.third.ch.qos.logback.core.net.ssl.SSLParametersConfiguration; import javax.net.ServerSocketFactory; import javax.net.ssl.SSLContext; public abstract class SSLServerSocketAppenderBase<E> extends AbstractServerSocketAppender<E> implements SSLComponent { private SSLConfiguration ssl; private ServerSocketFactory socketFactory; protected ServerSocketFactory getServerSocketFactory() { return this.socketFactory; } public void start() { try { SSLContext sslContext = this.getSsl().createContext(this); SSLParametersConfiguration parameters = this.getSsl().getParameters(); parameters.setContext(this.getContext()); this.socketFactory = new ConfigurableSSLServerSocketFactory(parameters, sslContext.getServerSocketFactory()); super.start(); } catch (Exception var3) { this.addError(var3.getMessage(), var3); } } public SSLConfiguration getSsl() { if (this.ssl == null) { this.ssl = new SSLConfiguration(); } return this.ssl; } public void setSsl(SSLConfiguration ssl) { this.ssl = ssl; } }
1,453
0.72746
0.725396
42
33.595238
32.443401
118
false
false
0
0
0
0
0
0
0.5
false
false
4
f5c47d8753f9ddb9af3f2c5f1926094fe090f60e
6,682,969,168,091
5b6e818543e5b23df470aa78ddc963de6c251ae5
/app/src/main/java/com/example/qjh/r/Fragment/TotalFragment.java
50eb414840c396f329f00a423245b4ac77258c49
[]
no_license
Mr1q/repair
https://github.com/Mr1q/repair
f9b952c889120223cdedfb32796bbb0cabb7e9ce
ec36fbfd58d3aaca386a0b82f1ac36c1d07f3656
refs/heads/master
2020-04-27T00:55:27.332000
2020-02-02T23:29:03
2020-02-02T23:29:03
173,949,336
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.qjh.r.Fragment; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import com.example.qjh.r.Control.ActivityCollector; import com.example.qjh.r.Activity.LocActivity; import com.example.qjh.r.Activity.RepairActivity; import com.example.qjh.r.R; import com.example.qjh.r.Activity.EvaluateActivity; public class TotalFragment extends Fragment implements View.OnClickListener { private ScrollView scrollView; private RelativeLayout location; //定位按钮 private View view; private RelativeLayout frameLayout; private RelativeLayout evaluate;//评价 private IntentFilter intentFilter; private NetChangeBroder netChangeBroder; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.message, container, false); scrollView = (ScrollView) view.findViewById(R.id.scrollView); evaluate = (RelativeLayout) view.findViewById(R.id.evaluate); evaluate.setOnClickListener(this); location = (RelativeLayout) view.findViewById(R.id.location); location.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity().getApplicationContext(), LocActivity.class); startActivity(intent); } }); Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); toolbar.setTitle("维修导航"); setHasOptionsMenu(true); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); frameLayout = (RelativeLayout) view.findViewById(R.id.repair); frameLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getContext(), RepairActivity.class); startActivity(intent); } }); intentFilter = new IntentFilter(); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); netChangeBroder = new NetChangeBroder(); getContext().registerReceiver(netChangeBroder, intentFilter); return view; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.evaluate: Intent intent = new Intent(getContext(), EvaluateActivity.class); startActivity(intent); break; } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.back: ActivityCollector.Finish_All(); break; } return true; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.clear(); inflater.inflate(R.menu.menui, menu); } @Override public void onDestroyView() { super.onDestroyView(); getContext().unregisterReceiver(netChangeBroder); } class NetChangeBroder extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ConnectivityManager connectivityManager = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); //系统服务类 NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isAvailable()) { // Toast.makeText(getContext(), "网络启动", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getContext(), "未检测到网络", Toast.LENGTH_LONG).show(); } } } }
UTF-8
Java
4,521
java
TotalFragment.java
Java
[]
null
[]
package com.example.qjh.r.Fragment; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import com.example.qjh.r.Control.ActivityCollector; import com.example.qjh.r.Activity.LocActivity; import com.example.qjh.r.Activity.RepairActivity; import com.example.qjh.r.R; import com.example.qjh.r.Activity.EvaluateActivity; public class TotalFragment extends Fragment implements View.OnClickListener { private ScrollView scrollView; private RelativeLayout location; //定位按钮 private View view; private RelativeLayout frameLayout; private RelativeLayout evaluate;//评价 private IntentFilter intentFilter; private NetChangeBroder netChangeBroder; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.message, container, false); scrollView = (ScrollView) view.findViewById(R.id.scrollView); evaluate = (RelativeLayout) view.findViewById(R.id.evaluate); evaluate.setOnClickListener(this); location = (RelativeLayout) view.findViewById(R.id.location); location.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity().getApplicationContext(), LocActivity.class); startActivity(intent); } }); Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); toolbar.setTitle("维修导航"); setHasOptionsMenu(true); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); frameLayout = (RelativeLayout) view.findViewById(R.id.repair); frameLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getContext(), RepairActivity.class); startActivity(intent); } }); intentFilter = new IntentFilter(); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); netChangeBroder = new NetChangeBroder(); getContext().registerReceiver(netChangeBroder, intentFilter); return view; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.evaluate: Intent intent = new Intent(getContext(), EvaluateActivity.class); startActivity(intent); break; } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.back: ActivityCollector.Finish_All(); break; } return true; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.clear(); inflater.inflate(R.menu.menui, menu); } @Override public void onDestroyView() { super.onDestroyView(); getContext().unregisterReceiver(netChangeBroder); } class NetChangeBroder extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ConnectivityManager connectivityManager = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); //系统服务类 NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isAvailable()) { // Toast.makeText(getContext(), "网络启动", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getContext(), "未检测到网络", Toast.LENGTH_LONG).show(); } } } }
4,521
0.680385
0.680385
130
33.392307
27.491676
145
false
false
0
0
0
0
0
0
0.661538
false
false
4
012cf90813ee361edcac2567692b2a043044b54a
31,739,808,366,080
91a1148cbdb6510f13bcaa749ca02c10aa0f4a67
/src/com/foxminded/task13/dao/SchedulePositionDao.java
0354849a47514e7b09c737bcc4d4c27d78f64474
[]
no_license
sl101/Foxminded_task_13
https://github.com/sl101/Foxminded_task_13
a325c8e9d733918abed3ce2bb0eed81cf819281a
a1d59dc660fadb96e760398e0adefa0550647158
refs/heads/master
2021-01-19T16:16:40.267000
2017-04-22T20:59:02
2017-04-22T20:59:02
88,259,196
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.foxminded.task13.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.apache.log4j.Logger; import com.foxminded.task13.domain.SchedulePosition; public class SchedulePositionDao implements GenericDao<SchedulePosition, Long> { private static final Logger log = Logger.getLogger(SchedulePositionDao.class); private final String CREATE = "INSERT INTO Schedule (weekDay, time, event) VALUES (?, ?, ?) ON CONFLICT (weekDay, time, event) DO UPDATE SET weekDay = excluded.weekDay, time = excluded.time, event = excluded.event;"; private final String GET_ALL = "SELECT * FROM Schedule ORDER BY id;"; @Override public List<SchedulePosition> getAll() throws ScheduleException { List<SchedulePosition> schedule = new ArrayList<SchedulePosition>(); Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; connection = ConnectionFactory.getConnection(); try { statement = connection.prepareStatement(GET_ALL); resultSet = statement.executeQuery(); while (resultSet.next()) { String weekDay = resultSet.getString("weekDay"); String time = resultSet.getString("time"); String event = resultSet.getString("event"); SchedulePosition schedulePosition = new SchedulePosition(weekDay, time, event); long id = resultSet.getLong("id"); schedulePosition.setId(id); Map<Integer, SchedulePosition> positionsSet = new TreeMap<Integer, SchedulePosition>(); positionsSet.put((int) id, schedulePosition); for (Integer position : positionsSet.keySet()) { schedule.add(positionsSet.get(position)); } } } catch (SQLException e) { log.error("Can't retrieve schedule from DB", e); throw new ScheduleException("Can't retrieve schedule from DB", e); } finally { ConnectionFactory.closeConnection(connection, statement, resultSet); } return schedule; } @Override public void create(SchedulePosition schedulePosition) throws ScheduleException { Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; connection = ConnectionFactory.getConnection(); try { statement = connection.prepareStatement(CREATE, Statement.RETURN_GENERATED_KEYS); statement.setString(1, schedulePosition.getWeekDay()); statement.setString(2, schedulePosition.getTime()); statement.setString(3, schedulePosition.getEvent()); statement.executeUpdate(); resultSet = statement.getGeneratedKeys(); schedulePosition.setId(resultSet.getLong("id")); } catch (SQLException e) { log.error("Can't save schedule position", e); throw new ScheduleException("Can't save schedule position", e); } finally { ConnectionFactory.closeConnection(connection, statement, resultSet); } } }
UTF-8
Java
2,947
java
SchedulePositionDao.java
Java
[]
null
[]
package com.foxminded.task13.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import org.apache.log4j.Logger; import com.foxminded.task13.domain.SchedulePosition; public class SchedulePositionDao implements GenericDao<SchedulePosition, Long> { private static final Logger log = Logger.getLogger(SchedulePositionDao.class); private final String CREATE = "INSERT INTO Schedule (weekDay, time, event) VALUES (?, ?, ?) ON CONFLICT (weekDay, time, event) DO UPDATE SET weekDay = excluded.weekDay, time = excluded.time, event = excluded.event;"; private final String GET_ALL = "SELECT * FROM Schedule ORDER BY id;"; @Override public List<SchedulePosition> getAll() throws ScheduleException { List<SchedulePosition> schedule = new ArrayList<SchedulePosition>(); Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; connection = ConnectionFactory.getConnection(); try { statement = connection.prepareStatement(GET_ALL); resultSet = statement.executeQuery(); while (resultSet.next()) { String weekDay = resultSet.getString("weekDay"); String time = resultSet.getString("time"); String event = resultSet.getString("event"); SchedulePosition schedulePosition = new SchedulePosition(weekDay, time, event); long id = resultSet.getLong("id"); schedulePosition.setId(id); Map<Integer, SchedulePosition> positionsSet = new TreeMap<Integer, SchedulePosition>(); positionsSet.put((int) id, schedulePosition); for (Integer position : positionsSet.keySet()) { schedule.add(positionsSet.get(position)); } } } catch (SQLException e) { log.error("Can't retrieve schedule from DB", e); throw new ScheduleException("Can't retrieve schedule from DB", e); } finally { ConnectionFactory.closeConnection(connection, statement, resultSet); } return schedule; } @Override public void create(SchedulePosition schedulePosition) throws ScheduleException { Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; connection = ConnectionFactory.getConnection(); try { statement = connection.prepareStatement(CREATE, Statement.RETURN_GENERATED_KEYS); statement.setString(1, schedulePosition.getWeekDay()); statement.setString(2, schedulePosition.getTime()); statement.setString(3, schedulePosition.getEvent()); statement.executeUpdate(); resultSet = statement.getGeneratedKeys(); schedulePosition.setId(resultSet.getLong("id")); } catch (SQLException e) { log.error("Can't save schedule position", e); throw new ScheduleException("Can't save schedule position", e); } finally { ConnectionFactory.closeConnection(connection, statement, resultSet); } } }
2,947
0.750933
0.748219
78
36.782051
32.534657
217
false
false
0
0
0
0
0
0
2.794872
false
false
4
4b5c6c6ab36178ef7f7ceff1f1001a22f6a948bc
22,393,959,531,018
0b5f272a12774f79acaf562929458aa1d76446f1
/framework_web/src/main/java/org/apache/framework/controller/systemmanage/UserController.java
da14797a87974ab634933118ff4e212ebf0c84e6
[]
no_license
willenfoo/framework
https://github.com/willenfoo/framework
6565d40ca061eec6f8ded8c71f69bb3d0118522e
261320fe0f3c3c7560ef8cfe05650ad488d7ff5b
refs/heads/master
2020-06-06T20:43:34.337000
2016-11-01T02:46:45
2016-11-01T02:46:45
14,723,204
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.framework.controller.systemmanage; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; import org.apache.framework.controller.BaseController; import org.apache.framework.domain.Pager; import org.apache.framework.model.*; import org.apache.framework.model.example.*; import org.apache.framework.service.*; import org.apache.framework.util.Md5Utils; import org.apache.framework.util.SessionUtils; import org.apache.framework.util.StringUtils; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; /** * * @author willenfoo * */ @Controller @RequestMapping("user/") public class UserController extends BaseController { /** * 查询数据 * @param role * @return */ @RequiresPermissions("user_find") @RequestMapping(value = "find") @ResponseBody public Object find(User user) { Map<String, Object> map = getSuccessResult(); UserExample example = new UserExample(); UserExample.Criteria criteria = example.createCriteria(); if (StringUtils.isNotEmpty(user.getUserName())) { criteria.andUserNameLike("%"+user.getUserName().trim()+"%"); } Pager pager = userService.selectByExample(example, getOffset(), getPageSize()); map.put(TOTAL, pager.getTotal()); map.put(ROWS, pager.getList()); return map; } /** * 跳转到查询页面 * @return */ @RequiresPermissions("user") @RequestMapping(value="toFind") public String toFind() { return VIEWS_PATH+"find"; } /** * 跳转到新增页面 * @param modelMap * @return */ @RequiresPermissions("user_add") @RequestMapping(value="toAdd") public String toAdd(ModelMap modelMap) { modelMap.put("user", new User()); return VIEWS_PATH+"edit"; } /** * 跳转到更新页面 * @param modelMap * @return */ @RequiresPermissions("user_update") @RequestMapping(value="toUpdate") public String toUpdate(@RequestParam Long id,ModelMap modelMap) { User user = userService.selectById(id); modelMap.put("user", user); return VIEWS_PATH+"edit"; } /** * 添加 * @param user * @return */ @RequiresPermissions("user_add") @RequestMapping(value = "add") @ResponseBody public Object add(User user, String projectCode) { Map<String, Object> map = getSuccessResult(); user.setCreateUserId(SessionUtils.getUserId()); user.setPassword(Md5Utils.getMD5(user.getPassword())); user.setProjectCode(projectCode); userService.insertConnect(user); return map; } /** * 更新 * @param user * @return */ @RequiresPermissions("user_update") @RequestMapping(value = "update") @ResponseBody public Object update(User user) { Map<String, Object> map = getSuccessResult(); userService.updateById(user); return map; } /** * 删除用户 * @param id * @return */ @RequiresPermissions("user_delete") @RequestMapping(value="delete") @ResponseBody public Object delete(@RequestParam("id") Long id) { Map<String, Object> map = getSuccessResult(); userService.deleteById(id); return map; } /** * 判断用户名是否存在 * @param role * @return */ @RequiresPermissions("user_add") @RequestMapping(value = "isExistByUserName") @ResponseBody public Object isExistByUserName(@RequestParam String userName) { Map<String, Object> map = getSuccessResult(); User user = new User(); user.setUserName(userName); user = userService.selectByModel(user); if (user != null) { map = getFailureResult("用户名已经存在!"); } return map; } /** * 切换系统 * @param projectCode * @return */ @RequestMapping(value="switchingSystem") @ResponseBody public Object switchingSystem(@RequestParam String projectCode) { Map<String, Object> map = getSuccessResult(); Subject subject = SecurityUtils.getSubject(); Session session = subject.getSession(); User user = (User)session.getAttribute("user"); if (user != null) { UsernamePasswordToken token = new UsernamePasswordToken(user.getUserName(), user.getPassword()); try { session.setAttribute("projectCode", projectCode); subject.login(token); } catch (AuthenticationException e) { e.printStackTrace(); map = getFailureResult("密码被修改,请重新登录!"); } } return map; } @Resource private UserService userService; //服务层 private static String VIEWS_PATH = "systemmanage/user/"; }
UTF-8
Java
5,188
java
UserController.java
Java
[ { "context": "e.shiro.subject.Subject;\r\n\r\n\r\n/**\r\n * \r\n * @author willenfoo\r\n *\r\n */\r\n@Controller\r\n@RequestMapping(\"user/\")\r\n", "end": 1223, "score": 0.9996261596679688, "start": 1214, "tag": "USERNAME", "value": "willenfoo" }, { "context": "Id(SessionUtils.getUs...
null
[]
package org.apache.framework.controller.systemmanage; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; import org.apache.framework.controller.BaseController; import org.apache.framework.domain.Pager; import org.apache.framework.model.*; import org.apache.framework.model.example.*; import org.apache.framework.service.*; import org.apache.framework.util.Md5Utils; import org.apache.framework.util.SessionUtils; import org.apache.framework.util.StringUtils; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; /** * * @author willenfoo * */ @Controller @RequestMapping("user/") public class UserController extends BaseController { /** * 查询数据 * @param role * @return */ @RequiresPermissions("user_find") @RequestMapping(value = "find") @ResponseBody public Object find(User user) { Map<String, Object> map = getSuccessResult(); UserExample example = new UserExample(); UserExample.Criteria criteria = example.createCriteria(); if (StringUtils.isNotEmpty(user.getUserName())) { criteria.andUserNameLike("%"+user.getUserName().trim()+"%"); } Pager pager = userService.selectByExample(example, getOffset(), getPageSize()); map.put(TOTAL, pager.getTotal()); map.put(ROWS, pager.getList()); return map; } /** * 跳转到查询页面 * @return */ @RequiresPermissions("user") @RequestMapping(value="toFind") public String toFind() { return VIEWS_PATH+"find"; } /** * 跳转到新增页面 * @param modelMap * @return */ @RequiresPermissions("user_add") @RequestMapping(value="toAdd") public String toAdd(ModelMap modelMap) { modelMap.put("user", new User()); return VIEWS_PATH+"edit"; } /** * 跳转到更新页面 * @param modelMap * @return */ @RequiresPermissions("user_update") @RequestMapping(value="toUpdate") public String toUpdate(@RequestParam Long id,ModelMap modelMap) { User user = userService.selectById(id); modelMap.put("user", user); return VIEWS_PATH+"edit"; } /** * 添加 * @param user * @return */ @RequiresPermissions("user_add") @RequestMapping(value = "add") @ResponseBody public Object add(User user, String projectCode) { Map<String, Object> map = getSuccessResult(); user.setCreateUserId(SessionUtils.getUserId()); user.setPassword(<PASSWORD>(user.<PASSWORD>())); user.setProjectCode(projectCode); userService.insertConnect(user); return map; } /** * 更新 * @param user * @return */ @RequiresPermissions("user_update") @RequestMapping(value = "update") @ResponseBody public Object update(User user) { Map<String, Object> map = getSuccessResult(); userService.updateById(user); return map; } /** * 删除用户 * @param id * @return */ @RequiresPermissions("user_delete") @RequestMapping(value="delete") @ResponseBody public Object delete(@RequestParam("id") Long id) { Map<String, Object> map = getSuccessResult(); userService.deleteById(id); return map; } /** * 判断用户名是否存在 * @param role * @return */ @RequiresPermissions("user_add") @RequestMapping(value = "isExistByUserName") @ResponseBody public Object isExistByUserName(@RequestParam String userName) { Map<String, Object> map = getSuccessResult(); User user = new User(); user.setUserName(userName); user = userService.selectByModel(user); if (user != null) { map = getFailureResult("用户名已经存在!"); } return map; } /** * 切换系统 * @param projectCode * @return */ @RequestMapping(value="switchingSystem") @ResponseBody public Object switchingSystem(@RequestParam String projectCode) { Map<String, Object> map = getSuccessResult(); Subject subject = SecurityUtils.getSubject(); Session session = subject.getSession(); User user = (User)session.getAttribute("user"); if (user != null) { UsernamePasswordToken token = new UsernamePasswordToken(user.getUserName(), user.getPassword()); try { session.setAttribute("projectCode", projectCode); subject.login(token); } catch (AuthenticationException e) { e.printStackTrace(); map = getFailureResult("密码被修改,请重新登录!"); } } return map; } @Resource private UserService userService; //服务层 private static String VIEWS_PATH = "systemmanage/user/"; }
5,182
0.691927
0.691334
190
24.610527
20.512793
99
false
false
0
0
0
0
0
0
1.505263
false
false
4
8d08091b33766ea9384e05dac809e50630483004
15,994,458,278,689
b947c8e8a413bd8afc8f3eb5dc35c407a2b5cc37
/src/Main.java
24459415a1df3dc40b3d46f547035a5b23e20ee6
[]
no_license
yanxion/Java_Crawler
https://github.com/yanxion/Java_Crawler
a1fe74c57d446de107659765be6a74be6c23c080
a6eb0efeceea554a1c5feddd720bcedc41d12e6c
refs/heads/master
2020-12-02T18:19:18.999000
2017-07-07T08:53:45
2017-07-07T08:53:45
96,512,749
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by P17179 on 2017/7/7. */ import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; public class Main { public static void main(String[] args) { MySQL News_DB = new MySQL(); Crawler News = new Crawler(); Connection conn = null; Statement st = null; ResultSet rs = null; String [] List_Array = null ; String [] News_Data = null; String sql_query = null; try { st = News_DB.connect("test", "user", "user"); //sql_query = "INSERT INTO News_Item (url,sitename,type,title,time,content,author) VALUES ('1','2','3','4','5','6','7');"; //st.execute(sql_query); List_Array = News.Crawl_List("http://www.taiwandaily.net/gp2.aspx?_p=qSVC5QJMmrgSnMLB3faGiTKNGj06VlbL","台灣政治"); for (int i=0;i<List_Array.length;i++){ System.out.println(List_Array[i]); News_Data = News.Crawl_Item(List_Array[i],"台灣政治"); sql_query = "INSERT INTO News_Item (url,sitename,type,title,time,content,author) VALUES ('"+News_Data[0]+"','"+News_Data[1]+"','"+News_Data[2]+"','"+News_Data[3]+"','"+News_Data[4]+"','"+News_Data[5]+"','"+News_Data[6]+"');"; //System.out.println(sql_query); st.execute(sql_query); } }catch(Exception e) { // handle the exception e.printStackTrace(); System.err.println(e.getMessage()); } } }
UTF-8
Java
1,529
java
Main.java
Java
[ { "context": "/**\n * Created by P17179 on 2017/7/7.\n */\nimport java.sql.Connection;\nimpo", "end": 24, "score": 0.9994296431541443, "start": 18, "tag": "USERNAME", "value": "P17179" } ]
null
[]
/** * Created by P17179 on 2017/7/7. */ import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; public class Main { public static void main(String[] args) { MySQL News_DB = new MySQL(); Crawler News = new Crawler(); Connection conn = null; Statement st = null; ResultSet rs = null; String [] List_Array = null ; String [] News_Data = null; String sql_query = null; try { st = News_DB.connect("test", "user", "user"); //sql_query = "INSERT INTO News_Item (url,sitename,type,title,time,content,author) VALUES ('1','2','3','4','5','6','7');"; //st.execute(sql_query); List_Array = News.Crawl_List("http://www.taiwandaily.net/gp2.aspx?_p=qSVC5QJMmrgSnMLB3faGiTKNGj06VlbL","台灣政治"); for (int i=0;i<List_Array.length;i++){ System.out.println(List_Array[i]); News_Data = News.Crawl_Item(List_Array[i],"台灣政治"); sql_query = "INSERT INTO News_Item (url,sitename,type,title,time,content,author) VALUES ('"+News_Data[0]+"','"+News_Data[1]+"','"+News_Data[2]+"','"+News_Data[3]+"','"+News_Data[4]+"','"+News_Data[5]+"','"+News_Data[6]+"');"; //System.out.println(sql_query); st.execute(sql_query); } }catch(Exception e) { // handle the exception e.printStackTrace(); System.err.println(e.getMessage()); } } }
1,529
0.543952
0.523463
41
35.902439
43.05629
241
false
false
0
0
0
0
0
0
1.317073
false
false
4
b781f549cb66a7dd4415eb7de41f4537a4cbd18d
15,994,458,279,448
db0cd361f86dbeacc6e66e266dcf969edb7d3df1
/app/src/main/java/com/isoftston/issuser/fusioncharge/views/TimerService.java
6c160cc6db4e327778688dd9ea0b062065c587a5
[]
no_license
tmyzh13/FusionCharge
https://github.com/tmyzh13/FusionCharge
4f6f93756ffed7a312a3b60cdfa99a04c59be15c
62e607b964d329ba0060cd7d16d28ef0f9b59fd7
refs/heads/master
2020-03-11T13:57:38.232000
2018-04-28T08:42:07
2018-04-28T08:42:07
130,039,854
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.isoftston.issuser.fusioncharge.views; import android.app.Service; import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; import com.corelibs.utils.PreferencesHelper; import com.corelibs.utils.rxbus.RxBus; import com.isoftston.issuser.fusioncharge.constants.Constant; import com.isoftston.issuser.fusioncharge.utils.Tools; import java.util.Timer; import java.util.TimerTask; /** * Created by issuser on 2018/4/22. */ public class TimerService extends Service{ private ServiceBinder mBinder=new ServiceBinder(); private Timer timer; private Timer timerSec; private boolean isStartCharge=false; private boolean isAppointmentCharge=false; @Nullable @Override public IBinder onBind(Intent intent) { return mBinder; } @Override public void onCreate() { super.onCreate(); timer=new Timer(); timerSec=new Timer(); } private Long hourTime; private long appointmentTime; //更新预约时间 public void timeAppointment(){ if(isAppointmentCharge){ Log.e("yzh","已经开始"); return; }else{ isAppointmentCharge=true; } if(timerSec==null){ timerSec=new Timer(); } timerSec.schedule(new TimerTask() { @Override public void run() { if(Tools.isNull(PreferencesHelper.getData(Constant.TIME_APPOINTMENT))){ appointmentTime=0; }else{ appointmentTime=Long.parseLong(PreferencesHelper.getData(Constant.TIME_APPOINTMENT)); } appointmentTime-=1000; Log.e("yzh","sssss----"+appointmentTime); PreferencesHelper.saveData(Constant.TIME_APPOINTMENT,appointmentTime+""); RxBus.getDefault().send(new Object(),Constant.REFRESH_APPOINTMENT_TIME); if(appointmentTime<=0){ Log.e("yzh","cancel"); //预约超时 RxBus.getDefault().send(new Object(),Constant.APPOINTMENT_TIME_OUT); cancelTimerAppointment(); } } },1000,10000); } public void cancelTimerAppointment(){ if(timerSec!=null){ timerSec.cancel(); timerSec=null; isAppointmentCharge=false; } } //更新充电时间 public void timerHour(){ //一分钟更新一次时间 if(isStartCharge){ //已经开始了不用再执行一个操作 Log.e("yzh","已经开始了不用再执行一个操作"); return; }else{ isStartCharge=true; } if(timer==null){ timer=new Timer(); } // timer.schedule(new TimerTask() { // @Override // public void run() { // hourTime=Long.parseLong(PreferencesHelper.getData(Constant.CHARGING_TIME)); // Log.e("yzh","timerHour----"+PreferencesHelper.getData(Constant.CHARGING_TIME)); // hourTime-=60*1000; // PreferencesHelper.saveData(Constant.CHARGING_TIME,hourTime+""); // RxBus.getDefault().send(new Object(),Constant.CHARGING_TIME); // if(hourTime<=0){ // Log.e("yzh","cancel"); // cancelTimerHour(); // } // } // },5*1000,5*1000); Log.e("yzh","schedule"); timer.schedule(new TimerTask() { @Override public void run() { if(TextUtils.isEmpty(PreferencesHelper.getData(Constant.CHARGING_TIME))){ hourTime = 0L; } else { hourTime=Long.parseLong(PreferencesHelper.getData(Constant.CHARGING_TIME)); } Log.e("yzh","timerHour----"+PreferencesHelper.getData(Constant.CHARGING_TIME)); hourTime+=1000; PreferencesHelper.saveData(Constant.CHARGING_TIME,hourTime+""); if(hourTime%(60*1000)==0){ //是整分钟 去刷新时间 RxBus.getDefault().send(new Object(),Constant.CHARGING_TIME); } // if(hourTime>=Long.parseLong(PreferencesHelper.getData(Constant.CHARGING_TOTAL))){ // Log.e("yzh","cancel"); // cancelTimerHour(); // } } },1000,1000); } public void cancelTimerHour(){ if(timer!=null){ timer.cancel(); timer=null; isStartCharge=false; } } public class ServiceBinder extends Binder{ public TimerService getService(){ return TimerService.this; } } }
UTF-8
Java
4,953
java
TimerService.java
Java
[ { "context": "er;\nimport java.util.TimerTask;\n\n/**\n * Created by issuser on 2018/4/22.\n */\n\npublic class TimerService exte", "end": 544, "score": 0.9996334314346313, "start": 537, "tag": "USERNAME", "value": "issuser" } ]
null
[]
package com.isoftston.issuser.fusioncharge.views; import android.app.Service; import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; import com.corelibs.utils.PreferencesHelper; import com.corelibs.utils.rxbus.RxBus; import com.isoftston.issuser.fusioncharge.constants.Constant; import com.isoftston.issuser.fusioncharge.utils.Tools; import java.util.Timer; import java.util.TimerTask; /** * Created by issuser on 2018/4/22. */ public class TimerService extends Service{ private ServiceBinder mBinder=new ServiceBinder(); private Timer timer; private Timer timerSec; private boolean isStartCharge=false; private boolean isAppointmentCharge=false; @Nullable @Override public IBinder onBind(Intent intent) { return mBinder; } @Override public void onCreate() { super.onCreate(); timer=new Timer(); timerSec=new Timer(); } private Long hourTime; private long appointmentTime; //更新预约时间 public void timeAppointment(){ if(isAppointmentCharge){ Log.e("yzh","已经开始"); return; }else{ isAppointmentCharge=true; } if(timerSec==null){ timerSec=new Timer(); } timerSec.schedule(new TimerTask() { @Override public void run() { if(Tools.isNull(PreferencesHelper.getData(Constant.TIME_APPOINTMENT))){ appointmentTime=0; }else{ appointmentTime=Long.parseLong(PreferencesHelper.getData(Constant.TIME_APPOINTMENT)); } appointmentTime-=1000; Log.e("yzh","sssss----"+appointmentTime); PreferencesHelper.saveData(Constant.TIME_APPOINTMENT,appointmentTime+""); RxBus.getDefault().send(new Object(),Constant.REFRESH_APPOINTMENT_TIME); if(appointmentTime<=0){ Log.e("yzh","cancel"); //预约超时 RxBus.getDefault().send(new Object(),Constant.APPOINTMENT_TIME_OUT); cancelTimerAppointment(); } } },1000,10000); } public void cancelTimerAppointment(){ if(timerSec!=null){ timerSec.cancel(); timerSec=null; isAppointmentCharge=false; } } //更新充电时间 public void timerHour(){ //一分钟更新一次时间 if(isStartCharge){ //已经开始了不用再执行一个操作 Log.e("yzh","已经开始了不用再执行一个操作"); return; }else{ isStartCharge=true; } if(timer==null){ timer=new Timer(); } // timer.schedule(new TimerTask() { // @Override // public void run() { // hourTime=Long.parseLong(PreferencesHelper.getData(Constant.CHARGING_TIME)); // Log.e("yzh","timerHour----"+PreferencesHelper.getData(Constant.CHARGING_TIME)); // hourTime-=60*1000; // PreferencesHelper.saveData(Constant.CHARGING_TIME,hourTime+""); // RxBus.getDefault().send(new Object(),Constant.CHARGING_TIME); // if(hourTime<=0){ // Log.e("yzh","cancel"); // cancelTimerHour(); // } // } // },5*1000,5*1000); Log.e("yzh","schedule"); timer.schedule(new TimerTask() { @Override public void run() { if(TextUtils.isEmpty(PreferencesHelper.getData(Constant.CHARGING_TIME))){ hourTime = 0L; } else { hourTime=Long.parseLong(PreferencesHelper.getData(Constant.CHARGING_TIME)); } Log.e("yzh","timerHour----"+PreferencesHelper.getData(Constant.CHARGING_TIME)); hourTime+=1000; PreferencesHelper.saveData(Constant.CHARGING_TIME,hourTime+""); if(hourTime%(60*1000)==0){ //是整分钟 去刷新时间 RxBus.getDefault().send(new Object(),Constant.CHARGING_TIME); } // if(hourTime>=Long.parseLong(PreferencesHelper.getData(Constant.CHARGING_TOTAL))){ // Log.e("yzh","cancel"); // cancelTimerHour(); // } } },1000,1000); } public void cancelTimerHour(){ if(timer!=null){ timer.cancel(); timer=null; isStartCharge=false; } } public class ServiceBinder extends Binder{ public TimerService getService(){ return TimerService.this; } } }
4,953
0.553205
0.540967
150
31.139999
24.036924
105
false
false
0
0
0
0
0
0
0.6
false
false
4
8f02b4596a604a6865301ab29fccafb0317fbfdf
30,709,016,169,104
d41f2733eda691aad3727b391b05c33d97047f4c
/app/src/main/java/com/example/hackthe6ix/MenuActivity.java
b27317bf60541a09529d10c86079504e7b46114e
[]
no_license
DaJellyDanish/HackThe6ix
https://github.com/DaJellyDanish/HackThe6ix
224667a08a59028adc42852184da8afb9216ca0b
6afe5b0d075704c857387e23446140f22b3bd2f8
refs/heads/master
2020-07-10T15:19:27.870000
2019-08-25T13:16:27
2019-08-25T13:16:27
204,292,837
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.hackthe6ix; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; public class MenuActivity extends AppCompatActivity { TextView tv; String s; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); tv = findViewById(R.id.textView); s = getIntent().getStringExtra("name"); tv.setText(s); Log.d("name",s); } public void growth(View view) { Intent intent = new Intent(this,MainActivity.class); startActivity(intent); } public void dash(View view) { Intent intent = new Intent(this,DashboardActivity.class); intent.putExtra("name",s); startActivity(intent); } }
UTF-8
Java
934
java
MenuActivity.java
Java
[]
null
[]
package com.example.hackthe6ix; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; public class MenuActivity extends AppCompatActivity { TextView tv; String s; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menu); tv = findViewById(R.id.textView); s = getIntent().getStringExtra("name"); tv.setText(s); Log.d("name",s); } public void growth(View view) { Intent intent = new Intent(this,MainActivity.class); startActivity(intent); } public void dash(View view) { Intent intent = new Intent(this,DashboardActivity.class); intent.putExtra("name",s); startActivity(intent); } }
934
0.674518
0.673448
36
24.944445
19.043728
65
false
false
0
0
0
0
0
0
0.666667
false
false
4
bcf5196040c9c332a6a94e2b18c00e79c73c5c3c
11,020,886,134,776
cd36d9f69037777400e9f097b5231117566cbe16
/src/draw/visitorclient/package-info.java
65a2185acbcd9f420a5f6a8e4bb628cbb23a9590
[]
no_license
zorgulle/MD
https://github.com/zorgulle/MD
d20f922c4bb5852835be7ffb2675b89f467af9b8
537555bb6140e57c95b3bddaf5c0d82ea787c154
refs/heads/master
2016-06-02T12:42:26.629000
2014-12-18T14:53:23
2014-12-18T14:53:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * abonnement au visiteur. */ /** * @author t1002534 * */ package draw.visitorclient;
UTF-8
Java
94
java
package-info.java
Java
[ { "context": "/**\n * abonnement au visiteur.\n */\n/**\n * @author t1002534\n *\n */\npackage draw.visitorclient;\n", "end": 58, "score": 0.999274492263794, "start": 50, "tag": "USERNAME", "value": "t1002534" } ]
null
[]
/** * abonnement au visiteur. */ /** * @author t1002534 * */ package draw.visitorclient;
94
0.617021
0.542553
8
10.75
10.497024
27
false
false
0
0
0
0
0
0
0.125
false
false
4
17f991b115cd287aadef5659bc13f32da4ca987b
6,210,522,724,565
a00b3e3776a7676e449d6fe57ec0baf9dd7e1d40
/src/Kata2.java
11c02017ded99843d0498cc8654eb7352c3d78a9
[]
no_license
Aitor-Ventura/IS2_Kata2_List
https://github.com/Aitor-Ventura/IS2_Kata2_List
470d224c50237397966f62bc6db3a055a3ce1cf1
c97eab4a90bfcdc60ecac8c38ad3cb8f0e0b54c4
refs/heads/main
2023-01-22T07:36:21.456000
2020-11-19T17:21:49
2020-11-19T17:21:49
314,319,761
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Kata2 { public static void main(String[] args) throws Exception { int[] array = {1,2,3,4,5,6,1,2,3,1,1,2,3}; List b = new List(); for (int i = 0; i < array.length; i++) b.add(array[i]); System.out.println("El numero que aparece con mas frecuencia en la lista es: " + b.mostFrequency()); } }
UTF-8
Java
344
java
Kata2.java
Java
[]
null
[]
public class Kata2 { public static void main(String[] args) throws Exception { int[] array = {1,2,3,4,5,6,1,2,3,1,1,2,3}; List b = new List(); for (int i = 0; i < array.length; i++) b.add(array[i]); System.out.println("El numero que aparece con mas frecuencia en la lista es: " + b.mostFrequency()); } }
344
0.581395
0.537791
8
42
33.451458
108
false
false
0
0
0
0
0
0
2.25
false
false
4
1eeca800dbbf81dcab8d2426eb06a6533758b8f8
12,146,167,548,301
f1263274bd3209f456f68e8f1b31bec1e750fdb5
/src/main/java/com/bmsoft/sharejdbc/vo/TypeEventDataVO.java
5081566995db47dd7ee62bdb72da0536d73f07d7
[]
no_license
dht5867/share-jdbc
https://github.com/dht5867/share-jdbc
bcb16126d430c48d86a58fbfcb7522eeb2618d2f
da6ea9ffedb0acdb00b645da0df1090602d440d8
refs/heads/master
2020-06-15T02:24:31.585000
2019-07-04T06:42:14
2019-07-04T06:42:14
195,183,645
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bmsoft.sharejdbc.vo; import lombok.Data; @Data public class TypeEventDataVO { private String relationType; private String eventCount; }
UTF-8
Java
155
java
TypeEventDataVO.java
Java
[]
null
[]
package com.bmsoft.sharejdbc.vo; import lombok.Data; @Data public class TypeEventDataVO { private String relationType; private String eventCount; }
155
0.780645
0.780645
10
14.5
13.756817
32
false
false
0
0
0
0
0
0
0.4
false
false
4
9e0441819fdf6439b90d81e25134604f9a041301
21,500,606,288,540
bc7f15bcadabe11871ac870ff1fb8a25d4048d8e
/app/src/main/java/com/example/android/automatictestgrader/AnswerKeyActivity.java
e365db803a60222c77039dca0d4005126c2094e5
[]
no_license
prashsub2/AutomaticTestGrader
https://github.com/prashsub2/AutomaticTestGrader
6401eb38ced5628bdb50789b2eeeea0c87442b04
54705cd67af769a2429e2ea0de188c4b43bef2ce
refs/heads/master
2021-01-21T12:01:14.954000
2017-05-19T06:09:30
2017-05-19T06:09:30
91,771,505
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.android.automatictestgrader; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.EventListener; import java.util.List; import static android.view.ViewGroup.LayoutParams.FILL_PARENT; import static android.widget.GridLayout.VERTICAL; import static android.widget.ListPopupWindow.WRAP_CONTENT; public class AnswerKeyActivity extends AppCompatActivity { private FirebaseDatabase database = FirebaseDatabase.getInstance(); private DatabaseReference numberOfQuestionsReference = database.getReference("numberOfQuestions"); private DatabaseReference answerKeyReference = database.getReference("answerKey"); private int numberOfQuestionsInt; private List<EditText> editTextList = new ArrayList<EditText>(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final LinearLayout linearLayout = new LinearLayout(this); final TextView directions = new TextView(this); directions.setText("Please enter the corresponding answer to each question"); directions.setTextSize(20f); directions.setTextColor(Color.BLACK); //Listener for Firebase reference numberOfQuestionsReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { numberOfQuestionsInt = dataSnapshot.getValue(Integer.class); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(FILL_PARENT, WRAP_CONTENT); linearLayout.setLayoutParams(params); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(directions); linearLayout.addView(tableLayout(numberOfQuestionsInt)); linearLayout.addView(submitButton()); setContentView(linearLayout); } @Override public void onCancelled(DatabaseError databaseError) { } }); } /** * Creates a submit button * * @return a button that the user clicks on after they have finished entering text */ private Button submitButton() { Button button = new Button(this); button.setHeight(WRAP_CONTENT); button.setText("Submit"); button.setOnClickListener(submitListener); return button; } /** * Access the value of the EditText. Adds answer key to database as a string. */ private View.OnClickListener submitListener = new View.OnClickListener() { public void onClick(View view) { StringBuilder stringBuilder = new StringBuilder(); for (EditText editText : editTextList) { if(editText.getText().toString().isEmpty() || editText.getText().toString().length() > 1){ Toast.makeText(getApplicationContext(), "At least one answer has an invalid length", Toast.LENGTH_LONG).show(); return; } else{ stringBuilder.append(editText.getText().toString()); } } answerKeyReference.setValue(stringBuilder.toString()); Intent intent = new Intent(AnswerKeyActivity.this, MainActivity.class); startActivity(intent); } }; /** * Using a TableLayout as it provides for a neat ordering structure * * @param count - number of edit texts needed as it corresponds to the amount of questions needed * @return - TableLayout */ private TableLayout tableLayout(int count) { TableLayout tableLayout = new TableLayout(this); tableLayout.setStretchAllColumns(true); int noOfRows = count / 5; for (int i = 0; i < noOfRows; i++) { int rowId = 5 * i; tableLayout.addView(createOneFullRow(rowId)); } int individualCells = count % 5; tableLayout.addView(createLeftOverCells(individualCells, count)); return tableLayout; } /** * After the creating of full rows is done, we must create the left over cells as not every test must have * an amount of questions that is a multiple of five. * * @param individualCells- Amount of leftover cells * @param count - Number ofo questions * @return - TableRow */ private TableRow createLeftOverCells(int individualCells, int count) { TableRow tableRow = new TableRow(this); tableRow.setPadding(0, 10, 0, 0); int rowId = count - individualCells; for (int i = 1; i <= individualCells; i++) { tableRow.addView(editText(String.valueOf(rowId + i))); } return tableRow; } /** * Creates one full row for the TableLayout * * @param rowId - Question number * @return Row of EditTexts */ private TableRow createOneFullRow(int rowId) { TableRow tableRow = new TableRow(this); tableRow.setPadding(0, 10, 0, 0); for (int i = 1; i <= 5; i++) { tableRow.addView(editText(String.valueOf(rowId + i))); } return tableRow; } /** * Creates edit text when called * * @param hint - Hint for each EditText * @return - EditText */ private EditText editText(String hint) { EditText editText = new EditText(this); editText.setId(Integer.valueOf(hint)); editText.setHint(hint); editTextList.add(editText); return editText; } }
UTF-8
Java
6,303
java
AnswerKeyActivity.java
Java
[]
null
[]
package com.example.android.automatictestgrader; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.EventListener; import java.util.List; import static android.view.ViewGroup.LayoutParams.FILL_PARENT; import static android.widget.GridLayout.VERTICAL; import static android.widget.ListPopupWindow.WRAP_CONTENT; public class AnswerKeyActivity extends AppCompatActivity { private FirebaseDatabase database = FirebaseDatabase.getInstance(); private DatabaseReference numberOfQuestionsReference = database.getReference("numberOfQuestions"); private DatabaseReference answerKeyReference = database.getReference("answerKey"); private int numberOfQuestionsInt; private List<EditText> editTextList = new ArrayList<EditText>(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final LinearLayout linearLayout = new LinearLayout(this); final TextView directions = new TextView(this); directions.setText("Please enter the corresponding answer to each question"); directions.setTextSize(20f); directions.setTextColor(Color.BLACK); //Listener for Firebase reference numberOfQuestionsReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { numberOfQuestionsInt = dataSnapshot.getValue(Integer.class); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(FILL_PARENT, WRAP_CONTENT); linearLayout.setLayoutParams(params); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(directions); linearLayout.addView(tableLayout(numberOfQuestionsInt)); linearLayout.addView(submitButton()); setContentView(linearLayout); } @Override public void onCancelled(DatabaseError databaseError) { } }); } /** * Creates a submit button * * @return a button that the user clicks on after they have finished entering text */ private Button submitButton() { Button button = new Button(this); button.setHeight(WRAP_CONTENT); button.setText("Submit"); button.setOnClickListener(submitListener); return button; } /** * Access the value of the EditText. Adds answer key to database as a string. */ private View.OnClickListener submitListener = new View.OnClickListener() { public void onClick(View view) { StringBuilder stringBuilder = new StringBuilder(); for (EditText editText : editTextList) { if(editText.getText().toString().isEmpty() || editText.getText().toString().length() > 1){ Toast.makeText(getApplicationContext(), "At least one answer has an invalid length", Toast.LENGTH_LONG).show(); return; } else{ stringBuilder.append(editText.getText().toString()); } } answerKeyReference.setValue(stringBuilder.toString()); Intent intent = new Intent(AnswerKeyActivity.this, MainActivity.class); startActivity(intent); } }; /** * Using a TableLayout as it provides for a neat ordering structure * * @param count - number of edit texts needed as it corresponds to the amount of questions needed * @return - TableLayout */ private TableLayout tableLayout(int count) { TableLayout tableLayout = new TableLayout(this); tableLayout.setStretchAllColumns(true); int noOfRows = count / 5; for (int i = 0; i < noOfRows; i++) { int rowId = 5 * i; tableLayout.addView(createOneFullRow(rowId)); } int individualCells = count % 5; tableLayout.addView(createLeftOverCells(individualCells, count)); return tableLayout; } /** * After the creating of full rows is done, we must create the left over cells as not every test must have * an amount of questions that is a multiple of five. * * @param individualCells- Amount of leftover cells * @param count - Number ofo questions * @return - TableRow */ private TableRow createLeftOverCells(int individualCells, int count) { TableRow tableRow = new TableRow(this); tableRow.setPadding(0, 10, 0, 0); int rowId = count - individualCells; for (int i = 1; i <= individualCells; i++) { tableRow.addView(editText(String.valueOf(rowId + i))); } return tableRow; } /** * Creates one full row for the TableLayout * * @param rowId - Question number * @return Row of EditTexts */ private TableRow createOneFullRow(int rowId) { TableRow tableRow = new TableRow(this); tableRow.setPadding(0, 10, 0, 0); for (int i = 1; i <= 5; i++) { tableRow.addView(editText(String.valueOf(rowId + i))); } return tableRow; } /** * Creates edit text when called * * @param hint - Hint for each EditText * @return - EditText */ private EditText editText(String hint) { EditText editText = new EditText(this); editText.setId(Integer.valueOf(hint)); editText.setHint(hint); editTextList.add(editText); return editText; } }
6,303
0.663335
0.659845
176
34.80682
27.602024
131
false
false
0
0
0
0
0
0
0.585227
false
false
4
0f7ffaa0e80f7caf337cf1c14bfb3ed87a274576
33,079,838,125,358
36327e0fa6ffb27776b6bf68ed4a49382c6e8829
/WEB-INF/classes/uk/ac/dundee/computing/fionamoug/DatabaseConnection.java
371d74ba0a38df4a22efb2f3290987df26a6cc71
[]
no_license
fmoug1/Mr-Faulty
https://github.com/fmoug1/Mr-Faulty
256c78055849ff0b01c5095ca9e6cd4aea92bc4f
17dfd2f9c80044971f24f1dfb30ec5c8562cc434
refs/heads/master
2021-01-15T17:29:30.284000
2012-02-27T13:51:29
2012-02-27T13:51:29
3,559,972
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uk.ac.dundee.computing.fionamoug; import javax.sql.*; import java.sql.*; import java.util.ArrayList; import uk.ac.dundee.computing.fionamoug.Fault; import uk.ac.dundee.computing.fionamoug.User; import uk.ac.dundee.computing.fionamoug.Error; public class DatabaseConnection { private String username; private String password; public DatabaseConnection() { username = "fionamoug"; password = "ac31004"; } public void addFault(Fault fault, DataSource source) throws SQLException { Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement("INSERT INTO Faults (summary, detail, faulttime, reporterid, status) VALUES (?,?,?,?,?)"); prepst.setString(1,fault.getSummary()); prepst.setString(2,fault.getDescription()); prepst.setObject(3,fault.getDateCreated()); prepst.setInt(4,fault.getReporter().getID()); prepst.setString(5,fault.getStatus().toString()); prepst.executeUpdate(); con.close(); } public void addUser(User user, DataSource source) throws SQLException { Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement("INSERT INTO Users (name, email, role, password) VALUES (?, ?, ?, ?)"); prepst.setString(1, user.getName()); prepst.setString(2, user.getEmail()); prepst.setString(3, user.getUserType().toString()); prepst.setString(4, user.getPassword()); prepst.executeUpdate(); con.close(); } public User findUser(String email, DataSource source) throws SQLException { User user = null; Connection con = source.getConnection(username, password); String sql = "SELECT name, role, password FROM Users WHERE email=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1, email); ResultSet results = prepst.executeQuery(); if (results.next()) { user = new User(); user.setEmail(email); user.setName(results.getString("name")); user.setUserType(results.getString("role")); user.setPassword(results.getString("password")); user.setID(findID(email, source)); } results.close(); con.close(); return user; } public User findUser(int id, DataSource source) throws SQLException { User user = null; Connection con = source.getConnection(username, password); String sql = "SELECT name, email, role, password FROM Users WHERE userid=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); ResultSet results = prepst.executeQuery(); if (results.next()) { user = new User(); user.setEmail(results.getString("email")); user.setName(results.getString("name")); user.setUserType(results.getString("role")); user.setPassword(results.getString("password")); user.setID(id); } results.close(); con.close(); return user; } public ArrayList<Fault> getAllFaults(DataSource source) throws SQLException { String sql = "SELECT * FROM Faults"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); ResultSet results = prepst.executeQuery(); Fault nextFault; ArrayList<Fault> faultList = new ArrayList<Fault>(); while (results.next()) { nextFault = new Fault(); nextFault.setID(results.getInt("faultid")); nextFault.setSummary(results.getString("summary")); nextFault.setDescription(results.getString("detail")); nextFault.setStatus(results.getString("status")); nextFault.setReporter(getUser(source, results.getInt("reporterid"))); nextFault.setDeveloper(getUser(source, results.getInt("developerid"))); nextFault.setAdministrator(getUser(source, results.getInt("adminid"))); faultList.add(nextFault); } results.close(); con.close(); return faultList; } public ArrayList<Fault> getAssignedFaults(DataSource source, int id, String staffType) throws SQLException { String sql = "SELECT * FROM Faults WHERE " + staffType.toLowerCase() + "id=?"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); ResultSet results = prepst.executeQuery(); ArrayList<Fault> faultList = new ArrayList<Fault>(); while (results.next()) { Fault nextFault = new Fault(); nextFault = new Fault(); nextFault.setID(results.getInt("faultid")); nextFault.setSummary(results.getString("summary")); nextFault.setDescription(results.getString("detail")); nextFault.setStatus(results.getString("status")); nextFault.setReporter(getUser(source, results.getInt("reporterid"))); nextFault.setDeveloper(getUser(source, results.getInt("developerid"))); nextFault.setAdministrator(getUser(source, results.getInt("adminid"))); faultList.add(nextFault); } results.close(); con.close(); return faultList; } public Fault getFault(DataSource source, int id) throws SQLException { Connection con = source.getConnection(username, password); String sql = "SELECT * FROM Faults WHERE faultid=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); ResultSet results = prepst.executeQuery(); Fault fault = null; if (results.next()) { fault = new Fault(); fault.setID(results.getInt("faultid")); fault.setSummary(results.getString("summary")); fault.setDescription(results.getString("detail")); fault.setStatus(results.getString("status")); fault.setReporter(findUser(results.getInt("reporterid"), source)); fault.setReporter(getUser(source, results.getInt("reporterid"))); fault.setDeveloper(getUser(source, results.getInt("developerid"))); fault.setAdministrator(getUser(source, results.getInt("adminid"))); } results.close(); con.close(); return fault; } public int findID(String userEmail, DataSource source) throws SQLException { int id = -1; Connection con = source.getConnection(username, password); String sql = "SELECT userid FROM Users WHERE email=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1,userEmail); ResultSet results = prepst.executeQuery(); if (results.next()) { id = results.getInt("userid"); } return id; } public ArrayList<User> getAllUsers(DataSource source, String userType) throws SQLException { userType = userType.toUpperCase(); Connection con = source.getConnection(username, password); String sql = "SELECT userid, name, email FROM Users WHERE role = ?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1,userType); ResultSet results = prepst.executeQuery(); ArrayList<User> userList = new ArrayList<User>(); User user; while (results.next()) { user = new User(); user.setID(results.getInt("userid")); user.setName(results.getString("name")); user.setEmail(results.getString("email")); user.setUserType(userType); userList.add(user); } return userList; } public User getUser(DataSource source, int userID) throws SQLException { String sql = "SELECT name, email, role, password FROM Users WHERE userid = ?"; Connection con = source.getConnection(username,password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1,userID); ResultSet results = prepst.executeQuery(); User user = null; if (results.next()) { user = new User(); user.setID(userID); user.setName(results.getString("name")); user.setEmail(results.getString("email")); user.setUserType(results.getString("role")); user.setPassword(results.getString("password")); } results.close(); con.close(); return user; } public void delete(DataSource source, String type, int id) throws SQLException { //need to change 'type' as it appears in the URL (user, fault) to match database table names (Users, Faults) String resolvedType = type.toUpperCase().substring(0,1) + type.substring(1) + "s"; String sql = "DELETE FROM " + resolvedType +" WHERE " + type + "id= ?"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); prepst.executeUpdate(); con.close(); } public void updateFault(DataSource source, int id, String developerEmail, String adminEmail, String status) throws SQLException { int developerID, adminID; Fault fault = getFault(source,id); if (developerEmail.equals("") || developerEmail == null) developerID = fault.getDeveloper().getID(); else developerID = findID(developerEmail, source); if (adminEmail.equals("") || adminEmail == null) adminID = fault.getAdministrator().getID(); else adminID = findID(adminEmail,source); if (status.equals("") || status == null) status = fault.getStatus().toString(); String sql = "UPDATE Faults SET adminid=?, developerid=?, status=? WHERE faultid=?"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1,adminID); prepst.setInt(2,developerID); prepst.setString(3,status); prepst.setInt(4,id); prepst.executeUpdate(); con.close(); } public void updateUser(DataSource source, int id, String name, String email, String role, String password) throws SQLException { User user = getUser(source,id); if (name.equals("") || name == null) name = user.getName(); if (email.equals("") || email == null) email = user.getEmail(); if (role.equals("") || role == null) role = user.getUserType().toString(); if (password.equals("") || password == null) password = user.getPassword(); String sql = "UPDATE Users SET name=?, email=?, role=?, password=? WHERE userid=?"; Connection con = source.getConnection(username, this.password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1,name); prepst.setString(2,email); prepst.setString(3,role); prepst.setString(4,password); prepst.setInt(5,id); prepst.executeUpdate(); con.close(); } }
UTF-8
Java
10,363
java
DatabaseConnection.java
Java
[ { "context": "\r\n\tpublic DatabaseConnection()\r\n\t{\r\n\t\tusername = \"fionamoug\";\r\n\t\tpassword = \"ac31004\";\r\n\t}\r\n\r\n\tpublic void ad", "end": 412, "score": 0.9995208978652954, "start": 403, "tag": "USERNAME", "value": "fionamoug" }, { "context": "n()\r\n\t{\r\n\t\tus...
null
[]
package uk.ac.dundee.computing.fionamoug; import javax.sql.*; import java.sql.*; import java.util.ArrayList; import uk.ac.dundee.computing.fionamoug.Fault; import uk.ac.dundee.computing.fionamoug.User; import uk.ac.dundee.computing.fionamoug.Error; public class DatabaseConnection { private String username; private String password; public DatabaseConnection() { username = "fionamoug"; password = "<PASSWORD>"; } public void addFault(Fault fault, DataSource source) throws SQLException { Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement("INSERT INTO Faults (summary, detail, faulttime, reporterid, status) VALUES (?,?,?,?,?)"); prepst.setString(1,fault.getSummary()); prepst.setString(2,fault.getDescription()); prepst.setObject(3,fault.getDateCreated()); prepst.setInt(4,fault.getReporter().getID()); prepst.setString(5,fault.getStatus().toString()); prepst.executeUpdate(); con.close(); } public void addUser(User user, DataSource source) throws SQLException { Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement("INSERT INTO Users (name, email, role, password) VALUES (?, ?, ?, ?)"); prepst.setString(1, user.getName()); prepst.setString(2, user.getEmail()); prepst.setString(3, user.getUserType().toString()); prepst.setString(4, user.getPassword()); prepst.executeUpdate(); con.close(); } public User findUser(String email, DataSource source) throws SQLException { User user = null; Connection con = source.getConnection(username, password); String sql = "SELECT name, role, password FROM Users WHERE email=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1, email); ResultSet results = prepst.executeQuery(); if (results.next()) { user = new User(); user.setEmail(email); user.setName(results.getString("name")); user.setUserType(results.getString("role")); user.setPassword(results.getString("password")); user.setID(findID(email, source)); } results.close(); con.close(); return user; } public User findUser(int id, DataSource source) throws SQLException { User user = null; Connection con = source.getConnection(username, password); String sql = "SELECT name, email, role, password FROM Users WHERE userid=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); ResultSet results = prepst.executeQuery(); if (results.next()) { user = new User(); user.setEmail(results.getString("email")); user.setName(results.getString("name")); user.setUserType(results.getString("role")); user.setPassword(results.getString("<PASSWORD>")); user.setID(id); } results.close(); con.close(); return user; } public ArrayList<Fault> getAllFaults(DataSource source) throws SQLException { String sql = "SELECT * FROM Faults"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); ResultSet results = prepst.executeQuery(); Fault nextFault; ArrayList<Fault> faultList = new ArrayList<Fault>(); while (results.next()) { nextFault = new Fault(); nextFault.setID(results.getInt("faultid")); nextFault.setSummary(results.getString("summary")); nextFault.setDescription(results.getString("detail")); nextFault.setStatus(results.getString("status")); nextFault.setReporter(getUser(source, results.getInt("reporterid"))); nextFault.setDeveloper(getUser(source, results.getInt("developerid"))); nextFault.setAdministrator(getUser(source, results.getInt("adminid"))); faultList.add(nextFault); } results.close(); con.close(); return faultList; } public ArrayList<Fault> getAssignedFaults(DataSource source, int id, String staffType) throws SQLException { String sql = "SELECT * FROM Faults WHERE " + staffType.toLowerCase() + "id=?"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); ResultSet results = prepst.executeQuery(); ArrayList<Fault> faultList = new ArrayList<Fault>(); while (results.next()) { Fault nextFault = new Fault(); nextFault = new Fault(); nextFault.setID(results.getInt("faultid")); nextFault.setSummary(results.getString("summary")); nextFault.setDescription(results.getString("detail")); nextFault.setStatus(results.getString("status")); nextFault.setReporter(getUser(source, results.getInt("reporterid"))); nextFault.setDeveloper(getUser(source, results.getInt("developerid"))); nextFault.setAdministrator(getUser(source, results.getInt("adminid"))); faultList.add(nextFault); } results.close(); con.close(); return faultList; } public Fault getFault(DataSource source, int id) throws SQLException { Connection con = source.getConnection(username, password); String sql = "SELECT * FROM Faults WHERE faultid=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); ResultSet results = prepst.executeQuery(); Fault fault = null; if (results.next()) { fault = new Fault(); fault.setID(results.getInt("faultid")); fault.setSummary(results.getString("summary")); fault.setDescription(results.getString("detail")); fault.setStatus(results.getString("status")); fault.setReporter(findUser(results.getInt("reporterid"), source)); fault.setReporter(getUser(source, results.getInt("reporterid"))); fault.setDeveloper(getUser(source, results.getInt("developerid"))); fault.setAdministrator(getUser(source, results.getInt("adminid"))); } results.close(); con.close(); return fault; } public int findID(String userEmail, DataSource source) throws SQLException { int id = -1; Connection con = source.getConnection(username, password); String sql = "SELECT userid FROM Users WHERE email=?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1,userEmail); ResultSet results = prepst.executeQuery(); if (results.next()) { id = results.getInt("userid"); } return id; } public ArrayList<User> getAllUsers(DataSource source, String userType) throws SQLException { userType = userType.toUpperCase(); Connection con = source.getConnection(username, password); String sql = "SELECT userid, name, email FROM Users WHERE role = ?"; PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1,userType); ResultSet results = prepst.executeQuery(); ArrayList<User> userList = new ArrayList<User>(); User user; while (results.next()) { user = new User(); user.setID(results.getInt("userid")); user.setName(results.getString("name")); user.setEmail(results.getString("email")); user.setUserType(userType); userList.add(user); } return userList; } public User getUser(DataSource source, int userID) throws SQLException { String sql = "SELECT name, email, role, password FROM Users WHERE userid = ?"; Connection con = source.getConnection(username,password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1,userID); ResultSet results = prepst.executeQuery(); User user = null; if (results.next()) { user = new User(); user.setID(userID); user.setName(results.getString("name")); user.setEmail(results.getString("email")); user.setUserType(results.getString("role")); user.setPassword(results.getString("password")); } results.close(); con.close(); return user; } public void delete(DataSource source, String type, int id) throws SQLException { //need to change 'type' as it appears in the URL (user, fault) to match database table names (Users, Faults) String resolvedType = type.toUpperCase().substring(0,1) + type.substring(1) + "s"; String sql = "DELETE FROM " + resolvedType +" WHERE " + type + "id= ?"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1, id); prepst.executeUpdate(); con.close(); } public void updateFault(DataSource source, int id, String developerEmail, String adminEmail, String status) throws SQLException { int developerID, adminID; Fault fault = getFault(source,id); if (developerEmail.equals("") || developerEmail == null) developerID = fault.getDeveloper().getID(); else developerID = findID(developerEmail, source); if (adminEmail.equals("") || adminEmail == null) adminID = fault.getAdministrator().getID(); else adminID = findID(adminEmail,source); if (status.equals("") || status == null) status = fault.getStatus().toString(); String sql = "UPDATE Faults SET adminid=?, developerid=?, status=? WHERE faultid=?"; Connection con = source.getConnection(username, password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setInt(1,adminID); prepst.setInt(2,developerID); prepst.setString(3,status); prepst.setInt(4,id); prepst.executeUpdate(); con.close(); } public void updateUser(DataSource source, int id, String name, String email, String role, String password) throws SQLException { User user = getUser(source,id); if (name.equals("") || name == null) name = user.getName(); if (email.equals("") || email == null) email = user.getEmail(); if (role.equals("") || role == null) role = user.getUserType().toString(); if (password.equals("") || password == null) password = <PASSWORD>(); String sql = "UPDATE Users SET name=?, email=?, role=?, password=? WHERE userid=?"; Connection con = source.getConnection(username, this.password); PreparedStatement prepst = con.prepareStatement(sql); prepst.setString(1,name); prepst.setString(2,email); prepst.setString(3,role); prepst.setString(4,password); prepst.setInt(5,id); prepst.executeUpdate(); con.close(); } }
10,362
0.685226
0.681849
333
29.126125
25.871983
140
false
false
0
0
0
0
0
0
2.828829
false
false
4
2efd43a7708f9a72a8a7a26befbea9a804e98263
28,862,180,264,691
c215d2d9b4250988c7d391e0469d7e63256089a5
/src/main/java/Utilities.java
81b656feb9c70a21f3c76419fd1a96cebcd8ae44
[]
no_license
vinayakkaladhar/canvastest
https://github.com/vinayakkaladhar/canvastest
88e045bbc40f6a9f22fe16a43a7b2bb9fbdb5e4e
fcf57a146e6d709aa42c4369a3641c32275ef619
refs/heads/master
2021-07-08T21:33:47.264000
2020-02-25T05:59:07
2020-02-25T05:59:07
242,528,270
0
0
null
false
2021-04-26T19:59:02
2020-02-23T14:08:35
2020-02-25T05:59:41
2021-04-26T19:59:01
278
0
0
1
HTML
false
false
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.GeckoDriverInfo; import org.apache.commons.io.FileUtils; import java.io.File; import org.openqa.selenium.OutputType; import javax.imageio.ImageIO; import org.openqa.selenium.TakesScreenshot; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; public class Utilities { WebDriver driver; public WebDriver fireFox(){ System.setProperty("webdriver.gecko.driver", "/Users/cb-vinayak/Downloads/geckodriver"); driver = new FirefoxDriver(); return driver; } public static void takeSnapShot(WebDriver webdriver,String fileWithPath) throws Exception{ //Convert web driver object to TakeScreenshot TakesScreenshot scrShot =((TakesScreenshot)webdriver); //Call getScreenshotAs method to create image file File SrcFile=scrShot.getScreenshotAs(OutputType.FILE); //Move image file to new destination File DestFile=new File(fileWithPath); //Copy file at destination FileUtils.copyFile(SrcFile, DestFile); } public static boolean compareImage(File fileA, File fileB) { try { // take buffer data from botm image files // BufferedImage biA = ImageIO.read(fileA); DataBuffer dbA = biA.getData().getDataBuffer(); int sizeA = dbA.getSize(); BufferedImage biB = ImageIO.read(fileB); DataBuffer dbB = biB.getData().getDataBuffer(); int sizeB = dbB.getSize(); // compare data-buffer objects // if(sizeA == sizeB) { for(int i=0; i<sizeA; i++) { if(dbA.getElem(i) != dbB.getElem(i)) { return false; } } return true; } else { return false; } } catch (Exception e) { System.out.println("Failed to compare image files ..."); return false; } } }
UTF-8
Java
2,141
java
Utilities.java
Java
[ { "context": "tem.setProperty(\"webdriver.gecko.driver\", \"/Users/cb-vinayak/Downloads/geckodriver\");\n driver = new Firefox", "end": 573, "score": 0.7985482215881348, "start": 563, "tag": "USERNAME", "value": "cb-vinayak" } ]
null
[]
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.GeckoDriverInfo; import org.apache.commons.io.FileUtils; import java.io.File; import org.openqa.selenium.OutputType; import javax.imageio.ImageIO; import org.openqa.selenium.TakesScreenshot; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; public class Utilities { WebDriver driver; public WebDriver fireFox(){ System.setProperty("webdriver.gecko.driver", "/Users/cb-vinayak/Downloads/geckodriver"); driver = new FirefoxDriver(); return driver; } public static void takeSnapShot(WebDriver webdriver,String fileWithPath) throws Exception{ //Convert web driver object to TakeScreenshot TakesScreenshot scrShot =((TakesScreenshot)webdriver); //Call getScreenshotAs method to create image file File SrcFile=scrShot.getScreenshotAs(OutputType.FILE); //Move image file to new destination File DestFile=new File(fileWithPath); //Copy file at destination FileUtils.copyFile(SrcFile, DestFile); } public static boolean compareImage(File fileA, File fileB) { try { // take buffer data from botm image files // BufferedImage biA = ImageIO.read(fileA); DataBuffer dbA = biA.getData().getDataBuffer(); int sizeA = dbA.getSize(); BufferedImage biB = ImageIO.read(fileB); DataBuffer dbB = biB.getData().getDataBuffer(); int sizeB = dbB.getSize(); // compare data-buffer objects // if(sizeA == sizeB) { for(int i=0; i<sizeA; i++) { if(dbA.getElem(i) != dbB.getElem(i)) { return false; } } return true; } else { return false; } } catch (Exception e) { System.out.println("Failed to compare image files ..."); return false; } } }
2,141
0.619337
0.61887
69
30
23.489128
94
false
false
0
0
0
0
0
0
0.521739
false
false
4
f6698d66552f48963481145d0ebf0aa02c4d1ccd
32,418,413,164,912
4a5576228243cefcc83abf2d59ddb7e4b1956471
/DummyApp/src/main/java/es/ulpgc/eite/clean/mvp/sample/dataBase/Autor.java
e727eec10bc6c5534c5f24278b1ba2758e80f84b
[]
no_license
JonayCruzDelgado/G1App
https://github.com/JonayCruzDelgado/G1App
ec5efc25101f7010c761970a682fb00de1f63d0d
1bf01a89118a5b328d7ad1d2c360e20a2d149517
refs/heads/master
2021-01-23T22:23:24.898000
2017-05-27T16:33:06
2017-05-27T16:33:06
83,126,059
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.ulpgc.eite.clean.mvp.sample.dataBase; import io.realm.RealmObject; import io.realm.annotations.PrimaryKey; /** * Created by Marta on 14/03/2017. */ public class Autor extends RealmObject { @PrimaryKey private int id; private String nombre; private String descripcion; private int idCategoria; private String imagen; private Boolean isInAssetsAutor; public Boolean getIsInAssetsAutor() { return isInAssetsAutor; } public void setIsInAssetsAutor(Boolean inAssetAutor) { isInAssetsAutor = inAssetAutor; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public int getIdCategoria() { return idCategoria; } public void setIdCategoria(int idCategoria) { this.idCategoria = idCategoria; } public String getImagen() { return imagen; } public void setImagen(String imagen) { this.imagen = imagen; } }
UTF-8
Java
1,318
java
Autor.java
Java
[ { "context": "o.realm.annotations.PrimaryKey;\n\n/**\n * Created by Marta on 14/03/2017.\n */\n\npublic class Autor extends Re", "end": 143, "score": 0.993539571762085, "start": 138, "tag": "NAME", "value": "Marta" } ]
null
[]
package es.ulpgc.eite.clean.mvp.sample.dataBase; import io.realm.RealmObject; import io.realm.annotations.PrimaryKey; /** * Created by Marta on 14/03/2017. */ public class Autor extends RealmObject { @PrimaryKey private int id; private String nombre; private String descripcion; private int idCategoria; private String imagen; private Boolean isInAssetsAutor; public Boolean getIsInAssetsAutor() { return isInAssetsAutor; } public void setIsInAssetsAutor(Boolean inAssetAutor) { isInAssetsAutor = inAssetAutor; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public int getIdCategoria() { return idCategoria; } public void setIdCategoria(int idCategoria) { this.idCategoria = idCategoria; } public String getImagen() { return imagen; } public void setImagen(String imagen) { this.imagen = imagen; } }
1,318
0.637329
0.63126
68
18.382353
16.979252
58
false
false
0
0
0
0
0
0
0.308824
false
false
4
7817f455adc665f5a794c5e2d59edea9209a2094
4,294,967,321,236
99b67204e2aae5cea46d9e4e3ccb86673bcdf6a8
/src/sun/Admin.java
e7e08ade63c819afbb225d113e8002d40e64befb
[]
no_license
yaaamin/RMI-Java-Application
https://github.com/yaaamin/RMI-Java-Application
394814741de5ec1d4e2eeaf3c87dcb846de247b5
864d1ae89ec0434d6d137408dc98929f9a1e9700
refs/heads/main
2023-04-29T09:51:42.944000
2021-05-13T07:45:02
2021-05-13T07:45:02
346,277,512
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package sun; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; /** * * @author salma */ public class Admin implements Serializable{ private String firstName; private String lastName; private String passportNumber; public Admin(){} public Admin(String firstName, String lastName, String passportNumber){ this.firstName = firstName; this.lastName = lastName; this.passportNumber = passportNumber; } public String getFirstName(){ return this.firstName; } public String getLastName(){ return this.lastName; } public String getPassportNumber(){ return this.passportNumber; } public void modifyPassport(String newPassport){ this.passportNumber = newPassport; } }
UTF-8
Java
1,193
java
Admin.java
Java
[ { "context": "ble;\nimport java.util.ArrayList;\n/**\n *\n * @author salma\n */\npublic class Admin implements Serializable{\n ", "end": 441, "score": 0.9984816908836365, "start": 436, "tag": "USERNAME", "value": "salma" }, { "context": "Name, String passportNumber){\n this.firstN...
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package sun; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; /** * * @author salma */ public class Admin implements Serializable{ private String firstName; private String lastName; private String passportNumber; public Admin(){} public Admin(String firstName, String lastName, String passportNumber){ this.firstName = firstName; this.lastName = lastName; this.passportNumber = passportNumber; } public String getFirstName(){ return this.firstName; } public String getLastName(){ return this.lastName; } public String getPassportNumber(){ return this.passportNumber; } public void modifyPassport(String newPassport){ this.passportNumber = newPassport; } }
1,193
0.672255
0.672255
55
20.690908
18.759602
79
false
false
0
0
0
0
0
0
0.418182
false
false
4
b3a8b1463719f2f3c3e1caee82eca2800186415e
31,421,980,741,107
5ab9ffa0414072caaba695fb4b30c9db0f835e51
/OIBS-Projesi-With-Swing-Database/src/data/Teacher.java
9e84821689b01e13489d6545801017be64211d95
[]
no_license
DenizYercel/JavaProjects
https://github.com/DenizYercel/JavaProjects
9d7c47fc3123240ad64deb0ab8681a0eae9fd72d
a3bc014f7775f36696f11442978fdcb521b36a31
refs/heads/master
2020-12-17T12:15:50.528000
2020-05-09T11:36:31
2020-05-09T11:36:31
235,293,727
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package data; import java.sql.Date; public class Teacher { private String ad; private String soyad; private int bolum_id; private String bolum_adi; private String unvan; private int baslamaTarihi; private int sicil_no; public Teacher(String ad, String soyad,int bolum_id, int sicil_no, int baslamaTarihi, String unvan) { super(); this.ad = ad; this.soyad = soyad; this.unvan = unvan; this.baslamaTarihi = baslamaTarihi; this.sicil_no = sicil_no; this.bolum_id=bolum_id; } public Teacher() { } public String getAd() { return ad; } public void setAd(String ad) { this.ad = ad; } public String getSoyad() { return soyad; } public void setSoyad(String soyad) { this.soyad = soyad; } public String getBolum_adi() { return bolum_adi; } public void setBolum_adi(String bolum_adi) { this.bolum_adi = bolum_adi; } public int getBolum_id() { return bolum_id; } public void setBolum_id(int bolum_id) { this.bolum_id = bolum_id; } public String getUnvan() { return unvan; } public void setUnvan(String unvan) { this.unvan = unvan; } public int getBaslamaTarihi() { return baslamaTarihi; } public void setBaslamaTarihi(int baslamaTarihi) { this.baslamaTarihi = baslamaTarihi; } public int getSicil_no() { return sicil_no; } public void setSicil_no(int sicil_no) { this.sicil_no = sicil_no; } @Override public String toString() { return "Teacher [ad=" + ad + ", lastName=" + soyad + ", bolum_id=" + bolum_id + ", unvan=" + unvan + ", baslamaTarihi=" + baslamaTarihi + ", sicil_no=" + sicil_no + "]"; } }
UTF-8
Java
1,740
java
Teacher.java
Java
[ { "context": " {\r\n\t\treturn \"Teacher [ad=\" + ad + \", lastName=\" + soyad + \", bolum_id=\" + bolum_id + \", unvan=\" + unvan\r\n", "end": 1589, "score": 0.7544814944267273, "start": 1584, "tag": "NAME", "value": "soyad" } ]
null
[]
package data; import java.sql.Date; public class Teacher { private String ad; private String soyad; private int bolum_id; private String bolum_adi; private String unvan; private int baslamaTarihi; private int sicil_no; public Teacher(String ad, String soyad,int bolum_id, int sicil_no, int baslamaTarihi, String unvan) { super(); this.ad = ad; this.soyad = soyad; this.unvan = unvan; this.baslamaTarihi = baslamaTarihi; this.sicil_no = sicil_no; this.bolum_id=bolum_id; } public Teacher() { } public String getAd() { return ad; } public void setAd(String ad) { this.ad = ad; } public String getSoyad() { return soyad; } public void setSoyad(String soyad) { this.soyad = soyad; } public String getBolum_adi() { return bolum_adi; } public void setBolum_adi(String bolum_adi) { this.bolum_adi = bolum_adi; } public int getBolum_id() { return bolum_id; } public void setBolum_id(int bolum_id) { this.bolum_id = bolum_id; } public String getUnvan() { return unvan; } public void setUnvan(String unvan) { this.unvan = unvan; } public int getBaslamaTarihi() { return baslamaTarihi; } public void setBaslamaTarihi(int baslamaTarihi) { this.baslamaTarihi = baslamaTarihi; } public int getSicil_no() { return sicil_no; } public void setSicil_no(int sicil_no) { this.sicil_no = sicil_no; } @Override public String toString() { return "Teacher [ad=" + ad + ", lastName=" + soyad + ", bolum_id=" + bolum_id + ", unvan=" + unvan + ", baslamaTarihi=" + baslamaTarihi + ", sicil_no=" + sicil_no + "]"; } }
1,740
0.613793
0.613793
109
13.963303
18.777758
102
false
false
0
0
0
0
0
0
1.302752
false
false
4
c5b64b3a873638b40b4ec3b353a93de9a0697bf7
17,849,884,152,040
7ec7da5fd6c5379b12d93235b191fdf148b1493b
/DisenoDeSoftware/GameDesignPattern/src/com/utad/project/singletonPattern/CombatManager.java
3b57f1f96fa543e12c04f948bddabdf07cd6e973
[]
no_license
erickcs2000/Grupal-Java-Proyects
https://github.com/erickcs2000/Grupal-Java-Proyects
67c42ffc01d7a08647c09c78074bfc70c4ff8755
787e5da102ed98eddfc01975c60164a9e69c5963
refs/heads/main
2023-08-15T15:10:25.463000
2021-10-21T20:26:54
2021-10-21T20:26:54
419,864,585
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.utad.project.singletonPattern; import java.util.ArrayList; import java.util.List; import com.utad.project.base.*; import com.utad.project.base.Character; public class CombatManager { //Algoritmo para ordenar a los personajes de la lista por nivel de velocidad public List<Character> orderBySpeed(List<Character> characters) { List<Character> aux = new ArrayList<Character>(); Character max = null; while(!characters.isEmpty()) { max = characters.get(0); for(int i = 0; i < characters.size(); i++) { if(characters.get(i).getEquipment().getSpeed() > max.getEquipment().getSpeed()) { max = characters.get(i); } } aux.add(max); characters.remove(max); } return aux; } public void combat(List<Character> characters, List<Action> actions) { //Calcular las estadisticas modificadas este turno for(int i = 0; i < characters.size();i++) { characters.get(i).applyStats(characters.get(i).modifyStats()); } //Pedir las acciones a cada personaje y almacenarlas en el buffer para tratarlas for(int i = 0; i < characters.size();i++) { if(characters.get(i) instanceof Enemy) { ((Enemy) characters.get(i)).changeStrategy(); } characters.get(i).decision(); } //Aplicar los efectos del estado de cada personaje a las acciones que ha lanzado for(int i = 0; i < actions.size(); i++) { if(actions.get(i).getUser()!=null) { //Eventos sin usuario directo (ej: envenenamiento) actions.get(i).getUser().StatusEffect(actions.get(i)); } } //Resolver por orden while(actions.size()>0) { //El actor es el sistema (user null) o el actor concreto sigue vivo if(actions.get(0).getUser() == null || actions.get(0).getUser().isAlive()) { actions.get(0).getTarget().applyStats(actions.get(0).getVariation()); //Ejecutar la accion } actions.remove(0); //Eliminar una vez ejecutada } } }
UTF-8
Java
1,902
java
CombatManager.java
Java
[]
null
[]
package com.utad.project.singletonPattern; import java.util.ArrayList; import java.util.List; import com.utad.project.base.*; import com.utad.project.base.Character; public class CombatManager { //Algoritmo para ordenar a los personajes de la lista por nivel de velocidad public List<Character> orderBySpeed(List<Character> characters) { List<Character> aux = new ArrayList<Character>(); Character max = null; while(!characters.isEmpty()) { max = characters.get(0); for(int i = 0; i < characters.size(); i++) { if(characters.get(i).getEquipment().getSpeed() > max.getEquipment().getSpeed()) { max = characters.get(i); } } aux.add(max); characters.remove(max); } return aux; } public void combat(List<Character> characters, List<Action> actions) { //Calcular las estadisticas modificadas este turno for(int i = 0; i < characters.size();i++) { characters.get(i).applyStats(characters.get(i).modifyStats()); } //Pedir las acciones a cada personaje y almacenarlas en el buffer para tratarlas for(int i = 0; i < characters.size();i++) { if(characters.get(i) instanceof Enemy) { ((Enemy) characters.get(i)).changeStrategy(); } characters.get(i).decision(); } //Aplicar los efectos del estado de cada personaje a las acciones que ha lanzado for(int i = 0; i < actions.size(); i++) { if(actions.get(i).getUser()!=null) { //Eventos sin usuario directo (ej: envenenamiento) actions.get(i).getUser().StatusEffect(actions.get(i)); } } //Resolver por orden while(actions.size()>0) { //El actor es el sistema (user null) o el actor concreto sigue vivo if(actions.get(0).getUser() == null || actions.get(0).getUser().isAlive()) { actions.get(0).getTarget().applyStats(actions.get(0).getVariation()); //Ejecutar la accion } actions.remove(0); //Eliminar una vez ejecutada } } }
1,902
0.674027
0.668244
62
29.645161
28.396442
93
false
false
0
0
0
0
0
0
2.451613
false
false
4
abcc371c5a5ea795a626c7feb97d961d65a11c9d
2,920,577,824,279
0973941060daaf766c32f5c143e0df81f6c179a1
/rxjavademo/src/main/java/com/hftsoft/rxjavademo/LombokModel.java
f4bdae27e7616fd916fcf833c2da2447e6c9b3cd
[]
no_license
meybeBlank/PracticeDemos
https://github.com/meybeBlank/PracticeDemos
22112b2b5d9b044aa65548f75f96ddb1dc5eb155
cc7c246d26daefddc711438d33961bbb004558ed
refs/heads/master
2019-07-30T01:13:51.339000
2018-10-30T03:07:56
2018-10-30T03:07:56
84,818,014
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hftsoft.rxjavademo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * 测试Lombok * * @author fengzhen * @version v1.0, 2017/8/17 */ @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Data public class LombokModel { private int a; private String b; private boolean c; }
UTF-8
Java
395
java
LombokModel.java
Java
[ { "context": "port lombok.Setter;\n\n/**\n * 测试Lombok\n *\n * @author fengzhen\n * @version v1.0, 2017/8/17\n */\n@Getter\n@Setter\n@", "end": 203, "score": 0.9891290664672852, "start": 195, "tag": "USERNAME", "value": "fengzhen" } ]
null
[]
package com.hftsoft.rxjavademo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * 测试Lombok * * @author fengzhen * @version v1.0, 2017/8/17 */ @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Data public class LombokModel { private int a; private String b; private boolean c; }
395
0.741688
0.71867
25
14.64
10.818059
33
false
false
0
0
0
0
0
0
0.4
false
false
4
8873bdd8ea882d9adea969cb077f0752ef89e49d
20,590,073,246,537
fef5296397f9b950a11455e880a919537390aea0
/java/java.platform/test/unit/src/org/netbeans/api/java/platform/TestJavaPlatformProvider.java
a02cfc77c32e7558c350d51cff7d28cc5b8ddd95
[ "Apache-2.0" ]
permissive
apache/netbeans
https://github.com/apache/netbeans
5a4d6fa9e4f230b33e44519a479d66e47a381289
28d308b400bbe439ac0ac84b64d823ce0b69272e
refs/heads/master
2023-08-29T15:32:41.838000
2023-08-29T09:48:59
2023-08-29T09:48:59
102,083,576
1,692
718
Apache-2.0
false
2023-09-14T19:41:05
2017-09-01T07:00:11
2023-09-14T09:51:47
2023-09-14T19:41:04
381,002
2,386
791
718
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.api.java.platform; import org.netbeans.modules.java.platform.implspi.JavaPlatformProvider; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; import java.util.List; import org.openide.util.Lookup; /** * * @author Tomas Zezula */ public class TestJavaPlatformProvider implements JavaPlatformProvider { private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private List<JavaPlatform> platforms = new ArrayList<JavaPlatform>(); public static TestJavaPlatformProvider getDefault () { return Lookup.getDefault().lookup(TestJavaPlatformProvider.class); } @Override public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { assert listener != null; pcs.addPropertyChangeListener(listener); } @Override public void removePropertyChangeListener(PropertyChangeListener listener) { assert listener != null; pcs.removePropertyChangeListener(listener); } @Override public JavaPlatform[] getInstalledPlatforms() { return this.platforms.toArray(new JavaPlatform[platforms.size()]); } public void addPlatform (JavaPlatform platform) { this.platforms.add (platform); this.firePropertyChange (); } public void removePlatform (JavaPlatform platform) { this.platforms.remove (platform); this.firePropertyChange (); } public void insertPlatform(JavaPlatform before, JavaPlatform platform) { int index = platforms.indexOf(before); if (index < 0) { index = platforms.size(); } this.platforms.add(index,platform); this.firePropertyChange (); } public void reset() { this.platforms.clear(); firePropertyChange(); } private void firePropertyChange () { pcs.firePropertyChange(PROP_INSTALLED_PLATFORMS, null, null); } @Override public JavaPlatform getDefaultPlatform() { if (platforms.size()>0) return platforms.get(0); else return null; } }
UTF-8
Java
2,975
java
TestJavaPlatformProvider.java
Java
[ { "context": "import org.openide.util.Lookup;\n\n/**\n *\n * @author Tomas Zezula\n */\npublic class TestJavaPlatformProvider impleme", "end": 1118, "score": 0.9993143081665039, "start": 1106, "tag": "NAME", "value": "Tomas Zezula" } ]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.api.java.platform; import org.netbeans.modules.java.platform.implspi.JavaPlatformProvider; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; import java.util.List; import org.openide.util.Lookup; /** * * @author <NAME> */ public class TestJavaPlatformProvider implements JavaPlatformProvider { private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private List<JavaPlatform> platforms = new ArrayList<JavaPlatform>(); public static TestJavaPlatformProvider getDefault () { return Lookup.getDefault().lookup(TestJavaPlatformProvider.class); } @Override public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { assert listener != null; pcs.addPropertyChangeListener(listener); } @Override public void removePropertyChangeListener(PropertyChangeListener listener) { assert listener != null; pcs.removePropertyChangeListener(listener); } @Override public JavaPlatform[] getInstalledPlatforms() { return this.platforms.toArray(new JavaPlatform[platforms.size()]); } public void addPlatform (JavaPlatform platform) { this.platforms.add (platform); this.firePropertyChange (); } public void removePlatform (JavaPlatform platform) { this.platforms.remove (platform); this.firePropertyChange (); } public void insertPlatform(JavaPlatform before, JavaPlatform platform) { int index = platforms.indexOf(before); if (index < 0) { index = platforms.size(); } this.platforms.add(index,platform); this.firePropertyChange (); } public void reset() { this.platforms.clear(); firePropertyChange(); } private void firePropertyChange () { pcs.firePropertyChange(PROP_INSTALLED_PLATFORMS, null, null); } @Override public JavaPlatform getDefaultPlatform() { if (platforms.size()>0) return platforms.get(0); else return null; } }
2,969
0.703866
0.701513
95
30.31579
26.002131
89
false
false
0
0
0
0
0
0
0.389474
false
false
4
8e46b2c8a68c7f93fc9834fd1f173c3819f65ea3
4,793,183,519,906
e3d46eb3e6a889de271a6d1f0fe7da2a5d37f687
/pro_thread/src/example1/MyThreadApp.java
eeefe48a655ba63172b45f768e2a57ec0fbca609
[]
no_license
astute22/java-p
https://github.com/astute22/java-p
0da882f3f02388474fe2da1f4f569e0448a20a2e
2346e5bdf287bb9dc71e714145431097ce82e026
refs/heads/master
2021-01-21T12:35:29.881000
2017-10-17T06:21:25
2017-10-17T06:21:25
102,087,267
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package example1; public class MyThreadApp { public static void main(String[] args) throws InterruptedException{ // TODO Auto-generated method stub //new Thread 생성 Thread t = new MyThread(); t.start(); for(int i = 0; i<100 ; i++){ System.out.println("메인쓰레드 : " + i); Thread.sleep(300); } } }
UTF-8
Java
329
java
MyThreadApp.java
Java
[]
null
[]
package example1; public class MyThreadApp { public static void main(String[] args) throws InterruptedException{ // TODO Auto-generated method stub //new Thread 생성 Thread t = new MyThread(); t.start(); for(int i = 0; i<100 ; i++){ System.out.println("메인쓰레드 : " + i); Thread.sleep(300); } } }
329
0.647619
0.622222
16
18.6875
18.223331
68
false
false
0
0
0
0
0
0
1.6875
false
false
4
7061e0708cab97017efaf1fb32cddfbe885bcb7e
4,793,183,519,335
c1ab930305e651d0ab0262f1bccee1d4c8436375
/src/main/java/com/jobdiva/api/dao/activity/ActivityRowMapper.java
80d17f7321a0818c69c4074700dad4472d155949
[]
no_license
omarkamoun1/SpringRestAPI
https://github.com/omarkamoun1/SpringRestAPI
ad2c0e846965b364f5067c7a229482b6ee5a8b3a
4a83b2f3dc097cc28eba2059873771679474f5d5
refs/heads/master
2023-04-30T08:47:37.804000
2021-05-20T10:33:11
2021-05-20T10:33:11
369,308,227
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jobdiva.api.dao.activity; import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.jdbc.core.RowMapper; import com.jobdiva.api.model.Activity; public class ActivityRowMapper implements RowMapper<Activity> { private AbstractActivityDao abstractActivityDao; public ActivityRowMapper(AbstractActivityDao abstractActivityDao) { super(); this.abstractActivityDao = abstractActivityDao; } @Override public Activity mapRow(ResultSet rs, int rowNum) throws SQLException { Activity activity = new Activity(); // activity.setId(rs.getLong("ID")); activity.setJobId(rs.getLong("RFQID")); activity.setCandidateId(rs.getLong("CANDIDATEID")); activity.setRecruiterId(rs.getLong("RECRUITERID")); activity.setRecruiterTeamId(rs.getLong("RECRUITER_TEAMID")); activity.setCandidateTeamId(rs.getLong("CANDIDATE_TEAMID")); // // CANDIDATE String str = ""; if (rs.getString("FIRSTNAME") != null) str = rs.getString("FIRSTNAME"); // if (rs.getString("LASTNAME") != null) str += " " + rs.getString("LASTNAME"); activity.setCandidateName(str); // activity.setCandidateEmail(rs.getString("EMAIL")); // String address1 = rs.getString("ADDRESS1"); String address2 = rs.getString("ADDRESS2"); String city = rs.getString("CITY"); String state = rs.getString("STATE"); String zipCode = rs.getString("ZIPCODE"); str = abstractActivityDao.formatCandidateAddress(address1, address2, city, state, zipCode); activity.setCandidateAddress(str); // // String phoneTypes = rs.getString("PHONE_TYPES"); if (phoneTypes == null) phoneTypes = "0123"; // if (phoneTypes.length() >= 4) { String hompePhone = rs.getString("HOMEPHONE"); String hompePhoneExt = rs.getString("HOMEPHONE"); String workPhone = rs.getString("WORKPHONE"); String workPhoneExt = rs.getString("WORKPHONE"); String cellPhone = rs.getString("CELLPHONE"); String cellPhoneExt = rs.getString("CELLPHONE"); String fax = rs.getString("FAX"); String faxExt = rs.getString("FAX"); str = abstractActivityDao.formatCandidatePhones(hompePhone, hompePhoneExt, workPhone, workPhoneExt, cellPhone, cellPhoneExt, fax, faxExt, phoneTypes); activity.setCandidatePhones(str); } // // activity.setDatePresented(rs.getDate("DATEPRESENTED")); activity.setDateInterview(rs.getDate("DATEINTERVIEW")); activity.setDateHired(rs.getDate("DATEHIRED")); activity.setDateEnded(rs.getDate("DATE_ENDED")); activity.setContract(rs.getInt("CONTRACT")); // // RECURUTIERNAME String recruiterFirstName = rs.getString("RecruiterFIRSTNAME"); String recruiterlastName = rs.getString("RecruiterLASTNAME"); if (recruiterFirstName != null || recruiterlastName != null) { // String name = recruiterFirstName != null ? recruiterFirstName : ""; if (recruiterlastName != null) name += " " + recruiterlastName; // activity.setRecruiterName(name); } // // activity.setManagerFirstName(rs.getString("MANAGERFIRSTNAME")); activity.setManagerLastName(rs.getString("MANAGERLASTNAME")); activity.setNotes(rs.getString("NOTES")); activity.setPayHourly(rs.getBigDecimal("PAY_HOURLY")); // String rateUnit = ""; String currencyUnit = ""; // if (rs.getInt("FINALBILLRATE_CURRENCY") == 0) { currencyUnit = "USD"; } else { currencyUnit = abstractActivityDao.getCurrencyString(rs.getInt("FINALBILLRATE_CURRENCY")); } // activity.setDbFinalBillRateUnit(rs.getString("FINALBILLRATEUNIT")); // if (rs.getString("FINALBILLRATEUNIT") == null || rs.getString("FINALBILLRATEUNIT").length() == 0) { rateUnit = "Hour"; } else { rateUnit = abstractActivityDao.getRateUnitString(rs.getString("FINALBILLRATEUNIT").toLowerCase().charAt(0), false); } // activity.setFinalBillRateUnit(currencyUnit + "/" + rateUnit); // activity.setHourly(activity.getHourly()); // // formated along with HOURLY_CURRENCY if (rs.getInt("HOURLY_CURRENCY") == 0) { currencyUnit = "USD"; } else { currencyUnit = abstractActivityDao.getCurrencyString(rs.getInt("HOURLY_CURRENCY")); } // if (rs.getString("PAYRATEUNITS") == null || rs.getString("PAYRATEUNITS").length() == 0) { rateUnit = "Hour"; } else { rateUnit = abstractActivityDao.getRateUnitString(rs.getString("PAYRATEUNITS").toLowerCase().charAt(0), false); } // activity.setPayRateUnits(currencyUnit + "/" + rateUnit); // return activity; } }
UTF-8
Java
4,567
java
ActivityRowMapper.java
Java
[]
null
[]
package com.jobdiva.api.dao.activity; import java.sql.ResultSet; import java.sql.SQLException; import org.springframework.jdbc.core.RowMapper; import com.jobdiva.api.model.Activity; public class ActivityRowMapper implements RowMapper<Activity> { private AbstractActivityDao abstractActivityDao; public ActivityRowMapper(AbstractActivityDao abstractActivityDao) { super(); this.abstractActivityDao = abstractActivityDao; } @Override public Activity mapRow(ResultSet rs, int rowNum) throws SQLException { Activity activity = new Activity(); // activity.setId(rs.getLong("ID")); activity.setJobId(rs.getLong("RFQID")); activity.setCandidateId(rs.getLong("CANDIDATEID")); activity.setRecruiterId(rs.getLong("RECRUITERID")); activity.setRecruiterTeamId(rs.getLong("RECRUITER_TEAMID")); activity.setCandidateTeamId(rs.getLong("CANDIDATE_TEAMID")); // // CANDIDATE String str = ""; if (rs.getString("FIRSTNAME") != null) str = rs.getString("FIRSTNAME"); // if (rs.getString("LASTNAME") != null) str += " " + rs.getString("LASTNAME"); activity.setCandidateName(str); // activity.setCandidateEmail(rs.getString("EMAIL")); // String address1 = rs.getString("ADDRESS1"); String address2 = rs.getString("ADDRESS2"); String city = rs.getString("CITY"); String state = rs.getString("STATE"); String zipCode = rs.getString("ZIPCODE"); str = abstractActivityDao.formatCandidateAddress(address1, address2, city, state, zipCode); activity.setCandidateAddress(str); // // String phoneTypes = rs.getString("PHONE_TYPES"); if (phoneTypes == null) phoneTypes = "0123"; // if (phoneTypes.length() >= 4) { String hompePhone = rs.getString("HOMEPHONE"); String hompePhoneExt = rs.getString("HOMEPHONE"); String workPhone = rs.getString("WORKPHONE"); String workPhoneExt = rs.getString("WORKPHONE"); String cellPhone = rs.getString("CELLPHONE"); String cellPhoneExt = rs.getString("CELLPHONE"); String fax = rs.getString("FAX"); String faxExt = rs.getString("FAX"); str = abstractActivityDao.formatCandidatePhones(hompePhone, hompePhoneExt, workPhone, workPhoneExt, cellPhone, cellPhoneExt, fax, faxExt, phoneTypes); activity.setCandidatePhones(str); } // // activity.setDatePresented(rs.getDate("DATEPRESENTED")); activity.setDateInterview(rs.getDate("DATEINTERVIEW")); activity.setDateHired(rs.getDate("DATEHIRED")); activity.setDateEnded(rs.getDate("DATE_ENDED")); activity.setContract(rs.getInt("CONTRACT")); // // RECURUTIERNAME String recruiterFirstName = rs.getString("RecruiterFIRSTNAME"); String recruiterlastName = rs.getString("RecruiterLASTNAME"); if (recruiterFirstName != null || recruiterlastName != null) { // String name = recruiterFirstName != null ? recruiterFirstName : ""; if (recruiterlastName != null) name += " " + recruiterlastName; // activity.setRecruiterName(name); } // // activity.setManagerFirstName(rs.getString("MANAGERFIRSTNAME")); activity.setManagerLastName(rs.getString("MANAGERLASTNAME")); activity.setNotes(rs.getString("NOTES")); activity.setPayHourly(rs.getBigDecimal("PAY_HOURLY")); // String rateUnit = ""; String currencyUnit = ""; // if (rs.getInt("FINALBILLRATE_CURRENCY") == 0) { currencyUnit = "USD"; } else { currencyUnit = abstractActivityDao.getCurrencyString(rs.getInt("FINALBILLRATE_CURRENCY")); } // activity.setDbFinalBillRateUnit(rs.getString("FINALBILLRATEUNIT")); // if (rs.getString("FINALBILLRATEUNIT") == null || rs.getString("FINALBILLRATEUNIT").length() == 0) { rateUnit = "Hour"; } else { rateUnit = abstractActivityDao.getRateUnitString(rs.getString("FINALBILLRATEUNIT").toLowerCase().charAt(0), false); } // activity.setFinalBillRateUnit(currencyUnit + "/" + rateUnit); // activity.setHourly(activity.getHourly()); // // formated along with HOURLY_CURRENCY if (rs.getInt("HOURLY_CURRENCY") == 0) { currencyUnit = "USD"; } else { currencyUnit = abstractActivityDao.getCurrencyString(rs.getInt("HOURLY_CURRENCY")); } // if (rs.getString("PAYRATEUNITS") == null || rs.getString("PAYRATEUNITS").length() == 0) { rateUnit = "Hour"; } else { rateUnit = abstractActivityDao.getRateUnitString(rs.getString("PAYRATEUNITS").toLowerCase().charAt(0), false); } // activity.setPayRateUnits(currencyUnit + "/" + rateUnit); // return activity; } }
4,567
0.691044
0.687322
130
33.130768
29.035625
153
false
false
0
0
0
0
0
0
2.661538
false
false
4
2b9586e3f4b7d6d863cb30afe0de57d064098284
18,700,287,622,901
b06b46d61f548315fab7aed8030dbb2b53d16f5d
/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/expression/operator/Inside.java
7ced86fd77d83fdd09b0d1ed75adce48ffefb855
[ "BSD-3-Clause" ]
permissive
davemckain/qtiworks
https://github.com/davemckain/qtiworks
7e3af1f37182d374d44bbcf7206f218e1785013a
f1465aad49d575f7fc44ff9eaae3d0d57a323abb
refs/heads/master
2023-01-05T04:26:02.922000
2023-01-04T11:29:04
2023-01-04T11:29:04
4,086,423
57
48
NOASSERTION
false
2022-10-28T08:18:29
2012-04-20T12:48:06
2022-10-25T05:19:29
2022-10-28T08:18:28
15,706
65
51
29
Java
false
false
/* Copyright (c) 2012-2013, University of Edinburgh. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * * Neither the name of the University of Edinburgh nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * This software is derived from (and contains code from) QTItools and MathAssessEngine. * QTItools is (c) 2008, University of Southampton. * MathAssessEngine is (c) 2010, University of Edinburgh. */ package uk.ac.ed.ph.jqtiplus.node.expression.operator; import uk.ac.ed.ph.jqtiplus.attribute.enumerate.ShapeAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.CoordsAttribute; import uk.ac.ed.ph.jqtiplus.node.expression.AbstractSimpleFunctionalExpression; import uk.ac.ed.ph.jqtiplus.node.expression.ExpressionParent; import uk.ac.ed.ph.jqtiplus.validation.ValidationContext; import uk.ac.ed.ph.jqtiplus.value.BooleanValue; import uk.ac.ed.ph.jqtiplus.value.ListValue; import uk.ac.ed.ph.jqtiplus.value.NullValue; import uk.ac.ed.ph.jqtiplus.value.PointValue; import uk.ac.ed.ph.jqtiplus.value.Value; import java.util.List; /** * The inside operator takes a single sub-expression which must have a baseType of point. The result * is a single boolean with a value of true if the given point is inside the area defined by shape and * coords. If the sub-expression is a container the result is true if any of the points are inside the * area. If either sub-expression is NULL then the operator results in NULL. * <p> * This implementation doesn't support record container, default shape and percentage values. * <p> * Separator of coordinate values is not comma but space. * * @see uk.ac.ed.ph.jqtiplus.value.Cardinality * @see uk.ac.ed.ph.jqtiplus.value.BaseType * @author Jiri Kajaba */ public final class Inside extends AbstractSimpleFunctionalExpression { private static final long serialVersionUID = 4926097648005221931L; /** Name of this class in xml schema. */ public static final String QTI_CLASS_NAME = "inside"; /** Name of shape attribute in xml schema. */ public static final String ATTR_SHAPE_NAME = Shape.QTI_CLASS_NAME; /** Name of coords attribute in xml schema. */ public static final String ATTR_COORDINATES_NAME = "coords"; public Inside(final ExpressionParent parent) { super(parent, QTI_CLASS_NAME); getAttributes().add(new ShapeAttribute(this, ATTR_SHAPE_NAME, true)); getAttributes().add(new CoordsAttribute(this, ATTR_COORDINATES_NAME, false)); } public Shape getShape() { return getAttributes().getShapeAttribute(ATTR_SHAPE_NAME).getComputedValue(); } public void setShape(final Shape shape) { getAttributes().getShapeAttribute(ATTR_SHAPE_NAME).setValue(shape); } public List<Integer> getCoordinates() { return getAttributes().getCoordsAttribute(ATTR_COORDINATES_NAME).getComputedValue(); } public void setCoordinates(final List<Integer> value) { getAttributes().getCoordsAttribute(ATTR_COORDINATES_NAME).setValue(value); } @Override protected void validateThis(final ValidationContext context) { super.validateThis(context); if (getShape() != null) { getShape().validateCoords(context, getAttributes().getCoordsAttribute(ATTR_COORDINATES_NAME), convertCoordinates(getCoordinates())); } } @Override protected Value evaluateValidSelf(final Value[] childValues) { if (isAnyChildNull(childValues)) { return NullValue.INSTANCE; } boolean result = false; final int[] coords = convertCoordinates(getCoordinates()); if (childValues[0].getCardinality().isSingle()) { final PointValue point = (PointValue) childValues[0]; result = getShape().isInside(coords, point); } else { final ListValue list = (ListValue) childValues[0]; for (int i = 0; i < list.size(); i++) { final PointValue point = (PointValue) list.get(i); if (getShape().isInside(coords, point)) { result = true; break; } } } return BooleanValue.valueOf(result); } /** * Converts list of coordinates to array of coordinates. * * @param coords list of coordinates * @return array of coordinates */ private int[] convertCoordinates(final List<Integer> coords) { final int[] result = new int[coords.size()]; for (int i = 0; i < result.length; i++) { result[i] = coords.get(i).intValue(); } return result; } }
UTF-8
Java
6,035
java
Inside.java
Java
[ { "context": "see uk.ac.ed.ph.jqtiplus.value.BaseType\n * @author Jiri Kajaba\n */\npublic final class Inside extends AbstractSim", "end": 3099, "score": 0.9998348951339722, "start": 3088, "tag": "NAME", "value": "Jiri Kajaba" } ]
null
[]
/* Copyright (c) 2012-2013, University of Edinburgh. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * * Neither the name of the University of Edinburgh nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * This software is derived from (and contains code from) QTItools and MathAssessEngine. * QTItools is (c) 2008, University of Southampton. * MathAssessEngine is (c) 2010, University of Edinburgh. */ package uk.ac.ed.ph.jqtiplus.node.expression.operator; import uk.ac.ed.ph.jqtiplus.attribute.enumerate.ShapeAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.CoordsAttribute; import uk.ac.ed.ph.jqtiplus.node.expression.AbstractSimpleFunctionalExpression; import uk.ac.ed.ph.jqtiplus.node.expression.ExpressionParent; import uk.ac.ed.ph.jqtiplus.validation.ValidationContext; import uk.ac.ed.ph.jqtiplus.value.BooleanValue; import uk.ac.ed.ph.jqtiplus.value.ListValue; import uk.ac.ed.ph.jqtiplus.value.NullValue; import uk.ac.ed.ph.jqtiplus.value.PointValue; import uk.ac.ed.ph.jqtiplus.value.Value; import java.util.List; /** * The inside operator takes a single sub-expression which must have a baseType of point. The result * is a single boolean with a value of true if the given point is inside the area defined by shape and * coords. If the sub-expression is a container the result is true if any of the points are inside the * area. If either sub-expression is NULL then the operator results in NULL. * <p> * This implementation doesn't support record container, default shape and percentage values. * <p> * Separator of coordinate values is not comma but space. * * @see uk.ac.ed.ph.jqtiplus.value.Cardinality * @see uk.ac.ed.ph.jqtiplus.value.BaseType * @author <NAME> */ public final class Inside extends AbstractSimpleFunctionalExpression { private static final long serialVersionUID = 4926097648005221931L; /** Name of this class in xml schema. */ public static final String QTI_CLASS_NAME = "inside"; /** Name of shape attribute in xml schema. */ public static final String ATTR_SHAPE_NAME = Shape.QTI_CLASS_NAME; /** Name of coords attribute in xml schema. */ public static final String ATTR_COORDINATES_NAME = "coords"; public Inside(final ExpressionParent parent) { super(parent, QTI_CLASS_NAME); getAttributes().add(new ShapeAttribute(this, ATTR_SHAPE_NAME, true)); getAttributes().add(new CoordsAttribute(this, ATTR_COORDINATES_NAME, false)); } public Shape getShape() { return getAttributes().getShapeAttribute(ATTR_SHAPE_NAME).getComputedValue(); } public void setShape(final Shape shape) { getAttributes().getShapeAttribute(ATTR_SHAPE_NAME).setValue(shape); } public List<Integer> getCoordinates() { return getAttributes().getCoordsAttribute(ATTR_COORDINATES_NAME).getComputedValue(); } public void setCoordinates(final List<Integer> value) { getAttributes().getCoordsAttribute(ATTR_COORDINATES_NAME).setValue(value); } @Override protected void validateThis(final ValidationContext context) { super.validateThis(context); if (getShape() != null) { getShape().validateCoords(context, getAttributes().getCoordsAttribute(ATTR_COORDINATES_NAME), convertCoordinates(getCoordinates())); } } @Override protected Value evaluateValidSelf(final Value[] childValues) { if (isAnyChildNull(childValues)) { return NullValue.INSTANCE; } boolean result = false; final int[] coords = convertCoordinates(getCoordinates()); if (childValues[0].getCardinality().isSingle()) { final PointValue point = (PointValue) childValues[0]; result = getShape().isInside(coords, point); } else { final ListValue list = (ListValue) childValues[0]; for (int i = 0; i < list.size(); i++) { final PointValue point = (PointValue) list.get(i); if (getShape().isInside(coords, point)) { result = true; break; } } } return BooleanValue.valueOf(result); } /** * Converts list of coordinates to array of coordinates. * * @param coords list of coordinates * @return array of coordinates */ private int[] convertCoordinates(final List<Integer> coords) { final int[] result = new int[coords.size()]; for (int i = 0; i < result.length; i++) { result[i] = coords.get(i).intValue(); } return result; } }
6,030
0.699917
0.693289
152
38.703949
31.633352
105
false
false
0
0
0
0
0
0
0.506579
false
false
4
e2de35a13464cbce001a6abbc22629bfd175750c
8,306,466,784,521
beec1f4c4f6df813b7b56ac38447b72c9ea44699
/ParseStarterProject/src/com/parse/starter/LoginActivity.java
4920ff0544f371bec07a455a38a5c7fcc0955da8
[ "LicenseRef-scancode-unicode-mappings", "BSD-3-Clause", "Apache-2.0" ]
permissive
kristoprifti/Parse-Starter-Project-1.8.2
https://github.com/kristoprifti/Parse-Starter-Project-1.8.2
69522430de581863cd97ddc409a1eac7967d36a3
76f2dc94626684c1bd45541016adafe2d5a46ccd
refs/heads/master
2020-06-05T16:53:48.843000
2015-03-15T14:47:58
2015-03-15T14:47:58
31,304,325
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.parse.starter; /** * Created by Kristi-PC on 2/17/2015. */ import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.parse.FunctionCallback; import com.parse.LogInCallback; import com.parse.ParseCloud; import com.parse.ParseException; import com.parse.ParseUser; import java.util.HashMap; public class LoginActivity extends Activity { // Declare Variables Button loginbutton; Button signup; String usernametxt; String passwordtxt; EditText password; EditText username; String mobiletxt; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from main.xml setContentView(R.layout.login); // Locate EditTexts in main.xml username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); // Locate Buttons in main.xml loginbutton = (Button) findViewById(R.id.login); signup = (Button) findViewById(R.id.signup); // Login Button Click Listener loginbutton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // Retrieve the text entered from the EditText usernametxt = username.getText().toString(); passwordtxt = password.getText().toString(); if(isNetworkAvailable()) { if(usernametxt.isEmpty() || passwordtxt.isEmpty()) { Toast.makeText(getApplicationContext(), "Please complete the login form", Toast.LENGTH_LONG).show(); } else { // Send data to Parse.com for verification ParseUser.logInInBackground(usernametxt, passwordtxt, new LogInCallback() { public void done(ParseUser user, ParseException e) { if (user != null) { boolean verified = user.getBoolean("verifiedPhone"); if(!verified){ showInputDialog(); } // If user exist and authenticated, send user to Welcome.class else{ Intent intent = new Intent( LoginActivity.this, LoggedInActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "Successfully Logged in", Toast.LENGTH_LONG).show(); finish(); } } else { Toast.makeText( getApplicationContext(), "No such user exist, please Sign Up", Toast.LENGTH_LONG).show(); } } }); } } else { Toast.makeText(getApplicationContext(), "No Internet Connection!", Toast.LENGTH_LONG).show(); } } }); // Sign up Button Click Listener signup.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { Intent intent = new Intent(LoginActivity.this, SignupActivity.class); startActivity(intent); finish(); } }); } @Override public void onBackPressed() { finish(); } private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } private void showInputDialog() { // get prompts.xml view LayoutInflater layoutInflater = LayoutInflater.from(LoginActivity.this); View promptView = layoutInflater.inflate(R.layout.verify_phone_dialog, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(LoginActivity.this); alertDialogBuilder.setView(promptView); final EditText verificationCode = (EditText) promptView.findViewById(R.id.verificationCode); // setup a dialog window alertDialogBuilder.setCancelable(false) .setPositiveButton("Verify", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (verificationCode.getText().toString().isEmpty()) { showInputDialog(); Toast.makeText(getApplicationContext(), "Enter your verification code!", Toast.LENGTH_LONG).show(); } else { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("verCode", verificationCode.getText().toString()); ParseCloud.callFunctionInBackground("verifyPhoneNumber", params, new FunctionCallback<String>() { public void done(String ratings, ParseException e) { if (e == null) { Intent intent = new Intent(LoginActivity.this, LoggedInActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "Successfully Logged in", Toast.LENGTH_LONG).show(); finish(); } else { Toast.makeText(getApplicationContext(), "Verification Code Error!", Toast.LENGTH_LONG).show(); showInputDialog(); } } }); } } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }) .setNeutralButton("Get New Code", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser != null) { // do stuff with the user mobiletxt = currentUser.getString("phoneNumber"); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("number", mobiletxt); ParseCloud.callFunctionInBackground("sendVerificationCode", params, new FunctionCallback<String>() { public void done(String ratings, ParseException e) { if (e == null) { Toast.makeText(getApplicationContext(), "Verification Code Sent!", Toast.LENGTH_LONG).show(); } } }); showInputDialog(); } else { // show the signup or login screen Toast.makeText(getApplicationContext(), "Couldn't find your phone!", Toast.LENGTH_LONG).show(); } } }); // create an alert dialog AlertDialog alert = alertDialogBuilder.create(); alert.show(); } }
UTF-8
Java
9,178
java
LoginActivity.java
Java
[ { "context": "package com.parse.starter;\n\n/**\n * Created by Kristi-PC on 2/17/2015.\n */\nimport android.app.Activity;\nim", "end": 55, "score": 0.7821481227874756, "start": 46, "tag": "USERNAME", "value": "Kristi-PC" } ]
null
[]
package com.parse.starter; /** * Created by Kristi-PC on 2/17/2015. */ import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.parse.FunctionCallback; import com.parse.LogInCallback; import com.parse.ParseCloud; import com.parse.ParseException; import com.parse.ParseUser; import java.util.HashMap; public class LoginActivity extends Activity { // Declare Variables Button loginbutton; Button signup; String usernametxt; String passwordtxt; EditText password; EditText username; String mobiletxt; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from main.xml setContentView(R.layout.login); // Locate EditTexts in main.xml username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); // Locate Buttons in main.xml loginbutton = (Button) findViewById(R.id.login); signup = (Button) findViewById(R.id.signup); // Login Button Click Listener loginbutton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // Retrieve the text entered from the EditText usernametxt = username.getText().toString(); passwordtxt = password.getText().toString(); if(isNetworkAvailable()) { if(usernametxt.isEmpty() || passwordtxt.isEmpty()) { Toast.makeText(getApplicationContext(), "Please complete the login form", Toast.LENGTH_LONG).show(); } else { // Send data to Parse.com for verification ParseUser.logInInBackground(usernametxt, passwordtxt, new LogInCallback() { public void done(ParseUser user, ParseException e) { if (user != null) { boolean verified = user.getBoolean("verifiedPhone"); if(!verified){ showInputDialog(); } // If user exist and authenticated, send user to Welcome.class else{ Intent intent = new Intent( LoginActivity.this, LoggedInActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "Successfully Logged in", Toast.LENGTH_LONG).show(); finish(); } } else { Toast.makeText( getApplicationContext(), "No such user exist, please Sign Up", Toast.LENGTH_LONG).show(); } } }); } } else { Toast.makeText(getApplicationContext(), "No Internet Connection!", Toast.LENGTH_LONG).show(); } } }); // Sign up Button Click Listener signup.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { Intent intent = new Intent(LoginActivity.this, SignupActivity.class); startActivity(intent); finish(); } }); } @Override public void onBackPressed() { finish(); } private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } private void showInputDialog() { // get prompts.xml view LayoutInflater layoutInflater = LayoutInflater.from(LoginActivity.this); View promptView = layoutInflater.inflate(R.layout.verify_phone_dialog, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(LoginActivity.this); alertDialogBuilder.setView(promptView); final EditText verificationCode = (EditText) promptView.findViewById(R.id.verificationCode); // setup a dialog window alertDialogBuilder.setCancelable(false) .setPositiveButton("Verify", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (verificationCode.getText().toString().isEmpty()) { showInputDialog(); Toast.makeText(getApplicationContext(), "Enter your verification code!", Toast.LENGTH_LONG).show(); } else { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("verCode", verificationCode.getText().toString()); ParseCloud.callFunctionInBackground("verifyPhoneNumber", params, new FunctionCallback<String>() { public void done(String ratings, ParseException e) { if (e == null) { Intent intent = new Intent(LoginActivity.this, LoggedInActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "Successfully Logged in", Toast.LENGTH_LONG).show(); finish(); } else { Toast.makeText(getApplicationContext(), "Verification Code Error!", Toast.LENGTH_LONG).show(); showInputDialog(); } } }); } } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }) .setNeutralButton("Get New Code", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser != null) { // do stuff with the user mobiletxt = currentUser.getString("phoneNumber"); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("number", mobiletxt); ParseCloud.callFunctionInBackground("sendVerificationCode", params, new FunctionCallback<String>() { public void done(String ratings, ParseException e) { if (e == null) { Toast.makeText(getApplicationContext(), "Verification Code Sent!", Toast.LENGTH_LONG).show(); } } }); showInputDialog(); } else { // show the signup or login screen Toast.makeText(getApplicationContext(), "Couldn't find your phone!", Toast.LENGTH_LONG).show(); } } }); // create an alert dialog AlertDialog alert = alertDialogBuilder.create(); alert.show(); } }
9,178
0.480497
0.479516
197
45.588833
30.812656
134
false
false
0
0
0
0
0
0
0.659898
false
false
4
089dc1b8a25dc542ca091506ef6d6c85da76d3a9
8,306,466,780,582
57ba9f5d6300dc63a899c439a9d61ce47290609b
/src/main/java/com/suntossh/spring/Application.java
59493621f41223ddc98d5ca6771f7d9035569a49
[]
no_license
suntossh/IntroductionToBeans-SpringII
https://github.com/suntossh/IntroductionToBeans-SpringII
4fcb983165d06ad3da2d507f2bb8dae26fa8598a
759c7e4ee15f9d8c45a31d1be2c220a374e2471c
refs/heads/master
2021-01-10T03:10:54.094000
2015-06-01T19:19:09
2015-06-01T19:19:09
36,682,148
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.suntossh.spring; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Application { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml"); BeanA bean1 = context.getBean("_bean1",BeanA.class); BeanA bean2 = context.getBean("bean2",BeanA.class); System.out.println(bean1==bean2); System.out.println(bean1==bean2?"equal":"not equal"); bean1.printMessage(); } }
UTF-8
Java
556
java
Application.java
Java
[]
null
[]
package com.suntossh.spring; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Application { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml"); BeanA bean1 = context.getBean("_bean1",BeanA.class); BeanA bean2 = context.getBean("bean2",BeanA.class); System.out.println(bean1==bean2); System.out.println(bean1==bean2?"equal":"not equal"); bean1.printMessage(); } }
556
0.776978
0.760791
17
31.705883
28.285862
93
false
false
0
0
0
0
0
0
1.470588
false
false
4
9fa18880198bbb527f6ce1cddd59fd7523e19c52
28,475,633,240,026
85a24c2531ad91cf79d390ada6d98caa609686cf
/app/src/main/java/com/example/monprojetandroid/DataBaseTuteur.java
cc4524a406886f246f7d557f6942a92fda3e37a6
[]
no_license
Mamadou-Faye/GestionTuteursAndroid
https://github.com/Mamadou-Faye/GestionTuteursAndroid
4ce9477e6401cae8bf96b21c4d1db0fbde4ab8c4
53e6a2faf932fcb5a01f05bb053c86c58917417a
refs/heads/master
2023-05-31T19:28:07.587000
2021-06-11T16:20:51
2021-06-11T16:20:51
376,080,334
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.monprojetandroid; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import androidx.annotation.Nullable; import java.util.SimpleTimeZone; public class DataBaseTuteur extends SQLiteOpenHelper { //Base de donnée private static final String DATABASE_NAME = "GestionTuteur"; //Table tuteur private static final String TABLE_NAME1 = "Tuteur"; private static final String Col1 = "ID"; private static final String Col2 = "Nom"; private static final String Col3 ="Prenom"; private static final String Col4 = "Email"; private static final String Col5 = "Filiere"; //table filiere private static final String TABLE_NAME3 = "filiere"; private static final String Col111 = "IDFILIERE"; private static final String Col222 = "NOM"; private static final String Col333 = "CHEFFILIERE"; //table cours private static final String TABLE_NAME2 = "Cours"; private static final String Col11 = "IDCOURS"; private static final String Col22 = "NOM"; private static final String Col33 = "IDFILIERE"; private Tuteur tuteur; private Filiere fl; public DataBaseTuteur(@Nullable Context context) { super(context, DATABASE_NAME, null, 1); SQLiteDatabase db =this.getWritableDatabase(); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table " + TABLE_NAME1 + "(ID INTEGER PRIMARY KEY AUTOINCREMENT, Prenom TEXT, Nom TEXT, Email TEXT, Filiere TEXT)"); db.execSQL("create table " + TABLE_NAME3 + "(IDFILIERE INTEGER PRIMARY KEY AUTOINCREMENT, nom text, chefFiliere text)"); db.execSQL("create table " + TABLE_NAME2 + "(IDCOURS INTEGER PRIMARY KEY AUTOINCREMENT," + " Nom TEXT, " + "CONSTRAINT Id FOREIGN KEY (Tuteur) REFERENCES TABLE_NAME1 (ID)," + "CONSTRAINT idFIliere FOREIGN KEY (Filiere) REFERENCES TABLE_NAME3(idFiliere))"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersio) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME1); db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME2); db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME3); onCreate(db); } public boolean insert(String email, String nom, String prenom, String filiere){ SQLiteDatabase db =this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(Col2, nom); values.put(Col3, prenom); values.put(Col4, email); values.put(Col5, filiere); long resultat = db.insert(TABLE_NAME1, null, values); Log.i("##### check insert", "result " + resultat); if (resultat == -1){ return false; }else{ return true; } } public Cursor gatAllDATA (){ SQLiteDatabase db = this.getWritableDatabase(); Cursor res = db.rawQuery("SELECT * FROM " + TABLE_NAME1, null); return res; } public boolean upDateData(String id, String nom, String prenom, String email, String filiere){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(Col1, id); values.put(Col2, nom); values.put(Col3, prenom); values.put(Col4, email); values.put(Col5, filiere); db.update(TABLE_NAME1, values, "ID = ?", new String[]{id}); return true; } public Integer deleteData (String id) { SQLiteDatabase db = this.getWritableDatabase(); return db.delete(TABLE_NAME1, "ID = ?", new String[]{id}); } }
UTF-8
Java
3,805
java
DataBaseTuteur.java
Java
[]
null
[]
package com.example.monprojetandroid; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import androidx.annotation.Nullable; import java.util.SimpleTimeZone; public class DataBaseTuteur extends SQLiteOpenHelper { //Base de donnée private static final String DATABASE_NAME = "GestionTuteur"; //Table tuteur private static final String TABLE_NAME1 = "Tuteur"; private static final String Col1 = "ID"; private static final String Col2 = "Nom"; private static final String Col3 ="Prenom"; private static final String Col4 = "Email"; private static final String Col5 = "Filiere"; //table filiere private static final String TABLE_NAME3 = "filiere"; private static final String Col111 = "IDFILIERE"; private static final String Col222 = "NOM"; private static final String Col333 = "CHEFFILIERE"; //table cours private static final String TABLE_NAME2 = "Cours"; private static final String Col11 = "IDCOURS"; private static final String Col22 = "NOM"; private static final String Col33 = "IDFILIERE"; private Tuteur tuteur; private Filiere fl; public DataBaseTuteur(@Nullable Context context) { super(context, DATABASE_NAME, null, 1); SQLiteDatabase db =this.getWritableDatabase(); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table " + TABLE_NAME1 + "(ID INTEGER PRIMARY KEY AUTOINCREMENT, Prenom TEXT, Nom TEXT, Email TEXT, Filiere TEXT)"); db.execSQL("create table " + TABLE_NAME3 + "(IDFILIERE INTEGER PRIMARY KEY AUTOINCREMENT, nom text, chefFiliere text)"); db.execSQL("create table " + TABLE_NAME2 + "(IDCOURS INTEGER PRIMARY KEY AUTOINCREMENT," + " Nom TEXT, " + "CONSTRAINT Id FOREIGN KEY (Tuteur) REFERENCES TABLE_NAME1 (ID)," + "CONSTRAINT idFIliere FOREIGN KEY (Filiere) REFERENCES TABLE_NAME3(idFiliere))"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersio) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME1); db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME2); db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME3); onCreate(db); } public boolean insert(String email, String nom, String prenom, String filiere){ SQLiteDatabase db =this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(Col2, nom); values.put(Col3, prenom); values.put(Col4, email); values.put(Col5, filiere); long resultat = db.insert(TABLE_NAME1, null, values); Log.i("##### check insert", "result " + resultat); if (resultat == -1){ return false; }else{ return true; } } public Cursor gatAllDATA (){ SQLiteDatabase db = this.getWritableDatabase(); Cursor res = db.rawQuery("SELECT * FROM " + TABLE_NAME1, null); return res; } public boolean upDateData(String id, String nom, String prenom, String email, String filiere){ SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(Col1, id); values.put(Col2, nom); values.put(Col3, prenom); values.put(Col4, email); values.put(Col5, filiere); db.update(TABLE_NAME1, values, "ID = ?", new String[]{id}); return true; } public Integer deleteData (String id) { SQLiteDatabase db = this.getWritableDatabase(); return db.delete(TABLE_NAME1, "ID = ?", new String[]{id}); } }
3,805
0.657466
0.645373
101
36.663368
28.378725
142
false
false
0
0
0
0
0
0
0.970297
false
false
4
1cd2b41b48d9230c386e6d8cee0aae9c4c7acfd8
13,151,189,873,516
5d9a7e685de566786fc6057f04aa42e735480f8e
/src/main/java/br/com/utilitarios/AppInterface.java
82b3a3520c638ba4f5e5d95f5a69995f07910e65
[]
no_license
llyppi/tools
https://github.com/llyppi/tools
d0241dcabf94f501dec4d82233e7876656aafe21
dfcc3d9102f42190d19ed73530dc09d6bdf0bb57
refs/heads/master
2023-04-30T02:01:40.674000
2022-10-22T17:08:16
2022-10-22T17:08:16
175,113,109
0
0
null
false
2023-04-14T17:23:48
2019-03-12T01:40:05
2022-05-13T12:01:53
2023-04-14T17:23:48
5,127
0
0
14
Java
false
false
package br.com.utilitarios; /** * * @author Felipe L. Garcia */ public interface AppInterface { public String getDataBase(); public int getUserLogin(); public int getSysLogin(); public int getClient(); public void setDataBase(String dataBase); public void setUserLogin(int userLogin); public void setSysLogin(int sysLogin); public void setClient(int client); }
UTF-8
Java
414
java
AppInterface.java
Java
[ { "context": "\n\npackage br.com.utilitarios;\n\n/**\n *\n * @author Felipe L. Garcia\n */\npublic interface AppInterface {\n \n publ", "end": 65, "score": 0.9998451471328735, "start": 49, "tag": "NAME", "value": "Felipe L. Garcia" } ]
null
[]
package br.com.utilitarios; /** * * @author <NAME> */ public interface AppInterface { public String getDataBase(); public int getUserLogin(); public int getSysLogin(); public int getClient(); public void setDataBase(String dataBase); public void setUserLogin(int userLogin); public void setSysLogin(int sysLogin); public void setClient(int client); }
404
0.676328
0.676328
19
20.68421
16.261198
45
false
false
0
0
0
0
0
0
0.473684
false
false
4
b282cf8b357b10636069364e21f610929780f49c
1,185,411,014,305
03ea4fcabfd281d62f81ffc49b6a35433c34516a
/summary/src/main/java/com/qiangssvip/summary/pojo/Employee.java
451d73ecd379e3931a1f3802f191b74acb4f1452
[]
no_license
xinggevip/SpringBootSummary
https://github.com/xinggevip/SpringBootSummary
73b20bcba866c29c2f902ddd7675e5d78022ce55
3aeb6bcee8be48e665ce175cd0a5e5b5ffb67d2a
refs/heads/master
2022-12-14T19:04:35.738000
2022-03-31T01:55:11
2022-03-31T01:55:11
250,751,892
0
0
null
false
2022-12-06T00:47:35
2020-03-28T09:00:12
2022-03-31T02:04:11
2022-12-06T00:47:34
40,340
0
0
1
Java
false
false
package com.qiangssvip.summary.pojo; import java.io.Serializable; import java.util.Date; public class Employee implements Serializable { private Long id; private String username; private Date inputtime; private String tel; private String email; private Boolean state; private Boolean admin; private Long depId; private String password; private static final long serialVersionUID = 1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username == null ? null : username.trim(); } public Date getInputtime() { return inputtime; } public void setInputtime(Date inputtime) { this.inputtime = inputtime; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel == null ? null : tel.trim(); } public String getEmail() { return email; } public void setEmail(String email) { this.email = email == null ? null : email.trim(); } public Boolean getState() { return state; } public void setState(Boolean state) { this.state = state; } public Boolean getAdmin() { return admin; } public void setAdmin(Boolean admin) { this.admin = admin; } public Long getDepId() { return depId; } public void setDepId(Long depId) { this.depId = depId; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password == null ? null : password.trim(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", username=").append(username); sb.append(", inputtime=").append(inputtime); sb.append(", tel=").append(tel); sb.append(", email=").append(email); sb.append(", state=").append(state); sb.append(", admin=").append(admin); sb.append(", depId=").append(depId); sb.append(", password=").append(password); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } @Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } Employee other = (Employee) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername())) && (this.getInputtime() == null ? other.getInputtime() == null : this.getInputtime().equals(other.getInputtime())) && (this.getTel() == null ? other.getTel() == null : this.getTel().equals(other.getTel())) && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail())) && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())) && (this.getAdmin() == null ? other.getAdmin() == null : this.getAdmin().equals(other.getAdmin())) && (this.getDepId() == null ? other.getDepId() == null : this.getDepId().equals(other.getDepId())) && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword())); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode()); result = prime * result + ((getInputtime() == null) ? 0 : getInputtime().hashCode()); result = prime * result + ((getTel() == null) ? 0 : getTel().hashCode()); result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode()); result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); result = prime * result + ((getAdmin() == null) ? 0 : getAdmin().hashCode()); result = prime * result + ((getDepId() == null) ? 0 : getDepId().hashCode()); result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode()); return result; } }
UTF-8
Java
4,806
java
Employee.java
Java
[ { "context": "pend(id);\n sb.append(\", username=\").append(username);\n sb.append(\", inputtime=\").append(inputt", "end": 2108, "score": 0.9417937994003296, "start": 2100, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.qiangssvip.summary.pojo; import java.io.Serializable; import java.util.Date; public class Employee implements Serializable { private Long id; private String username; private Date inputtime; private String tel; private String email; private Boolean state; private Boolean admin; private Long depId; private String password; private static final long serialVersionUID = 1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username == null ? null : username.trim(); } public Date getInputtime() { return inputtime; } public void setInputtime(Date inputtime) { this.inputtime = inputtime; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel == null ? null : tel.trim(); } public String getEmail() { return email; } public void setEmail(String email) { this.email = email == null ? null : email.trim(); } public Boolean getState() { return state; } public void setState(Boolean state) { this.state = state; } public Boolean getAdmin() { return admin; } public void setAdmin(Boolean admin) { this.admin = admin; } public Long getDepId() { return depId; } public void setDepId(Long depId) { this.depId = depId; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password == null ? null : password.trim(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", username=").append(username); sb.append(", inputtime=").append(inputtime); sb.append(", tel=").append(tel); sb.append(", email=").append(email); sb.append(", state=").append(state); sb.append(", admin=").append(admin); sb.append(", depId=").append(depId); sb.append(", password=").append(password); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } @Override public boolean equals(Object that) { if (this == that) { return true; } if (that == null) { return false; } if (getClass() != that.getClass()) { return false; } Employee other = (Employee) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername())) && (this.getInputtime() == null ? other.getInputtime() == null : this.getInputtime().equals(other.getInputtime())) && (this.getTel() == null ? other.getTel() == null : this.getTel().equals(other.getTel())) && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail())) && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())) && (this.getAdmin() == null ? other.getAdmin() == null : this.getAdmin().equals(other.getAdmin())) && (this.getDepId() == null ? other.getDepId() == null : this.getDepId().equals(other.getDepId())) && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword())); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode()); result = prime * result + ((getInputtime() == null) ? 0 : getInputtime().hashCode()); result = prime * result + ((getTel() == null) ? 0 : getTel().hashCode()); result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode()); result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); result = prime * result + ((getAdmin() == null) ? 0 : getAdmin().hashCode()); result = prime * result + ((getDepId() == null) ? 0 : getDepId().hashCode()); result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode()); return result; } }
4,806
0.565751
0.563046
157
29.617834
30.631472
126
false
false
0
0
0
0
0
0
0.471338
false
false
4
e2a4378283f1c0010db899ec17bb3cfe9e0ccb57
644,245,103,655
e907f20170e68351943affd8f081ae22c164b658
/src/OnePlayerNewbieMode/Map.java
75223fd620acaab023e474a9581c938519cc361e
[]
no_license
Gunzther/RabbyBana-the-juker
https://github.com/Gunzther/RabbyBana-the-juker
1c6a4a0a8ff6e249bd6e09256efffdbd3a29326d
690414e1c8f068c65a279aca583fd1bb2d4a91d6
refs/heads/master
2021-10-21T07:32:03.976000
2017-12-15T11:00:23
2017-12-15T11:00:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package OnePlayerNewbieMode; import java.awt.Graphics; import java.awt.Rectangle; /** * This class has the Map object constructor and render the map that load from MapSheet class(size 800*640). * @author KameriiJ */ public class Map extends Rectangle { private static final long serialVersionUID = 1L; public Map(int x, int y) { setBounds(x, y, 800, 640); } public void render(Graphics g) { g.drawImage(Game.mapSheet.getMap(0, 0), x, y, 800, 640, null); } }
UTF-8
Java
475
java
Map.java
Java
[ { "context": "load from MapSheet class(size 800*640).\n * @author KameriiJ\n */\npublic class Map extends Rectangle {\n\n\tprivat", "end": 216, "score": 0.8723605275154114, "start": 208, "tag": "USERNAME", "value": "KameriiJ" } ]
null
[]
package OnePlayerNewbieMode; import java.awt.Graphics; import java.awt.Rectangle; /** * This class has the Map object constructor and render the map that load from MapSheet class(size 800*640). * @author KameriiJ */ public class Map extends Rectangle { private static final long serialVersionUID = 1L; public Map(int x, int y) { setBounds(x, y, 800, 640); } public void render(Graphics g) { g.drawImage(Game.mapSheet.getMap(0, 0), x, y, 800, 640, null); } }
475
0.713684
0.669474
21
21.619047
26.472765
108
false
false
0
0
0
0
0
0
1.190476
false
false
4
d552a2b33ad461d017e2a487642932b106765c8f
8,040,178,787,904
7317cec873de51abf16d03e7ffaa5e6be339e89e
/XorApp/app/src/main/java/alonsod/mov/urjc/xorapp/StoreUsers.java
a0f8969d502e6206df362e33d9ff4a3c04515d5a
[]
no_license
dralonso29/Android
https://github.com/dralonso29/Android
3e337cbf3b7c939f30a4677e5beec9f2b59f1756
867fb7b2ce9fdf9be36347010e7552a9a3e7519d
refs/heads/master
2020-06-11T07:22:23.954000
2019-05-21T19:25:29
2019-05-21T19:25:29
193,888,398
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package alonsod.mov.urjc.xorapp; import android.util.Log; import android.widget.TextView; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import static alonsod.mov.urjc.xorapp.LevelFactory.MAXLEVELS; public class StoreUsers { private static final int KEYVALUE = 2; HashMap<String, String> hsmp; private String str; private String username; private int[] actual_times; StoreUsers(String username, int[] actual_times) { hsmp = new HashMap<>(); this.username = username; this.actual_times = actual_times; } /*public String getString() { return str; }*/ public String[] parseLine(String line){ String lineaux; String[] splited = new String[KEYVALUE]; int i; String times = ""; lineaux = line.split("\n")[0]; splited[0] = lineaux.split(" ")[0]; //username for (i = 1; i <= MAXLEVELS ; i++){ if (i == 1){ times = times + lineaux.split(" ")[i]; continue; } times = times +" "+ lineaux.split(" ")[i]; } splited[1] = times; //Es posible que aqui haya que añadir un \n return splited; } public void putOnHashMap(String[] array){ hsmp.put(array[0], array[1]); } public int[] getTimesString(String usr){ String t = hsmp.get(usr); String[] aux = t.split(" "); int[] times = new int[MAXLEVELS]; for (int i =0 ; i<MAXLEVELS; i++) { times[i] = Integer.parseInt(aux[i]); } return times; } public void readFile(File scores) { try { FileInputStream fs = new FileInputStream(scores); BufferedReader br = new BufferedReader(new InputStreamReader(fs)); String line; String[] parsed; while ((line = br.readLine()) != null) { Log.d("StoreUsers", "Leemos -->" + line + "@@@@"); parsed = parseLine(line); Log.d("StoreUsers", "parsed[0]: "+parsed[0]); Log.d("StoreUsers", "parsed[1]: "+parsed[1]+"@@@@"); putOnHashMap(parsed); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public String makeString(int[] times) { String str = username; for (int i = 0; i < MAXLEVELS;i++) { str = str + " " + times[i]; } return str; } public void writeOn(String str, File scores, boolean append) { try { BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(scores, append)); DataOutputStream data = new DataOutputStream(output); str = str+"\n"; Log.d("StoreUsers", "Escribimos en el fichero: "+str+"$$$$$$"); data.writeBytes(str); data.close(); } catch (Exception e) { e.printStackTrace(); } } public String arrayIntToStr(int[] times){ String str = ""; for (int i = 0; i < MAXLEVELS; i++){ if (i == 0){ str = str + times[i]; continue; } str = str + " " + times[i]; } return str; } public void modifyHashMap() { String value; int[] times_file = getTimesString(username); for (int i = 0; i < MAXLEVELS; i++){ Log.d("StoreUsers", "modify_HasMap: actual_times["+i+"]: "+actual_times[i]); Log.d("StoreUsers", "modify_HasMap: times_file["+i+"]: "+times_file[i]); if (actual_times[i] <= times_file[i]){ times_file[i] = actual_times[i]; } } value = arrayIntToStr(times_file); Log.d("StoreUsers", "Modificado: "+value+"@@@@"); //Los @ son para ver si mete los saltos de linea hsmp.put(username, value); } public boolean userFound() { if (hsmp.get(username) == null){ return false; } return true; } public String getValue() { return hsmp.get(username); } public void writing(File scores) { boolean first = true; for (HashMap.Entry<String, String> hash: hsmp.entrySet()){ String str; str = hash.getKey() + " " + hash.getValue(); if (first) { writeOn(str, scores, false); first = false; continue; } writeOn(str, scores, true); } } public String setBest(int n) { String user; String time; String best = ""; int time_best = 99999999; for (HashMap.Entry<String, String> hash: hsmp.entrySet()){ user = hash.getKey(); Log.d("ActivityScores", "user:"+user); time = hash.getValue().split(" ")[n]; Log.d("ActivityScores", "time:"+time); if (Integer.parseInt(time.trim()) <= time_best && Integer.parseInt(time.trim()) > 0){ time_best = Integer.parseInt(time.trim()); best = user; } } Log.d("ActivityScores", "Best usr:"+best); Log.d("ActivityScores", "Best time:"+time_best); if (time_best == 99999999){ return "Aún no hay registros"; } return "Usuario: "+best+" Tiempo empleado: " + beautifyTime(time_best); } private String beautifyTime(int time_best) { time_best = time_best / 1000; //now time_best is on seconds long seconds = time_best % 60; long minutes = (time_best / 60) % 60; long hours = (time_best / (60*60)) % 24; return String.format("%d horas %02d minutos %02d segundos ", hours, minutes, seconds); } }
UTF-8
Java
6,168
java
StoreUsers.java
Java
[ { "context": " hsmp = new HashMap<>();\n this.username = username;\n this.actual_times = actual_times;\n }\n", "end": 808, "score": 0.9995118379592896, "start": 800, "tag": "USERNAME", "value": "username" } ]
null
[]
package alonsod.mov.urjc.xorapp; import android.util.Log; import android.widget.TextView; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import static alonsod.mov.urjc.xorapp.LevelFactory.MAXLEVELS; public class StoreUsers { private static final int KEYVALUE = 2; HashMap<String, String> hsmp; private String str; private String username; private int[] actual_times; StoreUsers(String username, int[] actual_times) { hsmp = new HashMap<>(); this.username = username; this.actual_times = actual_times; } /*public String getString() { return str; }*/ public String[] parseLine(String line){ String lineaux; String[] splited = new String[KEYVALUE]; int i; String times = ""; lineaux = line.split("\n")[0]; splited[0] = lineaux.split(" ")[0]; //username for (i = 1; i <= MAXLEVELS ; i++){ if (i == 1){ times = times + lineaux.split(" ")[i]; continue; } times = times +" "+ lineaux.split(" ")[i]; } splited[1] = times; //Es posible que aqui haya que añadir un \n return splited; } public void putOnHashMap(String[] array){ hsmp.put(array[0], array[1]); } public int[] getTimesString(String usr){ String t = hsmp.get(usr); String[] aux = t.split(" "); int[] times = new int[MAXLEVELS]; for (int i =0 ; i<MAXLEVELS; i++) { times[i] = Integer.parseInt(aux[i]); } return times; } public void readFile(File scores) { try { FileInputStream fs = new FileInputStream(scores); BufferedReader br = new BufferedReader(new InputStreamReader(fs)); String line; String[] parsed; while ((line = br.readLine()) != null) { Log.d("StoreUsers", "Leemos -->" + line + "@@@@"); parsed = parseLine(line); Log.d("StoreUsers", "parsed[0]: "+parsed[0]); Log.d("StoreUsers", "parsed[1]: "+parsed[1]+"@@@@"); putOnHashMap(parsed); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public String makeString(int[] times) { String str = username; for (int i = 0; i < MAXLEVELS;i++) { str = str + " " + times[i]; } return str; } public void writeOn(String str, File scores, boolean append) { try { BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(scores, append)); DataOutputStream data = new DataOutputStream(output); str = str+"\n"; Log.d("StoreUsers", "Escribimos en el fichero: "+str+"$$$$$$"); data.writeBytes(str); data.close(); } catch (Exception e) { e.printStackTrace(); } } public String arrayIntToStr(int[] times){ String str = ""; for (int i = 0; i < MAXLEVELS; i++){ if (i == 0){ str = str + times[i]; continue; } str = str + " " + times[i]; } return str; } public void modifyHashMap() { String value; int[] times_file = getTimesString(username); for (int i = 0; i < MAXLEVELS; i++){ Log.d("StoreUsers", "modify_HasMap: actual_times["+i+"]: "+actual_times[i]); Log.d("StoreUsers", "modify_HasMap: times_file["+i+"]: "+times_file[i]); if (actual_times[i] <= times_file[i]){ times_file[i] = actual_times[i]; } } value = arrayIntToStr(times_file); Log.d("StoreUsers", "Modificado: "+value+"@@@@"); //Los @ son para ver si mete los saltos de linea hsmp.put(username, value); } public boolean userFound() { if (hsmp.get(username) == null){ return false; } return true; } public String getValue() { return hsmp.get(username); } public void writing(File scores) { boolean first = true; for (HashMap.Entry<String, String> hash: hsmp.entrySet()){ String str; str = hash.getKey() + " " + hash.getValue(); if (first) { writeOn(str, scores, false); first = false; continue; } writeOn(str, scores, true); } } public String setBest(int n) { String user; String time; String best = ""; int time_best = 99999999; for (HashMap.Entry<String, String> hash: hsmp.entrySet()){ user = hash.getKey(); Log.d("ActivityScores", "user:"+user); time = hash.getValue().split(" ")[n]; Log.d("ActivityScores", "time:"+time); if (Integer.parseInt(time.trim()) <= time_best && Integer.parseInt(time.trim()) > 0){ time_best = Integer.parseInt(time.trim()); best = user; } } Log.d("ActivityScores", "Best usr:"+best); Log.d("ActivityScores", "Best time:"+time_best); if (time_best == 99999999){ return "Aún no hay registros"; } return "Usuario: "+best+" Tiempo empleado: " + beautifyTime(time_best); } private String beautifyTime(int time_best) { time_best = time_best / 1000; //now time_best is on seconds long seconds = time_best % 60; long minutes = (time_best / 60) % 60; long hours = (time_best / (60*60)) % 24; return String.format("%d horas %02d minutos %02d segundos ", hours, minutes, seconds); } }
6,168
0.529679
0.520759
201
29.676617
22.359119
106
false
false
0
0
0
0
0
0
0.701493
false
false
4
2859998b29b0d00aa52ba1add485eed1320ed8a5
2,877,628,088,694
af21c03fb9cbfa9921aaafbdb0af8a4ba1f68689
/lbs-poi/src/main/java/com/lanx/app/lbs/poi/dao/PoiPageDao.java
c3e748839db9fff190b190ee6881a834194a6b22
[]
no_license
uwitec/open-jlbs
https://github.com/uwitec/open-jlbs
4c5b5c554616e6713b2bdb0a767d44749056be90
55cf0566a6ff996020caba1f0b35e9989cdea4f4
refs/heads/master
2021-01-19T06:26:03.037000
2013-09-30T16:13:17
2013-09-30T16:13:17
40,972,464
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lanx.app.lbs.poi.dao; import java.io.Serializable; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.PagingAndSortingRepository; import com.lanx.app.lbs.core.domain.LBSPoi; /** * <p>LBS操作poi的dao接口</p> * * @author Ramboo * @date 2013-09-27 * */ public interface PoiPageDao extends PagingAndSortingRepository<LBSPoi, Serializable>, JpaSpecificationExecutor<LBSPoi> { }
UTF-8
Java
487
java
PoiPageDao.java
Java
[ { "context": "\r\n\r\n/**\r\n * <p>LBS操作poi的dao接口</p>\r\n * \r\n * @author Ramboo\r\n * @date 2013-09-27\r\n * */\r\npublic interface Poi", "end": 317, "score": 0.9987754225730896, "start": 311, "tag": "USERNAME", "value": "Ramboo" } ]
null
[]
package com.lanx.app.lbs.poi.dao; import java.io.Serializable; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.PagingAndSortingRepository; import com.lanx.app.lbs.core.domain.LBSPoi; /** * <p>LBS操作poi的dao接口</p> * * @author Ramboo * @date 2013-09-27 * */ public interface PoiPageDao extends PagingAndSortingRepository<LBSPoi, Serializable>, JpaSpecificationExecutor<LBSPoi> { }
487
0.754717
0.737945
18
24.388889
32.4981
121
false
false
0
0
0
0
0
0
0.388889
false
false
4
6945967181224841998cbdf980cdbdb4795573a3
29,686,813,978,573
7fc6b3e7c25184c846011c3b1935a1bca9148269
/src/industry/PlanMessage.java
520c5118daccb3e7cae8e71d3fe42b1d422d607a
[]
no_license
tomek1kk/Industry4.0
https://github.com/tomek1kk/Industry4.0
d241067f24d50781d3306794600d94f362316148
b54fd91ece5b46882d26db05780e4ab3160adb13
refs/heads/master
2022-12-11T12:22:37.092000
2020-08-16T18:30:27
2020-08-16T18:30:27
287,729,280
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package industry; import jade.core.AID; import java.util.List; import java.util.Map; public class PlanMessage { private String productName; private int socketId; private Integer stageId; private String actionName; private Integer priority; private String id; //11 cyfr, 2 pierwsze to numer maszyny która zleciła wykonanie produktu private Map<Integer, List<String>> bookedActions; //zawiera akcje które już zostały zarezerwowane do wykonania private String requestingAgent; public PlanMessage(String productName, String actionName, Integer stageId, Integer priority, Map<Integer, List<String>> bookedActions, String requestingAgent, String id, int socketId){ this.productName = productName; this.stageId = stageId; this.actionName = actionName; this.priority = priority; this.bookedActions = bookedActions; this.requestingAgent = requestingAgent; this.id = id; this.socketId = socketId; } public PlanMessage(PlanMessage that){ this (that.productName, that.actionName, that.stageId, that.priority, that.bookedActions, that.requestingAgent, that.id, that.socketId); } public String GetProductName() { return productName; } public Integer GetStageId(){ return stageId; } public String GetActionName(){ return actionName; } public Integer getPriority() { return priority; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getRequestingAgent() { return requestingAgent; } public int getSocketId() { return socketId; } public Map<Integer, List<String>> getBookedActions() { return bookedActions; } }
UTF-8
Java
1,817
java
PlanMessage.java
Java
[]
null
[]
package industry; import jade.core.AID; import java.util.List; import java.util.Map; public class PlanMessage { private String productName; private int socketId; private Integer stageId; private String actionName; private Integer priority; private String id; //11 cyfr, 2 pierwsze to numer maszyny która zleciła wykonanie produktu private Map<Integer, List<String>> bookedActions; //zawiera akcje które już zostały zarezerwowane do wykonania private String requestingAgent; public PlanMessage(String productName, String actionName, Integer stageId, Integer priority, Map<Integer, List<String>> bookedActions, String requestingAgent, String id, int socketId){ this.productName = productName; this.stageId = stageId; this.actionName = actionName; this.priority = priority; this.bookedActions = bookedActions; this.requestingAgent = requestingAgent; this.id = id; this.socketId = socketId; } public PlanMessage(PlanMessage that){ this (that.productName, that.actionName, that.stageId, that.priority, that.bookedActions, that.requestingAgent, that.id, that.socketId); } public String GetProductName() { return productName; } public Integer GetStageId(){ return stageId; } public String GetActionName(){ return actionName; } public Integer getPriority() { return priority; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getRequestingAgent() { return requestingAgent; } public int getSocketId() { return socketId; } public Map<Integer, List<String>> getBookedActions() { return bookedActions; } }
1,817
0.674945
0.673289
56
31.357143
30.051401
144
false
false
0
0
0
0
0
0
0.857143
false
false
4
cc52e329c22603f1ce29c3b3de28e4ca07031722
29,686,813,980,438
fd404575917125ecacd79b296891ce8cb98466ce
/Cursada/ProyectoInteresesSpring3REST/src/edu/curso/java/spring/mvc/form/PostForm.java
41716e0ecd3aea972ed7d41a9b5574df86a7cc88
[]
no_license
cckmit/TecnicasProgramacionAvanzadas
https://github.com/cckmit/TecnicasProgramacionAvanzadas
4aac5336221936bf7c1604b0756913a362e6c8b6
553ddbbbbbdda9b0870bf4c63730eaf97be61d3e
refs/heads/master
2023-03-15T02:10:53.645000
2012-10-29T17:35:59
2012-10-29T17:35:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.curso.java.spring.mvc.form; public class PostForm { }
UTF-8
Java
73
java
PostForm.java
Java
[]
null
[]
package edu.curso.java.spring.mvc.form; public class PostForm { }
73
0.69863
0.69863
5
12.6
15.85686
39
false
false
0
0
0
0
0
0
0.2
false
false
4
231b911ee258a6db3cb3280043e6366af888c740
23,880,018,218,025
d05df39e73e525c64db8f764475d3ea28f0263a2
/ApplicationShop/ShopBuisnessFacadeBean/src/DAO/rdbDAO/RdbOrderedProductDAO.java
e89faa9627ed7080700ea7e8c17e6e38ab7e27ed
[]
no_license
aschworer/store
https://github.com/aschworer/store
0531607d58357472b87353f9b678bcb598d97e30
1ec5ff3b8dc24222500cc78c42425f76f2186a9a
refs/heads/master
2016-08-12T03:34:28.162000
2015-10-07T05:28:59
2015-10-07T05:28:59
43,795,963
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package DAO.rdbDAO; import DAO.GettingDataFailedException; import DAO.ConnectionFailedException; import DAO.rdbDAO.rdb_transfer_objects.Product; import DAO.*; import java.sql.*; import java.util.Collection; import java.util.ArrayList; public class RdbOrderedProductDAO extends OrderedProductDAO { private Connection conn; private PreparedStatement insertProduct; private PreparedStatement selectProducts; private PreparedStatement selectProduct; // public Product getProduct() { // org.hibernate.Session session = HibernateUtil.getSession(); // System.out.println("SBFB: HIBERNATE SESSION GET"); // System.out.println("SBFB: HIBERNATE TRYING TO GET TEST (ID=1)"); // return (Product) session.load(Product.class, new Long(1)); // } public RdbOrderedProductDAO(Connection conn) throws GettingDataFailedException { this.conn = conn; try { insertProduct = conn.prepareStatement("INSERT INTO products (title, price) VALUES (?,?)", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); selectProducts = conn.prepareStatement("SELECT * FROM products"); selectProduct = conn.prepareStatement("SELECT * FROM products WHERE product_id=?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); } catch (SQLException e) { throw new GettingDataFailedException(); } } public void setLastFill(int productID, long lastFill) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); r.updateLong("last_fill", lastFill); r.updateRow(); r.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public void setLastMail(int productID, long lastMail) throws GettingDataFailedException { try { System.out.println("Setting last mail.. product id=" + productID); System.out.println("Setting last mail.. date=" + lastMail); selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); r.updateLong("last_mail", lastMail); r.updateRow(); r.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public long getLastFill(int productID) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); return r.getLong("last_fill"); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public long getLastMail(int productID) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); return r.getLong("last_mail"); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public int getWarehouseAmount(int productID) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); return r.getInt("warehouse_amount"); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public void setWarehouseAmount(int productID, int newAmount) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); r.updateInt("warehouse_amount", newAmount); r.updateRow(); r.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } // public void changeWarehouseAmount(int productID, int decrementNumber) // throws GettingDataFailedException, WarehouseProductAmountException { // try { // selectProduct.setInt(1, productID); // ResultSet r = selectProduct.executeQuery(); // r.next(); // int amountDB = r.getInt("warehouse_amount"); // // System.err.println("Product id " + productID + "amount " // + amountDB + "decrement " + decrementNumber); // // if ((amountDB - decrementNumber) <= 0) { // System.err.println("Throwing Earehouse amount <0 " + (amountDB - decrementNumber)); //// //// r.updateInt("warehouse_amount", 0); // throw new WarehouseProductAmountException(); // } else { // r.updateInt("warehouse_amount", amountDB - decrementNumber); // } // r.updateRow(); // r.close(); // } catch (SQLException e) { // e.printStackTrace(); // System.err.println("\n---SQLException caught---\n" + e.getMessage()); // throw new GettingDataFailedException(); // } // } /** * Method inserts information about product with given description in database * * @param orderProduct * @return id of inserted product * @throws TransactionRollbackedException * @throws TransactionFailedException */ public int insertOrderedProduct(Product orderProduct) throws TransactionRollbackedException, TransactionFailedException { Integer id = 0; try { insertProduct.setString(1, orderProduct.getTitle()); insertProduct.setDouble(2, orderProduct.getPrice()); // if (conn.getAutoCommit()) { // conn.setAutoCommit(false); // wasAutoCommit = true; // } else { // wasAutoCommit = false; // } insertProduct.executeUpdate(); ResultSet r = insertProduct.executeQuery("SELECT * FROM products ORDER BY product_id DESC LIMIT 1"); r.next(); id = r.getInt("product_id"); // conn.commit(); // if (wasAutoCommit) { // conn.setAutoCommit(true); // } r.close(); } catch (SQLException e) { // try { // conn.rollback(); // if (wasAutoCommit) { // conn.setAutoCommit(true); // } e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); // throw new TransactionRollbackedException(); // } catch (SQLException ex) { // throw new TransactionFailedException(); // } } return id; } public Collection<Product> getOrderedProducts() throws GettingDataFailedException { ArrayList products = new ArrayList(); try { ResultSet rs = selectProducts.executeQuery(); while (rs.next()) { int productID = rs.getInt("product_id"); products.add(new Product(productID, rs.getString("title"), rs.getDouble("price"))); } rs.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } return products; } public void close() throws ConnectionFailedException { try { insertProduct.close(); conn.close(); } catch (SQLException e) { throw new ConnectionFailedException(); } } }
UTF-8
Java
8,488
java
RdbOrderedProductDAO.java
Java
[]
null
[]
package DAO.rdbDAO; import DAO.GettingDataFailedException; import DAO.ConnectionFailedException; import DAO.rdbDAO.rdb_transfer_objects.Product; import DAO.*; import java.sql.*; import java.util.Collection; import java.util.ArrayList; public class RdbOrderedProductDAO extends OrderedProductDAO { private Connection conn; private PreparedStatement insertProduct; private PreparedStatement selectProducts; private PreparedStatement selectProduct; // public Product getProduct() { // org.hibernate.Session session = HibernateUtil.getSession(); // System.out.println("SBFB: HIBERNATE SESSION GET"); // System.out.println("SBFB: HIBERNATE TRYING TO GET TEST (ID=1)"); // return (Product) session.load(Product.class, new Long(1)); // } public RdbOrderedProductDAO(Connection conn) throws GettingDataFailedException { this.conn = conn; try { insertProduct = conn.prepareStatement("INSERT INTO products (title, price) VALUES (?,?)", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); selectProducts = conn.prepareStatement("SELECT * FROM products"); selectProduct = conn.prepareStatement("SELECT * FROM products WHERE product_id=?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); } catch (SQLException e) { throw new GettingDataFailedException(); } } public void setLastFill(int productID, long lastFill) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); r.updateLong("last_fill", lastFill); r.updateRow(); r.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public void setLastMail(int productID, long lastMail) throws GettingDataFailedException { try { System.out.println("Setting last mail.. product id=" + productID); System.out.println("Setting last mail.. date=" + lastMail); selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); r.updateLong("last_mail", lastMail); r.updateRow(); r.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public long getLastFill(int productID) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); return r.getLong("last_fill"); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public long getLastMail(int productID) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); return r.getLong("last_mail"); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public int getWarehouseAmount(int productID) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); return r.getInt("warehouse_amount"); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } public void setWarehouseAmount(int productID, int newAmount) throws GettingDataFailedException { try { selectProduct.setInt(1, productID); ResultSet r = selectProduct.executeQuery(); r.next(); r.updateInt("warehouse_amount", newAmount); r.updateRow(); r.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } } // public void changeWarehouseAmount(int productID, int decrementNumber) // throws GettingDataFailedException, WarehouseProductAmountException { // try { // selectProduct.setInt(1, productID); // ResultSet r = selectProduct.executeQuery(); // r.next(); // int amountDB = r.getInt("warehouse_amount"); // // System.err.println("Product id " + productID + "amount " // + amountDB + "decrement " + decrementNumber); // // if ((amountDB - decrementNumber) <= 0) { // System.err.println("Throwing Earehouse amount <0 " + (amountDB - decrementNumber)); //// //// r.updateInt("warehouse_amount", 0); // throw new WarehouseProductAmountException(); // } else { // r.updateInt("warehouse_amount", amountDB - decrementNumber); // } // r.updateRow(); // r.close(); // } catch (SQLException e) { // e.printStackTrace(); // System.err.println("\n---SQLException caught---\n" + e.getMessage()); // throw new GettingDataFailedException(); // } // } /** * Method inserts information about product with given description in database * * @param orderProduct * @return id of inserted product * @throws TransactionRollbackedException * @throws TransactionFailedException */ public int insertOrderedProduct(Product orderProduct) throws TransactionRollbackedException, TransactionFailedException { Integer id = 0; try { insertProduct.setString(1, orderProduct.getTitle()); insertProduct.setDouble(2, orderProduct.getPrice()); // if (conn.getAutoCommit()) { // conn.setAutoCommit(false); // wasAutoCommit = true; // } else { // wasAutoCommit = false; // } insertProduct.executeUpdate(); ResultSet r = insertProduct.executeQuery("SELECT * FROM products ORDER BY product_id DESC LIMIT 1"); r.next(); id = r.getInt("product_id"); // conn.commit(); // if (wasAutoCommit) { // conn.setAutoCommit(true); // } r.close(); } catch (SQLException e) { // try { // conn.rollback(); // if (wasAutoCommit) { // conn.setAutoCommit(true); // } e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); // throw new TransactionRollbackedException(); // } catch (SQLException ex) { // throw new TransactionFailedException(); // } } return id; } public Collection<Product> getOrderedProducts() throws GettingDataFailedException { ArrayList products = new ArrayList(); try { ResultSet rs = selectProducts.executeQuery(); while (rs.next()) { int productID = rs.getInt("product_id"); products.add(new Product(productID, rs.getString("title"), rs.getDouble("price"))); } rs.close(); } catch (SQLException e) { e.printStackTrace(); System.err.println("\n---SQLException caught---\n" + e.getMessage()); throw new GettingDataFailedException(); } return products; } public void close() throws ConnectionFailedException { try { insertProduct.close(); conn.close(); } catch (SQLException e) { throw new ConnectionFailedException(); } } }
8,488
0.575518
0.573633
227
36.392071
27.155621
112
false
false
0
0
0
0
0
0
0.643172
false
false
4
c5641ce6506eb35bc9668227a1494cd1ac20df6a
27,831,388,100,348
7cf7fbfce7bd5ea71fa28dd6420ed4d42a6288ba
/Applications/Networks/test/Callback/CallbackApp/MsgCallbackHolder.java
3fcf9f0e7de804e1cd1f1e52da8fb38251a167f5
[]
no_license
kev7/Java
https://github.com/kev7/Java
84dcb107de72443e499635cd8d968b0cedfefc6e
8a92163819c0bce3e1188cac11768a2a8b405bcc
refs/heads/master
2018-12-30T00:49:00.180000
2014-10-30T12:05:41
2014-10-30T12:05:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package CallbackApp; /** * CallbackApp/MsgCallbackHolder.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from CallbackExample.idl * niedziela, 28 kwiecień 2013 20:47:44 CEST */ public final class MsgCallbackHolder implements org.omg.CORBA.portable.Streamable { public CallbackApp.MsgCallback value = null; public MsgCallbackHolder () { } public MsgCallbackHolder (CallbackApp.MsgCallback initialValue) { value = initialValue; } public void _read (org.omg.CORBA.portable.InputStream i) { value = CallbackApp.MsgCallbackHelper.read (i); } public void _write (org.omg.CORBA.portable.OutputStream o) { CallbackApp.MsgCallbackHelper.write (o, value); } public org.omg.CORBA.TypeCode _type () { return CallbackApp.MsgCallbackHelper.type (); } }
WINDOWS-1250
Java
823
java
MsgCallbackHolder.java
Java
[ { "context": "table), version \"3.2\"\n* from CallbackExample.idl\n* niedziela, 28 kwiecień 2013 20:47:44 CEST\n*/\n\npublic final ", "end": 169, "score": 0.8145478367805481, "start": 160, "tag": "NAME", "value": "niedziela" } ]
null
[]
package CallbackApp; /** * CallbackApp/MsgCallbackHolder.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from CallbackExample.idl * niedziela, 28 kwiecień 2013 20:47:44 CEST */ public final class MsgCallbackHolder implements org.omg.CORBA.portable.Streamable { public CallbackApp.MsgCallback value = null; public MsgCallbackHolder () { } public MsgCallbackHolder (CallbackApp.MsgCallback initialValue) { value = initialValue; } public void _read (org.omg.CORBA.portable.InputStream i) { value = CallbackApp.MsgCallbackHelper.read (i); } public void _write (org.omg.CORBA.portable.OutputStream o) { CallbackApp.MsgCallbackHelper.write (o, value); } public org.omg.CORBA.TypeCode _type () { return CallbackApp.MsgCallbackHelper.type (); } }
823
0.723844
0.706813
38
20.631578
24.633547
81
false
false
0
0
0
0
0
0
0.236842
false
false
4
bd5cf455aa550568f79eda5b06ff4c4cdda9f2e8
28,424,093,610,538
10f30d7ac8584521f0958d009d6e508a63bb4879
/IntegrationTests/src/test/java/com/kvitka/integration/tests/admin/commiss/scheme/findByA/FindSchemeByAgentConfiguration.java
4dda9de6559a24696e59a33bd81c1ab868a982c3
[]
no_license
JobTest/Kvitka
https://github.com/JobTest/Kvitka
6234fbb2d111018a210b9787fb11c3bd0129d53a
e67946dbd517e5ba7b91784d906b2170510f9d65
refs/heads/master
2016-08-03T06:08:09.417000
2015-09-22T15:00:14
2015-09-22T15:00:14
42,940,685
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kvitka.integration.tests.admin.commiss.scheme.findByA; import com.kvitka.admin.dao.api.commiss.scheme.FindSchemeByAgentResultI; import com.kvitka.admin.dao.implementation.AdminServicesDao; import com.kvitka.integration.tests.admin.commiss.scheme.SchemeConfigurationAbs; import com.kvitka.integration.tests.core.profiles.Profiles; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Profile; import java.util.Collections; public class FindSchemeByAgentConfiguration extends SchemeConfigurationAbs { @Bean public AdminServicesDao mockDaoSuccessful() { return mockDao(FindSchemeByAgentFixtures.getMockDao()); } @Bean @Profile(Profiles.Menu.List.EMPTY_LIST) @Primary public AdminServicesDao mockEmptyList() { return mockDao(Collections.<FindSchemeByAgentResultI>emptyList()); } }
UTF-8
Java
942
java
FindSchemeByAgentConfiguration.java
Java
[]
null
[]
package com.kvitka.integration.tests.admin.commiss.scheme.findByA; import com.kvitka.admin.dao.api.commiss.scheme.FindSchemeByAgentResultI; import com.kvitka.admin.dao.implementation.AdminServicesDao; import com.kvitka.integration.tests.admin.commiss.scheme.SchemeConfigurationAbs; import com.kvitka.integration.tests.core.profiles.Profiles; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Profile; import java.util.Collections; public class FindSchemeByAgentConfiguration extends SchemeConfigurationAbs { @Bean public AdminServicesDao mockDaoSuccessful() { return mockDao(FindSchemeByAgentFixtures.getMockDao()); } @Bean @Profile(Profiles.Menu.List.EMPTY_LIST) @Primary public AdminServicesDao mockEmptyList() { return mockDao(Collections.<FindSchemeByAgentResultI>emptyList()); } }
942
0.803609
0.803609
26
35.23077
29.007038
80
false
false
0
0
0
0
0
0
0.423077
false
false
4
25db097306ffd5fdcbc0e5f29511a0d38273dcf2
22,170,621,216,726
430590dcb34527ff6f6ca6d54145a88094b75aaf
/src/test/java/com/oreilly/rxjava/ch6/Repository.java
41e9107d2c29ab48796f2a2fac338851dfa007f9
[]
no_license
ktz-study-repo/rxjava-book-examples
https://github.com/ktz-study-repo/rxjava-book-examples
fd0bec4c3e8a49e33223710f85864af98548be97
e9cb0bfc477de1524117fb07856ed98df5042783
refs/heads/master
2021-01-19T15:54:18.213000
2017-08-22T17:07:43
2017-08-22T17:07:43
100,977,380
0
0
null
true
2017-08-21T17:41:16
2017-08-21T17:41:16
2017-08-21T17:41:12
2016-12-01T09:42:41
127
0
0
0
null
null
null
package com.oreilly.rxjava.ch6; import java.util.List; interface Repository { void store(Record record); void storeAll(List<Record> records); } class SomeRepository implements Repository { @Override public void store(Record record) { System.out.println("store: " + record); } @Override public void storeAll(List<Record> records) { System.out.println("storeAll - nOf records " + records.size()); } }
UTF-8
Java
451
java
Repository.java
Java
[]
null
[]
package com.oreilly.rxjava.ch6; import java.util.List; interface Repository { void store(Record record); void storeAll(List<Record> records); } class SomeRepository implements Repository { @Override public void store(Record record) { System.out.println("store: " + record); } @Override public void storeAll(List<Record> records) { System.out.println("storeAll - nOf records " + records.size()); } }
451
0.669623
0.667406
20
21.549999
20.572979
71
false
false
0
0
0
0
0
0
0.3
false
false
4
747ea6b51ebc88dfdf0acb3e6f96b18197d659b8
3,393,024,194,466
4b0421019fb1e19d7e6d5f6b9bf77ee3eaf1f679
/cdv_website/src/java/com/venvidrio/cdv/loader/ProductosLoader.java
0726062a10a0d4906b652986136b5d68894e26c0
[]
no_license
macor003/programacion-java
https://github.com/macor003/programacion-java
1ce17690da6e0abf39927ab5afad7d6ca2ba1b61
70b1edf2725288ad56f11af6d588fba684dcff26
refs/heads/master
2023-02-21T12:05:31.601000
2023-02-17T03:55:08
2023-02-17T03:55:08
61,124,882
0
0
null
false
2020-10-12T22:36:51
2016-06-14T13:26:52
2020-04-15T01:49:15
2020-10-12T22:36:50
202,872
0
0
3
CSS
false
false
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.venvidrio.cdv.loader; import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; import com.venvidrio.cdv.utility.cdvUtility; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.DecimalFormat; /** * * @author carmonahjd */ public class ProductosLoader { public String getProductosHTML() throws SQLException, FileNotFoundException, IOException{ cdvUtility util=new cdvUtility(); Connection con=util.Conexion(); Statement stmt=null; ResultSet rs=null; DecimalFormat df_precio=new DecimalFormat("#,##0.00"); DecimalFormat df_cantidad=new DecimalFormat("#0"); String html="<div class=\"container\">\n" + " <div class=\"jumbotron\"><center><h1><span class=\"glyphicon glyphicon-glass\"></span> PRODUCTOS</h1></center></div>"; String html2=""; String sql="SELECT \n" + " t_cdv_productos.cdv_id_producto, \n" + " t_cdv_productos.cdv_cod_cia, \n" + " t_cdv_productos.cdv_desc_producto, \n" + " t_cdv_productos.cdv_molde, \n" + " t_cdv_productos.cdv_capacidad_llenado, \n" + " t_cdv_productos.cdv_altura, \n" + " t_cdv_productos.cdv_diametro, \n" + " t_cdv_productos.cdv_tipo_tapa, \n" + " t_cdv_productos.cdv_envases_caja, \n" + " t_cdv_productos.cdv_precio, \n" + " t_cdv_productos.cdv_img_producto, \n" + " t_cdv_productos.cdv_fecha_hora_modif, \n" + " t_cdv_productos.cdv_usuario_modif, \n" + " t_cdv_productos.cdv_nombre_img, \n" + " t_cdv_productos.cdv_estatus \n" + " FROM \n" + " t_cdv_productos \n" + " WHERE \n" + " t_cdv_productos.cdv_estatus = 'A' \n" + " ORDER BY \n" + " t_cdv_productos.cdv_id_producto ASC"; stmt=con.createStatement(); rs=stmt.executeQuery(sql); while(rs.next()){ int cdv_id_producto=rs.getInt("cdv_id_producto"); String cdv_desc_producto=rs.getString("cdv_desc_producto"); String cdv_molde=rs.getString("cdv_molde"); String cdv_capacidad_llenado=rs.getString("cdv_capacidad_llenado"); String cdv_altura=rs.getString("cdv_altura"); String cdv_diametro=rs.getString("cdv_diametro"); String cdv_tipo_tapa=rs.getString("cdv_tipo_tapa"); int cdv_envases_caja=rs.getInt("cdv_envases_caja"); double cdv_precio=rs.getDouble("cdv_precio"); byte[] img_bytea=rs.getBytes("cdv_img_producto"); String img_code=Base64.encode(img_bytea); //System.out.println("CODE = "+img_code); String cdv_nombre_img=rs.getString("cdv_nombre_img"); /*String ruta="C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0\\webapps\\cdv_website\\cdv_imagenes\\"+cdv_nombre_img; OutputStream out = new BufferedOutputStream(new FileOutputStream(ruta)); out.write(img_bytea); out.close();*/ html+="<div class='col-lg-3'>\n" + " <div class='thumbnail item' style=\"background-color: white; box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);\">\n" + " <img src=\"data:image/png;base64,"+img_code+"\" data-toggle=\"modal\" data-target=\"#PopUp"+cdv_id_producto+"\" class=\"img-rounded center-block\" style=\" cursor: pointer; width: 200px; height:200px;\" alt='item'/>\n" + " <h4>"+cdv_desc_producto+"</h4>\n" + " <div class=\"col-lg-4\"><label style=\"font-size: 16px;\">Cantidad:</label></div>\n" + " <div class=\"col-lg-8\"><input name='lm_cantidad_1_"+cdv_id_producto+"' type=\"number\" class=\"form-control\" value=\"0\" style=\"height: 25px;\"></div>\n" + " <button name='lm_cantidad_1_"+cdv_id_producto+"' onclick='AgregarCarrito(this.name)' type=\"button\" class='btn btn-primary btn-block agregar'><i class=\"glyphicon glyphicon-plus\"></i> Agregar al carrito</button>\n" + " </div>\n" + " </div>"; html2+="<div class=\"modal fade\" id=\"PopUp"+cdv_id_producto+"\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n" + " <div class=\"modal-dialog\">\n" + " <div class=\"modal-content\">\n" + " <div class=\"modal-header\">\n" + " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n" + " <h2 class=\"modal-title text-danger\">"+cdv_desc_producto+"</h2>\n" + " </div>\n" + " <div class=\"modal-body\">\n" + " <div class=\"col-lg-8 col-lg-offset-2\">\n" + " <img src=\"data:image/png;base64,"+img_code+"\" class=\"img-thumbnail center-block\" alt=\"\"/><br>\n" + " \n" + " <table class=\"table\">\n" + " <tbody>\n" + " <tr>\n" + " <td><strong>Molde:</strong></td>\n" + " <td>"+cdv_molde+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Capacidad de llenado:</strong></td>\n" + " <td>"+cdv_capacidad_llenado+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Alto:</strong></td>\n" + " <td>"+cdv_altura+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Diámetro:</strong></td>\n" + " <td>"+cdv_diametro+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Tipo de Tapa:</strong></td>\n" + " <td>"+cdv_tipo_tapa+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Envases por Caja:</strong></td>\n" + " <td>"+df_cantidad.format(cdv_envases_caja)+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>P.V.P.</strong></td>\n" + " <td>Bs. "+df_precio.format(cdv_precio)+" (IVA Incluido)</td>\n" + " </tr>\n" + " </tbody>\n" + " </table>\n" + " <div class=\"col-lg-4\"><h4><strong>Cantidad:</strong></h4></div>\n" + " <div class=\"col-lg-8\"><input name='lm_cantidad_2_"+cdv_id_producto+"' type=\"number\" class=\"form-control\" value=\"10\" style=\"height: 35px; font-size: 18px;\"></div>\n" + " <button name='lm_cantidad_2_"+cdv_id_producto+"' onclick='AgregarCarrito(this.name)' class=\"btn btn-primary btn-block\"><span class=\"glyphicon glyphicon-plus\"></span> Agregar</button>\n" + " <button class=\"btn btn-danger btn-block\" data-dismiss=\"modal\"><span class=\"glyphicon glyphicon-remove\"></span> Cerrar</button>\n" + " </div>\n" + " </div>\n" + " <div class=\"modal-footer\">\n" + " \n" + " </div>\n" + " </div>\n" + " </div>\n" + " </div>"; } html+="</div>"; html+=html2; if(rs!=null) rs.close(); if(stmt!=null) stmt.close(); if(con!=null) con.close(); return html; } }
UTF-8
Java
9,110
java
ProductosLoader.java
Java
[ { "context": " java.text.DecimalFormat;\r\n\r\n\r\n/**\r\n *\r\n * @author carmonahjd\r\n */\r\npublic class ProductosLoader {\r\n \r\n p", "end": 590, "score": 0.9995275735855103, "start": 580, "tag": "USERNAME", "value": "carmonahjd" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.venvidrio.cdv.loader; import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; import com.venvidrio.cdv.utility.cdvUtility; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.DecimalFormat; /** * * @author carmonahjd */ public class ProductosLoader { public String getProductosHTML() throws SQLException, FileNotFoundException, IOException{ cdvUtility util=new cdvUtility(); Connection con=util.Conexion(); Statement stmt=null; ResultSet rs=null; DecimalFormat df_precio=new DecimalFormat("#,##0.00"); DecimalFormat df_cantidad=new DecimalFormat("#0"); String html="<div class=\"container\">\n" + " <div class=\"jumbotron\"><center><h1><span class=\"glyphicon glyphicon-glass\"></span> PRODUCTOS</h1></center></div>"; String html2=""; String sql="SELECT \n" + " t_cdv_productos.cdv_id_producto, \n" + " t_cdv_productos.cdv_cod_cia, \n" + " t_cdv_productos.cdv_desc_producto, \n" + " t_cdv_productos.cdv_molde, \n" + " t_cdv_productos.cdv_capacidad_llenado, \n" + " t_cdv_productos.cdv_altura, \n" + " t_cdv_productos.cdv_diametro, \n" + " t_cdv_productos.cdv_tipo_tapa, \n" + " t_cdv_productos.cdv_envases_caja, \n" + " t_cdv_productos.cdv_precio, \n" + " t_cdv_productos.cdv_img_producto, \n" + " t_cdv_productos.cdv_fecha_hora_modif, \n" + " t_cdv_productos.cdv_usuario_modif, \n" + " t_cdv_productos.cdv_nombre_img, \n" + " t_cdv_productos.cdv_estatus \n" + " FROM \n" + " t_cdv_productos \n" + " WHERE \n" + " t_cdv_productos.cdv_estatus = 'A' \n" + " ORDER BY \n" + " t_cdv_productos.cdv_id_producto ASC"; stmt=con.createStatement(); rs=stmt.executeQuery(sql); while(rs.next()){ int cdv_id_producto=rs.getInt("cdv_id_producto"); String cdv_desc_producto=rs.getString("cdv_desc_producto"); String cdv_molde=rs.getString("cdv_molde"); String cdv_capacidad_llenado=rs.getString("cdv_capacidad_llenado"); String cdv_altura=rs.getString("cdv_altura"); String cdv_diametro=rs.getString("cdv_diametro"); String cdv_tipo_tapa=rs.getString("cdv_tipo_tapa"); int cdv_envases_caja=rs.getInt("cdv_envases_caja"); double cdv_precio=rs.getDouble("cdv_precio"); byte[] img_bytea=rs.getBytes("cdv_img_producto"); String img_code=Base64.encode(img_bytea); //System.out.println("CODE = "+img_code); String cdv_nombre_img=rs.getString("cdv_nombre_img"); /*String ruta="C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0\\webapps\\cdv_website\\cdv_imagenes\\"+cdv_nombre_img; OutputStream out = new BufferedOutputStream(new FileOutputStream(ruta)); out.write(img_bytea); out.close();*/ html+="<div class='col-lg-3'>\n" + " <div class='thumbnail item' style=\"background-color: white; box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);\">\n" + " <img src=\"data:image/png;base64,"+img_code+"\" data-toggle=\"modal\" data-target=\"#PopUp"+cdv_id_producto+"\" class=\"img-rounded center-block\" style=\" cursor: pointer; width: 200px; height:200px;\" alt='item'/>\n" + " <h4>"+cdv_desc_producto+"</h4>\n" + " <div class=\"col-lg-4\"><label style=\"font-size: 16px;\">Cantidad:</label></div>\n" + " <div class=\"col-lg-8\"><input name='lm_cantidad_1_"+cdv_id_producto+"' type=\"number\" class=\"form-control\" value=\"0\" style=\"height: 25px;\"></div>\n" + " <button name='lm_cantidad_1_"+cdv_id_producto+"' onclick='AgregarCarrito(this.name)' type=\"button\" class='btn btn-primary btn-block agregar'><i class=\"glyphicon glyphicon-plus\"></i> Agregar al carrito</button>\n" + " </div>\n" + " </div>"; html2+="<div class=\"modal fade\" id=\"PopUp"+cdv_id_producto+"\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n" + " <div class=\"modal-dialog\">\n" + " <div class=\"modal-content\">\n" + " <div class=\"modal-header\">\n" + " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n" + " <h2 class=\"modal-title text-danger\">"+cdv_desc_producto+"</h2>\n" + " </div>\n" + " <div class=\"modal-body\">\n" + " <div class=\"col-lg-8 col-lg-offset-2\">\n" + " <img src=\"data:image/png;base64,"+img_code+"\" class=\"img-thumbnail center-block\" alt=\"\"/><br>\n" + " \n" + " <table class=\"table\">\n" + " <tbody>\n" + " <tr>\n" + " <td><strong>Molde:</strong></td>\n" + " <td>"+cdv_molde+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Capacidad de llenado:</strong></td>\n" + " <td>"+cdv_capacidad_llenado+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Alto:</strong></td>\n" + " <td>"+cdv_altura+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Diámetro:</strong></td>\n" + " <td>"+cdv_diametro+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Tipo de Tapa:</strong></td>\n" + " <td>"+cdv_tipo_tapa+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>Envases por Caja:</strong></td>\n" + " <td>"+df_cantidad.format(cdv_envases_caja)+"</td>\n" + " </tr>\n" + " <tr>\n" + " <td><strong>P.V.P.</strong></td>\n" + " <td>Bs. "+df_precio.format(cdv_precio)+" (IVA Incluido)</td>\n" + " </tr>\n" + " </tbody>\n" + " </table>\n" + " <div class=\"col-lg-4\"><h4><strong>Cantidad:</strong></h4></div>\n" + " <div class=\"col-lg-8\"><input name='lm_cantidad_2_"+cdv_id_producto+"' type=\"number\" class=\"form-control\" value=\"10\" style=\"height: 35px; font-size: 18px;\"></div>\n" + " <button name='lm_cantidad_2_"+cdv_id_producto+"' onclick='AgregarCarrito(this.name)' class=\"btn btn-primary btn-block\"><span class=\"glyphicon glyphicon-plus\"></span> Agregar</button>\n" + " <button class=\"btn btn-danger btn-block\" data-dismiss=\"modal\"><span class=\"glyphicon glyphicon-remove\"></span> Cerrar</button>\n" + " </div>\n" + " </div>\n" + " <div class=\"modal-footer\">\n" + " \n" + " </div>\n" + " </div>\n" + " </div>\n" + " </div>"; } html+="</div>"; html+=html2; if(rs!=null) rs.close(); if(stmt!=null) stmt.close(); if(con!=null) con.close(); return html; } }
9,110
0.435661
0.427426
170
51.576469
43.864063
241
false
false
0
0
0
0
0
0
0.505882
false
false
4
ebfae959e2eee546c140183c94e3a2c2dbb10d65
6,914,897,377,587
2625f052edd8932898ef3c882376152130f5a347
/src/Logica/ColaArreglo.java
b08e12d9a7d7594e75897f6cf82cb4c1bc9eeda1
[]
no_license
arturo-hnavarro/escuelaITProyecto
https://github.com/arturo-hnavarro/escuelaITProyecto
36f52bc69dcbccb2b81746fb01f39c096462399a
0eabdd56cd855b2bc36d7a9223bc56074937cc75
refs/heads/master
2020-12-30T12:11:15.688000
2017-05-19T02:34:23
2017-05-19T02:34:23
91,409,955
0
1
null
false
2017-05-19T02:34:24
2017-05-16T03:26:36
2017-05-16T03:36:05
2017-05-19T02:34:24
58
0
1
0
Java
null
null
/** * File : ColaArreglo.java * @author : Prof. Gilberth Chaves Avila * Date : 2017-05-09 */ package Logica; public class ColaArreglo implements Cola{ //Atributos private Object cola[]; //un arreglo de objetos private int anterior, posterior; //para manejar los extremos de la cola public ColaArreglo(int n) { if(n<=0) System.exit(0); //se sale this.cola = new Object[n]; //creamos el arreglo con el tamano indicado this.posterior=n-1; //el indice del ultimo elemento del arreglo this.anterior = this.posterior; } @Override public int getSize() throws ColaException { return posterior-anterior; } @Override public void anular() { anterior=posterior; } @Override public boolean isEmpty() { return anterior==posterior; } private int getPosReal(int posicion){ int i=0; while(cola[i]==null) i++; return posicion-i; } @Override public int getPosicion(Object elemento) throws ColaException { if(isEmpty()) throw new ColaException("La cola esta vacia"); for(int i=anterior+1;i<=posterior;i++){ if(cola[i].equals(elemento)){ return getPosReal(i); }//if }//for return -1; //el elemento no existe en la cola arreglo } @Override public void encolar(Object elemento) throws ColaException { if(this.getSize()==cola.length) throw new ColaException("La cola esta llena. " + "No se pueden encolar mas elementos"); //cuando la cola esta vacia, no pasar por el for //la primera vez no pasa por el for for(int i=anterior;i<posterior;i++){ cola[i] = cola[i+1]; }//for //la primera vez encola en el extremo posterior //y mueve anterior una posicion a la izquierda cola[posterior] = elemento; //el elemento a encolar //anterior siempre va a quedar a la izq de posterior anterior--; //la idea es q anterior quede en un campo vacio del vector } @Override public Object desencolar() throws ColaException { if(this.isEmpty()) throw new ColaException("La cola esta vacia"); return cola[++anterior]; } @Override public boolean existe(Object elemento) throws ColaException { if(isEmpty()) throw new ColaException("La cola esta vacia"); for(int i=anterior+1;i<=posterior;i++){ if(cola[i].equals(elemento)){ return true; }//if }//for return false; } @Override public Object frente() throws ColaException { if(isEmpty()) throw new ColaException("La cola esta vacia"); return cola[anterior+1]; } @Override public String toString() { String result=""; try { if(this.isEmpty()) throw new ColaException("La cola esta vacia"); result="COLA CON ARREGLOS ESTATICOS\n"; for(int i=anterior+1;i<=posterior;i++){ result +=cola[i]+" "; if ((i+1) % 10 == 0) { result +="\n"; } }//for } catch (ColaException ex) { System.out.println(ex.getMessage()); } return result; } }
UTF-8
Java
3,400
java
ColaArreglo.java
Java
[ { "context": " * File : ColaArreglo.java\n * @author : Prof. Gilberth Chaves Avila\n * Date : 2017-05-09\n */\n\npackage Logica;\npub", "end": 77, "score": 0.9996994733810425, "start": 56, "tag": "NAME", "value": "Gilberth Chaves Avila" } ]
null
[]
/** * File : ColaArreglo.java * @author : Prof. <NAME> * Date : 2017-05-09 */ package Logica; public class ColaArreglo implements Cola{ //Atributos private Object cola[]; //un arreglo de objetos private int anterior, posterior; //para manejar los extremos de la cola public ColaArreglo(int n) { if(n<=0) System.exit(0); //se sale this.cola = new Object[n]; //creamos el arreglo con el tamano indicado this.posterior=n-1; //el indice del ultimo elemento del arreglo this.anterior = this.posterior; } @Override public int getSize() throws ColaException { return posterior-anterior; } @Override public void anular() { anterior=posterior; } @Override public boolean isEmpty() { return anterior==posterior; } private int getPosReal(int posicion){ int i=0; while(cola[i]==null) i++; return posicion-i; } @Override public int getPosicion(Object elemento) throws ColaException { if(isEmpty()) throw new ColaException("La cola esta vacia"); for(int i=anterior+1;i<=posterior;i++){ if(cola[i].equals(elemento)){ return getPosReal(i); }//if }//for return -1; //el elemento no existe en la cola arreglo } @Override public void encolar(Object elemento) throws ColaException { if(this.getSize()==cola.length) throw new ColaException("La cola esta llena. " + "No se pueden encolar mas elementos"); //cuando la cola esta vacia, no pasar por el for //la primera vez no pasa por el for for(int i=anterior;i<posterior;i++){ cola[i] = cola[i+1]; }//for //la primera vez encola en el extremo posterior //y mueve anterior una posicion a la izquierda cola[posterior] = elemento; //el elemento a encolar //anterior siempre va a quedar a la izq de posterior anterior--; //la idea es q anterior quede en un campo vacio del vector } @Override public Object desencolar() throws ColaException { if(this.isEmpty()) throw new ColaException("La cola esta vacia"); return cola[++anterior]; } @Override public boolean existe(Object elemento) throws ColaException { if(isEmpty()) throw new ColaException("La cola esta vacia"); for(int i=anterior+1;i<=posterior;i++){ if(cola[i].equals(elemento)){ return true; }//if }//for return false; } @Override public Object frente() throws ColaException { if(isEmpty()) throw new ColaException("La cola esta vacia"); return cola[anterior+1]; } @Override public String toString() { String result=""; try { if(this.isEmpty()) throw new ColaException("La cola esta vacia"); result="COLA CON ARREGLOS ESTATICOS\n"; for(int i=anterior+1;i<=posterior;i++){ result +=cola[i]+" "; if ((i+1) % 10 == 0) { result +="\n"; } }//for } catch (ColaException ex) { System.out.println(ex.getMessage()); } return result; } }
3,385
0.564118
0.557647
113
29.088495
21.989763
78
false
false
0
0
0
0
0
0
0.389381
false
false
4
78efaa00737dca21c4b18f55eeb9e637b6b92a68
15,779,709,900,125
bcbf780f9ebec179abc70a7f1a064973b7c0a6ec
/mdp-admin-server/src/main/java/com/miotech/mdp/common/model/dao/UsersEntity.java
54a301d9cf25622998f1632c74fc6ccdf10ed715
[]
no_license
balzaron/mdp
https://github.com/balzaron/mdp
993f7d7ff2245fdcbff82958a52100847812b27b
41b0694afaf95423ecb06eea3ece04c90d68bcd0
refs/heads/master
2022-07-15T23:01:22.509000
2020-04-08T03:32:58
2020-04-08T03:32:58
253,976,372
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.miotech.mdp.common.model.dao; import com.fasterxml.jackson.annotation.JsonFormat; import com.miotech.mdp.common.model.BaseEntity; import lombok.Data; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Table(name = "users", schema = "public") @Data @GenericGenerator(name = "custom_id", strategy = "com.miotech.mdp.common.jpa.CustomIdentifierGenerator") public class UsersEntity extends BaseEntity { @Id @GeneratedValue(generator = "custom_id") @Column(name = "id",columnDefinition = "varchar (200)") private String id; @Column(name = "user_name") private String username; @Column(name = "user_info") private String userInfo; @Column(name = "last_login") private LocalDateTime lastLogin; @Column(name = "is_active") private Boolean isActive = true; @Column(name = "create_time") @JsonFormat(timezone = "GMT+0", pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") private LocalDateTime createTime = LocalDateTime.now(); @Column(name = "update_time") @JsonFormat(timezone = "GMT+0", pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") private LocalDateTime updateTime = LocalDateTime.now(); }
UTF-8
Java
1,233
java
UsersEntity.java
Java
[]
null
[]
package com.miotech.mdp.common.model.dao; import com.fasterxml.jackson.annotation.JsonFormat; import com.miotech.mdp.common.model.BaseEntity; import lombok.Data; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.time.LocalDateTime; @Entity @Table(name = "users", schema = "public") @Data @GenericGenerator(name = "custom_id", strategy = "com.miotech.mdp.common.jpa.CustomIdentifierGenerator") public class UsersEntity extends BaseEntity { @Id @GeneratedValue(generator = "custom_id") @Column(name = "id",columnDefinition = "varchar (200)") private String id; @Column(name = "user_name") private String username; @Column(name = "user_info") private String userInfo; @Column(name = "last_login") private LocalDateTime lastLogin; @Column(name = "is_active") private Boolean isActive = true; @Column(name = "create_time") @JsonFormat(timezone = "GMT+0", pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") private LocalDateTime createTime = LocalDateTime.now(); @Column(name = "update_time") @JsonFormat(timezone = "GMT+0", pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") private LocalDateTime updateTime = LocalDateTime.now(); }
1,233
0.706407
0.702352
41
29.073172
25.181671
104
false
false
0
0
0
0
0
0
0.463415
false
false
4
2a56b74465040b8f5debb96c908b2551af1e5f5e
2,284,922,627,537
fc97069a0b4701fd7ee5d489e94abbfdba273066
/src/main/java/androidx/core/view/accessibility/AccessibilityViewCommand$ScrollToPositionArguments.java
f199ed0460108f08a9a88d0f3fec4fd8d976e7a8
[]
no_license
bellmit/zycami-ded
https://github.com/bellmit/zycami-ded
8604f1eb24fb767e4cf499e019d6e4568451bb4b
27686ca846de6d164692c81bac2ae7f85710361f
refs/heads/main
2023-06-17T20:36:29.589000
2021-07-19T18:58:18
2021-07-19T18:58:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Decompiled with CFR 0.151. */ package androidx.core.view.accessibility; import androidx.core.view.accessibility.AccessibilityViewCommand$CommandArguments; public final class AccessibilityViewCommand$ScrollToPositionArguments extends AccessibilityViewCommand$CommandArguments { public int getColumn() { return this.mBundle.getInt("android.view.accessibility.action.ARGUMENT_COLUMN_INT"); } public int getRow() { return this.mBundle.getInt("android.view.accessibility.action.ARGUMENT_ROW_INT"); } }
UTF-8
Java
540
java
AccessibilityViewCommand$ScrollToPositionArguments.java
Java
[]
null
[]
/* * Decompiled with CFR 0.151. */ package androidx.core.view.accessibility; import androidx.core.view.accessibility.AccessibilityViewCommand$CommandArguments; public final class AccessibilityViewCommand$ScrollToPositionArguments extends AccessibilityViewCommand$CommandArguments { public int getColumn() { return this.mBundle.getInt("android.view.accessibility.action.ARGUMENT_COLUMN_INT"); } public int getRow() { return this.mBundle.getInt("android.view.accessibility.action.ARGUMENT_ROW_INT"); } }
540
0.766667
0.759259
17
30.705883
32.932667
92
false
false
0
0
0
0
0
0
0.235294
false
false
4
ae201f444b271294fb44ba8cbcc9621e0e01d0bc
21,139,829,047,372
5218d9711a90e9c361c5119fe9a20a027adad30b
/src/main/java/template_method/strategy/enums/MedicineType.java
22828fc096ffb23a798a63d99ae053822aa4df74
[]
no_license
currentperson/CodogDesignPattern
https://github.com/currentperson/CodogDesignPattern
22160daef7f34507cf6cc9c1459e40cd71a45b58
556de025da50f72c1dba9943794ae4b5a650f45a
refs/heads/master
2022-06-21T17:11:45.891000
2020-08-31T10:36:08
2020-08-31T10:36:08
208,385,047
1
0
null
false
2022-05-20T21:19:04
2019-09-14T03:48:06
2020-10-14T09:52:42
2022-05-20T21:19:03
181
1
0
1
Java
false
false
package template_method.strategy.enums; import lombok.Getter; /** * 药物类型列表 */ @Getter public enum MedicineType { //消炎药 ANTICATARRHALS, //活血化瘀药 BLOOD_CIRCULATION_DRUGS, //蚂蚁大力丸 ANT_POWERFUL_PILL, //没有药 NULL }
UTF-8
Java
289
java
MedicineType.java
Java
[]
null
[]
package template_method.strategy.enums; import lombok.Getter; /** * 药物类型列表 */ @Getter public enum MedicineType { //消炎药 ANTICATARRHALS, //活血化瘀药 BLOOD_CIRCULATION_DRUGS, //蚂蚁大力丸 ANT_POWERFUL_PILL, //没有药 NULL }
289
0.636735
0.636735
18
12.611111
10.73488
39
false
false
0
0
0
0
0
0
0.277778
false
false
4
9ee4404ce9a6425f7c7c6eba34b902dfc10e4c9e
14,886,356,689,668
9d040aaaa8bb2fde390628d90cb031bf4119ba5d
/app/src/main/java/tz/co/ubunifusolutions/screens/api/HttpHandler.java
156a9d673f95704ae099e878dcdf7e76f022cdba
[]
no_license
paulloya1984/MeterReadingApp
https://github.com/paulloya1984/MeterReadingApp
7fe9577b6bd2d470f81896dd1ac761c8116af9f5
56ad00c5f1087b6fd952f201e54d550d49d912b9
refs/heads/master
2022-12-26T03:47:35.002000
2020-09-29T10:57:25
2020-09-29T10:57:25
270,992,439
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tz.co.ubunifusolutions.screens.api; import android.util.Log; import android.widget.Toast; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.util.UUID; public class HttpHandler { private static final String TAG = HttpHandler.class.getSimpleName(); public HttpHandler() { } public String makeServiceCall(String reqUrl) { String response = null; try { URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } return response; } public static String makeServiceCall_Upload(String reqUrl, File file) { String uploadId = UUID.randomUUID().toString(); String response = null; int serverResponseCode = 0; DataOutputStream dataOutputStream; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; try { FileInputStream fileInputStream = new FileInputStream(file); URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("uploaded_file", file.getName()); //creating new dataoutputstream dataOutputStream = new DataOutputStream(conn.getOutputStream()); //writing bytes to data outputstream dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd); // dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\"" // + file + "\"" + lineEnd); dataOutputStream.writeBytes( file +""); dataOutputStream.writeBytes(lineEnd); //returns no. of bytes present in fileInputStream bytesAvailable = fileInputStream.available(); //selecting the buffer size as minimum of available bytes or 1 MB bufferSize = Math.min(bytesAvailable, maxBufferSize); //setting the buffer as byte array of size of bufferSize buffer = new byte[bufferSize]; //reads bytes from FileInputStream(from 0th index of buffer to buffersize) bytesRead = fileInputStream.read(buffer, 0, bufferSize); //loop repeats till bytesRead = -1, i.e., no bytes are left to read while (bytesRead > 0) { //write the bytes read from inputstream dataOutputStream.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } // dataOutputStream.writeBytes(lineEnd); // dataOutputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); serverResponseCode = conn.getResponseCode(); String serverResponseMessage = conn.getResponseMessage(); Log.i(TAG, "Server Response is: " + serverResponseMessage + ": " + serverResponseCode); if (serverResponseCode == 200) { Log.i(TAG, "makeServiceCall_Upload: Upload was Successful File Name: "+ file.getName()); // Log.i(TAG, "makeServiceCall_Upload: File "); } else { Log.e(TAG, "makeServiceCall_Upload: Upload Not Successfull File Name " + file.getName() + " Response Code: " + serverResponseCode ); } //closing the input and output streams fileInputStream.close(); dataOutputStream.flush(); dataOutputStream.close(); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } //dialog.dismiss(); //return serverResponseCode; return response = "" + serverResponseCode; } public static String makeServiceCall_Post(String reqUrl, File file) { String response = null; try { URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("uploaded_file", file.getName()); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } return response; } private static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line; try { while ((line = reader.readLine()) != null) { sb.append(line).append('\n'); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } }
UTF-8
Java
7,903
java
HttpHandler.java
Java
[]
null
[]
package tz.co.ubunifusolutions.screens.api; import android.util.Log; import android.widget.Toast; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.util.UUID; public class HttpHandler { private static final String TAG = HttpHandler.class.getSimpleName(); public HttpHandler() { } public String makeServiceCall(String reqUrl) { String response = null; try { URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } return response; } public static String makeServiceCall_Upload(String reqUrl, File file) { String uploadId = UUID.randomUUID().toString(); String response = null; int serverResponseCode = 0; DataOutputStream dataOutputStream; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize; byte[] buffer; int maxBufferSize = 1 * 1024 * 1024; try { FileInputStream fileInputStream = new FileInputStream(file); URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("uploaded_file", file.getName()); //creating new dataoutputstream dataOutputStream = new DataOutputStream(conn.getOutputStream()); //writing bytes to data outputstream dataOutputStream.writeBytes(twoHyphens + boundary + lineEnd); // dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\"" // + file + "\"" + lineEnd); dataOutputStream.writeBytes( file +""); dataOutputStream.writeBytes(lineEnd); //returns no. of bytes present in fileInputStream bytesAvailable = fileInputStream.available(); //selecting the buffer size as minimum of available bytes or 1 MB bufferSize = Math.min(bytesAvailable, maxBufferSize); //setting the buffer as byte array of size of bufferSize buffer = new byte[bufferSize]; //reads bytes from FileInputStream(from 0th index of buffer to buffersize) bytesRead = fileInputStream.read(buffer, 0, bufferSize); //loop repeats till bytesRead = -1, i.e., no bytes are left to read while (bytesRead > 0) { //write the bytes read from inputstream dataOutputStream.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } // dataOutputStream.writeBytes(lineEnd); // dataOutputStream.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd); serverResponseCode = conn.getResponseCode(); String serverResponseMessage = conn.getResponseMessage(); Log.i(TAG, "Server Response is: " + serverResponseMessage + ": " + serverResponseCode); if (serverResponseCode == 200) { Log.i(TAG, "makeServiceCall_Upload: Upload was Successful File Name: "+ file.getName()); // Log.i(TAG, "makeServiceCall_Upload: File "); } else { Log.e(TAG, "makeServiceCall_Upload: Upload Not Successfull File Name " + file.getName() + " Response Code: " + serverResponseCode ); } //closing the input and output streams fileInputStream.close(); dataOutputStream.flush(); dataOutputStream.close(); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } //dialog.dismiss(); //return serverResponseCode; return response = "" + serverResponseCode; } public static String makeServiceCall_Post(String reqUrl, File file) { String response = null; try { URL url = new URL(reqUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("uploaded_file", file.getName()); // read the response InputStream in = new BufferedInputStream(conn.getInputStream()); response = convertStreamToString(in); } catch (MalformedURLException e) { Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (ProtocolException e) { Log.e(TAG, "ProtocolException: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IOException: " + e.getMessage()); } catch (Exception e) { Log.e(TAG, "Exception: " + e.getMessage()); } return response; } private static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line; try { while ((line = reader.readLine()) != null) { sb.append(line).append('\n'); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } }
7,903
0.574718
0.572188
196
39.32143
28.008631
152
false
false
0
0
0
0
0
0
0.734694
false
false
4
3b8e9d0a2a0ada1287f8b892795694b39ba83caa
4,492,535,806,343
a1baf62b7a0ecb76c9b60201557df612d5beee5c
/src/main/java/demo/user/repository/BowlUserRepository.java
8f41bfb3db3f75ffad32933df380c1d53419f08c
[]
no_license
sstoneju/Boot-JPA-Vue
https://github.com/sstoneju/Boot-JPA-Vue
542f8831dd83fed7f44989ab137ffc60bad16a92
32f0e1f390d34b36c825761b13cf7d75ecbb5862
refs/heads/master
2020-04-16T13:19:20.378000
2019-01-16T16:36:53
2019-01-16T16:36:53
165,621,240
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package demo.user.repository; import org.springframework.data.jpa.repository.JpaRepository; import demo.user.domain.BowlUser; public interface BowlUserRepository extends JpaRepository<BowlUser, String>{ }
UTF-8
Java
208
java
BowlUserRepository.java
Java
[]
null
[]
package demo.user.repository; import org.springframework.data.jpa.repository.JpaRepository; import demo.user.domain.BowlUser; public interface BowlUserRepository extends JpaRepository<BowlUser, String>{ }
208
0.836538
0.836538
8
25
28.346075
76
false
false
0
0
0
0
0
0
0.5
false
false
4
251dfa87b6d650446f12cdbbd6e31d9ee0d0e7f4
23,502,061,069,565
b5bac9985707c6d0f417f42d5de0dafb9243622f
/app/src/main/java/dingdong/com/mql/www/compusdingdong/activity/bean/MyUser.java
728f6bec41e0810df0a6d6f9717438a2c4a65537
[]
no_license
MQLX1004/CompusDingdong
https://github.com/MQLX1004/CompusDingdong
b0158a23e756015203a5dec9ffcc56798875f37c
5bc7e6ebc6161a0a28972967da36737714d9a6b3
refs/heads/master
2020-03-18T16:27:02.787000
2018-05-26T14:16:55
2018-05-26T14:16:55
134,965,946
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dingdong.com.mql.www.compusdingdong.activity.bean; import cn.bmob.v3.BmobUser; import cn.bmob.v3.datatype.BmobFile; /** * Bmob用户Bean * Created by MQL on 2018/5/18. */ public class MyUser extends BmobUser { private boolean isPresiden; private String nickname; private BmobFile headPicture; public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public boolean isPresiden() { return isPresiden; } public void setPresiden(boolean presiden) { isPresiden = presiden; } public BmobFile getHeadPicture() { return headPicture; } public void setHeadPicture(BmobFile headPicture) { this.headPicture = headPicture; } }
UTF-8
Java
805
java
MyUser.java
Java
[ { "context": "atatype.BmobFile;\n\n/**\n * Bmob用户Bean\n * Created by MQL on 2018/5/18.\n */\n\npublic class MyUser extends Bm", "end": 161, "score": 0.9992377758026123, "start": 158, "tag": "USERNAME", "value": "MQL" } ]
null
[]
package dingdong.com.mql.www.compusdingdong.activity.bean; import cn.bmob.v3.BmobUser; import cn.bmob.v3.datatype.BmobFile; /** * Bmob用户Bean * Created by MQL on 2018/5/18. */ public class MyUser extends BmobUser { private boolean isPresiden; private String nickname; private BmobFile headPicture; public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public boolean isPresiden() { return isPresiden; } public void setPresiden(boolean presiden) { isPresiden = presiden; } public BmobFile getHeadPicture() { return headPicture; } public void setHeadPicture(BmobFile headPicture) { this.headPicture = headPicture; } }
805
0.667915
0.656679
39
19.538462
17.853889
58
false
false
0
0
0
0
0
0
0.307692
false
false
4
7f3458356c6bcd3e5b640f74173eb430ec94f89f
1,185,411,022,719
e1a64ed987b28dde82a90810fb03fd3d8147bdcc
/src/test/java/com/vcit/country/CountryInfoControllerTest.java
6ef230af9ac35be57ca98bd83d28ed32e15e7de8
[]
no_license
ramuchandran/country
https://github.com/ramuchandran/country
89eb4e9406d29dec9e14b9753ee03c8df21fb09a
1813ff5c7e7d800275ce46144a3568b1bf6924c6
refs/heads/master
2022-11-07T07:29:03.580000
2020-06-28T00:50:48
2020-06-28T00:50:48
275,475,070
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vcit.country; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.containsString; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; //import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @AutoConfigureMockMvc public class CountryInfoControllerTest { @Autowired private MockMvc mockMvc; @Test public void shouldReturnCapital() throws Exception { this.mockMvc.perform(get("/country/captial/tw")).andDo(print()).andExpect(status().isOk()) .andExpect(content().string(containsString("{\"alpha2Code\":\"TW\",\"name\":\"Taiwan\",\"capital\":\"Taipei\"}"))); } @Test public void shouldReturnNotFoundErrorCode() throws Exception { this.mockMvc.perform(get("/country/captial/twa")).andDo(print()) .andExpect(status().is4xxClientError()) .andExpect(status().reason(containsString("Country with the code do not exist"))); } }
UTF-8
Java
1,482
java
CountryInfoControllerTest.java
Java
[]
null
[]
package com.vcit.country; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.containsString; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; //import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @AutoConfigureMockMvc public class CountryInfoControllerTest { @Autowired private MockMvc mockMvc; @Test public void shouldReturnCapital() throws Exception { this.mockMvc.perform(get("/country/captial/tw")).andDo(print()).andExpect(status().isOk()) .andExpect(content().string(containsString("{\"alpha2Code\":\"TW\",\"name\":\"Taiwan\",\"capital\":\"Taipei\"}"))); } @Test public void shouldReturnNotFoundErrorCode() throws Exception { this.mockMvc.perform(get("/country/captial/twa")).andDo(print()) .andExpect(status().is4xxClientError()) .andExpect(status().reason(containsString("Country with the code do not exist"))); } }
1,482
0.799595
0.798246
35
41.342857
35.5961
119
false
false
0
0
0
0
0
0
1.114286
false
false
4
53df082aed66493e2d3f49682ab16762656511dc
24,094,766,551,476
718f40473b7bb6218f38e298a06e514ba0bd23db
/com.epam.bridge.app/src/com/epam/bridge/implementor/TableList.java
38ffa04518da27608c67fb864408adc48dbd1940
[]
no_license
PYEGH/Bridge
https://github.com/PYEGH/Bridge
46a3a8175f7b91db5a75b40f6ba7b71608c45cdc
823317a972a8774a368bec22e66090dd2985effa
refs/heads/master
2021-01-10T16:02:39.922000
2015-12-19T14:15:49
2015-12-19T14:15:49
48,284,412
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epam.bridge.implementor; import java.util.List; import javax.swing.JComponent; import javax.swing.JTable; /** * Table list implementation * @author Pavel * */ public class TableList implements UIList { @Override public JComponent getFilledComponent(List<String> list) { Object columnNames[] = { "Column One" }; // This matrix simulates table with one column String rowData[][] = new String[list.size()][1]; // Filling the matrix for (int i = 0; i < list.size(); i++) { rowData[i][0] = list.get(i); } return new JTable(rowData, columnNames); } }
UTF-8
Java
619
java
TableList.java
Java
[ { "context": ";\r\n\r\n/**\r\n * Table list implementation\r\n * @author Pavel\r\n *\r\n */\r\npublic class TableList implements UILis", "end": 179, "score": 0.9997787475585938, "start": 174, "tag": "NAME", "value": "Pavel" } ]
null
[]
package com.epam.bridge.implementor; import java.util.List; import javax.swing.JComponent; import javax.swing.JTable; /** * Table list implementation * @author Pavel * */ public class TableList implements UIList { @Override public JComponent getFilledComponent(List<String> list) { Object columnNames[] = { "Column One" }; // This matrix simulates table with one column String rowData[][] = new String[list.size()][1]; // Filling the matrix for (int i = 0; i < list.size(); i++) { rowData[i][0] = list.get(i); } return new JTable(rowData, columnNames); } }
619
0.647819
0.642973
30
18.633333
18.927023
58
false
false
0
0
0
0
0
0
1.033333
false
false
4
0c2cdb19eda1d7cff1099eaa99404ecfacaa4e43
8,040,178,788,879
af5232355ce31b768213aa8841b7223b2c1a6f9b
/src/main/java/com/example/springBootDemo/BootStrap/UtilityClass.java
58052bf101c0930d2fc8b7e3ef16454bf7908725
[]
no_license
adeepakb1/Utility
https://github.com/adeepakb1/Utility
7403d8be9f290b8a0152bedfa36119069958493c
cb6c776bec18b7b44decf0a2027e1923f459dc73
refs/heads/master
2020-04-28T22:42:56.253000
2019-03-14T13:31:41
2019-03-14T13:31:41
175,627,610
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.springBootDemo.BootStrap; import com.example.springBootDemo.Model.ErrorUtility; import com.example.springBootDemo.Model.Pnv; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import redis.clients.jedis.Jedis; @Component @PropertySource("classpath:Utility.properties") public class UtilityClass implements CommandLineRunner { @Value("${redis.uata}") String redisHostUata; @Value("${redis.uatb}") String redisHostUatb; String emailId; /*@Autowired Pnv pnv;*/ @Override public void run(String... args) throws Exception { } public Pnv dojedis(String emailId, String env, String toDo) { Pnv pnv = new Pnv(); try{ if (toDo.equalsIgnoreCase("pnv")) { String key = "com.gdn.x:otp:V1-userToken-10001-" + emailId + "-pnv"; String[] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpPnv(otp[0]); } else if (toDo.equalsIgnoreCase("emailRecovery")) { String key = "com.gdn.x:otp:V1-userToken-10001-" + emailId + "-email_recovery_change_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpEmailRecovery(otp[0]); }else if (toDo.equalsIgnoreCase("phoneRecovery")){ String key = "com.gdn.x:otp:V1-userToken-10001-" + emailId + "-phone_recovery_change_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpPhoneRecovery(otp[0]); }else if(toDo.equalsIgnoreCase("changePhoneNumber")){ String key = "com.gdn.x:otp:V1-userToken-10001-"+emailId+"-pnv_to_recovery_email_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpChangePhoneNumber(otp[0]); }else if(toDo.equalsIgnoreCase("forgotPassword")){ String key = "com.gdn.x:otp:V1-userToken-10001-"+emailId+"-forgot_password_phone_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpForgotPassword(otp[0]); }else if(toDo.equalsIgnoreCase("RewardPoint")){ String key = "com.gdn.x:otp:V1-userToken-10001-"+emailId+"-device_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpRewardPoints(otp[0]); } return pnv; }catch (NullPointerException e){ ErrorUtility err = new ErrorUtility(); err.setError("Otp page not open"); err.setErroMessage(e.toString()); return err; } } private Jedis jedisConnect(String env) { String host = env.equalsIgnoreCase("uata") ? redisHostUata : redisHostUatb; return new Jedis(host); } }
UTF-8
Java
3,028
java
UtilityClass.java
Java
[ { "context": "gnoreCase(\"pnv\")) {\n String key = \"com.gdn.x:otp:V1-userToken-10001-\" + emailId + \"-pnv\";\n ", "end": 960, "score": 0.9851929545402527, "start": 951, "tag": "KEY", "value": "com.gdn.x" }, { "context": ") {\n String key = \"com.gdn...
null
[]
package com.example.springBootDemo.BootStrap; import com.example.springBootDemo.Model.ErrorUtility; import com.example.springBootDemo.Model.Pnv; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import redis.clients.jedis.Jedis; @Component @PropertySource("classpath:Utility.properties") public class UtilityClass implements CommandLineRunner { @Value("${redis.uata}") String redisHostUata; @Value("${redis.uatb}") String redisHostUatb; String emailId; /*@Autowired Pnv pnv;*/ @Override public void run(String... args) throws Exception { } public Pnv dojedis(String emailId, String env, String toDo) { Pnv pnv = new Pnv(); try{ if (toDo.equalsIgnoreCase("pnv")) { String key = "<KEY>:otp:V1-userToken-10001-" + emailId + "-pnv"; String[] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpPnv(otp[0]); } else if (toDo.equalsIgnoreCase("emailRecovery")) { String key = "<KEY>:otp:V1-userToken-10001-" + emailId + "-email_recovery_change_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpEmailRecovery(otp[0]); }else if (toDo.equalsIgnoreCase("phoneRecovery")){ String key = "<KEY>:otp:V1-userToken-10001-" + emailId + "-phone_recovery_change_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpPhoneRecovery(otp[0]); }else if(toDo.equalsIgnoreCase("changePhoneNumber")){ String key = "<KEY>:otp:V1-userToken-10001-"+emailId+"-pnv_to_recovery_email_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpChangePhoneNumber(otp[0]); }else if(toDo.equalsIgnoreCase("forgotPassword")){ String key = "com.gdn.x:otp:V1-userToken-10001-"+emailId+"-forgot_password_phone_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpForgotPassword(otp[0]); }else if(toDo.equalsIgnoreCase("RewardPoint")){ String key = "com.gdn.x:otp:V1-userToken-10001-"+emailId+"-device_verification"; String [] otp = jedisConnect(env).get(key).split("-"); pnv.setOtpRewardPoints(otp[0]); } return pnv; }catch (NullPointerException e){ ErrorUtility err = new ErrorUtility(); err.setError("Otp page not open"); err.setErroMessage(e.toString()); return err; } } private Jedis jedisConnect(String env) { String host = env.equalsIgnoreCase("uata") ? redisHostUata : redisHostUatb; return new Jedis(host); } }
3,012
0.615258
0.601387
82
35.92683
31.672787
115
false
false
0
0
0
0
0
0
0.487805
false
false
4
543eb784a4a7bf49406766f9b8405b526b744e78
35,545,149,386,619
7a062a3b000c4562f5b47bc314300b484df21218
/app/src/main/java/lyxh/sdnu/com/testui/Data/SemesterPer.java
85d1764aad734d4880308f3d8a0b9c340f50de3d
[]
no_license
dong-8080/TextUI
https://github.com/dong-8080/TextUI
d9ba921af4ca8c73f697ecc265f64aebdd5a548a
c242f6e2004b7e51db1e590b8417675fcda5f4c2
refs/heads/master
2020-03-29T19:21:22.943000
2018-10-16T07:44:45
2018-10-16T07:44:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lyxh.sdnu.com.testui.Data; public class SemesterPer { public SemesterPer(int targetPer, int actualPer) { this.targetPer = targetPer; this.actualPer = actualPer; } private int targetPer; private int actualPer; public int getTargetPer() { return targetPer; } public void setTargetPer(int targetPer) { this.targetPer = targetPer; } public int getActualPer() { return actualPer; } public void setActualPer(int actualPer) { this.actualPer = actualPer; } }
UTF-8
Java
561
java
SemesterPer.java
Java
[]
null
[]
package lyxh.sdnu.com.testui.Data; public class SemesterPer { public SemesterPer(int targetPer, int actualPer) { this.targetPer = targetPer; this.actualPer = actualPer; } private int targetPer; private int actualPer; public int getTargetPer() { return targetPer; } public void setTargetPer(int targetPer) { this.targetPer = targetPer; } public int getActualPer() { return actualPer; } public void setActualPer(int actualPer) { this.actualPer = actualPer; } }
561
0.636364
0.636364
27
19.777779
16.982199
54
false
false
0
0
0
0
0
0
0.37037
false
false
4
3bed6f888102596733b3647f3bfcbc64d0c1ec4f
30,674,656,452,993
35fee149ce67775da3050ac09ee6af4b72d28938
/app/src/main/java/org/cmucreatelab/flutter_android/ui/relativelayout/StatsRelativeLayout.java
ef9e3d809493dd8f408152fd0316609c5451a80d
[]
no_license
CMU-CREATE-Lab/flutter-app-android
https://github.com/CMU-CREATE-Lab/flutter-app-android
c1668a7b05235911d0d93233d53c310024301a73
015cc7e0f99e1e1e0dd783e5b874a10dd9108dbf
refs/heads/master
2020-04-03T22:04:35.792000
2018-08-10T19:26:51
2018-08-10T19:26:51
59,662,932
4
3
null
false
2018-06-20T17:16:15
2016-05-25T12:52:38
2018-06-15T16:03:47
2018-06-20T17:16:00
11,892
3
2
44
Java
false
null
package org.cmucreatelab.flutter_android.ui.relativelayout; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.RelativeLayout; import org.cmucreatelab.flutter_android.classes.Stat; import org.cmucreatelab.flutter_android.helpers.static_classes.Constants; import org.cmucreatelab.flutter_android.ui.PositionTextView; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; /** * Created by Steve on 3/14/2017. * * StatsRelativeLayout */ public class StatsRelativeLayout extends RelativeLayout { private ArrayList<PositionTextView> views; private Context context; private StatsRelativeLayout instance; private int positionToPixels(int width, int position) { int result = 0; float temp = (float) position / 100; result = (int) (temp * width); return result; } private boolean isViewOverlapping(View v1, View v2) { Log.d(Constants.LOG_TAG, v1.getLeft() + " " + v1.getTop() + " " + v1.getRight() + " " + v1.getBottom()); Log.d(Constants.LOG_TAG, v2.getLeft() + " " + v2.getTop() + " " + v2.getRight() + " " + v2.getBottom()); Rect R1=new Rect(v1.getLeft(), v1.getTop(), v1.getRight(), v1.getBottom()); Rect R2=new Rect(v2.getLeft(), v2.getTop(), v2.getRight(), v2.getBottom()); return R1.intersect(R2); } private void update() { this.removeAllViews(); this.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener); Collections.sort(views, new Comparator<PositionTextView>() { @Override public int compare(PositionTextView positionTextView, PositionTextView t1) { return ((Integer)positionTextView.getPosition()).compareTo(t1.getPosition()); } }); for (int i = 0; i < views.size(); i++) { PositionTextView view = views.get(i); view.setId(i+100); view.setPadding(2,2,2,2); DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); view.measure(displayMetrics.widthPixels, displayMetrics.heightPixels); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (100 - view.getPosition() >= 90) { params.addRule(RelativeLayout.ALIGN_PARENT_START); } else if (100 - view.getPosition() <= 10) { params.addRule(RelativeLayout.ALIGN_PARENT_END); } else { params.setMargins(positionToPixels(instance.getWidth(), view.getPosition()) - view.getWidth() / 2, 0, 0, 0); } view.setLayoutParams(params); this.addView(view); } } private ViewTreeObserver.OnGlobalLayoutListener globalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { for (int i = 0; i < views.size(); i++) { PositionTextView view = views.get(i); RelativeLayout.LayoutParams params = (LayoutParams) view.getLayoutParams(); if (i > 0) { if (isViewOverlapping(view, views.get(i - 1))) { params.addRule(RelativeLayout.BELOW, views.get(i - 1).getId()); } } view.setLayoutParams(params); view.setVisibility(VISIBLE); } instance.getViewTreeObserver().removeOnGlobalLayoutListener(this); } }; private void init(Context context) { views = new ArrayList<>(); this.context = context; this.instance = this; } public StatsRelativeLayout(Context context) { super(context); init(context); } public StatsRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public StatsRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); for (View view : views) { view.setVisibility(VISIBLE); } } public void add(Stat stat, int position) { stat.setVisible(true); stat.setPosition(position); stat.setText(stat.getStatName() + ": " + stat.getPositionTextView().getPosition()); views.add(stat.getPositionTextView()); update(); } public void remove(Stat stat) { stat.setVisible(false); views.remove(stat.getPositionTextView()); update(); } }
UTF-8
Java
5,101
java
StatsRelativeLayout.java
Java
[ { "context": "s;\nimport java.util.Comparator;\n\n/**\n * Created by Steve on 3/14/2017.\n *\n * StatsRelativeLayout\n */\npubli", "end": 714, "score": 0.9896377921104431, "start": 709, "tag": "NAME", "value": "Steve" } ]
null
[]
package org.cmucreatelab.flutter_android.ui.relativelayout; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.RelativeLayout; import org.cmucreatelab.flutter_android.classes.Stat; import org.cmucreatelab.flutter_android.helpers.static_classes.Constants; import org.cmucreatelab.flutter_android.ui.PositionTextView; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; /** * Created by Steve on 3/14/2017. * * StatsRelativeLayout */ public class StatsRelativeLayout extends RelativeLayout { private ArrayList<PositionTextView> views; private Context context; private StatsRelativeLayout instance; private int positionToPixels(int width, int position) { int result = 0; float temp = (float) position / 100; result = (int) (temp * width); return result; } private boolean isViewOverlapping(View v1, View v2) { Log.d(Constants.LOG_TAG, v1.getLeft() + " " + v1.getTop() + " " + v1.getRight() + " " + v1.getBottom()); Log.d(Constants.LOG_TAG, v2.getLeft() + " " + v2.getTop() + " " + v2.getRight() + " " + v2.getBottom()); Rect R1=new Rect(v1.getLeft(), v1.getTop(), v1.getRight(), v1.getBottom()); Rect R2=new Rect(v2.getLeft(), v2.getTop(), v2.getRight(), v2.getBottom()); return R1.intersect(R2); } private void update() { this.removeAllViews(); this.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener); Collections.sort(views, new Comparator<PositionTextView>() { @Override public int compare(PositionTextView positionTextView, PositionTextView t1) { return ((Integer)positionTextView.getPosition()).compareTo(t1.getPosition()); } }); for (int i = 0; i < views.size(); i++) { PositionTextView view = views.get(i); view.setId(i+100); view.setPadding(2,2,2,2); DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); view.measure(displayMetrics.widthPixels, displayMetrics.heightPixels); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); if (100 - view.getPosition() >= 90) { params.addRule(RelativeLayout.ALIGN_PARENT_START); } else if (100 - view.getPosition() <= 10) { params.addRule(RelativeLayout.ALIGN_PARENT_END); } else { params.setMargins(positionToPixels(instance.getWidth(), view.getPosition()) - view.getWidth() / 2, 0, 0, 0); } view.setLayoutParams(params); this.addView(view); } } private ViewTreeObserver.OnGlobalLayoutListener globalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { for (int i = 0; i < views.size(); i++) { PositionTextView view = views.get(i); RelativeLayout.LayoutParams params = (LayoutParams) view.getLayoutParams(); if (i > 0) { if (isViewOverlapping(view, views.get(i - 1))) { params.addRule(RelativeLayout.BELOW, views.get(i - 1).getId()); } } view.setLayoutParams(params); view.setVisibility(VISIBLE); } instance.getViewTreeObserver().removeOnGlobalLayoutListener(this); } }; private void init(Context context) { views = new ArrayList<>(); this.context = context; this.instance = this; } public StatsRelativeLayout(Context context) { super(context); init(context); } public StatsRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public StatsRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); for (View view : views) { view.setVisibility(VISIBLE); } } public void add(Stat stat, int position) { stat.setVisible(true); stat.setPosition(position); stat.setText(stat.getStatName() + ": " + stat.getPositionTextView().getPosition()); views.add(stat.getPositionTextView()); update(); } public void remove(Stat stat) { stat.setVisible(false); views.remove(stat.getPositionTextView()); update(); } }
5,101
0.629092
0.617134
155
31.909678
31.078541
155
false
false
0
0
0
0
0
0
0.683871
false
false
4
bf532e535c7d386be5ab1e6839bcf3f4592d9cc0
39,316,130,640,659
ec4661aede665f593df38c3cedc854da73c933bf
/demo/src/main/java/com/example/demo/core/abstracts/CloudinaryServiceAdaptorService.java
44adcf816f0ce597ebdb94a02bc7ca06ce04403b
[]
no_license
guderhasan/projectHrms
https://github.com/guderhasan/projectHrms
33da56bcd0130af4fde4f8fc84e9d15125ae8c85
e42756f35387abf1d39f72439b268f184a7f07ed
refs/heads/main
2023-07-29T01:09:41.791000
2021-09-11T11:06:12
2021-09-11T11:06:12
401,330,222
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.core.abstracts; import java.io.IOException; import org.springframework.web.multipart.MultipartFile; public interface CloudinaryServiceAdaptorService { void uploadImage(MultipartFile multipartFile) throws IOException; String getUrl(); String getUrl(String url); }
UTF-8
Java
293
java
CloudinaryServiceAdaptorService.java
Java
[]
null
[]
package com.example.demo.core.abstracts; import java.io.IOException; import org.springframework.web.multipart.MultipartFile; public interface CloudinaryServiceAdaptorService { void uploadImage(MultipartFile multipartFile) throws IOException; String getUrl(); String getUrl(String url); }
293
0.829352
0.829352
11
25.636364
23.2507
66
false
false
0
0
0
0
0
0
0.545455
false
false
4
7ae4e716bfa93037b3a2be73d462f253b909faf3
2,147,483,707,866
5f42d999715deeccb6e6af533247b891f461d871
/idea_test/code_iostream/src/com/io/file/filedelete/FileDelete.java
dd3f32c2e34bfb0e4b108f03cfa05554873b444d
[]
no_license
flexibleq/JavaRepository
https://github.com/flexibleq/JavaRepository
6c5ee21f2cebeae1449bec84f8dc419e4a8b8bc6
e44378a4f3cce87c522caf4f5f20feaa570f0ffa
refs/heads/master
2021-08-06T22:21:39.319000
2019-12-08T00:39:19
2019-12-08T00:39:19
226,594,549
0
0
null
false
2020-10-13T18:03:12
2019-12-08T00:35:11
2019-12-08T00:43:19
2020-10-13T18:03:11
18,390
0
0
1
Java
false
false
package com.io.file.filedelete; import java.io.File; import java.io.IOException; /* * File类删除功能 * public boolean delete():删除由此抽象路径名表示的文件或目录 * */ public class FileDelete { public static void main(String[] args) throws IOException { //在当前模块目录下创建java.txt文件 File f1 = new File("code_iostream\\java.txt"); //System.out.println(f1.createNewFile()); //删除当前模块目录下的java.txt文件 System.out.println(f1.delete()); System.out.println("--------------------"); //在当前模块目录下创建itcast目录 File f2 = new File("code_iostream\\itcast"); //System.out.println(f2.mkdir()); //删除当前模块目录下的itcast目录 System.out.println(f2.delete()); System.out.println("-----------------------"); //在当前模块目录下创建一个目录itcast,然后在该目录下创建一个文件java.txt File f3 = new File("code_iostream\\itcast"); System.out.println(f3.mkdir()); File f4 = new File("code_iostream\\itcast\\java.txt"); System.out.println(f4.createNewFile()); //删除当前模块目录下的itcast目录 //如果一个目录中有内容(目录,文件),不能直接删除 //应该先删除目录中的内容,最后才能删除目录 System.out.println(f4.delete()); System.out.println(f3.delete()); } }
UTF-8
Java
1,499
java
FileDelete.java
Java
[]
null
[]
package com.io.file.filedelete; import java.io.File; import java.io.IOException; /* * File类删除功能 * public boolean delete():删除由此抽象路径名表示的文件或目录 * */ public class FileDelete { public static void main(String[] args) throws IOException { //在当前模块目录下创建java.txt文件 File f1 = new File("code_iostream\\java.txt"); //System.out.println(f1.createNewFile()); //删除当前模块目录下的java.txt文件 System.out.println(f1.delete()); System.out.println("--------------------"); //在当前模块目录下创建itcast目录 File f2 = new File("code_iostream\\itcast"); //System.out.println(f2.mkdir()); //删除当前模块目录下的itcast目录 System.out.println(f2.delete()); System.out.println("-----------------------"); //在当前模块目录下创建一个目录itcast,然后在该目录下创建一个文件java.txt File f3 = new File("code_iostream\\itcast"); System.out.println(f3.mkdir()); File f4 = new File("code_iostream\\itcast\\java.txt"); System.out.println(f4.createNewFile()); //删除当前模块目录下的itcast目录 //如果一个目录中有内容(目录,文件),不能直接删除 //应该先删除目录中的内容,最后才能删除目录 System.out.println(f4.delete()); System.out.println(f3.delete()); } }
1,499
0.601006
0.590947
40
28.825001
20.170383
63
false
false
0
0
0
0
0
0
0.45
false
false
4
31ede16e43d21530500665d0b955b6d019edef58
22,497,038,719,345
bd90c2d7176a1ba6f40f45f0c83d0ef1c763bc6d
/src/Pass2.java
672088d27f1ff9507ca3957c878df8eb07f624d4
[]
no_license
SumitBharsawade/Assembler-using-javaswing
https://github.com/SumitBharsawade/Assembler-using-javaswing
0b8eed78e65a4b967e89ab5c6f3a0ce14701b429
e39bda66fadd82cb0ee2bcba9cde559f568b9bdb
refs/heads/master
2020-05-02T17:45:53.176000
2019-04-17T14:36:21
2019-04-17T14:36:21
178,108,608
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; public class Pass2 { BufferedReader b1; BufferedReader b2; BufferedReader b3; Pass2(String syttab,String inttab,String littab)throws IOException { b1 = new BufferedReader(new FileReader(inttab)); b2 = new BufferedReader(new FileReader(syttab)); b3 = new BufferedReader(new FileReader(littab)); } public void compute() throws IOException { FileWriter f1 = new FileWriter(System.getProperty("user.dir")+"\\Pass2.txt");//get refrence to pass2.txt file HashMap<Integer, String> symSymbol = new HashMap<Integer, String>(); HashMap<Integer, String> litSymbol = new HashMap<Integer, String>(); HashMap<Integer, String> litAddr = new HashMap<Integer, String>(); String s; int symtabPointer=0,littabPointer=0,offset; while((s=b2.readLine())!=null) { String word[]=s.split("\t"); //System.out.println("-->>>"+symtabPointer++ +"-->"+word[1]); symSymbol.put(symtabPointer++,word[1]); } while((s=b3.readLine())!=null) { String word[]=s.split("\t"); litSymbol.put(littabPointer,word[0]); litAddr.put(littabPointer++,word[1]); } //understood to baghu while((s=b1.readLine())!=null){ if(s.substring(1,6).compareToIgnoreCase("IS,00")==0){ f1.write("+ 00 0 000\n"); } else if(s.substring(1,3).compareToIgnoreCase("IS")==0){ f1.write("+ "+s.substring(4,6)+" "); if(s.charAt(9)==')') { f1.write(s.charAt(8)+" "); offset=3; } else { f1.write("0 "); offset=0; } if(s.charAt(8+offset)=='S') f1.write(symSymbol.get(Integer.parseInt(s.substring(10+offset,s.length()-1)))+"\n"); else if(s.charAt(8+offset)=='C'&&s.charAt(9+offset)=='C') { f1.write(litAddr.get(Integer.parseInt(s.substring(11+offset,s.length()-1)))+"\n"); } else{ f1.write(litAddr.get(Integer.parseInt(s.substring(10+offset,s.length()-1)))+"\n"); } } else if(s.substring(1,6).compareToIgnoreCase("DL,01")==0){ String s1=s.substring(10,s.length()-1); String s2=""; for(int i=0;i<3-s1.length();i++) s2+="0"; s2+=s1; f1.write("+ 00 0 "+s2+"\n"); } else{f1.write("\n");} } f1.close(); b1.close(); b2.close(); b3.close(); } }
UTF-8
Java
2,323
java
Pass2.java
Java
[]
null
[]
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; public class Pass2 { BufferedReader b1; BufferedReader b2; BufferedReader b3; Pass2(String syttab,String inttab,String littab)throws IOException { b1 = new BufferedReader(new FileReader(inttab)); b2 = new BufferedReader(new FileReader(syttab)); b3 = new BufferedReader(new FileReader(littab)); } public void compute() throws IOException { FileWriter f1 = new FileWriter(System.getProperty("user.dir")+"\\Pass2.txt");//get refrence to pass2.txt file HashMap<Integer, String> symSymbol = new HashMap<Integer, String>(); HashMap<Integer, String> litSymbol = new HashMap<Integer, String>(); HashMap<Integer, String> litAddr = new HashMap<Integer, String>(); String s; int symtabPointer=0,littabPointer=0,offset; while((s=b2.readLine())!=null) { String word[]=s.split("\t"); //System.out.println("-->>>"+symtabPointer++ +"-->"+word[1]); symSymbol.put(symtabPointer++,word[1]); } while((s=b3.readLine())!=null) { String word[]=s.split("\t"); litSymbol.put(littabPointer,word[0]); litAddr.put(littabPointer++,word[1]); } //understood to baghu while((s=b1.readLine())!=null){ if(s.substring(1,6).compareToIgnoreCase("IS,00")==0){ f1.write("+ 00 0 000\n"); } else if(s.substring(1,3).compareToIgnoreCase("IS")==0){ f1.write("+ "+s.substring(4,6)+" "); if(s.charAt(9)==')') { f1.write(s.charAt(8)+" "); offset=3; } else { f1.write("0 "); offset=0; } if(s.charAt(8+offset)=='S') f1.write(symSymbol.get(Integer.parseInt(s.substring(10+offset,s.length()-1)))+"\n"); else if(s.charAt(8+offset)=='C'&&s.charAt(9+offset)=='C') { f1.write(litAddr.get(Integer.parseInt(s.substring(11+offset,s.length()-1)))+"\n"); } else{ f1.write(litAddr.get(Integer.parseInt(s.substring(10+offset,s.length()-1)))+"\n"); } } else if(s.substring(1,6).compareToIgnoreCase("DL,01")==0){ String s1=s.substring(10,s.length()-1); String s2=""; for(int i=0;i<3-s1.length();i++) s2+="0"; s2+=s1; f1.write("+ 00 0 "+s2+"\n"); } else{f1.write("\n");} } f1.close(); b1.close(); b2.close(); b3.close(); } }
2,323
0.625054
0.587602
94
23.69149
24.954437
111
false
false
0
0
0
0
0
0
2.904255
false
false
4
630161de0246325b83bffa434d1e7f1a94efb50b
26,852,135,601,333
66c91aacc13478a82be7fe044e6b53984e004f66
/Shopping/src/main/java/com/shopping/controller/BoardController.java
a1edca41b0d0e74b434835ece607c7977f9a3721
[]
no_license
ljwoon94/Shopping
https://github.com/ljwoon94/Shopping
2dd85cf4d0f193fa545a01c54da582b49efb193d
5f8807e88794662906f1d5cd024bb28ec54318a0
refs/heads/master
2023-03-29T10:39:24.139000
2021-03-25T09:54:20
2021-03-25T09:54:20
322,459,159
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shopping.controller; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.shopping.domain.Board; import com.shopping.domain.CodeLabelValue; import com.shopping.domain.Member; import com.shopping.domain.PageRequest; import com.shopping.domain.Pagination; import com.shopping.security.domain.CustomUser; import com.shopping.service.BoardService; @Controller @RequestMapping("/board") public class BoardController { @Autowired private BoardService service; @GetMapping(value="/register") @PreAuthorize("hasRole('ROLE_ADMIN','ROLE_MEMBER')") public void registerForm(Model model, Authentication authentication) throws Exception{ //로그인한 사용자 정보 획득 CustomUser customUser = (CustomUser) authentication.getPrincipal(); Member member = customUser.getMember(); Board board = new Board(); //로그인한 사용자 아이디를 등록화면에 표시 board.setWriter(member.getUserId()); model.addAttribute(board); } @PostMapping(value="/register") @PreAuthorize("hasRole('ROLE_ADMIN','ROLE_MEMBER')") public String register(Board board, RedirectAttributes rttr) throws Exception{ service.register(board); rttr.addFlashAttribute("msg","SUCCESS"); return "redirect:/board/list"; } @GetMapping(value="/list") public void list(@ModelAttribute("pgrq") PageRequest pageRequest, Model model) throws Exception{ //뷰에 페이징 처리를 한 게시글 목록을 전달한다. model.addAttribute("list",service.list(pageRequest)); //페이징 네비게이션 정보를 뷰에 전달한다. Pagination pagination = new Pagination(); pagination.setPageRequest(pageRequest); //페이지 네비게이션 정보에 검색처ㅗ리된 게시글 건수를 저장한다. pagination.setTotalCount(service.count(pageRequest)); model.addAttribute("pagination",pagination); //검색유형의 코드명과 코드값을 정의한다. List<CodeLabelValue> searchTypeCodeValueList = new ArrayList<CodeLabelValue>(); searchTypeCodeValueList.add(new CodeLabelValue("n","---")); searchTypeCodeValueList.add(new CodeLabelValue("t","Title")); searchTypeCodeValueList.add(new CodeLabelValue("c","Content")); searchTypeCodeValueList.add(new CodeLabelValue("w","Writer")); searchTypeCodeValueList.add(new CodeLabelValue("tc","Title OR Content")); searchTypeCodeValueList.add(new CodeLabelValue("cw","Content OR Writer")); searchTypeCodeValueList.add(new CodeLabelValue("tcw","Title OR Content OR Writer")); model.addAttribute("searchTypeCodeValueList", searchTypeCodeValueList); } //회원 게시글 상세화면 @GetMapping(value="/read") public void read(int boardNo,@ModelAttribute("pgrq") PageRequest pageRequest, Model model) throws Exception{ Board board =service.read(boardNo); model.addAttribute(board); } //게시글 수정 화면 @GetMapping(value="/modify") @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MEMBER')") public void modifyForm(int boardNo,@ModelAttribute("pgrq") PageRequest pageRequest, Model model) throws Exception{ //조회한 게시글 상세정보를 뷰에 전달한다. Board board = service.read(boardNo); model.addAttribute(board); } //게시글 수정 @PostMapping(value="/modify") @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MEMBER')") public String modify(Board board,PageRequest pageRequest, RedirectAttributes rttr) throws Exception{ service.modify(board); //RedirectAttributes 객체에 일회성 데이터를 지정하여 전달한다. rttr.addAttribute("page",pageRequest.getPage()); //검색 유형과 검색어를 뷰에 전달한다. rttr.addAttribute("searchType",pageRequest.getSearchType()); rttr.addAttribute("keyword", pageRequest.getKeyword()); rttr.addFlashAttribute("msg", "SUCCESS"); return "redirect:/board/list"; } //게시글 삭제 @PostMapping(value="/remove") @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MEMBER')") public String remove(int boardNo, PageRequest pageRequest, RedirectAttributes rttr) throws Exception{ service.remove(boardNo); //RedirectAttributes 객체에 일회성 데이터를 지정하여 전달한다. rttr.addAttribute("page",pageRequest.getPage()); //검색 유형과 검색어를 뷰에 전달한다. rttr.addAttribute("searchType",pageRequest.getSearchType()); rttr.addAttribute("keyword", pageRequest.getKeyword()); rttr.addFlashAttribute("msg","SUCCESS"); return "redirect:/board/list"; } }
UTF-8
Java
5,043
java
BoardController.java
Java
[]
null
[]
package com.shopping.controller; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.shopping.domain.Board; import com.shopping.domain.CodeLabelValue; import com.shopping.domain.Member; import com.shopping.domain.PageRequest; import com.shopping.domain.Pagination; import com.shopping.security.domain.CustomUser; import com.shopping.service.BoardService; @Controller @RequestMapping("/board") public class BoardController { @Autowired private BoardService service; @GetMapping(value="/register") @PreAuthorize("hasRole('ROLE_ADMIN','ROLE_MEMBER')") public void registerForm(Model model, Authentication authentication) throws Exception{ //로그인한 사용자 정보 획득 CustomUser customUser = (CustomUser) authentication.getPrincipal(); Member member = customUser.getMember(); Board board = new Board(); //로그인한 사용자 아이디를 등록화면에 표시 board.setWriter(member.getUserId()); model.addAttribute(board); } @PostMapping(value="/register") @PreAuthorize("hasRole('ROLE_ADMIN','ROLE_MEMBER')") public String register(Board board, RedirectAttributes rttr) throws Exception{ service.register(board); rttr.addFlashAttribute("msg","SUCCESS"); return "redirect:/board/list"; } @GetMapping(value="/list") public void list(@ModelAttribute("pgrq") PageRequest pageRequest, Model model) throws Exception{ //뷰에 페이징 처리를 한 게시글 목록을 전달한다. model.addAttribute("list",service.list(pageRequest)); //페이징 네비게이션 정보를 뷰에 전달한다. Pagination pagination = new Pagination(); pagination.setPageRequest(pageRequest); //페이지 네비게이션 정보에 검색처ㅗ리된 게시글 건수를 저장한다. pagination.setTotalCount(service.count(pageRequest)); model.addAttribute("pagination",pagination); //검색유형의 코드명과 코드값을 정의한다. List<CodeLabelValue> searchTypeCodeValueList = new ArrayList<CodeLabelValue>(); searchTypeCodeValueList.add(new CodeLabelValue("n","---")); searchTypeCodeValueList.add(new CodeLabelValue("t","Title")); searchTypeCodeValueList.add(new CodeLabelValue("c","Content")); searchTypeCodeValueList.add(new CodeLabelValue("w","Writer")); searchTypeCodeValueList.add(new CodeLabelValue("tc","Title OR Content")); searchTypeCodeValueList.add(new CodeLabelValue("cw","Content OR Writer")); searchTypeCodeValueList.add(new CodeLabelValue("tcw","Title OR Content OR Writer")); model.addAttribute("searchTypeCodeValueList", searchTypeCodeValueList); } //회원 게시글 상세화면 @GetMapping(value="/read") public void read(int boardNo,@ModelAttribute("pgrq") PageRequest pageRequest, Model model) throws Exception{ Board board =service.read(boardNo); model.addAttribute(board); } //게시글 수정 화면 @GetMapping(value="/modify") @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MEMBER')") public void modifyForm(int boardNo,@ModelAttribute("pgrq") PageRequest pageRequest, Model model) throws Exception{ //조회한 게시글 상세정보를 뷰에 전달한다. Board board = service.read(boardNo); model.addAttribute(board); } //게시글 수정 @PostMapping(value="/modify") @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MEMBER')") public String modify(Board board,PageRequest pageRequest, RedirectAttributes rttr) throws Exception{ service.modify(board); //RedirectAttributes 객체에 일회성 데이터를 지정하여 전달한다. rttr.addAttribute("page",pageRequest.getPage()); //검색 유형과 검색어를 뷰에 전달한다. rttr.addAttribute("searchType",pageRequest.getSearchType()); rttr.addAttribute("keyword", pageRequest.getKeyword()); rttr.addFlashAttribute("msg", "SUCCESS"); return "redirect:/board/list"; } //게시글 삭제 @PostMapping(value="/remove") @PreAuthorize("hasAnyRole('ROLE_ADMIN','ROLE_MEMBER')") public String remove(int boardNo, PageRequest pageRequest, RedirectAttributes rttr) throws Exception{ service.remove(boardNo); //RedirectAttributes 객체에 일회성 데이터를 지정하여 전달한다. rttr.addAttribute("page",pageRequest.getPage()); //검색 유형과 검색어를 뷰에 전달한다. rttr.addAttribute("searchType",pageRequest.getSearchType()); rttr.addAttribute("keyword", pageRequest.getKeyword()); rttr.addFlashAttribute("msg","SUCCESS"); return "redirect:/board/list"; } }
5,043
0.767528
0.767528
126
35.563492
26.938643
115
false
false
0
0
0
0
0
0
1.992064
false
false
4
07a9479dcd0daa8378685630a42d11a573663051
22,016,002,425,116
cf7a1dce1a16176f1d23619b90524e082fcb463f
/app/src/main/java/com/example/shakeel/books/MainActivity.java
901b85f7b94d9177fea48588368642e059b94fc2
[]
no_license
ShakeelAhmed12/Books
https://github.com/ShakeelAhmed12/Books
85db71cb42f4f4f64ce4722ba00887dfa7ff7a1d
c2676dda77f8aded8b5b1d5521c7448c1e26509d
refs/heads/master
2021-04-12T09:32:20.743000
2018-03-23T18:07:33
2018-03-23T18:07:33
126,522,405
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.shakeel.books; import android.app.LoaderManager; import android.content.Context; import android.content.Loader; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<List<Books>> { private static final String URL = "https://www.googleapis.com/books/v1/volumes?q="; private String newURL; private static final int BOOKS_LOADER_ID = 1; private EditText editTextSearchQuery; private TextView emptyTextView; private ImageButton searchBttn; private BooksAdapter mAdapter; private boolean isConnected; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView booksListView = findViewById(R.id.list); emptyTextView = findViewById(R.id.empty_text); booksListView.setEmptyView(emptyTextView); mAdapter = new BooksAdapter(this, new ArrayList<Books>()); ConnectivityManager connectivityManager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); booksListView.setAdapter(mAdapter); editTextSearchQuery = findViewById(R.id.search_bar); searchBttn = findViewById(R.id.search_icon); searchBttn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { search(editTextSearchQuery.getText().toString()); } }); } private void search(String Query){ newURL = URL + Query; Log.e("MainActivity", newURL); if(isConnected){ getLoaderManager().restartLoader(BOOKS_LOADER_ID, null, this); LoaderManager loaderManager = getLoaderManager(); loaderManager.initLoader(BOOKS_LOADER_ID, null, this); }else{ emptyTextView.setText(R.string.no_internet); Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_SHORT).show(); } } @Override public Loader<List<Books>> onCreateLoader(int i, Bundle bundle) { return new BooksLoader(this, newURL); } @Override public void onLoadFinished(Loader<List<Books>> loader, List<Books> books) { emptyTextView.setText(R.string.no_books); mAdapter.clear(); if(books != null && !books.isEmpty()){ mAdapter.addAll(books); } } @Override public void onLoaderReset(Loader<List<Books>> loader) { mAdapter.clear(); } }
UTF-8
Java
3,262
java
MainActivity.java
Java
[ { "context": "package com.example.shakeel.books;\n\nimport android.app.LoaderManager;\nimport ", "end": 27, "score": 0.6495475769042969, "start": 25, "tag": "USERNAME", "value": "el" } ]
null
[]
package com.example.shakeel.books; import android.app.LoaderManager; import android.content.Context; import android.content.Loader; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<List<Books>> { private static final String URL = "https://www.googleapis.com/books/v1/volumes?q="; private String newURL; private static final int BOOKS_LOADER_ID = 1; private EditText editTextSearchQuery; private TextView emptyTextView; private ImageButton searchBttn; private BooksAdapter mAdapter; private boolean isConnected; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView booksListView = findViewById(R.id.list); emptyTextView = findViewById(R.id.empty_text); booksListView.setEmptyView(emptyTextView); mAdapter = new BooksAdapter(this, new ArrayList<Books>()); ConnectivityManager connectivityManager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo(); isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); booksListView.setAdapter(mAdapter); editTextSearchQuery = findViewById(R.id.search_bar); searchBttn = findViewById(R.id.search_icon); searchBttn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { search(editTextSearchQuery.getText().toString()); } }); } private void search(String Query){ newURL = URL + Query; Log.e("MainActivity", newURL); if(isConnected){ getLoaderManager().restartLoader(BOOKS_LOADER_ID, null, this); LoaderManager loaderManager = getLoaderManager(); loaderManager.initLoader(BOOKS_LOADER_ID, null, this); }else{ emptyTextView.setText(R.string.no_internet); Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_SHORT).show(); } } @Override public Loader<List<Books>> onCreateLoader(int i, Bundle bundle) { return new BooksLoader(this, newURL); } @Override public void onLoadFinished(Loader<List<Books>> loader, List<Books> books) { emptyTextView.setText(R.string.no_books); mAdapter.clear(); if(books != null && !books.isEmpty()){ mAdapter.addAll(books); } } @Override public void onLoaderReset(Loader<List<Books>> loader) { mAdapter.clear(); } }
3,262
0.698651
0.697731
101
31.297029
28.237516
124
false
false
0
0
0
0
0
0
0.633663
false
false
4
eafb25c7feae6aa17e5a58fd70a1d13148f0a804
15,659,450,783,145
23afde5563920a7e4892328c13d04c1eba094595
/src/test/java/com/googlecode/charts4j/example/MapChartExample.java
811e690c2e83bc29b83a90a70fb9bd20c07f028f
[ "MIT" ]
permissive
wcluckyguy/charts4j
https://github.com/wcluckyguy/charts4j
dbfa34f593be6a08223eba9569f1fad625624322
08201256063f8de7c19d5cc18dab112c7b9953b7
refs/heads/master
2023-03-21T17:56:13.947000
2020-10-12T18:25:48
2020-10-19T22:03:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * * The MIT License * * Copyright (c) 2011 the original author or authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.googlecode.charts4j.example; import static com.googlecode.charts4j.Color.*; import static com.googlecode.charts4j.USAState.Code.*; import static com.googlecode.charts4j.UrlUtil.normalize; import static org.junit.Assert.assertEquals; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.BeforeClass; import org.junit.Test; import com.googlecode.charts4j.Fills; import com.googlecode.charts4j.GCharts; import com.googlecode.charts4j.GeographicalArea; import com.googlecode.charts4j.MapChart; import com.googlecode.charts4j.PoliticalBoundary; import com.googlecode.charts4j.USAState; /** * * @author Julien Chastang (julien.c.chastang at gmail dot com) */ public class MapChartExample { @BeforeClass public static void setUpBeforeClass() throws Exception { Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).setLevel(Level.ALL); } @Test public void example1() { // EXAMPLE CODE START MapChart chart = GCharts.newMapChart(GeographicalArea.USA); PoliticalBoundary al = new USAState( AL, 10); PoliticalBoundary ak = new USAState( AK, 10); PoliticalBoundary az = new USAState( AZ, 10); PoliticalBoundary ar = new USAState( AR, 10); PoliticalBoundary ca = new USAState( CA, 90); PoliticalBoundary co = new USAState( CO, 50); PoliticalBoundary ct = new USAState( CT, 90); PoliticalBoundary de = new USAState( DE, 90); PoliticalBoundary fl = new USAState( FL, 50); PoliticalBoundary ga = new USAState( GA, 10); PoliticalBoundary hi = new USAState( HI, 90); PoliticalBoundary id = new USAState( ID, 10); PoliticalBoundary il = new USAState( IL, 90); PoliticalBoundary in = new USAState( IN, 50); PoliticalBoundary ia = new USAState( IA, 50); PoliticalBoundary ks = new USAState( KS, 10); PoliticalBoundary ky = new USAState( KY, 10); PoliticalBoundary la = new USAState( LA, 10); PoliticalBoundary me = new USAState( ME, 50); PoliticalBoundary md = new USAState( MD, 90); PoliticalBoundary ma = new USAState( MA, 90); PoliticalBoundary mi = new USAState( MI, 90); PoliticalBoundary mn = new USAState( MN, 90); PoliticalBoundary ms = new USAState( MS, 10); PoliticalBoundary mo = new USAState( MO, 10); PoliticalBoundary mt = new USAState( MT, 90); PoliticalBoundary ne = new USAState( NE, 10); PoliticalBoundary nv = new USAState( NV, 90); PoliticalBoundary nh = new USAState( NH, 90); PoliticalBoundary nj = new USAState( NJ, 90); PoliticalBoundary nm = new USAState( NM, 50); PoliticalBoundary ny = new USAState( NY, 90); PoliticalBoundary nc = new USAState( NC, 50); PoliticalBoundary nd = new USAState( ND, 90); PoliticalBoundary oh = new USAState( OH, 90); PoliticalBoundary ok = new USAState( OK, 10); PoliticalBoundary or = new USAState( OR, 90); PoliticalBoundary pa = new USAState( PA, 50); PoliticalBoundary ri = new USAState( RI, 90); PoliticalBoundary sc = new USAState( SC, 50); PoliticalBoundary sd = new USAState( SD, 10); PoliticalBoundary tn = new USAState( TN, 10); PoliticalBoundary tx = new USAState( TX, 10); PoliticalBoundary ut = new USAState( UT, 10); PoliticalBoundary vt = new USAState( VT, 90); PoliticalBoundary va = new USAState( VA, 50); PoliticalBoundary wa = new USAState( WA, 90); PoliticalBoundary wv = new USAState( WV, 10); PoliticalBoundary wi = new USAState( WI, 90); PoliticalBoundary wy = new USAState( WY, 10); chart.addPoliticalBoundaries(al,ak,az,ar,ca,co,ct,de,fl,ga,hi,id,il,in,ia,ks,ky,la,me,md,ma,mi,mn,ms,mo,mt,ne,nv,nh,nj,nm,ny,nc,nd,oh,ok,or,pa,ri,sc,sd,tn,tx,ut,vt,va,wa,wv,wi,wy); chart.setColorGradient(WHITE, RED, BLUE); chart.setBackgroundFill(Fills.newSolidFill(ALICEBLUE)); String url = chart.toURLString(); // EXAMPLE CODE END. Use this url string in your web or // Internet application. Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(url); String expectedString = "http://chart.apis.google.com/chart?chf=bg,s,F0F8FF&chs=440x220&chd=e:GaGaGaGa5mgA5m5mgAGa5mGa5mgAgAGaGaGagA5m5m5m5mGaGa5mGa5m5m5mgA5mgA5m5mGa5mgA5mgAGaGaGaGa5mgA5mGa5mGa&chtm=usa&chco=FFFFFF,FF0000,0000FF&chld=ALAKAZARCACOCTDEFLGAHIIDILINIAKSKYLAMEMDMAMIMNMSMOMTNENVNHNJNMNYNCNDOHOKORPARISCSDTNTXUTVTVAWAWVWIWY&cht=t"; assertEquals("Junit error", normalize(expectedString), normalize(url)); } }
UTF-8
Java
5,836
java
MapChartExample.java
Java
[ { "context": "m.googlecode.charts4j.USAState;\n\n/**\n *\n * @author Julien Chastang (julien.c.chastang at gmail dot com)\n */\npublic c", "end": 1819, "score": 0.9998819231987, "start": 1804, "tag": "NAME", "value": "Julien Chastang" }, { "context": "s4j.USAState;\n\n/**\n *\n * @au...
null
[]
/** * * The MIT License * * Copyright (c) 2011 the original author or authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.googlecode.charts4j.example; import static com.googlecode.charts4j.Color.*; import static com.googlecode.charts4j.USAState.Code.*; import static com.googlecode.charts4j.UrlUtil.normalize; import static org.junit.Assert.assertEquals; import java.util.logging.Level; import java.util.logging.Logger; import org.junit.BeforeClass; import org.junit.Test; import com.googlecode.charts4j.Fills; import com.googlecode.charts4j.GCharts; import com.googlecode.charts4j.GeographicalArea; import com.googlecode.charts4j.MapChart; import com.googlecode.charts4j.PoliticalBoundary; import com.googlecode.charts4j.USAState; /** * * @author <NAME> (<EMAIL> at gmail dot com) */ public class MapChartExample { @BeforeClass public static void setUpBeforeClass() throws Exception { Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).setLevel(Level.ALL); } @Test public void example1() { // EXAMPLE CODE START MapChart chart = GCharts.newMapChart(GeographicalArea.USA); PoliticalBoundary al = new USAState( AL, 10); PoliticalBoundary ak = new USAState( AK, 10); PoliticalBoundary az = new USAState( AZ, 10); PoliticalBoundary ar = new USAState( AR, 10); PoliticalBoundary ca = new USAState( CA, 90); PoliticalBoundary co = new USAState( CO, 50); PoliticalBoundary ct = new USAState( CT, 90); PoliticalBoundary de = new USAState( DE, 90); PoliticalBoundary fl = new USAState( FL, 50); PoliticalBoundary ga = new USAState( GA, 10); PoliticalBoundary hi = new USAState( HI, 90); PoliticalBoundary id = new USAState( ID, 10); PoliticalBoundary il = new USAState( IL, 90); PoliticalBoundary in = new USAState( IN, 50); PoliticalBoundary ia = new USAState( IA, 50); PoliticalBoundary ks = new USAState( KS, 10); PoliticalBoundary ky = new USAState( KY, 10); PoliticalBoundary la = new USAState( LA, 10); PoliticalBoundary me = new USAState( ME, 50); PoliticalBoundary md = new USAState( MD, 90); PoliticalBoundary ma = new USAState( MA, 90); PoliticalBoundary mi = new USAState( MI, 90); PoliticalBoundary mn = new USAState( MN, 90); PoliticalBoundary ms = new USAState( MS, 10); PoliticalBoundary mo = new USAState( MO, 10); PoliticalBoundary mt = new USAState( MT, 90); PoliticalBoundary ne = new USAState( NE, 10); PoliticalBoundary nv = new USAState( NV, 90); PoliticalBoundary nh = new USAState( NH, 90); PoliticalBoundary nj = new USAState( NJ, 90); PoliticalBoundary nm = new USAState( NM, 50); PoliticalBoundary ny = new USAState( NY, 90); PoliticalBoundary nc = new USAState( NC, 50); PoliticalBoundary nd = new USAState( ND, 90); PoliticalBoundary oh = new USAState( OH, 90); PoliticalBoundary ok = new USAState( OK, 10); PoliticalBoundary or = new USAState( OR, 90); PoliticalBoundary pa = new USAState( PA, 50); PoliticalBoundary ri = new USAState( RI, 90); PoliticalBoundary sc = new USAState( SC, 50); PoliticalBoundary sd = new USAState( SD, 10); PoliticalBoundary tn = new USAState( TN, 10); PoliticalBoundary tx = new USAState( TX, 10); PoliticalBoundary ut = new USAState( UT, 10); PoliticalBoundary vt = new USAState( VT, 90); PoliticalBoundary va = new USAState( VA, 50); PoliticalBoundary wa = new USAState( WA, 90); PoliticalBoundary wv = new USAState( WV, 10); PoliticalBoundary wi = new USAState( WI, 90); PoliticalBoundary wy = new USAState( WY, 10); chart.addPoliticalBoundaries(al,ak,az,ar,ca,co,ct,de,fl,ga,hi,id,il,in,ia,ks,ky,la,me,md,ma,mi,mn,ms,mo,mt,ne,nv,nh,nj,nm,ny,nc,nd,oh,ok,or,pa,ri,sc,sd,tn,tx,ut,vt,va,wa,wv,wi,wy); chart.setColorGradient(WHITE, RED, BLUE); chart.setBackgroundFill(Fills.newSolidFill(ALICEBLUE)); String url = chart.toURLString(); // EXAMPLE CODE END. Use this url string in your web or // Internet application. Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(url); String expectedString = "http://chart.apis.google.com/chart?chf=bg,s,F0F8FF&chs=440x220&chd=e:GaGaGaGa5mgA5m5mgAGa5mGa5mgAgAGaGaGagA5m5m5m5mGaGa5mGa5m5m5mgA5mgA5m5mGa5mgA5mgAGaGaGaGa5mgA5mGa5mGa&chtm=usa&chco=FFFFFF,FF0000,0000FF&chld=ALAKAZARCACOCTDEFLGAHIIDILINIAKSKYLAMEMDMAMIMNMSMOMTNENVNHNJNMNYNCNDOHOKORPARISCSDTNTXUTVTVAWAWVWIWY&cht=t"; assertEquals("Junit error", normalize(expectedString), normalize(url)); } }
5,817
0.699109
0.673064
124
46.064518
38.700619
351
false
false
0
0
0
0
105
0.035127
1.637097
false
false
4
7500a695a0a51af63dc632e6640bf2ed77a31752
2,723,009,299,576
053d5038f8d524d0a682fa4c066773b9c60d3374
/query/sources/common/src/main/java/org/codice/ddf/admin/sources/utils/SourceUtilCommons.java
80071bd55d3ff572721e479a6534b8aa8e2cc9bd
[]
no_license
jlcsmith/admin-console-beta
https://github.com/jlcsmith/admin-console-beta
1e72c322df5461f8ea25f06bf8707a78e09149fb
c48fb9fa470d64a58bd9fb16f20b47ae09481012
refs/heads/master
2020-12-02T19:30:46.287000
2017-06-27T21:17:13
2017-06-27T21:17:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright (c) Codice Foundation * <p> * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the * License, or any later version. * <p> * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. A copy of the GNU Lesser General Public License * is distributed along with this program and can be found at * <http://www.gnu.org/licenses/lgpl.html>. */ package org.codice.ddf.admin.sources.utils; import static org.codice.ddf.admin.common.report.message.DefaultMessages.failedPersistError; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.function.Function; import javax.xml.namespace.NamespaceContext; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.lang.StringUtils; import org.codice.ddf.admin.api.report.Report; import org.codice.ddf.admin.common.fields.base.scalar.BooleanField; import org.codice.ddf.admin.common.fields.common.PidField; import org.codice.ddf.admin.common.report.ReportImpl; import org.codice.ddf.admin.common.services.ServiceCommons; import org.codice.ddf.admin.configurator.ConfiguratorFactory; import org.codice.ddf.admin.sources.fields.type.SourceConfigField; import org.codice.ddf.internal.admin.configurator.actions.ManagedServiceActions; import org.codice.ddf.internal.admin.configurator.actions.ServiceActions; import org.codice.ddf.internal.admin.configurator.actions.ServiceReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import ddf.catalog.service.ConfiguredService; import ddf.catalog.source.ConnectedSource; import ddf.catalog.source.FederatedSource; import ddf.catalog.source.Source; public class SourceUtilCommons { private static final Logger LOGGER = LoggerFactory.getLogger(SourceUtilCommons.class); private ServiceCommons serviceCommons; private ManagedServiceActions managedServiceActions; private ServiceActions serviceActions; private ServiceReader serviceReader; private ConfiguratorFactory configuratorFactory; public SourceUtilCommons() { } /** * @param managedServiceActions service to interact with managed service configurations * @param serviceActions service to interact with admin configurations * @param serviceReader service to query service state * @param configuratorFactory service to create {@link org.codice.ddf.admin.configurator.Configurator}s */ public SourceUtilCommons(ManagedServiceActions managedServiceActions, ServiceActions serviceActions, ServiceReader serviceReader, ConfiguratorFactory configuratorFactory) { this.managedServiceActions = managedServiceActions; this.serviceActions = serviceActions; this.serviceReader = serviceReader; this.configuratorFactory = configuratorFactory; serviceCommons = new ServiceCommons(managedServiceActions, serviceActions, serviceReader, configuratorFactory); } public static final NamespaceContext SOURCES_NAMESPACE_CONTEXT = new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { switch (prefix) { case "ows": return "http://www.opengis.net/ows"; case "wfs": return "http://www.opengis.net/wfs/2.0"; case "os": case "opensearch": return "http://a9.com/-/spec/opensearch/1.1/"; default: return null; } } @Override public String getPrefix(String namespaceURI) { switch (namespaceURI) { case "http://www.opengis.net/ows": return "ows"; case "http://www.opengis.net/wfs/2.0": return "wfs"; case "http://a9.com/-/spec/opensearch/1.1/": return "os"; default: return null; } } @Override public Iterator getPrefixes(String namespaceURI) { return null; } }; public Document createDocument(String body) throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); return factory.newDocumentBuilder() .parse(new InputSource(new StringReader(body))); } public List<Source> getAllSourceReferences() { if (serviceReader == null) { LOGGER.debug("Unable to get source references due to missing serviceReader"); return Collections.emptyList(); } List<Source> sources = new ArrayList<>(); sources.addAll(serviceReader.getServices(FederatedSource.class, null)); sources.addAll(serviceReader.getServices(ConnectedSource.class, null)); return sources; } /** * Gets the configurations for the given factoryPids using the actions provided. A mapper is used * to transform the service properties to a {@link SourceConfigField}. Providing the pid parameter * will return only the configuration with that pid. * * @param factoryPids factory pids to lookup configurations for * @param mapper a {@link Function} taking a map of string to objects and returning a {@code SourceConfigField} * @param pid a servicePid to select a single configuration, returns all configs when null or empty * @return a list of {@code SourceInfoField}s configured in the system */ public List<SourceConfigField> getSourceConfigurations(List<String> factoryPids, Function<Map<String, Object>, SourceConfigField> mapper, String pid) { if (serviceActions == null || managedServiceActions == null) { LOGGER.debug( "Unable to get source configurations due to missing serviceActions or managedServiceActions"); return Collections.emptyList(); } List<SourceConfigField> sourceInfoListField = new ArrayList<>(); if (StringUtils.isNotEmpty(pid)) { SourceConfigField config = mapper.apply(serviceActions.read(pid)); sourceInfoListField.add(config); return sourceInfoListField; } factoryPids.stream() .flatMap(factoryPid -> managedServiceActions.read(factoryPid) .values() .stream()) .map(mapper) .forEach(sourceInfoListField::add); return sourceInfoListField; } public Report saveSource(PidField pid, Map<String, Object> serviceProps, String factoryPid) { ReportImpl saveSourceReport = new ReportImpl(); if (StringUtils.isNotEmpty(pid.getValue())) { saveSourceReport.addMessages(serviceCommons.updateService(pid, serviceProps)); } else { if (serviceCommons.createManagedService(serviceProps, factoryPid) .containsErrorMsgs()) { saveSourceReport.addResultMessage(failedPersistError()); } } return saveSourceReport; } public void populateAvailability(BooleanField availability, PidField pid) { for (Source source : getAllSourceReferences()) { if (source instanceof ConfiguredService) { ConfiguredService service = (ConfiguredService) source; if (service.getConfigurationPid() .equals(pid.getValue())) { availability.setValue(source.isAvailable()); break; } } } } public void setManagedServiceActions(ManagedServiceActions managedServiceActions) { this.managedServiceActions = managedServiceActions; } public void setServiceActions(ServiceActions serviceActions) { this.serviceActions = serviceActions; } public void setServiceReader(ServiceReader serviceReader) { this.serviceReader = serviceReader; } public void setConfiguratorFactory(ConfiguratorFactory configuratorFactory) { this.configuratorFactory = configuratorFactory; } }
UTF-8
Java
8,805
java
SourceUtilCommons.java
Java
[]
null
[]
/** * Copyright (c) Codice Foundation * <p> * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation, either version 3 of the * License, or any later version. * <p> * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. A copy of the GNU Lesser General Public License * is distributed along with this program and can be found at * <http://www.gnu.org/licenses/lgpl.html>. */ package org.codice.ddf.admin.sources.utils; import static org.codice.ddf.admin.common.report.message.DefaultMessages.failedPersistError; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.function.Function; import javax.xml.namespace.NamespaceContext; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.lang.StringUtils; import org.codice.ddf.admin.api.report.Report; import org.codice.ddf.admin.common.fields.base.scalar.BooleanField; import org.codice.ddf.admin.common.fields.common.PidField; import org.codice.ddf.admin.common.report.ReportImpl; import org.codice.ddf.admin.common.services.ServiceCommons; import org.codice.ddf.admin.configurator.ConfiguratorFactory; import org.codice.ddf.admin.sources.fields.type.SourceConfigField; import org.codice.ddf.internal.admin.configurator.actions.ManagedServiceActions; import org.codice.ddf.internal.admin.configurator.actions.ServiceActions; import org.codice.ddf.internal.admin.configurator.actions.ServiceReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import ddf.catalog.service.ConfiguredService; import ddf.catalog.source.ConnectedSource; import ddf.catalog.source.FederatedSource; import ddf.catalog.source.Source; public class SourceUtilCommons { private static final Logger LOGGER = LoggerFactory.getLogger(SourceUtilCommons.class); private ServiceCommons serviceCommons; private ManagedServiceActions managedServiceActions; private ServiceActions serviceActions; private ServiceReader serviceReader; private ConfiguratorFactory configuratorFactory; public SourceUtilCommons() { } /** * @param managedServiceActions service to interact with managed service configurations * @param serviceActions service to interact with admin configurations * @param serviceReader service to query service state * @param configuratorFactory service to create {@link org.codice.ddf.admin.configurator.Configurator}s */ public SourceUtilCommons(ManagedServiceActions managedServiceActions, ServiceActions serviceActions, ServiceReader serviceReader, ConfiguratorFactory configuratorFactory) { this.managedServiceActions = managedServiceActions; this.serviceActions = serviceActions; this.serviceReader = serviceReader; this.configuratorFactory = configuratorFactory; serviceCommons = new ServiceCommons(managedServiceActions, serviceActions, serviceReader, configuratorFactory); } public static final NamespaceContext SOURCES_NAMESPACE_CONTEXT = new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { switch (prefix) { case "ows": return "http://www.opengis.net/ows"; case "wfs": return "http://www.opengis.net/wfs/2.0"; case "os": case "opensearch": return "http://a9.com/-/spec/opensearch/1.1/"; default: return null; } } @Override public String getPrefix(String namespaceURI) { switch (namespaceURI) { case "http://www.opengis.net/ows": return "ows"; case "http://www.opengis.net/wfs/2.0": return "wfs"; case "http://a9.com/-/spec/opensearch/1.1/": return "os"; default: return null; } } @Override public Iterator getPrefixes(String namespaceURI) { return null; } }; public Document createDocument(String body) throws ParserConfigurationException, IOException, SAXException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); return factory.newDocumentBuilder() .parse(new InputSource(new StringReader(body))); } public List<Source> getAllSourceReferences() { if (serviceReader == null) { LOGGER.debug("Unable to get source references due to missing serviceReader"); return Collections.emptyList(); } List<Source> sources = new ArrayList<>(); sources.addAll(serviceReader.getServices(FederatedSource.class, null)); sources.addAll(serviceReader.getServices(ConnectedSource.class, null)); return sources; } /** * Gets the configurations for the given factoryPids using the actions provided. A mapper is used * to transform the service properties to a {@link SourceConfigField}. Providing the pid parameter * will return only the configuration with that pid. * * @param factoryPids factory pids to lookup configurations for * @param mapper a {@link Function} taking a map of string to objects and returning a {@code SourceConfigField} * @param pid a servicePid to select a single configuration, returns all configs when null or empty * @return a list of {@code SourceInfoField}s configured in the system */ public List<SourceConfigField> getSourceConfigurations(List<String> factoryPids, Function<Map<String, Object>, SourceConfigField> mapper, String pid) { if (serviceActions == null || managedServiceActions == null) { LOGGER.debug( "Unable to get source configurations due to missing serviceActions or managedServiceActions"); return Collections.emptyList(); } List<SourceConfigField> sourceInfoListField = new ArrayList<>(); if (StringUtils.isNotEmpty(pid)) { SourceConfigField config = mapper.apply(serviceActions.read(pid)); sourceInfoListField.add(config); return sourceInfoListField; } factoryPids.stream() .flatMap(factoryPid -> managedServiceActions.read(factoryPid) .values() .stream()) .map(mapper) .forEach(sourceInfoListField::add); return sourceInfoListField; } public Report saveSource(PidField pid, Map<String, Object> serviceProps, String factoryPid) { ReportImpl saveSourceReport = new ReportImpl(); if (StringUtils.isNotEmpty(pid.getValue())) { saveSourceReport.addMessages(serviceCommons.updateService(pid, serviceProps)); } else { if (serviceCommons.createManagedService(serviceProps, factoryPid) .containsErrorMsgs()) { saveSourceReport.addResultMessage(failedPersistError()); } } return saveSourceReport; } public void populateAvailability(BooleanField availability, PidField pid) { for (Source source : getAllSourceReferences()) { if (source instanceof ConfiguredService) { ConfiguredService service = (ConfiguredService) source; if (service.getConfigurationPid() .equals(pid.getValue())) { availability.setValue(source.isAvailable()); break; } } } } public void setManagedServiceActions(ManagedServiceActions managedServiceActions) { this.managedServiceActions = managedServiceActions; } public void setServiceActions(ServiceActions serviceActions) { this.serviceActions = serviceActions; } public void setServiceReader(ServiceReader serviceReader) { this.serviceReader = serviceReader; } public void setConfiguratorFactory(ConfiguratorFactory configuratorFactory) { this.configuratorFactory = configuratorFactory; } }
8,805
0.681772
0.680182
222
38.662163
30.436735
120
false
false
0
0
0
0
0
0
0.490991
false
false
4
ec88ac5b1d0ef6d14216076524c2fa3f7465273b
26,972,394,675,716
34dcfff06d5f70ba1b8aaa3900b67e0cb75c58b3
/codeforces/1401/F.java
985da61a203d3c7e4e98426ae6b4a7df0fd1421a
[]
no_license
spar5h/harwest-tool
https://github.com/spar5h/harwest-tool
71477cc5c702d52a1c5178fff0ab4929585cd8f1
fce068d88df81056ee953932782c5c2ef0871917
refs/heads/master
2023-02-02T10:06:33.485000
2017-03-03T21:34:00
2020-12-23T13:37:45
323,742,904
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Sparsh Sanchorawala */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); FReverseAndSwap solver = new FReverseAndSwap(); solver.solve(1, in, out); out.close(); } static class FReverseAndSwap { int[] a; int[] rev; int[] swap; long[] tree; void build(int n, int nL, int nR) { if (nL == nR) { tree[n] = a[nL]; return; } build(2 * n + 1, nL, (nL + nR) / 2); build(2 * n + 2, (nL + nR) / 2 + 1, nR); tree[n] = tree[2 * n + 1] + tree[2 * n + 2]; } long query(int n, int k, int cr, int l, int r) { if (r - l + 1 == (1 << k)) return tree[n]; cr ^= rev[k]; int left = 2 * n + 1, right = 2 * n + 2; if ((swap[k] ^ cr) == 1) { left = 2 * n + 2; right = 2 * n + 1; } int m = 1 << (k - 1); if (r < m) { return query(left, k - 1, cr, l, r); } if (l >= m) { return query(right, k - 1, cr, l - m, r - m); } return query(left, k - 1, cr, l, m - 1) + query(right, k - 1, cr, 0, r - m); } void update(int n, int k, int cr, int i, int v) { if (k == 0) { tree[n] = v; return; } cr ^= rev[k]; int left = 2 * n + 1, right = 2 * n + 2; if ((swap[k] ^ cr) == 1) { left = 2 * n + 2; right = 2 * n + 1; } int m = 1 << (k - 1); if (i < m) update(left, k - 1, cr, i, v); else update(right, k - 1, cr, i - m, v); tree[n] = tree[2 * n + 1] + tree[2 * n + 2]; } public void solve(int testNumber, InputReader s, PrintWriter w) { int k = s.nextInt(), q = s.nextInt(); int n = 1 << k; a = new int[n]; for (int i = 0; i < n; i++) a[i] = s.nextInt(); tree = new long[2 * n]; build(0, 0, n - 1); rev = new int[k + 1]; swap = new int[k + 1]; while (q-- > 0) { int t = s.nextInt(); if (t == 1) update(0, k, 0, s.nextInt() - 1, s.nextInt()); else if (t == 2) rev[s.nextInt()] ^= 1; else if (t == 3) swap[s.nextInt() + 1] ^= 1; else w.println(query(0, k, 0, s.nextInt() - 1, s.nextInt() - 1)); } } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private InputReader.SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) { return -1; } } return buf[curChar++]; } public int nextInt() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
UTF-8
Java
5,097
java
F.java
Java
[ { "context": "-in\n * Actual solution is at the top\n *\n * @author Sparsh Sanchorawala\n */\npublic class Main {\n public static void ma", "end": 312, "score": 0.9998257756233215, "start": 293, "tag": "NAME", "value": "Sparsh Sanchorawala" } ]
null
[]
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author <NAME> */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); FReverseAndSwap solver = new FReverseAndSwap(); solver.solve(1, in, out); out.close(); } static class FReverseAndSwap { int[] a; int[] rev; int[] swap; long[] tree; void build(int n, int nL, int nR) { if (nL == nR) { tree[n] = a[nL]; return; } build(2 * n + 1, nL, (nL + nR) / 2); build(2 * n + 2, (nL + nR) / 2 + 1, nR); tree[n] = tree[2 * n + 1] + tree[2 * n + 2]; } long query(int n, int k, int cr, int l, int r) { if (r - l + 1 == (1 << k)) return tree[n]; cr ^= rev[k]; int left = 2 * n + 1, right = 2 * n + 2; if ((swap[k] ^ cr) == 1) { left = 2 * n + 2; right = 2 * n + 1; } int m = 1 << (k - 1); if (r < m) { return query(left, k - 1, cr, l, r); } if (l >= m) { return query(right, k - 1, cr, l - m, r - m); } return query(left, k - 1, cr, l, m - 1) + query(right, k - 1, cr, 0, r - m); } void update(int n, int k, int cr, int i, int v) { if (k == 0) { tree[n] = v; return; } cr ^= rev[k]; int left = 2 * n + 1, right = 2 * n + 2; if ((swap[k] ^ cr) == 1) { left = 2 * n + 2; right = 2 * n + 1; } int m = 1 << (k - 1); if (i < m) update(left, k - 1, cr, i, v); else update(right, k - 1, cr, i - m, v); tree[n] = tree[2 * n + 1] + tree[2 * n + 2]; } public void solve(int testNumber, InputReader s, PrintWriter w) { int k = s.nextInt(), q = s.nextInt(); int n = 1 << k; a = new int[n]; for (int i = 0; i < n; i++) a[i] = s.nextInt(); tree = new long[2 * n]; build(0, 0, n - 1); rev = new int[k + 1]; swap = new int[k + 1]; while (q-- > 0) { int t = s.nextInt(); if (t == 1) update(0, k, 0, s.nextInt() - 1, s.nextInt()); else if (t == 2) rev[s.nextInt()] ^= 1; else if (t == 3) swap[s.nextInt() + 1] ^= 1; else w.println(query(0, k, 0, s.nextInt() - 1, s.nextInt() - 1)); } } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private InputReader.SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) { return -1; } } return buf[curChar++]; } public int nextInt() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
5,084
0.393761
0.376496
173
28.456648
18.013309
88
false
false
0
0
0
0
0
0
0.867052
false
false
4
35bf055f5c71d3fe491a8e349675cccccccf36ca
17,437,567,279,031
6b9bd24ce01140421ab465b8333a6a3d6af44ac5
/src/main/java/com/caysever/dockermoon/handler/ExceptionHandler.java
241301d2cfff1e30bf6d998c712264f31bcbad99
[]
no_license
AlicanAkkus/docker-moon
https://github.com/AlicanAkkus/docker-moon
80d42667d3be20b02123e6933df92f1ecd27f89c
63b6407ab84ab88ce5a5a07a077947e296397f2f
refs/heads/master
2021-08-30T17:35:02.197000
2017-12-18T20:51:16
2017-12-18T20:51:16
109,610,111
8
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.caysever.dockermoon.handler; import com.caysever.dockermoon.exception.DockermoonException; import org.springframework.stereotype.Service; import java.util.concurrent.Callable; @Service public class ExceptionHandler { public static <T> T handle(Callable<T> callable) { try { return callable.call(); } catch (Exception e) { e.printStackTrace(); throw new DockermoonException(e); } } }
UTF-8
Java
468
java
ExceptionHandler.java
Java
[]
null
[]
package com.caysever.dockermoon.handler; import com.caysever.dockermoon.exception.DockermoonException; import org.springframework.stereotype.Service; import java.util.concurrent.Callable; @Service public class ExceptionHandler { public static <T> T handle(Callable<T> callable) { try { return callable.call(); } catch (Exception e) { e.printStackTrace(); throw new DockermoonException(e); } } }
468
0.67094
0.67094
20
22.4
20.276587
61
false
false
0
0
0
0
0
0
0.35
false
false
4
6aa9e9d9215abb9e3a8b565392a7e5ad8b1b25d6
12,953,621,422,897
2b634efff97a12e94d73f64a2d31db24895e25e1
/src/main/java/org/coding/challenge/flowershop/FlowerShopDemo.java
2f132cb37486a0d58f42cf0babcff510bf3b7b6f
[]
no_license
valgilbert/java-flowershop
https://github.com/valgilbert/java-flowershop
8c7c50a321d62dcb7a1a7ba2b4211f2fa934a3b1
4ce7890d77f3d2fe09d4df8424544430891172d4
refs/heads/master
2020-12-02T22:12:56.334000
2017-07-03T10:38:25
2017-07-03T10:38:25
96,096,622
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.coding.challenge.flowershop; import java.util.Scanner; import org.coding.challenge.flowershop.model.FlowerShopOrder; import org.coding.challenge.flowershop.model.ProductCodeEnum; import org.coding.challenge.flowershop.service.impl.LiliesBundle.LiliesBundleSizes; import org.coding.challenge.flowershop.service.impl.RosesBundle.RosesBundleSizes; import org.coding.challenge.flowershop.service.impl.TulipsBundle.TulipsBundleSizes; public class FlowerShopDemo { public static void main(String[] args) { FlowerShopOrderBuilder builder = new FlowerShopOrderBuilder(); System.out.println("Reading from user input..."); System.out .println("Order input in this format: \"<NUMBER> <PRODUCT_CODE>\". For Example \"12 R12\" for 12 Roses."); System.out.print("Product Codes: "); for (ProductCodeEnum product : ProductCodeEnum.values()) { System.out.print(product + " ProductCode[" + product.getValue() + "], "); } System.out.println("\n\nRoses Bundle Sizes"); for (RosesBundleSizes sizes : RosesBundleSizes.values()) { System.out.print("Size[" + sizes.value + "] Price[$ " + sizes.price + "], "); } System.out.println("\n\nLilies Bundle Sizes"); for (LiliesBundleSizes sizes : LiliesBundleSizes.values()) { System.out.print("Size[" + sizes.value + "] Price[" + sizes.price + "], "); } System.out.println("\n\nTulips Bundle Sizes"); for (TulipsBundleSizes sizes : TulipsBundleSizes.values()) { System.out.print("Size[" + sizes.value + "] Price[" + sizes.price + "], "); } System.out .println("\n\nEnter SUBMIT to submit order. Enter newline to exit."); Scanner scan = new Scanner(System.in); try { String input; FlowerShopOrder order = null; do { input = scan.nextLine(); if (input != null && !input.isEmpty()) { if ("SUBMIT".equalsIgnoreCase(input)) { // show items System.out.println("Order Details"); System.out .println("======================================="); if (order != null) { order.showItems(); } System.out .println("======================================="); } else { try { final String[] orderParams = input.split(" "); order = builder.addItemToCart(Integer .parseInt(orderParams[0]), ProductCodeEnum .valueOfProductCode(orderParams[1])); } catch (Exception e) { System.err .println("Order input in this format: \"<NUMBER> <PRODUCT_CODE>\". For Example \"12 R12\" for 12 Roses."); } } } } while (input != null && !input.isEmpty()); System.out.println("Exiting program..."); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } finally { scan.close(); } } }
UTF-8
Java
2,740
java
FlowerShopDemo.java
Java
[]
null
[]
package org.coding.challenge.flowershop; import java.util.Scanner; import org.coding.challenge.flowershop.model.FlowerShopOrder; import org.coding.challenge.flowershop.model.ProductCodeEnum; import org.coding.challenge.flowershop.service.impl.LiliesBundle.LiliesBundleSizes; import org.coding.challenge.flowershop.service.impl.RosesBundle.RosesBundleSizes; import org.coding.challenge.flowershop.service.impl.TulipsBundle.TulipsBundleSizes; public class FlowerShopDemo { public static void main(String[] args) { FlowerShopOrderBuilder builder = new FlowerShopOrderBuilder(); System.out.println("Reading from user input..."); System.out .println("Order input in this format: \"<NUMBER> <PRODUCT_CODE>\". For Example \"12 R12\" for 12 Roses."); System.out.print("Product Codes: "); for (ProductCodeEnum product : ProductCodeEnum.values()) { System.out.print(product + " ProductCode[" + product.getValue() + "], "); } System.out.println("\n\nRoses Bundle Sizes"); for (RosesBundleSizes sizes : RosesBundleSizes.values()) { System.out.print("Size[" + sizes.value + "] Price[$ " + sizes.price + "], "); } System.out.println("\n\nLilies Bundle Sizes"); for (LiliesBundleSizes sizes : LiliesBundleSizes.values()) { System.out.print("Size[" + sizes.value + "] Price[" + sizes.price + "], "); } System.out.println("\n\nTulips Bundle Sizes"); for (TulipsBundleSizes sizes : TulipsBundleSizes.values()) { System.out.print("Size[" + sizes.value + "] Price[" + sizes.price + "], "); } System.out .println("\n\nEnter SUBMIT to submit order. Enter newline to exit."); Scanner scan = new Scanner(System.in); try { String input; FlowerShopOrder order = null; do { input = scan.nextLine(); if (input != null && !input.isEmpty()) { if ("SUBMIT".equalsIgnoreCase(input)) { // show items System.out.println("Order Details"); System.out .println("======================================="); if (order != null) { order.showItems(); } System.out .println("======================================="); } else { try { final String[] orderParams = input.split(" "); order = builder.addItemToCart(Integer .parseInt(orderParams[0]), ProductCodeEnum .valueOfProductCode(orderParams[1])); } catch (Exception e) { System.err .println("Order input in this format: \"<NUMBER> <PRODUCT_CODE>\". For Example \"12 R12\" for 12 Roses."); } } } } while (input != null && !input.isEmpty()); System.out.println("Exiting program..."); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } finally { scan.close(); } } }
2,740
0.639051
0.633577
87
30.494253
27.640081
114
false
false
0
0
0
0
0
0
1.793103
false
false
4
f6267e7ee66f97861bf1399c78763880ef905d35
2,508,260,906,861
8ad535f9448217da370edec0dd9397b3ad806b93
/Smartx/Code/smartprj/src/main/java/com/smartxp/api/template/service/TemplateService.java
733ccbc6659cc2188864959ee98f4140ad2b602a
[]
no_license
savesong/Project
https://github.com/savesong/Project
c4b6b72e6ea4a2c82304da880b9cb616a2213ebc
452343a6df1b001081dbe499c74df4844d4538e8
refs/heads/master
2016-09-23T07:06:19.729000
2016-08-25T06:43:26
2016-08-25T06:58:31
59,801,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.smartxp.api.template.service; import com.smartxp.api.template.model.TemplateBasicVo; import com.smartxp.api.template.model.TemplateDetailedView; import com.smartxp.api.template.model.TemplateListsView; import com.smartxp.api.template.model.TemplateNewVo; public interface TemplateService { TemplateListsView<TemplateBasicVo> findAll(); int getAllTemplatesCount(); boolean isExistTemplateBy(long id); TemplateDetailedView getTemplateDetailsById(long id); // void delTemplateById(long id); // // long addNewTemplate(TemplateNewVo newVo); boolean updateTemplate(TemplateNewVo newVo); boolean deleteTemplate(long id); }
UTF-8
Java
646
java
TemplateService.java
Java
[]
null
[]
package com.smartxp.api.template.service; import com.smartxp.api.template.model.TemplateBasicVo; import com.smartxp.api.template.model.TemplateDetailedView; import com.smartxp.api.template.model.TemplateListsView; import com.smartxp.api.template.model.TemplateNewVo; public interface TemplateService { TemplateListsView<TemplateBasicVo> findAll(); int getAllTemplatesCount(); boolean isExistTemplateBy(long id); TemplateDetailedView getTemplateDetailsById(long id); // void delTemplateById(long id); // // long addNewTemplate(TemplateNewVo newVo); boolean updateTemplate(TemplateNewVo newVo); boolean deleteTemplate(long id); }
646
0.812693
0.812693
25
24.84
22.639223
59
false
false
0
0
0
0
0
0
0.92
false
false
4
e73135db81c7760c01ad79fa43a6dea3afebb308
36,928,128,849,629
2dfd97051588389981e238a8f3f07d37a31bfb0f
/AddressBookApp/src/tk/gilz688/AddressBook/JCheckBoxMenuItemGroup.java
41d1cccb5830944f1b5bd0febd019f1210b13790
[]
no_license
gilz688/address-book
https://github.com/gilz688/address-book
6bb9ea736702d3188db01783522733924d5e656d
052c26640bf52f16b601ebe92b9995a3a6535a41
refs/heads/master
2021-01-18T13:43:02.531000
2013-12-13T05:43:22
2013-12-13T05:43:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tk.gilz688.AddressBook; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.HashSet; import java.util.Set; import javax.swing.JCheckBoxMenuItem; /** * Group that manages JCheckBoxMenuItems */ public class JCheckBoxMenuItemGroup implements ItemListener { private Set<JCheckBoxMenuItem> items = new HashSet<JCheckBoxMenuItem>(); /** * Add JCheckBoxMenuItem to the JCheckBoxMenuItemGroup */ public void add(JCheckBoxMenuItem cbmi) { cbmi.addItemListener(this); cbmi.setState(false); items.add(cbmi); } @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { JCheckBoxMenuItem itemAffected = (JCheckBoxMenuItem) e.getItem(); for (JCheckBoxMenuItem item : items) { if (item != itemAffected) item.setState(false); } } } public void selectItem(JCheckBoxMenuItem itemToSelect) { for (JCheckBoxMenuItem item : items) { item.setState(item == itemToSelect); } } public JCheckBoxMenuItem getSelectedItem() { for (JCheckBoxMenuItem item : items) { if (item.getState()) return item; } return null; } }
UTF-8
Java
1,199
java
JCheckBoxMenuItemGroup.java
Java
[]
null
[]
package tk.gilz688.AddressBook; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.HashSet; import java.util.Set; import javax.swing.JCheckBoxMenuItem; /** * Group that manages JCheckBoxMenuItems */ public class JCheckBoxMenuItemGroup implements ItemListener { private Set<JCheckBoxMenuItem> items = new HashSet<JCheckBoxMenuItem>(); /** * Add JCheckBoxMenuItem to the JCheckBoxMenuItemGroup */ public void add(JCheckBoxMenuItem cbmi) { cbmi.addItemListener(this); cbmi.setState(false); items.add(cbmi); } @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { JCheckBoxMenuItem itemAffected = (JCheckBoxMenuItem) e.getItem(); for (JCheckBoxMenuItem item : items) { if (item != itemAffected) item.setState(false); } } } public void selectItem(JCheckBoxMenuItem itemToSelect) { for (JCheckBoxMenuItem item : items) { item.setState(item == itemToSelect); } } public JCheckBoxMenuItem getSelectedItem() { for (JCheckBoxMenuItem item : items) { if (item.getState()) return item; } return null; } }
1,199
0.69975
0.697248
50
22.02
21.009989
73
false
false
0
0
0
0
0
0
1.52
false
false
4
41cb4a9995ee33d4653badd7cad97fd1a3b457c9
15,161,234,619,092
90ad5696a7c20e9e74b995504c66b71d6b521772
/plugins/org.mondo.ifc.cstudy.metamodel.edit/src/org/bimserver/models/ifc2x3tc1/provider/IfcSurfaceCurveSweptAreaSolidItemProvider.java
f7f6e43d05aad4b8a589407619a1aed69ad80f5c
[]
no_license
mondo-project/mondo-demo-bim
https://github.com/mondo-project/mondo-demo-bim
5bbdffa5a61805256e476ec2fa84d6d93aeea29f
96d673eb14e5c191ea4ae7985eee4a10ac51ffec
refs/heads/master
2016-09-13T11:53:26.773000
2016-06-02T20:02:05
2016-06-02T20:02:05
56,190,032
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** */ package org.bimserver.models.ifc2x3tc1.provider; import java.util.Collection; import java.util.List; import org.bimserver.models.ifc2x3tc1.Ifc2x3tc1Package; import org.bimserver.models.ifc2x3tc1.IfcSurfaceCurveSweptAreaSolid; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link org.bimserver.models.ifc2x3tc1.IfcSurfaceCurveSweptAreaSolid} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class IfcSurfaceCurveSweptAreaSolidItemProvider extends IfcSweptAreaSolidItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IfcSurfaceCurveSweptAreaSolidItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addDirectrixPropertyDescriptor(object); addStartParamPropertyDescriptor(object); addStartParamAsStringPropertyDescriptor(object); addEndParamPropertyDescriptor(object); addEndParamAsStringPropertyDescriptor(object); addReferenceSurfacePropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Directrix feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addDirectrixPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_Directrix_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_Directrix_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_Directrix(), true, false, true, null, null, null)); } /** * This adds a property descriptor for the Start Param feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addStartParamPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_StartParam_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_StartParam_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_StartParam(), true, false, false, ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Start Param As String feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addStartParamAsStringPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_StartParamAsString_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_StartParamAsString_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_StartParamAsString(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the End Param feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addEndParamPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_EndParam_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_EndParam_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_EndParam(), true, false, false, ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the End Param As String feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addEndParamAsStringPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_EndParamAsString_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_EndParamAsString_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_EndParamAsString(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Reference Surface feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addReferenceSurfacePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_ReferenceSurface_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_ReferenceSurface_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_ReferenceSurface(), true, false, true, null, null, null)); } /** * This returns IfcSurfaceCurveSweptAreaSolid.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/IfcSurfaceCurveSweptAreaSolid")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { IfcSurfaceCurveSweptAreaSolid ifcSurfaceCurveSweptAreaSolid = (IfcSurfaceCurveSweptAreaSolid)object; return getString("_UI_IfcSurfaceCurveSweptAreaSolid_type") + " " + ifcSurfaceCurveSweptAreaSolid.getDim(); } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(IfcSurfaceCurveSweptAreaSolid.class)) { case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__START_PARAM: case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__START_PARAM_AS_STRING: case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__END_PARAM: case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__END_PARAM_AS_STRING: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } }
UTF-8
Java
8,513
java
IfcSurfaceCurveSweptAreaSolidItemProvider.java
Java
[]
null
[]
/** */ package org.bimserver.models.ifc2x3tc1.provider; import java.util.Collection; import java.util.List; import org.bimserver.models.ifc2x3tc1.Ifc2x3tc1Package; import org.bimserver.models.ifc2x3tc1.IfcSurfaceCurveSweptAreaSolid; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link org.bimserver.models.ifc2x3tc1.IfcSurfaceCurveSweptAreaSolid} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class IfcSurfaceCurveSweptAreaSolidItemProvider extends IfcSweptAreaSolidItemProvider { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IfcSurfaceCurveSweptAreaSolidItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addDirectrixPropertyDescriptor(object); addStartParamPropertyDescriptor(object); addStartParamAsStringPropertyDescriptor(object); addEndParamPropertyDescriptor(object); addEndParamAsStringPropertyDescriptor(object); addReferenceSurfacePropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Directrix feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addDirectrixPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_Directrix_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_Directrix_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_Directrix(), true, false, true, null, null, null)); } /** * This adds a property descriptor for the Start Param feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addStartParamPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_StartParam_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_StartParam_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_StartParam(), true, false, false, ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Start Param As String feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addStartParamAsStringPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_StartParamAsString_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_StartParamAsString_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_StartParamAsString(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the End Param feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addEndParamPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_EndParam_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_EndParam_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_EndParam(), true, false, false, ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the End Param As String feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addEndParamAsStringPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_EndParamAsString_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_EndParamAsString_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_EndParamAsString(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Reference Surface feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addReferenceSurfacePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_IfcSurfaceCurveSweptAreaSolid_ReferenceSurface_feature"), getString("_UI_PropertyDescriptor_description", "_UI_IfcSurfaceCurveSweptAreaSolid_ReferenceSurface_feature", "_UI_IfcSurfaceCurveSweptAreaSolid_type"), Ifc2x3tc1Package.eINSTANCE.getIfcSurfaceCurveSweptAreaSolid_ReferenceSurface(), true, false, true, null, null, null)); } /** * This returns IfcSurfaceCurveSweptAreaSolid.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/IfcSurfaceCurveSweptAreaSolid")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { IfcSurfaceCurveSweptAreaSolid ifcSurfaceCurveSweptAreaSolid = (IfcSurfaceCurveSweptAreaSolid)object; return getString("_UI_IfcSurfaceCurveSweptAreaSolid_type") + " " + ifcSurfaceCurveSweptAreaSolid.getDim(); } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(IfcSurfaceCurveSweptAreaSolid.class)) { case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__START_PARAM: case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__START_PARAM_AS_STRING: case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__END_PARAM: case Ifc2x3tc1Package.IFC_SURFACE_CURVE_SWEPT_AREA_SOLID__END_PARAM_AS_STRING: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } }
8,513
0.741102
0.735581
248
33.326614
34.460621
159
false
false
0
0
0
0
0
0
2.322581
false
false
4
885a5e70310011a0d78a434bec4c698eb420ebcc
15,161,234,620,338
e62627a49ea2510818d9092e01076490fe951b11
/core/src/com/corb/moveboxandshow/components/UserInputComponent.java
db9159e734a9001055836c6d26f0b1c61b515227
[]
no_license
corbeygh/MoveBoxAndShow
https://github.com/corbeygh/MoveBoxAndShow
1cd3de84a38927e148c55660a7333937c1d780f9
3dcff522d96b1d3b5ba82bc5831f8fced7ce4722
refs/heads/master
2021-01-23T01:21:31.783000
2017-07-20T11:23:59
2017-07-20T11:23:59
85,903,147
0
0
null
false
2017-07-20T11:24:00
2017-03-23T03:31:52
2017-03-23T03:32:37
2017-07-20T11:24:00
823
0
0
0
Java
null
null
package com.corb.moveboxandshow.components; import com.badlogic.ashley.core.Component; /** * Created by Calvin on 22/03/2017. */ public class UserInputComponent implements Component { public boolean moveUp = false; public boolean moveDown = false; public boolean moveLeft = false; public boolean moveRight = false; }
UTF-8
Java
340
java
UserInputComponent.java
Java
[ { "context": "badlogic.ashley.core.Component;\n\n/**\n * Created by Calvin on 22/03/2017.\n */\n\npublic class UserInputCompone", "end": 113, "score": 0.9994657635688782, "start": 107, "tag": "NAME", "value": "Calvin" } ]
null
[]
package com.corb.moveboxandshow.components; import com.badlogic.ashley.core.Component; /** * Created by Calvin on 22/03/2017. */ public class UserInputComponent implements Component { public boolean moveUp = false; public boolean moveDown = false; public boolean moveLeft = false; public boolean moveRight = false; }
340
0.735294
0.711765
16
20.25
19.888754
54
false
false
0
0
0
0
0
0
0.375
false
false
4
4f18d2fd51ea48adf77ed6377c9ee021d57e7e3f
38,903,813,807,704
a0e2904e05e54651e815d7899bdec9ae53578342
/ElevensLab/DeckTest.java
00263cde992a23bff6d255e5b3466199049c0a10
[]
no_license
shivansal/apcs_coursework
https://github.com/shivansal/apcs_coursework
af3d1ef7dc4d4303e3a2adcbf089b98e5cae7920
9af21f9e23f3cd9ba8c9657f7cbdcd4f0cd4952e
refs/heads/master
2021-01-24T07:27:22.204000
2017-06-04T22:13:06
2017-06-04T22:13:06
93,344,479
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * This is a class that tests the Deck class. */ public class DeckTest { /** * The main method in this class checks the Deck operations for consistency. * @param args is not used. */ public static void main(String[] args) { String[] ranks = {"Freshman", "Sophomore", "Junior", "Senior"}; String[] suits = {"Purple", "Gold", "Black"}; int[] pointValues = {9, 10, 11, 12}; Deck d = new Deck(ranks, suits, pointValues); System.out.println(); System.out.println(); System.out.println("**** Original Deck Methods ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); System.out.println("**** Deck Methods After 1 Card Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal Remaining 11 Cards ****"); for (int i = 0; i < 11; i++) { System.out.println(" deal: " + d.deal()); } System.out.println(); System.out.println(); System.out.println("**** Deck Methods After All Cards Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card From Empty Deck ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); ranks = new String[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"}; suits = new String[] {"Earth", "Air", "Fire", "Water"}; pointValues = new int[] {1, 2, 3, 4, 5, 6, 7, 8}; d = new Deck(ranks, suits, pointValues); System.out.println("**** Original Deck Methods ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); System.out.println("**** Deck Methods After 1 Card Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal Next 31 Cards ****"); for (int i = 0; i < 31; i++) { System.out.println(" deal: " + d.deal()); } System.out.println(); System.out.println(); System.out.println("**** Deck Methods After All Cards Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card From Empty Deck ****"); System.out.println(" deal: " + d.deal()); System.out.println(" deal: " + d.deal()); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); } } /* C:\Java\Elevens>java DeckTest **** Original Deck Methods **** toString: size = 12 Undealt cards: Senior of Black (point value = 12), Senior of Gold (point value = 12), Senior of Purple (point value = 12), Junior of Black (point value = 11), Junior of Gold (point value = 11), Junior of Purple (point value = 11), Sophomore of Black (point value = 10), Sophomore of Gold (point value = 10), Sophomore of Purple (point value = 10), Freshman of Black (point value = 9), Freshman of Gold (point value = 9), Freshman of Purple (point value = 9) Dealt cards: isEmpty: false size: 12 **** Deal a Card **** deal: Senior of Black (point value = 12) **** Deck Methods After 1 Card Dealt **** toString: size = 11 Undealt cards: Senior of Gold (point value = 12), Senior of Purple (point value = 12), Junior of Black (point value = 11), Junior of Gold (point value = 11), Junior of Purple (point value = 11), Sophomore of Black (point value = 10), Sophomore of Gold (point value = 10), Sophomore of Purple (point value = 10), Freshman of Black (point value = 9), Freshman of Gold (point value = 9), Freshman of Purple (point value = 9) Dealt cards: Senior of Black (point value = 12) isEmpty: false size: 11 **** Deal Remaining 11 Cards **** deal: Senior of Gold (point value = 12) deal: Senior of Purple (point value = 12) deal: Junior of Black (point value = 11) deal: Junior of Gold (point value = 11) deal: Junior of Purple (point value = 11) deal: Sophomore of Black (point value = 10) deal: Sophomore of Gold (point value = 10) deal: Sophomore of Purple (point value = 10) deal: Freshman of Black (point value = 9) deal: Freshman of Gold (point value = 9) deal: Freshman of Purple (point value = 9) **** Deck Methods After All Cards Dealt **** toString: size = 0 Undealt cards: Dealt cards: Senior of Black (point value = 12), Senior of Gold (point value = 12), Senior of Purple (point value = 12), Junior of Black (point value = 11), Junior of Gold (point value = 11), Junior of Purple (point value = 11), Sophomore of Black (point value = 10), Sophomore of Gold (point value = 10), Sophomore of Purple (point value = 10), Freshman of Black (point value = 9), Freshman of Gold (point value = 9), Freshman of Purple (point value = 9) isEmpty: true size: 0 **** Deal a Card From Empty Deck **** deal: null **** Original Deck Methods **** toString: size = 32 Undealt cards: Eight of Water (point value = 8), Eight of Fire (point value = 8), Eight of Air (point value = 8), Eight of Earth (point value = 8), Seven of Water (point value = 7), Seven of Fire (point value = 7), Seven of Air (point value = 7), Seven of Earth (point value = 7), Six of Water (point value = 6), Six of Fire (point value = 6), Six of Air (point value = 6), Six of Earth (point value = 6), Five of Water (point value = 5), Five of Fire (point value = 5), Five of Air (point value = 5), Five of Earth (point value = 5), Four of Water (point value = 4), Four of Fire (point value = 4), Four of Air (point value = 4), Four of Earth (point value = 4), Three of Water (point value = 3), Three of Fire (point value = 3), Three of Air (point value = 3), Three of Earth (point value = 3), Two of Water (point value = 2), Two of Fire (point value = 2), Two of Air (point value = 2), Two of Earth (point value = 2), One of Water (point value = 1), One of Fire (point value = 1), One of Air (point value = 1), One of Earth (point value = 1) Dealt cards: isEmpty: false size: 32 **** Deal a Card **** deal: Eight of Water (point value = 8) **** Deck Methods After 1 Card Dealt **** toString: size = 31 Undealt cards: Eight of Fire (point value = 8), Eight of Air (point value = 8), Eight of Earth (point value = 8), Seven of Water (point value = 7), Seven of Fire (point value = 7), Seven of Air (point value = 7), Seven of Earth (point value = 7), Six of Water (point value = 6), Six of Fire (point value = 6), Six of Air (point value = 6), Six of Earth (point value = 6), Five of Water (point value = 5), Five of Fire (point value = 5), Five of Air (point value = 5), Five of Earth (point value = 5), Four of Water (point value = 4), Four of Fire (point value = 4), Four of Air (point value = 4), Four of Earth (point value = 4), Three of Water (point value = 3), Three of Fire (point value = 3), Three of Air (point value = 3), Three of Earth (point value = 3), Two of Water (point value = 2), Two of Fire (point value = 2), Two of Air (point value = 2), Two of Earth (point value = 2), One of Water (point value = 1), One of Fire (point value = 1), One of Air (point value = 1), One of Earth (point value = 1) Dealt cards: Eight of Water (point value = 8) isEmpty: false size: 31 **** Deal Next 31 Cards **** deal: Eight of Fire (point value = 8) deal: Eight of Air (point value = 8) deal: Eight of Earth (point value = 8) deal: Seven of Water (point value = 7) deal: Seven of Fire (point value = 7) deal: Seven of Air (point value = 7) deal: Seven of Earth (point value = 7) deal: Six of Water (point value = 6) deal: Six of Fire (point value = 6) deal: Six of Air (point value = 6) deal: Six of Earth (point value = 6) deal: Five of Water (point value = 5) deal: Five of Fire (point value = 5) deal: Five of Air (point value = 5) deal: Five of Earth (point value = 5) deal: Four of Water (point value = 4) deal: Four of Fire (point value = 4) deal: Four of Air (point value = 4) deal: Four of Earth (point value = 4) deal: Three of Water (point value = 3) deal: Three of Fire (point value = 3) deal: Three of Air (point value = 3) deal: Three of Earth (point value = 3) deal: Two of Water (point value = 2) deal: Two of Fire (point value = 2) deal: Two of Air (point value = 2) deal: Two of Earth (point value = 2) deal: One of Water (point value = 1) deal: One of Fire (point value = 1) deal: One of Air (point value = 1) deal: One of Earth (point value = 1) **** Deck Methods After All Cards Dealt **** toString: size = 0 Undealt cards: Dealt cards: Eight of Water (point value = 8), Eight of Fire (point value = 8), Eight of Air (point value = 8), Eight of Earth (point value = 8), Seven of Water (point value = 7), Seven of Fire (point value = 7), Seven of Air (point value = 7), Seven of Earth (point value = 7), Six of Water (point value = 6), Six of Fire (point value = 6), Six of Air (point value = 6), Six of Earth (point value = 6), Five of Water (point value = 5), Five of Fire (point value = 5), Five of Air (point value = 5), Five of Earth (point value = 5), Four of Water (point value = 4), Four of Fire (point value = 4), Four of Air (point value = 4), Four of Earth (point value = 4), Three of Water (point value = 3), Three of Fire (point value = 3), Three of Air (point value = 3), Three of Earth (point value = 3), Two of Water (point value = 2), Two of Fire (point value = 2), Two of Air (point value = 2), Two of Earth (point value = 2), One of Water (point value = 1), One of Fire (point value = 1), One of Air (point value = 1), One of Earth (point value = 1) isEmpty: true size: 0 **** Deal a Card From Empty Deck **** deal: null deal: null deal: null */
UTF-8
Java
10,602
java
DeckTest.java
Java
[]
null
[]
/** * This is a class that tests the Deck class. */ public class DeckTest { /** * The main method in this class checks the Deck operations for consistency. * @param args is not used. */ public static void main(String[] args) { String[] ranks = {"Freshman", "Sophomore", "Junior", "Senior"}; String[] suits = {"Purple", "Gold", "Black"}; int[] pointValues = {9, 10, 11, 12}; Deck d = new Deck(ranks, suits, pointValues); System.out.println(); System.out.println(); System.out.println("**** Original Deck Methods ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); System.out.println("**** Deck Methods After 1 Card Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal Remaining 11 Cards ****"); for (int i = 0; i < 11; i++) { System.out.println(" deal: " + d.deal()); } System.out.println(); System.out.println(); System.out.println("**** Deck Methods After All Cards Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card From Empty Deck ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); ranks = new String[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"}; suits = new String[] {"Earth", "Air", "Fire", "Water"}; pointValues = new int[] {1, 2, 3, 4, 5, 6, 7, 8}; d = new Deck(ranks, suits, pointValues); System.out.println("**** Original Deck Methods ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); System.out.println("**** Deck Methods After 1 Card Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal Next 31 Cards ****"); for (int i = 0; i < 31; i++) { System.out.println(" deal: " + d.deal()); } System.out.println(); System.out.println(); System.out.println("**** Deck Methods After All Cards Dealt ****"); System.out.println(" toString:\n" + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card From Empty Deck ****"); System.out.println(" deal: " + d.deal()); System.out.println(" deal: " + d.deal()); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); } } /* C:\Java\Elevens>java DeckTest **** Original Deck Methods **** toString: size = 12 Undealt cards: Senior of Black (point value = 12), Senior of Gold (point value = 12), Senior of Purple (point value = 12), Junior of Black (point value = 11), Junior of Gold (point value = 11), Junior of Purple (point value = 11), Sophomore of Black (point value = 10), Sophomore of Gold (point value = 10), Sophomore of Purple (point value = 10), Freshman of Black (point value = 9), Freshman of Gold (point value = 9), Freshman of Purple (point value = 9) Dealt cards: isEmpty: false size: 12 **** Deal a Card **** deal: Senior of Black (point value = 12) **** Deck Methods After 1 Card Dealt **** toString: size = 11 Undealt cards: Senior of Gold (point value = 12), Senior of Purple (point value = 12), Junior of Black (point value = 11), Junior of Gold (point value = 11), Junior of Purple (point value = 11), Sophomore of Black (point value = 10), Sophomore of Gold (point value = 10), Sophomore of Purple (point value = 10), Freshman of Black (point value = 9), Freshman of Gold (point value = 9), Freshman of Purple (point value = 9) Dealt cards: Senior of Black (point value = 12) isEmpty: false size: 11 **** Deal Remaining 11 Cards **** deal: Senior of Gold (point value = 12) deal: Senior of Purple (point value = 12) deal: Junior of Black (point value = 11) deal: Junior of Gold (point value = 11) deal: Junior of Purple (point value = 11) deal: Sophomore of Black (point value = 10) deal: Sophomore of Gold (point value = 10) deal: Sophomore of Purple (point value = 10) deal: Freshman of Black (point value = 9) deal: Freshman of Gold (point value = 9) deal: Freshman of Purple (point value = 9) **** Deck Methods After All Cards Dealt **** toString: size = 0 Undealt cards: Dealt cards: Senior of Black (point value = 12), Senior of Gold (point value = 12), Senior of Purple (point value = 12), Junior of Black (point value = 11), Junior of Gold (point value = 11), Junior of Purple (point value = 11), Sophomore of Black (point value = 10), Sophomore of Gold (point value = 10), Sophomore of Purple (point value = 10), Freshman of Black (point value = 9), Freshman of Gold (point value = 9), Freshman of Purple (point value = 9) isEmpty: true size: 0 **** Deal a Card From Empty Deck **** deal: null **** Original Deck Methods **** toString: size = 32 Undealt cards: Eight of Water (point value = 8), Eight of Fire (point value = 8), Eight of Air (point value = 8), Eight of Earth (point value = 8), Seven of Water (point value = 7), Seven of Fire (point value = 7), Seven of Air (point value = 7), Seven of Earth (point value = 7), Six of Water (point value = 6), Six of Fire (point value = 6), Six of Air (point value = 6), Six of Earth (point value = 6), Five of Water (point value = 5), Five of Fire (point value = 5), Five of Air (point value = 5), Five of Earth (point value = 5), Four of Water (point value = 4), Four of Fire (point value = 4), Four of Air (point value = 4), Four of Earth (point value = 4), Three of Water (point value = 3), Three of Fire (point value = 3), Three of Air (point value = 3), Three of Earth (point value = 3), Two of Water (point value = 2), Two of Fire (point value = 2), Two of Air (point value = 2), Two of Earth (point value = 2), One of Water (point value = 1), One of Fire (point value = 1), One of Air (point value = 1), One of Earth (point value = 1) Dealt cards: isEmpty: false size: 32 **** Deal a Card **** deal: Eight of Water (point value = 8) **** Deck Methods After 1 Card Dealt **** toString: size = 31 Undealt cards: Eight of Fire (point value = 8), Eight of Air (point value = 8), Eight of Earth (point value = 8), Seven of Water (point value = 7), Seven of Fire (point value = 7), Seven of Air (point value = 7), Seven of Earth (point value = 7), Six of Water (point value = 6), Six of Fire (point value = 6), Six of Air (point value = 6), Six of Earth (point value = 6), Five of Water (point value = 5), Five of Fire (point value = 5), Five of Air (point value = 5), Five of Earth (point value = 5), Four of Water (point value = 4), Four of Fire (point value = 4), Four of Air (point value = 4), Four of Earth (point value = 4), Three of Water (point value = 3), Three of Fire (point value = 3), Three of Air (point value = 3), Three of Earth (point value = 3), Two of Water (point value = 2), Two of Fire (point value = 2), Two of Air (point value = 2), Two of Earth (point value = 2), One of Water (point value = 1), One of Fire (point value = 1), One of Air (point value = 1), One of Earth (point value = 1) Dealt cards: Eight of Water (point value = 8) isEmpty: false size: 31 **** Deal Next 31 Cards **** deal: Eight of Fire (point value = 8) deal: Eight of Air (point value = 8) deal: Eight of Earth (point value = 8) deal: Seven of Water (point value = 7) deal: Seven of Fire (point value = 7) deal: Seven of Air (point value = 7) deal: Seven of Earth (point value = 7) deal: Six of Water (point value = 6) deal: Six of Fire (point value = 6) deal: Six of Air (point value = 6) deal: Six of Earth (point value = 6) deal: Five of Water (point value = 5) deal: Five of Fire (point value = 5) deal: Five of Air (point value = 5) deal: Five of Earth (point value = 5) deal: Four of Water (point value = 4) deal: Four of Fire (point value = 4) deal: Four of Air (point value = 4) deal: Four of Earth (point value = 4) deal: Three of Water (point value = 3) deal: Three of Fire (point value = 3) deal: Three of Air (point value = 3) deal: Three of Earth (point value = 3) deal: Two of Water (point value = 2) deal: Two of Fire (point value = 2) deal: Two of Air (point value = 2) deal: Two of Earth (point value = 2) deal: One of Water (point value = 1) deal: One of Fire (point value = 1) deal: One of Air (point value = 1) deal: One of Earth (point value = 1) **** Deck Methods After All Cards Dealt **** toString: size = 0 Undealt cards: Dealt cards: Eight of Water (point value = 8), Eight of Fire (point value = 8), Eight of Air (point value = 8), Eight of Earth (point value = 8), Seven of Water (point value = 7), Seven of Fire (point value = 7), Seven of Air (point value = 7), Seven of Earth (point value = 7), Six of Water (point value = 6), Six of Fire (point value = 6), Six of Air (point value = 6), Six of Earth (point value = 6), Five of Water (point value = 5), Five of Fire (point value = 5), Five of Air (point value = 5), Five of Earth (point value = 5), Four of Water (point value = 4), Four of Fire (point value = 4), Four of Air (point value = 4), Four of Earth (point value = 4), Three of Water (point value = 3), Three of Fire (point value = 3), Three of Air (point value = 3), Three of Earth (point value = 3), Two of Water (point value = 2), Two of Fire (point value = 2), Two of Air (point value = 2), Two of Earth (point value = 2), One of Water (point value = 1), One of Fire (point value = 1), One of Air (point value = 1), One of Earth (point value = 1) isEmpty: true size: 0 **** Deal a Card From Empty Deck **** deal: null deal: null deal: null */
10,602
0.640634
0.615639
310
33.19355
24.545046
88
false
false
0
0
0
0
0
0
1.267742
false
false
4
6fa46dcffe5369f856c388bac553b2475b5df931
39,067,022,538,261
ef1b72abf5554c94661c495a0bf0a6aded89e37c
/src/net/minecraft/src/bnj.java
aa8c60d6abf3503109ded58ee1f66ab153c71cab
[]
no_license
JimmyZJX/MC1.8_source
https://github.com/JimmyZJX/MC1.8_source
ad459b12d0d01db28942b9af87c86393011fd626
25f56c7884a320cbf183b23010cccecb5689d707
refs/heads/master
2016-09-10T04:26:40.951000
2014-11-29T06:22:02
2014-11-29T06:22:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.minecraft.src; /* 1: */ import com.google.common.collect.Lists; /* 2: */ import java.util.List; /* 3: */ import java.util.Random; /* 4: */ /* 5: */ public class bnj /* 6: */ extends bnn /* 7: */ { /* 8:1467 */ private static final List<vl> a = Lists.newArrayList(new vl[] { new vl(ItemList.diamond, 0, 1, 3, 3), new vl(ItemList.ironIngot, 0, 1, 5, 10), new vl(ItemList.goldIngot, 0, 1, 3, 5), new vl(ItemList.bread, 0, 1, 3, 15), new vl(ItemList.apple, 0, 1, 3, 15), new vl(ItemList.ironPickaxe, 0, 1, 1, 5), new vl(ItemList.ironSword, 0, 1, 1, 5), new vl(ItemList.ironChestplate, 0, 1, 1, 5), new vl(ItemList.ironHelmet, 0, 1, 1, 5), new vl(ItemList.aa, 0, 1, 1, 5), new vl(ItemList.ab, 0, 1, 1, 5), new vl(Item.fromBlock(BlockList.obsidian), 0, 3, 7, 5), new vl(Item.fromBlock(BlockList.sapling), 0, 3, 7, 5), new vl(ItemList.saddle, 0, 1, 1, 3), new vl(ItemList.ck, 0, 1, 1, 1), new vl(ItemList.cl, 0, 1, 1, 1), new vl(ItemList.cm, 0, 1, 1, 1) }); /* 9: */ private boolean b; /* 10: */ /* 11: */ public bnj() {} /* 12: */ /* 13: */ public bnj(bnk parambnk, int paramInt, Random paramRandom, bjb parambjb, EnumDirection paramej) /* 14: */ { /* 15:1500 */ super(parambnk, paramInt); /* 16: */ /* 17:1502 */ this.m = paramej; /* 18:1503 */ this.l = parambjb; /* 19: */ } /* 20: */ /* 21: */ public static bnj a(bnk parambnk, List<bms> paramList, Random paramRandom, int paramInt1, int paramInt2, int paramInt3, EnumDirection paramej, int paramInt4) /* 22: */ { /* 23:1507 */ bjb localbjb = bjb.a(paramInt1, paramInt2, paramInt3, 0, 0, 0, 10, 6, 7, paramej); /* 24:1509 */ if ((!a(localbjb)) || (bms.a(paramList, localbjb) != null)) { /* 25:1510 */ return null; /* 26: */ } /* 27:1513 */ return new bnj(parambnk, paramInt4, paramRandom, localbjb, paramej); /* 28: */ } /* 29: */ /* 30: */ protected void a(NBTTagCompound paramfn) /* 31: */ { /* 32:1518 */ super.a(paramfn); /* 33:1519 */ paramfn.setBoolean("Chest", this.b); /* 34: */ } /* 35: */ /* 36: */ protected void b(NBTTagCompound paramfn) /* 37: */ { /* 38:1524 */ super.b(paramfn); /* 39:1525 */ this.b = paramfn.getBoolean("Chest"); /* 40: */ } /* 41: */ /* 42: */ public boolean a(World paramaqu, Random paramRandom, bjb parambjb) /* 43: */ { /* 44:1530 */ if (this.h < 0) /* 45: */ { /* 46:1531 */ this.h = b(paramaqu, parambjb); /* 47:1532 */ if (this.h < 0) { /* 48:1533 */ return true; /* 49: */ } /* 50:1535 */ this.l.a(0, this.h - this.l.e + 6 - 1, 0); /* 51: */ } /* 52:1539 */ a(paramaqu, parambjb, 0, 1, 0, 9, 4, 6, BlockList.air.instance(), BlockList.air.instance(), false); /* 53: */ /* 54: */ /* 55:1542 */ a(paramaqu, parambjb, 0, 0, 0, 9, 0, 6, BlockList.cobblestone.instance(), BlockList.cobblestone.instance(), false); /* 56: */ /* 57: */ /* 58:1545 */ a(paramaqu, parambjb, 0, 4, 0, 9, 4, 6, BlockList.cobblestone.instance(), BlockList.cobblestone.instance(), false); /* 59:1546 */ a(paramaqu, parambjb, 0, 5, 0, 9, 5, 6, BlockList.U.instance(), BlockList.U.instance(), false); /* 60:1547 */ a(paramaqu, parambjb, 1, 5, 1, 8, 5, 5, BlockList.air.instance(), BlockList.air.instance(), false); /* 61: */ /* 62: */ /* 63:1550 */ a(paramaqu, parambjb, 1, 1, 0, 2, 3, 0, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 64:1551 */ a(paramaqu, parambjb, 0, 1, 0, 0, 4, 0, BlockList.log.instance(), BlockList.log.instance(), false); /* 65:1552 */ a(paramaqu, parambjb, 3, 1, 0, 3, 4, 0, BlockList.log.instance(), BlockList.log.instance(), false); /* 66:1553 */ a(paramaqu, parambjb, 0, 1, 6, 0, 4, 6, BlockList.log.instance(), BlockList.log.instance(), false); /* 67:1554 */ a(paramaqu, BlockList.planks.instance(), 3, 3, 1, parambjb); /* 68:1555 */ a(paramaqu, parambjb, 3, 1, 2, 3, 3, 2, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 69:1556 */ a(paramaqu, parambjb, 4, 1, 3, 5, 3, 3, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 70:1557 */ a(paramaqu, parambjb, 0, 1, 1, 0, 3, 5, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 71:1558 */ a(paramaqu, parambjb, 1, 1, 6, 5, 3, 6, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 72: */ /* 73: */ /* 74:1561 */ a(paramaqu, parambjb, 5, 1, 0, 5, 3, 0, BlockList.fence.instance(), BlockList.fence.instance(), false); /* 75:1562 */ a(paramaqu, parambjb, 9, 1, 0, 9, 3, 0, BlockList.fence.instance(), BlockList.fence.instance(), false); /* 76: */ /* 77: */ /* 78:1565 */ a(paramaqu, parambjb, 6, 1, 4, 9, 4, 6, BlockList.cobblestone.instance(), BlockList.cobblestone.instance(), false); /* 79:1566 */ a(paramaqu, BlockList.flowingLava.instance(), 7, 1, 5, parambjb); /* 80:1567 */ a(paramaqu, BlockList.flowingLava.instance(), 8, 1, 5, parambjb); /* 81:1568 */ a(paramaqu, BlockList.ironBars.instance(), 9, 2, 5, parambjb); /* 82:1569 */ a(paramaqu, BlockList.ironBars.instance(), 9, 2, 4, parambjb); /* 83:1570 */ a(paramaqu, parambjb, 7, 2, 4, 8, 2, 5, BlockList.air.instance(), BlockList.air.instance(), false); /* 84:1571 */ a(paramaqu, BlockList.cobblestone.instance(), 6, 1, 3, parambjb); /* 85:1572 */ a(paramaqu, BlockList.al.instance(), 6, 2, 3, parambjb); /* 86:1573 */ a(paramaqu, BlockList.al.instance(), 6, 3, 3, parambjb); /* 87:1574 */ a(paramaqu, BlockList.T.instance(), 8, 1, 1, parambjb); /* 88: */ /* 89: */ /* 90:1577 */ a(paramaqu, BlockList.bj.instance(), 0, 2, 2, parambjb); /* 91:1578 */ a(paramaqu, BlockList.bj.instance(), 0, 2, 4, parambjb); /* 92:1579 */ a(paramaqu, BlockList.bj.instance(), 2, 2, 6, parambjb); /* 93:1580 */ a(paramaqu, BlockList.bj.instance(), 4, 2, 6, parambjb); /* 94: */ /* 95: */ /* 96:1583 */ a(paramaqu, BlockList.fence.instance(), 2, 1, 4, parambjb); /* 97:1584 */ a(paramaqu, BlockList.aB.instance(), 2, 2, 4, parambjb); /* 98:1585 */ a(paramaqu, BlockList.planks.instance(), 1, 1, 5, parambjb); /* 99:1586 */ a(paramaqu, BlockList.ad.instance(a(BlockList.ad, 3)), 2, 1, 5, parambjb); /* 100:1587 */ a(paramaqu, BlockList.ad.instance(a(BlockList.ad, 1)), 1, 1, 4, parambjb); /* 101:1589 */ if ((!this.b) && /* 102:1590 */ (parambjb.b(new BlockPosition(a(5, 5), d(1), b(5, 5))))) /* 103: */ { /* 104:1591 */ this.b = true; /* 105:1592 */ a(paramaqu, parambjb, paramRandom, 5, 1, 5, a, 3 + paramRandom.nextInt(6)); /* 106: */ } /* 107:1597 */ for (int i = 6; i <= 8; i++) { /* 108:1598 */ if ((a(paramaqu, i, 0, -1, parambjb).getType().getMaterial() == Material.air) && (a(paramaqu, i, -1, -1, parambjb).getType().getMaterial() != Material.air)) { /* 109:1599 */ a(paramaqu, BlockList.aw.instance(a(BlockList.aw, 3)), i, 0, -1, parambjb); /* 110: */ } /* 111: */ } /* 112:1603 */ for (int i = 0; i < 7; i++) { /* 113:1604 */ for (int j = 0; j < 10; j++) /* 114: */ { /* 115:1605 */ b(paramaqu, j, 6, i, parambjb); /* 116:1606 */ b(paramaqu, BlockList.cobblestone.instance(), j, -1, i, parambjb); /* 117: */ } /* 118: */ } /* 119:1610 */ a(paramaqu, parambjb, 7, 1, 1, 1); /* 120: */ /* 121:1612 */ return true; /* 122: */ } /* 123: */ /* 124: */ protected int c(int paramInt1, int paramInt2) /* 125: */ { /* 126:1617 */ return 3; /* 127: */ } /* 128: */ } /* Location: C:\Minecraft1.7.5\.minecraft\versions\1.8\1.8.jar * Qualified Name: bnj * JD-Core Version: 0.7.0.1 */
UTF-8
Java
8,270
java
bnj.java
Java
[]
null
[]
package net.minecraft.src; /* 1: */ import com.google.common.collect.Lists; /* 2: */ import java.util.List; /* 3: */ import java.util.Random; /* 4: */ /* 5: */ public class bnj /* 6: */ extends bnn /* 7: */ { /* 8:1467 */ private static final List<vl> a = Lists.newArrayList(new vl[] { new vl(ItemList.diamond, 0, 1, 3, 3), new vl(ItemList.ironIngot, 0, 1, 5, 10), new vl(ItemList.goldIngot, 0, 1, 3, 5), new vl(ItemList.bread, 0, 1, 3, 15), new vl(ItemList.apple, 0, 1, 3, 15), new vl(ItemList.ironPickaxe, 0, 1, 1, 5), new vl(ItemList.ironSword, 0, 1, 1, 5), new vl(ItemList.ironChestplate, 0, 1, 1, 5), new vl(ItemList.ironHelmet, 0, 1, 1, 5), new vl(ItemList.aa, 0, 1, 1, 5), new vl(ItemList.ab, 0, 1, 1, 5), new vl(Item.fromBlock(BlockList.obsidian), 0, 3, 7, 5), new vl(Item.fromBlock(BlockList.sapling), 0, 3, 7, 5), new vl(ItemList.saddle, 0, 1, 1, 3), new vl(ItemList.ck, 0, 1, 1, 1), new vl(ItemList.cl, 0, 1, 1, 1), new vl(ItemList.cm, 0, 1, 1, 1) }); /* 9: */ private boolean b; /* 10: */ /* 11: */ public bnj() {} /* 12: */ /* 13: */ public bnj(bnk parambnk, int paramInt, Random paramRandom, bjb parambjb, EnumDirection paramej) /* 14: */ { /* 15:1500 */ super(parambnk, paramInt); /* 16: */ /* 17:1502 */ this.m = paramej; /* 18:1503 */ this.l = parambjb; /* 19: */ } /* 20: */ /* 21: */ public static bnj a(bnk parambnk, List<bms> paramList, Random paramRandom, int paramInt1, int paramInt2, int paramInt3, EnumDirection paramej, int paramInt4) /* 22: */ { /* 23:1507 */ bjb localbjb = bjb.a(paramInt1, paramInt2, paramInt3, 0, 0, 0, 10, 6, 7, paramej); /* 24:1509 */ if ((!a(localbjb)) || (bms.a(paramList, localbjb) != null)) { /* 25:1510 */ return null; /* 26: */ } /* 27:1513 */ return new bnj(parambnk, paramInt4, paramRandom, localbjb, paramej); /* 28: */ } /* 29: */ /* 30: */ protected void a(NBTTagCompound paramfn) /* 31: */ { /* 32:1518 */ super.a(paramfn); /* 33:1519 */ paramfn.setBoolean("Chest", this.b); /* 34: */ } /* 35: */ /* 36: */ protected void b(NBTTagCompound paramfn) /* 37: */ { /* 38:1524 */ super.b(paramfn); /* 39:1525 */ this.b = paramfn.getBoolean("Chest"); /* 40: */ } /* 41: */ /* 42: */ public boolean a(World paramaqu, Random paramRandom, bjb parambjb) /* 43: */ { /* 44:1530 */ if (this.h < 0) /* 45: */ { /* 46:1531 */ this.h = b(paramaqu, parambjb); /* 47:1532 */ if (this.h < 0) { /* 48:1533 */ return true; /* 49: */ } /* 50:1535 */ this.l.a(0, this.h - this.l.e + 6 - 1, 0); /* 51: */ } /* 52:1539 */ a(paramaqu, parambjb, 0, 1, 0, 9, 4, 6, BlockList.air.instance(), BlockList.air.instance(), false); /* 53: */ /* 54: */ /* 55:1542 */ a(paramaqu, parambjb, 0, 0, 0, 9, 0, 6, BlockList.cobblestone.instance(), BlockList.cobblestone.instance(), false); /* 56: */ /* 57: */ /* 58:1545 */ a(paramaqu, parambjb, 0, 4, 0, 9, 4, 6, BlockList.cobblestone.instance(), BlockList.cobblestone.instance(), false); /* 59:1546 */ a(paramaqu, parambjb, 0, 5, 0, 9, 5, 6, BlockList.U.instance(), BlockList.U.instance(), false); /* 60:1547 */ a(paramaqu, parambjb, 1, 5, 1, 8, 5, 5, BlockList.air.instance(), BlockList.air.instance(), false); /* 61: */ /* 62: */ /* 63:1550 */ a(paramaqu, parambjb, 1, 1, 0, 2, 3, 0, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 64:1551 */ a(paramaqu, parambjb, 0, 1, 0, 0, 4, 0, BlockList.log.instance(), BlockList.log.instance(), false); /* 65:1552 */ a(paramaqu, parambjb, 3, 1, 0, 3, 4, 0, BlockList.log.instance(), BlockList.log.instance(), false); /* 66:1553 */ a(paramaqu, parambjb, 0, 1, 6, 0, 4, 6, BlockList.log.instance(), BlockList.log.instance(), false); /* 67:1554 */ a(paramaqu, BlockList.planks.instance(), 3, 3, 1, parambjb); /* 68:1555 */ a(paramaqu, parambjb, 3, 1, 2, 3, 3, 2, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 69:1556 */ a(paramaqu, parambjb, 4, 1, 3, 5, 3, 3, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 70:1557 */ a(paramaqu, parambjb, 0, 1, 1, 0, 3, 5, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 71:1558 */ a(paramaqu, parambjb, 1, 1, 6, 5, 3, 6, BlockList.planks.instance(), BlockList.planks.instance(), false); /* 72: */ /* 73: */ /* 74:1561 */ a(paramaqu, parambjb, 5, 1, 0, 5, 3, 0, BlockList.fence.instance(), BlockList.fence.instance(), false); /* 75:1562 */ a(paramaqu, parambjb, 9, 1, 0, 9, 3, 0, BlockList.fence.instance(), BlockList.fence.instance(), false); /* 76: */ /* 77: */ /* 78:1565 */ a(paramaqu, parambjb, 6, 1, 4, 9, 4, 6, BlockList.cobblestone.instance(), BlockList.cobblestone.instance(), false); /* 79:1566 */ a(paramaqu, BlockList.flowingLava.instance(), 7, 1, 5, parambjb); /* 80:1567 */ a(paramaqu, BlockList.flowingLava.instance(), 8, 1, 5, parambjb); /* 81:1568 */ a(paramaqu, BlockList.ironBars.instance(), 9, 2, 5, parambjb); /* 82:1569 */ a(paramaqu, BlockList.ironBars.instance(), 9, 2, 4, parambjb); /* 83:1570 */ a(paramaqu, parambjb, 7, 2, 4, 8, 2, 5, BlockList.air.instance(), BlockList.air.instance(), false); /* 84:1571 */ a(paramaqu, BlockList.cobblestone.instance(), 6, 1, 3, parambjb); /* 85:1572 */ a(paramaqu, BlockList.al.instance(), 6, 2, 3, parambjb); /* 86:1573 */ a(paramaqu, BlockList.al.instance(), 6, 3, 3, parambjb); /* 87:1574 */ a(paramaqu, BlockList.T.instance(), 8, 1, 1, parambjb); /* 88: */ /* 89: */ /* 90:1577 */ a(paramaqu, BlockList.bj.instance(), 0, 2, 2, parambjb); /* 91:1578 */ a(paramaqu, BlockList.bj.instance(), 0, 2, 4, parambjb); /* 92:1579 */ a(paramaqu, BlockList.bj.instance(), 2, 2, 6, parambjb); /* 93:1580 */ a(paramaqu, BlockList.bj.instance(), 4, 2, 6, parambjb); /* 94: */ /* 95: */ /* 96:1583 */ a(paramaqu, BlockList.fence.instance(), 2, 1, 4, parambjb); /* 97:1584 */ a(paramaqu, BlockList.aB.instance(), 2, 2, 4, parambjb); /* 98:1585 */ a(paramaqu, BlockList.planks.instance(), 1, 1, 5, parambjb); /* 99:1586 */ a(paramaqu, BlockList.ad.instance(a(BlockList.ad, 3)), 2, 1, 5, parambjb); /* 100:1587 */ a(paramaqu, BlockList.ad.instance(a(BlockList.ad, 1)), 1, 1, 4, parambjb); /* 101:1589 */ if ((!this.b) && /* 102:1590 */ (parambjb.b(new BlockPosition(a(5, 5), d(1), b(5, 5))))) /* 103: */ { /* 104:1591 */ this.b = true; /* 105:1592 */ a(paramaqu, parambjb, paramRandom, 5, 1, 5, a, 3 + paramRandom.nextInt(6)); /* 106: */ } /* 107:1597 */ for (int i = 6; i <= 8; i++) { /* 108:1598 */ if ((a(paramaqu, i, 0, -1, parambjb).getType().getMaterial() == Material.air) && (a(paramaqu, i, -1, -1, parambjb).getType().getMaterial() != Material.air)) { /* 109:1599 */ a(paramaqu, BlockList.aw.instance(a(BlockList.aw, 3)), i, 0, -1, parambjb); /* 110: */ } /* 111: */ } /* 112:1603 */ for (int i = 0; i < 7; i++) { /* 113:1604 */ for (int j = 0; j < 10; j++) /* 114: */ { /* 115:1605 */ b(paramaqu, j, 6, i, parambjb); /* 116:1606 */ b(paramaqu, BlockList.cobblestone.instance(), j, -1, i, parambjb); /* 117: */ } /* 118: */ } /* 119:1610 */ a(paramaqu, parambjb, 7, 1, 1, 1); /* 120: */ /* 121:1612 */ return true; /* 122: */ } /* 123: */ /* 124: */ protected int c(int paramInt1, int paramInt2) /* 125: */ { /* 126:1617 */ return 3; /* 127: */ } /* 128: */ } /* Location: C:\Minecraft1.7.5\.minecraft\versions\1.8\1.8.jar * Qualified Name: bnj * JD-Core Version: 0.7.0.1 */
8,270
0.527811
0.426965
139
57.53957
72.219414
758
false
false
0
0
0
0
0
0
3.510791
false
false
4
cb8ae851624c45e6b5782e77483098eaf2a0d487
39,599,598,479,838
0c752faa3e9583e46cd158887492b94b74c23ca1
/src/main/java/pages/NewCustomerPage.java
5140d9513f01e8300c45aee0c51735624fe06939
[]
no_license
AMarwan00/inetBanking
https://github.com/AMarwan00/inetBanking
1ef9bfdda1b71878dd21f7c2bdff41af17610aa6
cbb77e64af39a988c1b578b0c17190615ec4d518
refs/heads/master
2023-03-29T21:41:42.483000
2021-04-03T22:18:12
2021-04-03T22:18:12
354,402,197
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import pages.PageBase; public class NewCustomerPage extends PageBase { public NewCustomerPage(WebDriver driver) { super(driver); } @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/p") public WebElement titleNewCustForm; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[4]/td[2]/input") WebElement custNameEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[5]/td[2]/input[1]") WebElement genderEntry; @FindBy(id = "dob") WebElement dateOfBirthEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[7]/td[2]/textarea") WebElement adresseEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[8]/td[2]/input") WebElement cityEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[9]/td[2]/input") WebElement stateEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[10]/td[2]/input") WebElement pinEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[11]/td[2]/input") WebElement phoneEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[12]/td[2]/input") WebElement emailEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[13]/td[2]/input[1]") WebElement submitBtn; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[13]/td[2]/input[2]") WebElement reserBtn; @FindBy(xpath = "/html/body/text()") public WebElement successMsg; public void customerDataForRegistration(String custName,String DOB ,String adresse, String city ,String state , String pin, String phone,String email){ setTextElementText(custNameEntry,custName); clickButton(genderEntry); setTextElementText(dateOfBirthEntry,DOB); setTextElementText(adresseEntry,adresse); setTextElementText(cityEntry,city); setTextElementText(stateEntry,state); setTextElementText(pinEntry,pin); setTextElementText(phoneEntry,phone); setTextElementText(emailEntry,email); clickButton(submitBtn); } public void resetFormEntries(){ clickButton(reserBtn); } }
UTF-8
Java
2,387
java
NewCustomerPage.java
Java
[]
null
[]
package pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import pages.PageBase; public class NewCustomerPage extends PageBase { public NewCustomerPage(WebDriver driver) { super(driver); } @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[1]/td/p") public WebElement titleNewCustForm; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[4]/td[2]/input") WebElement custNameEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[5]/td[2]/input[1]") WebElement genderEntry; @FindBy(id = "dob") WebElement dateOfBirthEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[7]/td[2]/textarea") WebElement adresseEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[8]/td[2]/input") WebElement cityEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[9]/td[2]/input") WebElement stateEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[10]/td[2]/input") WebElement pinEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[11]/td[2]/input") WebElement phoneEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[12]/td[2]/input") WebElement emailEntry; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[13]/td[2]/input[1]") WebElement submitBtn; @FindBy(xpath = "/html/body/table/tbody/tr/td/table/tbody/tr[13]/td[2]/input[2]") WebElement reserBtn; @FindBy(xpath = "/html/body/text()") public WebElement successMsg; public void customerDataForRegistration(String custName,String DOB ,String adresse, String city ,String state , String pin, String phone,String email){ setTextElementText(custNameEntry,custName); clickButton(genderEntry); setTextElementText(dateOfBirthEntry,DOB); setTextElementText(adresseEntry,adresse); setTextElementText(cityEntry,city); setTextElementText(stateEntry,state); setTextElementText(pinEntry,pin); setTextElementText(phoneEntry,phone); setTextElementText(emailEntry,email); clickButton(submitBtn); } public void resetFormEntries(){ clickButton(reserBtn); } }
2,387
0.679514
0.667365
74
31.256756
29.557119
111
false
false
0
0
0
0
0
0
0.608108
false
false
4
32ee0985926fb0b13a576ea6d35d82c2b2d4ea8a
60,129,601,067
1ef6615a2a6b8fa18c1ccdd5bd7289106b8db1de
/part2/app/src/main/java/edu/washington/tchin94/quizdroid/TopicOverview.java
e4bb946dda098e513c33f059d8df398046154e0a
[]
no_license
tchin94/quizdroid
https://github.com/tchin94/quizdroid
d0b6db7a0899e3f59dc11207a726ccb96494d25d
b7f63d49782300d5247196a6492b4e66784c4ca9
refs/heads/master
2020-04-06T07:13:23.881000
2015-02-28T06:10:43
2015-02-28T06:10:43
30,212,314
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.washington.tchin94.quizdroid; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import org.w3c.dom.Text; public class TopicOverview extends ActionBarActivity { private String[] questions; private String[] answers; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_topic_overview); Intent launcher = getIntent(); String topicName = launcher.getStringExtra("topicName"); String topicDescription = launcher.getStringExtra("topicDescription"); questions = launcher.getStringArrayExtra("questions"); answers = launcher.getStringArrayExtra("answers"); int numQuestions = questions.length; TextView topicNameText = (TextView) findViewById(R.id.topic_name); topicNameText.setText(topicName); TextView topicDescriptionText = (TextView) findViewById(R.id.topic_description); topicDescriptionText.setText(topicDescription); TextView questionCount = (TextView) findViewById(R.id.topic_question_count); questionCount.setText("Number of Questions: " + numQuestions); Button beginBtn = (Button) findViewById(R.id.begin_btn); beginBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent firstQuestion = new Intent(TopicOverview.this, Question.class); firstQuestion.putExtra("questions", questions); firstQuestion.putExtra("answers", answers); if (firstQuestion.resolveActivity(getPackageManager()) != null) { startActivity(firstQuestion); } finish(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_topic_overview, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
2,741
java
TopicOverview.java
Java
[]
null
[]
package edu.washington.tchin94.quizdroid; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import org.w3c.dom.Text; public class TopicOverview extends ActionBarActivity { private String[] questions; private String[] answers; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_topic_overview); Intent launcher = getIntent(); String topicName = launcher.getStringExtra("topicName"); String topicDescription = launcher.getStringExtra("topicDescription"); questions = launcher.getStringArrayExtra("questions"); answers = launcher.getStringArrayExtra("answers"); int numQuestions = questions.length; TextView topicNameText = (TextView) findViewById(R.id.topic_name); topicNameText.setText(topicName); TextView topicDescriptionText = (TextView) findViewById(R.id.topic_description); topicDescriptionText.setText(topicDescription); TextView questionCount = (TextView) findViewById(R.id.topic_question_count); questionCount.setText("Number of Questions: " + numQuestions); Button beginBtn = (Button) findViewById(R.id.begin_btn); beginBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent firstQuestion = new Intent(TopicOverview.this, Question.class); firstQuestion.putExtra("questions", questions); firstQuestion.putExtra("answers", answers); if (firstQuestion.resolveActivity(getPackageManager()) != null) { startActivity(firstQuestion); } finish(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_topic_overview, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
2,741
0.670193
0.668734
78
34.141026
27.142418
88
false
false
0
0
0
0
0
0
0.564103
false
false
4
8b77ec23b1ae8718d0d2b4571f6100ba520bf5a3
37,838,661,911,329
8629464e172daad2e7804990355e7edc389d98a7
/android-app/src/eu/vranckaert/worktime/activities/notifcationbar/StatusBarActionDialogActivity.java
ef632aface672f18c27ab5f39e05d2338ba4e344
[ "Apache-2.0" ]
permissive
chokkarg/worktime
https://github.com/chokkarg/worktime
fb51ac90ba4182442693fac4ea9654ded822e978
c964e3b7d1627185ca6e6c844b385bb7f992c3ce
refs/heads/master
2021-09-25T14:59:24.296000
2018-10-23T08:02:32
2018-10-23T08:02:32
57,039,284
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2013 Dirk Vranckaert * * 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 eu.vranckaert.worktime.activities.notifcationbar; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; import com.google.inject.Inject; import eu.vranckaert.worktime.R; import eu.vranckaert.worktime.activities.timeregistrations.TimeRegistrationActionActivity; import eu.vranckaert.worktime.constants.Constants; import eu.vranckaert.worktime.enums.timeregistration.TimeRegistrationAction; import eu.vranckaert.worktime.model.TimeRegistration; import eu.vranckaert.worktime.service.TimeRegistrationService; import eu.vranckaert.worktime.service.ui.StatusBarNotificationService; import eu.vranckaert.worktime.utils.preferences.Preferences; import roboguice.activity.RoboActivity; /** * Date: 3/05/13 * Time: 15:31 * * @author Dirk Vranckaert */ public abstract class StatusBarActionDialogActivity extends RoboActivity { @Inject private TimeRegistrationService timeRegistrationService; @Inject private StatusBarNotificationService statusBarNotificationService; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); launchStopTimeRegistrationActivity(); } private void launchStopTimeRegistrationActivity() { TimeRegistration timeRegistration = timeRegistrationService.getLatestTimeRegistration(); if (timeRegistration != null) { Intent intent = new Intent(getApplicationContext(), TimeRegistrationActionActivity.class); intent.putExtra(Constants.Extras.TIME_REGISTRATION, timeRegistration); intent.putExtra(Constants.Extras.DEFAULT_ACTION, getTimeRegistrationAction()); if (Preferences.getImmediatePunchOut(this)) { intent.putExtra(Constants.Extras.SKIP_DIALOG, true); } else { intent.putExtra(Constants.Extras.ONLY_ACTION, true); } intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivityForResult(intent, Constants.IntentRequestCodes.TIME_REGISTRATION_ACTION); } else { Toast.makeText(this, R.string.lbl_notif_no_tr_found, Toast.LENGTH_LONG); statusBarNotificationService.removeOngoingTimeRegistrationNotification(); } } protected abstract TimeRegistrationAction getTimeRegistrationAction(); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { finish(); } }
UTF-8
Java
3,228
java
StatusBarActionDialogActivity.java
Java
[ { "context": "/*\r\n * Copyright 2013 Dirk Vranckaert\r\n *\r\n * Licensed under the Apache License, Versio", "end": 37, "score": 0.999888002872467, "start": 22, "tag": "NAME", "value": "Dirk Vranckaert" }, { "context": "\r\n * Date: 3/05/13\r\n * Time: 15:31\r\n *\r\n * @author Dirk...
null
[]
/* * Copyright 2013 <NAME> * * 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 eu.vranckaert.worktime.activities.notifcationbar; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; import com.google.inject.Inject; import eu.vranckaert.worktime.R; import eu.vranckaert.worktime.activities.timeregistrations.TimeRegistrationActionActivity; import eu.vranckaert.worktime.constants.Constants; import eu.vranckaert.worktime.enums.timeregistration.TimeRegistrationAction; import eu.vranckaert.worktime.model.TimeRegistration; import eu.vranckaert.worktime.service.TimeRegistrationService; import eu.vranckaert.worktime.service.ui.StatusBarNotificationService; import eu.vranckaert.worktime.utils.preferences.Preferences; import roboguice.activity.RoboActivity; /** * Date: 3/05/13 * Time: 15:31 * * @author <NAME> */ public abstract class StatusBarActionDialogActivity extends RoboActivity { @Inject private TimeRegistrationService timeRegistrationService; @Inject private StatusBarNotificationService statusBarNotificationService; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); launchStopTimeRegistrationActivity(); } private void launchStopTimeRegistrationActivity() { TimeRegistration timeRegistration = timeRegistrationService.getLatestTimeRegistration(); if (timeRegistration != null) { Intent intent = new Intent(getApplicationContext(), TimeRegistrationActionActivity.class); intent.putExtra(Constants.Extras.TIME_REGISTRATION, timeRegistration); intent.putExtra(Constants.Extras.DEFAULT_ACTION, getTimeRegistrationAction()); if (Preferences.getImmediatePunchOut(this)) { intent.putExtra(Constants.Extras.SKIP_DIALOG, true); } else { intent.putExtra(Constants.Extras.ONLY_ACTION, true); } intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivityForResult(intent, Constants.IntentRequestCodes.TIME_REGISTRATION_ACTION); } else { Toast.makeText(this, R.string.lbl_notif_no_tr_found, Toast.LENGTH_LONG); statusBarNotificationService.removeOngoingTimeRegistrationNotification(); } } protected abstract TimeRegistrationAction getTimeRegistrationAction(); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { finish(); } }
3,210
0.732652
0.727385
77
39.922077
34.814075
170
false
false
0
0
0
0
0
0
0.623377
false
false
4
4af1d1ad9dc32ed16713ad6cef7d9d009ace3d4a
37,417,755,112,162
155c90d73703d1765ba41188d4b22c7be22b104f
/src/main/java/com/jeong/blog/support/model/AjaxResult.java
195c78f9b8c42ec5c9445b3c83910301e59cd73f
[]
no_license
jeonglab12/jlog
https://github.com/jeonglab12/jlog
1c11bfdb4a4a4e7ef034cd3e59a6cb1c1da36c67
7eaf61fbb0f0ad975028618a0d5058f5e8f62727
refs/heads/develop
2020-06-06T18:52:35.400000
2019-09-06T13:10:11
2019-09-06T13:10:11
190,898,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jeong.blog.support.model; import java.util.Map; import lombok.Data; @Data public class AjaxResult { private String code; private String message; private Map<String, Object> data; }
UTF-8
Java
217
java
AjaxResult.java
Java
[]
null
[]
package com.jeong.blog.support.model; import java.util.Map; import lombok.Data; @Data public class AjaxResult { private String code; private String message; private Map<String, Object> data; }
217
0.700461
0.700461
14
13.5
13.216602
37
false
false
0
0
0
0
0
0
0.857143
false
false
4
9e17752c8cdc30a79938fe507096b730f77baa84
36,773,510,026,597
c131f537e5a6752aa0cfb26350068be7a073e4df
/src/main/java/com/youzipi/bean/entity/MarketingScope.java
9b3739f8db58ee94787ad191daf69a5e70d0b6d3
[]
no_license
youzipi/member_manage
https://github.com/youzipi/member_manage
038391d84ece6fcc97c0daa7da33573baf97348c
5fb5cd5bd6cfda40521e60e92150a65172046a22
refs/heads/master
2021-01-10T01:10:24.324000
2016-11-04T09:59:29
2016-11-04T09:59:29
45,916,714
0
2
null
false
2015-11-10T14:49:51
2015-11-10T14:22:15
2015-11-10T14:24:47
2015-11-10T14:49:49
0
0
0
0
Java
null
null
package com.youzipi.bean.entity; import java.util.Date; public class MarketingScope { private Long marketingScopeId; private Long marketingId; private Long scopeId; private String scopeType; private Date createTime; private Date updateTime; private String flag; public Long getMarketingScopeId() { return marketingScopeId; } public void setMarketingScopeId(Long marketingScopeId) { this.marketingScopeId = marketingScopeId; } public Long getMarketingId() { return marketingId; } public void setMarketingId(Long marketingId) { this.marketingId = marketingId; } public Long getScopeId() { return scopeId; } public void setScopeId(Long scopeId) { this.scopeId = scopeId; } public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } }
UTF-8
Java
1,423
java
MarketingScope.java
Java
[]
null
[]
package com.youzipi.bean.entity; import java.util.Date; public class MarketingScope { private Long marketingScopeId; private Long marketingId; private Long scopeId; private String scopeType; private Date createTime; private Date updateTime; private String flag; public Long getMarketingScopeId() { return marketingScopeId; } public void setMarketingScopeId(Long marketingScopeId) { this.marketingScopeId = marketingScopeId; } public Long getMarketingId() { return marketingId; } public void setMarketingId(Long marketingId) { this.marketingId = marketingId; } public Long getScopeId() { return scopeId; } public void setScopeId(Long scopeId) { this.scopeId = scopeId; } public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } }
1,423
0.638089
0.638089
75
17.986666
17.183321
60
false
false
0
0
0
0
0
0
0.306667
false
false
4
45d3f0a4801a7a2e90c58fb02f481be3c22cdabd
34,694,745,873,565
ca303228c457a022b9d68a1eabe45a94c2c1be02
/DAO3.0/StudentDao.java
18aa6d939fcfe34497d561fa912d0d1d4c6281d2
[]
no_license
ZhongHongDou/java_test
https://github.com/ZhongHongDou/java_test
99a4b2371ba66efd41544e673c097e6927a4c703
4bbea90f4e448e12cab0a901e19ec50be845f228
refs/heads/master
2021-05-27T15:44:55.626000
2014-10-21T14:58:48
2014-10-21T14:58:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/************************************************************************* > File Name: StudentDaojava > Author: trilever > Version: 1.0 > Mail: trilever31204@gmail.com > Created Time: 2014-7-18 14:52:50 > This program test the StudentDao. ************************************************************************/ /* * ���༴��������student����DAO�㣬��Ҫ�ṩ���ܾ������ݵ���ɾ�IJ顣 */ package com.trilever.DAO; import java.sql.*; import java.util.List; import com.trilever.DAOManager.*; import com.trilever.entity.*; public class StudentDao { public boolean add(Student stu) throws SQLException { String sql = "insert into student (stu_Id,stu_Name,stu_Age,stu_Ger,teachId,group_Id) values(?,?,?,?,?,?)"; System.out.println(sql); Object[] obs = new Object[] { stu.getStu_Id(), stu.getStu_Name(), stu.getStu_Age(), stu.isStu_Ger(), stu.getTeachId(), stu.getGroup_Id() }; DaoManager fdm = new DaoManager(); int row = fdm.insertManager(sql, obs); if (row != 0) return true; else return false; } public boolean delete(int id) throws SQLException { String sql = "delete from student where stu_Id= ?"; System.out.println(sql); DaoManager fdm = new DaoManager(); int row = fdm.deleteManager(sql, id); if (row != 0) return true; else return false; } public boolean update(Student stu) throws SQLException { String sql = "update student set stu_Age = ? where stu_Name=?"; System.out.println(sql); Object[] obs = new Object[] { stu.getStu_Age(), "trilever" }; DaoManager fdm = new DaoManager(); int row = fdm.updateManager(sql, obs); if (row != 0) return true; else return false; } public Student find(int id) throws SQLException { String sql = "select stu_Id,stu_Name,stu_Age,stu_Ger,teachId, group_Id from student where stu_Id = ?"; DaoManager fdm = new DaoManager(); ResultSet mk = fdm.findManager(sql, id); Student stu = new Student(); while (mk.next()) { stu.setStu_Id(mk.getInt("stu_Id")); stu.setStu_Name(mk.getString("stu_Name")); stu.setStu_Age(mk.getInt("stu_Age")); stu.setStu_Ger(mk.getByte("stu_Ger")); stu.setTeachId(mk.getInt("teachId")); stu.setGroup_Id(mk.getInt("group_Id")); } // ���ڲ�ѯ���ԣ�������ʹ�ý�����֮ǰ�͹ر��˽�����������Ҫ��DaoManager��������һ��closeFunc()��������������ʹ���˽�����ResultSet֮���ٹر��� fdm.closeFunc(); return stu; } public List<Student> findAll() throws SQLException { String sql = "select * from student"; DaoManager fdm = new DaoManager(); List<Student> mk = fdm.findAllManager(sql); // ���ڲ�ѯ���ԣ�������ʹ�ý�����֮ǰ�͹ر��˽�����������Ҫ��DaoManager��������һ��closeFunc()��������������ʹ���˽�����ResultSet֮���ٹر��� fdm.closeFunc(); return mk; } }
UTF-8
Java
3,192
java
StudentDao.java
Java
[ { "context": "**********\r\n> File Name: StudentDaojava\r\n> Author: trilever\r\n> Version: 1.0\r\n> Mail: trilever31204@gmail.com\r", "end": 123, "score": 0.99965500831604, "start": 115, "tag": "USERNAME", "value": "trilever" }, { "context": "ojava\r\n> Author: trilever\r\n> Version...
null
[]
/************************************************************************* > File Name: StudentDaojava > Author: trilever > Version: 1.0 > Mail: <EMAIL> > Created Time: 2014-7-18 14:52:50 > This program test the StudentDao. ************************************************************************/ /* * ���༴��������student����DAO�㣬��Ҫ�ṩ���ܾ������ݵ���ɾ�IJ顣 */ package com.trilever.DAO; import java.sql.*; import java.util.List; import com.trilever.DAOManager.*; import com.trilever.entity.*; public class StudentDao { public boolean add(Student stu) throws SQLException { String sql = "insert into student (stu_Id,stu_Name,stu_Age,stu_Ger,teachId,group_Id) values(?,?,?,?,?,?)"; System.out.println(sql); Object[] obs = new Object[] { stu.getStu_Id(), stu.getStu_Name(), stu.getStu_Age(), stu.isStu_Ger(), stu.getTeachId(), stu.getGroup_Id() }; DaoManager fdm = new DaoManager(); int row = fdm.insertManager(sql, obs); if (row != 0) return true; else return false; } public boolean delete(int id) throws SQLException { String sql = "delete from student where stu_Id= ?"; System.out.println(sql); DaoManager fdm = new DaoManager(); int row = fdm.deleteManager(sql, id); if (row != 0) return true; else return false; } public boolean update(Student stu) throws SQLException { String sql = "update student set stu_Age = ? where stu_Name=?"; System.out.println(sql); Object[] obs = new Object[] { stu.getStu_Age(), "trilever" }; DaoManager fdm = new DaoManager(); int row = fdm.updateManager(sql, obs); if (row != 0) return true; else return false; } public Student find(int id) throws SQLException { String sql = "select stu_Id,stu_Name,stu_Age,stu_Ger,teachId, group_Id from student where stu_Id = ?"; DaoManager fdm = new DaoManager(); ResultSet mk = fdm.findManager(sql, id); Student stu = new Student(); while (mk.next()) { stu.setStu_Id(mk.getInt("stu_Id")); stu.setStu_Name(mk.getString("stu_Name")); stu.setStu_Age(mk.getInt("stu_Age")); stu.setStu_Ger(mk.getByte("stu_Ger")); stu.setTeachId(mk.getInt("teachId")); stu.setGroup_Id(mk.getInt("group_Id")); } // ���ڲ�ѯ���ԣ�������ʹ�ý�����֮ǰ�͹ر��˽�����������Ҫ��DaoManager��������һ��closeFunc()��������������ʹ���˽�����ResultSet֮���ٹر��� fdm.closeFunc(); return stu; } public List<Student> findAll() throws SQLException { String sql = "select * from student"; DaoManager fdm = new DaoManager(); List<Student> mk = fdm.findAllManager(sql); // ���ڲ�ѯ���ԣ�������ʹ�ý�����֮ǰ�͹ر��˽�����������Ҫ��DaoManager��������һ��closeFunc()��������������ʹ���˽�����ResultSet֮���ٹر��� fdm.closeFunc(); return mk; } }
3,176
0.573429
0.565171
90
28.944445
26.669733
126
false
false
0
0
0
0
0
0
2.2
false
false
4
0533a897fd1be7195bb428af83035a4987ae3cfc
35,631,048,727,682
edcb66f7ee601dcf9aa0eef034f77722906da0cf
/src/main/java/pl/poznan/jug/meetings/frontend/security/AuthFilter.java
13c9ab50041701415bdb597e8c4c26c1f628589b
[]
no_license
damian0o/meetings
https://github.com/damian0o/meetings
a5c5581fb4008305992f5999cc6f00cdde0965fd
a57845655ff8f9d2868dd2b34e7397d87ba27616
refs/heads/master
2017-10-30T19:09:15.668000
2012-05-30T07:24:49
2012-05-30T07:24:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.poznan.jug.meetings.frontend.security; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pl.poznan.jug.meetings.frontend.security.AuthError.AuthErrorDescriptor; import pl.poznan.jug.meetings.frontend.utils.UrlBuilder; import pl.poznan.jug.meetings.shared.model.User; import pl.poznan.jug.meetings.shared.model.UserType; /** * Filters Request for pages that need som privileges. * @version $Id$ * @author pmendelski */ @WebFilter(filterName = "AuthFilter", urlPatterns = { "/*" }) public class AuthFilter implements Filter { /** * Session map key. Describes if user is logged in. */ public static final String AUTH_KEY = "authorizationKey"; private static final String LOGIN_PAGE_KEY = "auth-filter-login"; private final Logger logger = LoggerFactory.getLogger(getClass()); private FilteredPageUtil filteredPageUtil; private String loginPage; @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest servletRequest = (HttpServletRequest) req; HttpServletResponse servletResponse = (HttpServletResponse) resp; String url = servletRequest.getServletPath(); HttpSession session = servletRequest.getSession(false); User user = null; if (filteredPageUtil.urlOnFilteredList(url)) { if (session == null) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.SESSION_INVALID); return; } user = (User) session.getAttribute(AUTH_KEY); if (user == null) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.NOT_LOGGED_IN); return; } } if (filteredPageUtil.needAdminPrivileges(url) && !user.hasPrivilege(UserType.ADMIN)) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.NO_PRIVILIGE); return; } if (filteredPageUtil.needMemberPrivileges(url) && !user.hasPrivilege(UserType.MEMBER)) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.NO_PRIVILIGE); return; } chain.doFilter(req, resp); } @Override public void init(FilterConfig config) throws ServletException { this.filteredPageUtil = new FilteredPageUtil(config); this.loginPage = config.getServletContext().getInitParameter(LOGIN_PAGE_KEY); } @Override public void destroy() { } private void sendRedirect(HttpServletRequest req, HttpServletResponse resp, AuthErrorDescriptor descriptor) throws IOException, ServletException { logger.info("Forwarding to login page. It's restricted area."); // Saving last attempted page String facesUrl = req.getServletPath(); String queryString = req.getQueryString(); // Reconstruct original requesting URL if (queryString != null) { facesUrl += "?" + queryString; } String loginUrl = new UrlBuilder(req.getContextPath() + "/" + loginPage). addParameters("from", facesUrl). addParameters("cause", descriptor.name()). build(); resp.sendRedirect(loginUrl); } }
UTF-8
Java
3,389
java
AuthFilter.java
Java
[ { "context": "t need som privileges.\n * @version $Id$\n * @author pmendelski\n */\n@WebFilter(filterName = \"AuthFilter\", urlPatt", "end": 862, "score": 0.9995775818824768, "start": 852, "tag": "USERNAME", "value": "pmendelski" } ]
null
[]
package pl.poznan.jug.meetings.frontend.security; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pl.poznan.jug.meetings.frontend.security.AuthError.AuthErrorDescriptor; import pl.poznan.jug.meetings.frontend.utils.UrlBuilder; import pl.poznan.jug.meetings.shared.model.User; import pl.poznan.jug.meetings.shared.model.UserType; /** * Filters Request for pages that need som privileges. * @version $Id$ * @author pmendelski */ @WebFilter(filterName = "AuthFilter", urlPatterns = { "/*" }) public class AuthFilter implements Filter { /** * Session map key. Describes if user is logged in. */ public static final String AUTH_KEY = "authorizationKey"; private static final String LOGIN_PAGE_KEY = "auth-filter-login"; private final Logger logger = LoggerFactory.getLogger(getClass()); private FilteredPageUtil filteredPageUtil; private String loginPage; @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest servletRequest = (HttpServletRequest) req; HttpServletResponse servletResponse = (HttpServletResponse) resp; String url = servletRequest.getServletPath(); HttpSession session = servletRequest.getSession(false); User user = null; if (filteredPageUtil.urlOnFilteredList(url)) { if (session == null) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.SESSION_INVALID); return; } user = (User) session.getAttribute(AUTH_KEY); if (user == null) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.NOT_LOGGED_IN); return; } } if (filteredPageUtil.needAdminPrivileges(url) && !user.hasPrivilege(UserType.ADMIN)) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.NO_PRIVILIGE); return; } if (filteredPageUtil.needMemberPrivileges(url) && !user.hasPrivilege(UserType.MEMBER)) { sendRedirect(servletRequest, servletResponse, AuthErrorDescriptor.NO_PRIVILIGE); return; } chain.doFilter(req, resp); } @Override public void init(FilterConfig config) throws ServletException { this.filteredPageUtil = new FilteredPageUtil(config); this.loginPage = config.getServletContext().getInitParameter(LOGIN_PAGE_KEY); } @Override public void destroy() { } private void sendRedirect(HttpServletRequest req, HttpServletResponse resp, AuthErrorDescriptor descriptor) throws IOException, ServletException { logger.info("Forwarding to login page. It's restricted area."); // Saving last attempted page String facesUrl = req.getServletPath(); String queryString = req.getQueryString(); // Reconstruct original requesting URL if (queryString != null) { facesUrl += "?" + queryString; } String loginUrl = new UrlBuilder(req.getContextPath() + "/" + loginPage). addParameters("from", facesUrl). addParameters("cause", descriptor.name()). build(); resp.sendRedirect(loginUrl); } }
3,389
0.764827
0.764237
106
30.981133
27.469358
108
false
false
0
0
0
0
0
0
1.896226
false
false
4
b9c39975d622c0420930c50a13e2b8c54da15ffd
39,152,921,909,019
528ac42c6bde4e5f556aea0632f6ed0a22d6e2f4
/DocSources/src/main/java/org/medici/bia/domain/EpLink.java
4168809473dc6e41b90083965a48b3397b1e1a1f
[]
no_license
lallori/bia
https://github.com/lallori/bia
212946df613d2ca9fd33dfcb126f0c11b5230a36
2656eda3a1c203d3134bd98b7c79f5ca82e96f46
refs/heads/master
2021-01-17T13:17:01.681000
2017-08-28T08:18:05
2017-08-28T08:18:05
47,757,435
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * EpLink.java * * Developed by Medici Archive Project (2010-2012). * * This file is part of DocSources. * * DocSources is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * DocSources is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * As a special exception, if you link this library with other files to * produce an executable, this library does not by itself cause the * resulting executable to be covered by the GNU General Public License. * This exception does not however invalidate any other reasons why the * executable file might be covered by the GNU General Public License. */ package org.medici.bia.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.apache.commons.lang.ObjectUtils; import org.hibernate.envers.Audited; import org.hibernate.search.annotations.ContainedIn; import org.hibernate.search.annotations.DateBridge; import org.hibernate.search.annotations.DocumentId; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.FieldBridge; import org.hibernate.search.annotations.Index; import org.hibernate.search.annotations.Resolution; import org.hibernate.search.annotations.Store; import org.hibernate.search.bridge.builtin.BooleanBridge; /** * EpLink entity. * * @author Lorenzo Pasquinelli (<a href=mailto:l.pasquinelli@gmail.com>l.pasquinelli@gmail.com</a>) */ @Entity @Audited @Table ( name = "\"tblEpLink\"" ) public class EpLink implements Serializable{ /** * */ private static final long serialVersionUID = 6326212954483660974L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column (name="\"EPLINKID\"",length=10, nullable=false) @DocumentId private Integer epLinkId; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="\"ENTRYID\"") @ContainedIn private Document document; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="\"PERSONID\"") @ContainedIn private People person; @Column (name="\"PORTRAIT\"", length=1, columnDefinition="tinyint", nullable=false) @Field(index=Index.UN_TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) @FieldBridge(impl=BooleanBridge.class) private Boolean portrait; @Column (name="\"ASSIGNUNSURE\"", length=1, columnDefinition="tinyint", nullable=false) @Field(index=Index.UN_TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) @FieldBridge(impl=BooleanBridge.class) private Boolean assignUnsure; @Column (name="\"DOCROLE\"", length=50) @Field(index=Index.TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) private String docRole; @Column (name="\"DATECREATED\"") @Temporal(TemporalType.TIMESTAMP) @Field(index=Index.UN_TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) @DateBridge(resolution=Resolution.DAY) private Date dateCreated; /** * */ public EpLink(){ super(); } /** * * @param epLinkId */ public EpLink(Integer epLinkId) { super(); setEpLinkId(epLinkId); } /** * * @param epLinkId * @param entryId */ public EpLink(Integer epLinkId, Integer entryId) { super(); setEpLinkId(epLinkId); setDocument(new Document(entryId)); } /** * @return the epLinkId */ public Integer getEpLinkId() { return epLinkId; } /** * @param epLinkId the epLinkId to set */ public void setEpLinkId(Integer epLinkId) { this.epLinkId = epLinkId; } /** * @return the document */ public Document getDocument() { return document; } /** * @param document the document to set */ public void setDocument(Document document) { this.document = document; } /** * @return the people */ public People getPerson() { return person; } /** * @param person the people to set */ public void setPerson(People person) { this.person = person; } /** * @return the portrait */ public Boolean getPortrait() { return portrait; } /** * @param portrait the portrait to set */ public void setPortrait(Boolean portrait) { this.portrait = portrait; } /** * @return the dateCreated */ public Date getDateCreated() { return dateCreated; } /** * @param dateCreated the dateCreated to set */ public void setDateCreated(Date dateCreated) { this.dateCreated = dateCreated; } /** * @return the assignUnsure */ public Boolean getAssignUnsure() { return assignUnsure; } /** * @param assignUnsure the assignUnsure to set */ public void setAssignUnsure(Boolean assignUnsure) { this.assignUnsure = assignUnsure; } /** * @return the docRole */ public String getDocRole() { return docRole; } /** * @param docRole the docRole to set */ public void setDocRole(String docRole) { this.docRole = docRole; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getEpLinkId() == null) ? 0 : getEpLinkId().hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (! (obj instanceof EpLink)) { return false; } EpLink other = (EpLink) obj; if (getEpLinkId() == null) { if (other.getEpLinkId() != null) { return false; } } else if (!getEpLinkId().equals(other.getEpLinkId())) { return false; } return true; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder stringBuilder = new StringBuilder(""); if (!ObjectUtils.toString(getPerson()).equals("")) { stringBuilder.append(getPerson()); } if (getAssignUnsure()) { stringBuilder.append(" [unsure]"); } if (getPortrait()) { stringBuilder.append(" [portrait]"); } return stringBuilder.toString(); } }
UTF-8
Java
7,125
java
EpLink.java
Java
[ { "context": "nBridge;\r\n\r\n/**\r\n * EpLink entity.\r\n *\r\n * @author Lorenzo Pasquinelli (<a href=mailto:l.pasquinelli@gmail.com>l.pasquin", "end": 2332, "score": 0.9998804330825806, "start": 2313, "tag": "NAME", "value": "Lorenzo Pasquinelli" }, { "context": "*\r\n * @author L...
null
[]
/* * EpLink.java * * Developed by Medici Archive Project (2010-2012). * * This file is part of DocSources. * * DocSources is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * DocSources is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * As a special exception, if you link this library with other files to * produce an executable, this library does not by itself cause the * resulting executable to be covered by the GNU General Public License. * This exception does not however invalidate any other reasons why the * executable file might be covered by the GNU General Public License. */ package org.medici.bia.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.apache.commons.lang.ObjectUtils; import org.hibernate.envers.Audited; import org.hibernate.search.annotations.ContainedIn; import org.hibernate.search.annotations.DateBridge; import org.hibernate.search.annotations.DocumentId; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.FieldBridge; import org.hibernate.search.annotations.Index; import org.hibernate.search.annotations.Resolution; import org.hibernate.search.annotations.Store; import org.hibernate.search.bridge.builtin.BooleanBridge; /** * EpLink entity. * * @author <NAME> (<a href=mailto:<EMAIL>><EMAIL></a>) */ @Entity @Audited @Table ( name = "\"tblEpLink\"" ) public class EpLink implements Serializable{ /** * */ private static final long serialVersionUID = 6326212954483660974L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column (name="\"EPLINKID\"",length=10, nullable=false) @DocumentId private Integer epLinkId; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="\"ENTRYID\"") @ContainedIn private Document document; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="\"PERSONID\"") @ContainedIn private People person; @Column (name="\"PORTRAIT\"", length=1, columnDefinition="tinyint", nullable=false) @Field(index=Index.UN_TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) @FieldBridge(impl=BooleanBridge.class) private Boolean portrait; @Column (name="\"ASSIGNUNSURE\"", length=1, columnDefinition="tinyint", nullable=false) @Field(index=Index.UN_TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) @FieldBridge(impl=BooleanBridge.class) private Boolean assignUnsure; @Column (name="\"DOCROLE\"", length=50) @Field(index=Index.TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) private String docRole; @Column (name="\"DATECREATED\"") @Temporal(TemporalType.TIMESTAMP) @Field(index=Index.UN_TOKENIZED, store=Store.NO, indexNullAs=Field.DEFAULT_NULL_TOKEN) @DateBridge(resolution=Resolution.DAY) private Date dateCreated; /** * */ public EpLink(){ super(); } /** * * @param epLinkId */ public EpLink(Integer epLinkId) { super(); setEpLinkId(epLinkId); } /** * * @param epLinkId * @param entryId */ public EpLink(Integer epLinkId, Integer entryId) { super(); setEpLinkId(epLinkId); setDocument(new Document(entryId)); } /** * @return the epLinkId */ public Integer getEpLinkId() { return epLinkId; } /** * @param epLinkId the epLinkId to set */ public void setEpLinkId(Integer epLinkId) { this.epLinkId = epLinkId; } /** * @return the document */ public Document getDocument() { return document; } /** * @param document the document to set */ public void setDocument(Document document) { this.document = document; } /** * @return the people */ public People getPerson() { return person; } /** * @param person the people to set */ public void setPerson(People person) { this.person = person; } /** * @return the portrait */ public Boolean getPortrait() { return portrait; } /** * @param portrait the portrait to set */ public void setPortrait(Boolean portrait) { this.portrait = portrait; } /** * @return the dateCreated */ public Date getDateCreated() { return dateCreated; } /** * @param dateCreated the dateCreated to set */ public void setDateCreated(Date dateCreated) { this.dateCreated = dateCreated; } /** * @return the assignUnsure */ public Boolean getAssignUnsure() { return assignUnsure; } /** * @param assignUnsure the assignUnsure to set */ public void setAssignUnsure(Boolean assignUnsure) { this.assignUnsure = assignUnsure; } /** * @return the docRole */ public String getDocRole() { return docRole; } /** * @param docRole the docRole to set */ public void setDocRole(String docRole) { this.docRole = docRole; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getEpLinkId() == null) ? 0 : getEpLinkId().hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (! (obj instanceof EpLink)) { return false; } EpLink other = (EpLink) obj; if (getEpLinkId() == null) { if (other.getEpLinkId() != null) { return false; } } else if (!getEpLinkId().equals(other.getEpLinkId())) { return false; } return true; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder stringBuilder = new StringBuilder(""); if (!ObjectUtils.toString(getPerson()).equals("")) { stringBuilder.append(getPerson()); } if (getAssignUnsure()) { stringBuilder.append(" [unsure]"); } if (getPortrait()) { stringBuilder.append(" [portrait]"); } return stringBuilder.toString(); } }
7,080
0.68014
0.673263
288
22.739584
22.492241
99
false
false
0
0
0
0
0
0
1.315972
false
false
4
f6a7122627442f115770a90207cb18ce9299b1e9
26,319,559,638,123
1d73f6b0daf831493d8e8ae4a3197334ca6def48
/src/main/java/com/lifujian/webdemo/service/StudentService.java
e0e0a91a550d408460d9c6add9760c3740791ee5
[]
no_license
li-fujian/demo-web
https://github.com/li-fujian/demo-web
5f60a3916b6c946717b9a6e72ae4ec19cc5534a9
047fe7f5c85ffac16a6153bbf47b23fbd9783c43
refs/heads/master
2020-06-08T15:03:58.108000
2019-06-23T03:22:57
2019-06-23T03:22:57
193,248,266
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lifujian.webdemo.service; import com.lifujian.webdemo.model.Student; /** * @author itlfj * @time 2019/06/22 21:35 * @description StudentService */ public interface StudentService { Student getById(long id); }
UTF-8
Java
231
java
StudentService.java
Java
[ { "context": "om.lifujian.webdemo.model.Student;\n\n/**\n * @author itlfj\n * @time 2019/06/22 21:35\n * @description Student", "end": 103, "score": 0.9996137022972107, "start": 98, "tag": "USERNAME", "value": "itlfj" } ]
null
[]
package com.lifujian.webdemo.service; import com.lifujian.webdemo.model.Student; /** * @author itlfj * @time 2019/06/22 21:35 * @description StudentService */ public interface StudentService { Student getById(long id); }
231
0.731602
0.679654
14
15.5
15.435349
42
false
false
0
0
0
0
0
0
0.357143
false
false
2
fc4f42a39d0f449738d563182ec472705fe899e4
15,539,191,728,046
d8a8a53dd96b605f984725927da53c7784f5a73e
/src/main/java/com/hnu/softwarecollege/infocenter/controller/AccessController.java
33ee5b215e7ed95ef8e5d8af9326297a73149a3c
[]
no_license
zixuan-wang/information_center
https://github.com/zixuan-wang/information_center
6486d16747401ce57738bab70fe37d617bb3d561
09c010b62994dd01c8771faf235b26ff37b59164
refs/heads/master
2020-04-08T10:53:25.970000
2018-11-09T17:22:33
2018-11-09T17:22:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hnu.softwarecollege.infocenter.controller; import com.hnu.softwarecollege.infocenter.entity.vo.BaseResponseVo; import com.hnu.softwarecollege.infocenter.entity.vo.LoginForm; import com.hnu.softwarecollege.infocenter.service.UserService; import com.hnu.softwarecollege.infocenter.util.TokenUtil; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @RestController @RequestMapping("access") public class AccessController { @Resource UserService userService; /** * @Description: 生成跨域cookie * @Param: [name, value] * @return: javax.servlet.http.Cookie * @Author: yu * @Date: 2018/11/9 2:30 **/ private Cookie getCookie(String name,String value){ Cookie cookie = new Cookie(name,value); cookie.setHttpOnly(true); cookie.setPath("/"); return cookie; } /** * @Description: 用户登录 登录生成token,放于cookie中返回,生成上下文用户对象,filter使用该上下文验证用户 * @Param: [loginForm] * @return: com.hnu.softwarecollege.infocenter.entity.vo.BaseResponseVo * @Author: yu * @Date: 2018/11/7 **/ @PostMapping("login") @ResponseBody public BaseResponseVo login( @RequestBody @Valid LoginForm loginForm, HttpServletResponse response){ //will set userContext boolean isTrue = userService.verifyUser(loginForm); if(isTrue){ String token = TokenUtil.createToken(); response.addCookie(getCookie("token",token)); return BaseResponseVo.success("login success"); }else { return BaseResponseVo.fail("login fail"); } } }
UTF-8
Java
1,844
java
AccessController.java
Java
[ { "context": " @return: javax.servlet.http.Cookie\n * @Author: yu\n * @Date: 2018/11/9 2:30\n **/\n private C", "end": 753, "score": 0.8848562240600586, "start": 751, "tag": "USERNAME", "value": "yu" }, { "context": "nfocenter.entity.vo.BaseResponseVo \n * @Author: yu ...
null
[]
package com.hnu.softwarecollege.infocenter.controller; import com.hnu.softwarecollege.infocenter.entity.vo.BaseResponseVo; import com.hnu.softwarecollege.infocenter.entity.vo.LoginForm; import com.hnu.softwarecollege.infocenter.service.UserService; import com.hnu.softwarecollege.infocenter.util.TokenUtil; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @RestController @RequestMapping("access") public class AccessController { @Resource UserService userService; /** * @Description: 生成跨域cookie * @Param: [name, value] * @return: javax.servlet.http.Cookie * @Author: yu * @Date: 2018/11/9 2:30 **/ private Cookie getCookie(String name,String value){ Cookie cookie = new Cookie(name,value); cookie.setHttpOnly(true); cookie.setPath("/"); return cookie; } /** * @Description: 用户登录 登录生成token,放于cookie中返回,生成上下文用户对象,filter使用该上下文验证用户 * @Param: [loginForm] * @return: com.hnu.softwarecollege.infocenter.entity.vo.BaseResponseVo * @Author: yu * @Date: 2018/11/7 **/ @PostMapping("login") @ResponseBody public BaseResponseVo login( @RequestBody @Valid LoginForm loginForm, HttpServletResponse response){ //will set userContext boolean isTrue = userService.verifyUser(loginForm); if(isTrue){ String token = TokenUtil.createToken(); response.addCookie(getCookie("token",token)); return BaseResponseVo.success("login success"); }else { return BaseResponseVo.fail("login fail"); } } }
1,844
0.681767
0.67214
59
28.932203
21.609684
75
false
false
0
0
0
0
0
0
0.423729
false
false
2
da24df0c93cc8f9e2ff495c7d32b5e9da0ea6a0b
19,009,525,318,704
bf60f3ae9a03e93dd8678abfe187fbf3f1f73f25
/03-JPA-Introducao/src/br/com/fiap/teste/Teste.java
8308675096a7cabf6752566f4463d411aba06d09
[]
no_license
LaisPerini/Enterprise-Application-Development
https://github.com/LaisPerini/Enterprise-Application-Development
8b1db1786c1ad83cb6855d5dd587dbde2da0d590
d9e2715c4bfc5c9eeff2a21295e5f567d0943b2a
refs/heads/master
2020-04-22T22:10:13.470000
2019-02-21T15:00:47
2019-02-21T15:00:47
170,698,630
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.fiap.teste; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class Teste { public static void main ( String[]args) { //CRIAR PRIMEIRO GERENCIADOR DE ENTIDADES //PRIMEIRO CRIA A FABRICA EntityManagerFactory fabrica = Persistence.createEntityManagerFactory("CLIENTE_ORACLE"); //DEPOIS, A FABRICACAO CRIA A ENTITY MANAGER EntityManager em = fabrica.createEntityManager(); em.close(); fabrica.close(); } }
UTF-8
Java
552
java
Teste.java
Java
[]
null
[]
package br.com.fiap.teste; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class Teste { public static void main ( String[]args) { //CRIAR PRIMEIRO GERENCIADOR DE ENTIDADES //PRIMEIRO CRIA A FABRICA EntityManagerFactory fabrica = Persistence.createEntityManagerFactory("CLIENTE_ORACLE"); //DEPOIS, A FABRICACAO CRIA A ENTITY MANAGER EntityManager em = fabrica.createEntityManager(); em.close(); fabrica.close(); } }
552
0.731884
0.731884
29
18.034483
19.487366
61
false
false
0
0
0
0
0
0
1.586207
false
false
2
87363acdcf92b10228ad4f799aa78c7df78647d7
14,998,025,842,518
48658e7d268dc52f218262ba723e8f84e8c31875
/gateway-httpServer/src/test/java/com/hqyg/eway/netty/http/server/BigObjFactory.java
2a5c0e4e881751df8c2165a6f34a0261230fbe81
[]
no_license
jwcjlu/gateway-parent
https://github.com/jwcjlu/gateway-parent
7217fdba7fb543d660e041dce51babb5317df3e1
989873c84bb8d05da30d8aa44d4c6410c69941c3
refs/heads/master
2022-12-20T12:04:45.175000
2019-06-23T12:30:58
2019-06-23T12:30:58
147,084,899
0
0
null
false
2022-12-07T16:51:29
2018-09-02T12:54:41
2019-06-23T12:31:01
2022-12-07T16:51:28
1,554
0
0
17
JavaScript
false
false
package com.jwcjlu.gateway.netty.http.server; import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.PooledObjectFactory; import org.apache.commons.pool2.impl.DefaultPooledObject; import java.util.Random; public class BigObjFactory implements PooledObjectFactory<BigObj> { @Override public PooledObject<BigObj> makeObject() throws Exception { return new DefaultPooledObject<BigObj>(new BigObj()); } @Override public void destroyObject(PooledObject<BigObj> pooledObject) throws Exception { pooledObject.getObject().destroy(); } @Override public boolean validateObject(PooledObject<BigObj> pooledObject) { //默认是false,代表验证不通过,这里随机好了 return new Random().nextInt()%2==0; } @Override public void activateObject(PooledObject<BigObj> pooledObject) throws Exception { } @Override public void passivateObject(PooledObject<BigObj> pooledObject) throws Exception { } }
UTF-8
Java
1,037
java
BigObjFactory.java
Java
[]
null
[]
package com.jwcjlu.gateway.netty.http.server; import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.PooledObjectFactory; import org.apache.commons.pool2.impl.DefaultPooledObject; import java.util.Random; public class BigObjFactory implements PooledObjectFactory<BigObj> { @Override public PooledObject<BigObj> makeObject() throws Exception { return new DefaultPooledObject<BigObj>(new BigObj()); } @Override public void destroyObject(PooledObject<BigObj> pooledObject) throws Exception { pooledObject.getObject().destroy(); } @Override public boolean validateObject(PooledObject<BigObj> pooledObject) { //默认是false,代表验证不通过,这里随机好了 return new Random().nextInt()%2==0; } @Override public void activateObject(PooledObject<BigObj> pooledObject) throws Exception { } @Override public void passivateObject(PooledObject<BigObj> pooledObject) throws Exception { } }
1,037
0.717413
0.712438
38
25.447369
24.875158
70
false
false
0
0
0
0
0
0
0.263158
false
false
2
d09f75624cff207fe3613e036e3f018503b15286
4,681,514,392,523
0ae1e98f99eed0eee07a6459b33eca34983cf5f3
/app/src/main/java/com/jm/newvista/util/LanguageUtil.java
eb31fc1c77f13c0cf0368f0d87e2eab4ed7bee8e
[ "MIT" ]
permissive
RanjitPati/NewVista-for-Customer
https://github.com/RanjitPati/NewVista-for-Customer
6a228faee6313bdf49ca5232c060f94e0bd37268
3558d7b3d590dbc33527df88c1fd291d45d68dfb
refs/heads/master
2021-09-17T03:31:31.200000
2018-06-27T09:27:20
2018-06-27T09:27:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jm.newvista.util; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import java.util.Locale; public class LanguageUtil { private static final String PACKAGE_NAME = "com.jm.newvista"; private static final Context context = ApplicationUtil.context; public static final String ERROR_LABEL = ""; private static final String DEFAULT_COUNTRY = "US"; private static final String DEFAULT_LANGUAGE = "en"; public static String getStringByLocale(int stringId, String language, String country) { Resources resources = getApplicationResource(context.getApplicationContext().getPackageManager(), PACKAGE_NAME, new Locale(language, country)); if (resources == null) { return ERROR_LABEL; } else { try { return resources.getString(stringId); } catch (Exception e) { return ERROR_LABEL; } } } public static String[] getStringArrayByLocale(int stringId, String language, String country) { Resources resources = getApplicationResource(context.getApplicationContext().getPackageManager(), PACKAGE_NAME, new Locale(language, country)); if (resources == null) { return null; } else { try { return resources.getStringArray(stringId); } catch (Exception e) { return null; } } } public static String getStringToEnglish(int stringId) { return getStringByLocale(stringId, DEFAULT_LANGUAGE, DEFAULT_COUNTRY); } public static String[] getStringArrayToEnglish(int stringId) { return getStringArrayByLocale(stringId, DEFAULT_LANGUAGE, DEFAULT_COUNTRY); } private static Resources getApplicationResource(PackageManager pm, String pkgName, Locale l) { Resources resourceForApplication = null; try { resourceForApplication = pm.getResourcesForApplication(pkgName); updateResource(resourceForApplication, l); } catch (PackageManager.NameNotFoundException e) { } return resourceForApplication; } private static void updateResource(Resources resource, Locale l) { Configuration config = resource.getConfiguration(); config.locale = l; resource.updateConfiguration(config, null); } }
UTF-8
Java
2,501
java
LanguageUtil.java
Java
[]
null
[]
package com.jm.newvista.util; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import java.util.Locale; public class LanguageUtil { private static final String PACKAGE_NAME = "com.jm.newvista"; private static final Context context = ApplicationUtil.context; public static final String ERROR_LABEL = ""; private static final String DEFAULT_COUNTRY = "US"; private static final String DEFAULT_LANGUAGE = "en"; public static String getStringByLocale(int stringId, String language, String country) { Resources resources = getApplicationResource(context.getApplicationContext().getPackageManager(), PACKAGE_NAME, new Locale(language, country)); if (resources == null) { return ERROR_LABEL; } else { try { return resources.getString(stringId); } catch (Exception e) { return ERROR_LABEL; } } } public static String[] getStringArrayByLocale(int stringId, String language, String country) { Resources resources = getApplicationResource(context.getApplicationContext().getPackageManager(), PACKAGE_NAME, new Locale(language, country)); if (resources == null) { return null; } else { try { return resources.getStringArray(stringId); } catch (Exception e) { return null; } } } public static String getStringToEnglish(int stringId) { return getStringByLocale(stringId, DEFAULT_LANGUAGE, DEFAULT_COUNTRY); } public static String[] getStringArrayToEnglish(int stringId) { return getStringArrayByLocale(stringId, DEFAULT_LANGUAGE, DEFAULT_COUNTRY); } private static Resources getApplicationResource(PackageManager pm, String pkgName, Locale l) { Resources resourceForApplication = null; try { resourceForApplication = pm.getResourcesForApplication(pkgName); updateResource(resourceForApplication, l); } catch (PackageManager.NameNotFoundException e) { } return resourceForApplication; } private static void updateResource(Resources resource, Locale l) { Configuration config = resource.getConfiguration(); config.locale = l; resource.updateConfiguration(config, null); } }
2,501
0.660936
0.660936
69
35.246376
29.674273
105
false
false
0
0
0
0
0
0
0.681159
false
false
2
a28f7f9f508ff757448b40314186abe5e6af463f
214,748,385,089
47cd702356e47f7db6f39e41484b083ccab3aba4
/src/me/libraryaddict/IRC/IrcPrivateMessageEvent.java
d6e8f9898947c80105ab4ae7b34969658b73c338
[]
no_license
libraryaddict/IRC
https://github.com/libraryaddict/IRC
8319fc9650b1d47846b1a239b42d3ad4325da012
279bf94e6df323468e6f0d74d6e3e50d02d046f7
refs/heads/master
2021-01-25T10:15:48.833000
2012-11-30T06:03:52
2012-11-30T06:03:52
6,934,267
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.libraryaddict.IRC; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; public class IrcPrivateMessageEvent extends Event { private static final HandlerList handlers = new HandlerList(); private String nick; private String msg; private String botName; public IrcPrivateMessageEvent(String name, String message, String bName) { nick = name; msg = message; botName = bName; } public String getBot() { return botName; } public String getNick() { return nick; } public String getMessage() { return msg; } public HandlerList getHandlers() { return handlers; } public static HandlerList getHandlerList() { return handlers; } }
UTF-8
Java
728
java
IrcPrivateMessageEvent.java
Java
[ { "context": "g name, String message, String bName) {\n nick = name;\n msg = message;\n botName = bName;\n }\n \n ", "end": 383, "score": 0.7551758885383606, "start": 379, "tag": "USERNAME", "value": "name" } ]
null
[]
package me.libraryaddict.IRC; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; public class IrcPrivateMessageEvent extends Event { private static final HandlerList handlers = new HandlerList(); private String nick; private String msg; private String botName; public IrcPrivateMessageEvent(String name, String message, String bName) { nick = name; msg = message; botName = bName; } public String getBot() { return botName; } public String getNick() { return nick; } public String getMessage() { return msg; } public HandlerList getHandlers() { return handlers; } public static HandlerList getHandlerList() { return handlers; } }
728
0.695055
0.695055
38
18.157894
18.454105
76
false
false
0
0
0
0
0
0
0.447368
false
false
2
c7c3e94979b533c24f59c3755ea6a81bb19f3b66
1,297,080,177,022
53831c50a73a5d5812b96c280a16d585b5de0d19
/src/edu/wctc/camoshop/Product.java
9744ce67ab7e6d5e2f691f3d9ae0d6e53df00b6a
[]
no_license
ELigrow/CamoShopJSP
https://github.com/ELigrow/CamoShopJSP
55e38f1728d53613e7a642911c80cb6b9765ec41
d9ef9922b141bae528b6d34d55f6f345d7f56b4e
refs/heads/master
2020-04-22T19:48:02.468000
2019-02-14T03:18:53
2019-02-14T03:18:53
170,619,734
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.wctc.camoshop; public class Product { public Product(String name, String imgUrl, double price){}; }
UTF-8
Java
117
java
Product.java
Java
[]
null
[]
package edu.wctc.camoshop; public class Product { public Product(String name, String imgUrl, double price){}; }
117
0.735043
0.735043
5
22.4
22.896288
63
false
false
0
0
0
0
0
0
0.8
false
false
2
88054e0be0af67a88e3c796420eb08303812a008
7,636,451,884,564
54fb9644914cef6c6974590e0c3d5ab4bea61e21
/src/uke4/oppgaver/opg141.java
d6c25b65523c97ebb061c06155c977d56abb7a1a
[]
no_license
Falkendal/AlgDat2020
https://github.com/Falkendal/AlgDat2020
bb76ebd91935212f12fcc94f1d1a0134702757a9
194cd3f9c22383b43ddf4905f7b5cca854ae00fd
refs/heads/master
2023-01-01T07:40:37.116000
2020-10-18T14:28:46
2020-10-18T14:28:46
299,983,043
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uke4.oppgaver; import felles.Tabell; public class opg141 { public static void main(String[] args) { // 1.4.1 // Oppgave 1, 2 og 3. int[] intliste = {5,2,7,3,9,1,8,4,6}; double[] doubleliste = {5.7,3.14,7.12,3.9,6.5,7.1,7.11}; String[] stringliste = {"Sohil","Per","Thanh","Fatima","Kari","Jasmin"}; char[] charliste = "JASMIN".toCharArray(); Integer[] integerliste = {5,2,7,3,9,1,8,4,6}; // Oppgave 4 // Hvis a er mindre enn b, vil a.compareTo(b) returnere -1, hvis de er like, vil metodekallet returnere 0 og hvis a er større enn b, blir det 1. // Oppgave 5 /* - Metoden compareTo i class String virker slik: Hvis strengen s er forskjellig fra strengen t, s ikke utgjør første del av t og t ikke utgjør første del av s, så finnes det en første posisjon der s og t har forskjellige tegn. La f.eks. s = "Jasmin" og t = "Jason". Første posisjon der disse er forskjellige, er posisjon 3 siden tegnet m er forskjellig fra tegnet o. (Obs. første posisjon i en streng er 0). Metoden compareTo returnerer da differansen mellom ascii-verdiene til disse to tegnene. I dette tilfellet vil s.compareTo(t) returnere 'm' - 'o' = -2. - Hvis s og t er gitt slik som i oppgaveteksten, dvs. s = "A" og t = "B", vil s.compareTo(t) returnere verdien 'A' - 'B' = -1. - Problemet med Æ, Ø og Å er at de er plassert i feil innbyrdes rekkefølge i både UTF-8, Unicode og ISO-8859-1. Se Avsnitt 1.4.9. - Vi får et spesialtilfelle hvis s utgjør første del av t eller t første del av s. F.eks. s = "Karianne" og t = "Kari". Da vil s.compareTo(t) returnere differansen mellom de to strengenes lengder. I dette tilfellet blir det 8 - 4 = 4. Legg også merke til at s eller t eller begge, kan være tomme. Hvis f.eks. s = "" og t = "Petter", utgjør egentlig s første del av t. Dermed vil s.compareTo(t) returnere verdien 0 - 6 = -6. - Til slutt får vi at s.compareTo(t) vil returnere 0 hvis s og t har nøyaktig samme innhold. */ String a = "Æ", b = "Å"; System.out.println(a.compareTo(b)); // Oppgave 6 System.out.println(Boolean.compare(false, true)); // Kaller på funksjonene som ligger i klassen Tabell // Finner posisjonen til den største verdien i lista /* int ints = Tabell.maks(intliste); int doubles = Tabell.maks(doubleliste); int strings = Tabell.maks(stringliste); int chars = Tabell.maks(charliste); int Integers = maks(integerliste); System.out.println(intliste[ints] + " " + doubleliste[doubles] + " " + stringliste[strings] + " " + charliste[chars] + " " + integerliste[Integers]); */ } public static int maks(Integer[] a) // legges i class Tabell { int m = 0; // indeks til største verdi Integer maksverdi = a[0]; // største verdi for (int i = 1; i < a.length; i++) if (a[i].compareTo(maksverdi) > 0) { maksverdi = a[i]; // største verdi oppdateres m = i; // indeks til største verdi oppdaters } return m; // returnerer posisjonen til største verdi } }
UTF-8
Java
3,303
java
opg141.java
Java
[ { "context": "9,6.5,7.1,7.11};\n String[] stringliste = {\"Sohil\",\"Per\",\"Thanh\",\"Fatima\",\"Kari\",\"Jasmin\"};\n ", "end": 310, "score": 0.9996246099472046, "start": 305, "tag": "NAME", "value": "Sohil" }, { "context": "1,7.11};\n String[] stringliste = {\"...
null
[]
package uke4.oppgaver; import felles.Tabell; public class opg141 { public static void main(String[] args) { // 1.4.1 // Oppgave 1, 2 og 3. int[] intliste = {5,2,7,3,9,1,8,4,6}; double[] doubleliste = {5.7,3.14,7.12,3.9,6.5,7.1,7.11}; String[] stringliste = {"Sohil","Per","Thanh","Fatima","Kari","Jasmin"}; char[] charliste = "JASMIN".toCharArray(); Integer[] integerliste = {5,2,7,3,9,1,8,4,6}; // Oppgave 4 // Hvis a er mindre enn b, vil a.compareTo(b) returnere -1, hvis de er like, vil metodekallet returnere 0 og hvis a er større enn b, blir det 1. // Oppgave 5 /* - Metoden compareTo i class String virker slik: Hvis strengen s er forskjellig fra strengen t, s ikke utgjør første del av t og t ikke utgjør første del av s, så finnes det en første posisjon der s og t har forskjellige tegn. La f.eks. s = "Jasmin" og t = "Jason". Første posisjon der disse er forskjellige, er posisjon 3 siden tegnet m er forskjellig fra tegnet o. (Obs. første posisjon i en streng er 0). Metoden compareTo returnerer da differansen mellom ascii-verdiene til disse to tegnene. I dette tilfellet vil s.compareTo(t) returnere 'm' - 'o' = -2. - Hvis s og t er gitt slik som i oppgaveteksten, dvs. s = "A" og t = "B", vil s.compareTo(t) returnere verdien 'A' - 'B' = -1. - Problemet med Æ, Ø og Å er at de er plassert i feil innbyrdes rekkefølge i både UTF-8, Unicode og ISO-8859-1. Se Avsnitt 1.4.9. - Vi får et spesialtilfelle hvis s utgjør første del av t eller t første del av s. F.eks. s = "Karianne" og t = "Kari". Da vil s.compareTo(t) returnere differansen mellom de to strengenes lengder. I dette tilfellet blir det 8 - 4 = 4. Legg også merke til at s eller t eller begge, kan være tomme. Hvis f.eks. s = "" og t = "Petter", utgjør egentlig s første del av t. Dermed vil s.compareTo(t) returnere verdien 0 - 6 = -6. - Til slutt får vi at s.compareTo(t) vil returnere 0 hvis s og t har nøyaktig samme innhold. */ String a = "Æ", b = "Å"; System.out.println(a.compareTo(b)); // Oppgave 6 System.out.println(Boolean.compare(false, true)); // Kaller på funksjonene som ligger i klassen Tabell // Finner posisjonen til den største verdien i lista /* int ints = Tabell.maks(intliste); int doubles = Tabell.maks(doubleliste); int strings = Tabell.maks(stringliste); int chars = Tabell.maks(charliste); int Integers = maks(integerliste); System.out.println(intliste[ints] + " " + doubleliste[doubles] + " " + stringliste[strings] + " " + charliste[chars] + " " + integerliste[Integers]); */ } public static int maks(Integer[] a) // legges i class Tabell { int m = 0; // indeks til største verdi Integer maksverdi = a[0]; // største verdi for (int i = 1; i < a.length; i++) if (a[i].compareTo(maksverdi) > 0) { maksverdi = a[i]; // største verdi oppdateres m = i; // indeks til største verdi oppdaters } return m; // returnerer posisjonen til største verdi } }
3,303
0.612538
0.589602
62
51.741936
59.473209
242
false
false
0
0
0
0
0
0
1.064516
false
false
2
7265dff6cbba137557443d650a37da2e3d1b663e
7,730,941,164,074
34da8746469d862b6d5e08e594162256e9545c2a
/chapter_005_Pro/Generic/src/main/java/ru/nivanov/store/Store.java
35ce060f2370f1373bd940bf5499a04b0120b81a
[ "Apache-2.0" ]
permissive
Piterski72/Java-a-to-z
https://github.com/Piterski72/Java-a-to-z
a45c2a243e84c716ac8f2734344e2b92189070a5
69a553860892613e22c16509b49876ad226e3d0e
refs/heads/master
2021-01-24T08:56:32.119000
2018-06-14T03:14:09
2018-06-14T03:14:09
69,798,588
9
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.nivanov.store; /** * Created by Nikolay Ivanov on 29.04.2017. * @param <T> .. */ interface Store<T extends Base> { /** * Add object to collection. * @param object .. */ void add(T object); /** * Delete object from collection. * @param id .. */ void delete(String id); /** * Set new value in collection. * @param oldObject .. * @param newObject .. */ void update(T oldObject, T newObject); }
UTF-8
Java
485
java
Store.java
Java
[ { "context": "package ru.nivanov.store;\n\n/**\n * Created by Nikolay Ivanov on 29.04.2017.\n * @param <T> ..\n */\ninterface Sto", "end": 59, "score": 0.9998781681060791, "start": 45, "tag": "NAME", "value": "Nikolay Ivanov" } ]
null
[]
package ru.nivanov.store; /** * Created by <NAME> on 29.04.2017. * @param <T> .. */ interface Store<T extends Base> { /** * Add object to collection. * @param object .. */ void add(T object); /** * Delete object from collection. * @param id .. */ void delete(String id); /** * Set new value in collection. * @param oldObject .. * @param newObject .. */ void update(T oldObject, T newObject); }
477
0.542268
0.525773
28
16.285715
14.126614
43
false
false
0
0
0
0
0
0
0.178571
false
false
2
7d5b57240bdfed0e581acdb86c7892757129bc7e
25,202,868,134,389
722f8aeca200db849efa955dca6826e5ec908eab
/src/com/crowd/streetbuzzalgo/datasift/DataSift.java
60d3929ab07e7e63de50ad7ce0ae5761305fceab
[]
no_license
atrijitdasgupta/streetbuzz-investor
https://github.com/atrijitdasgupta/streetbuzz-investor
eada5931aa532e5f0235d20115d4cd24374fe34f
0fac3b9671181ea954dfd7e6bd64a32f114d45fc
refs/heads/master
2016-09-05T21:20:31.025000
2015-06-25T09:06:27
2015-06-25T09:06:27
38,039,398
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.crowd.streetbuzzalgo.datasift; import com.crowd.streetbuzzalgo.constants.SystemConstants; /** * @author Atrijit * */ public class DataSift implements SystemConstants{ /** * */ public DataSift() { // TODO Auto-generated constructor stub } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }
UTF-8
Java
391
java
DataSift.java
Java
[ { "context": "uzzalgo.constants.SystemConstants;\n\n/**\n * @author Atrijit\n *\n */\npublic class DataSift implements SystemCon", "end": 138, "score": 0.9737005829811096, "start": 131, "tag": "NAME", "value": "Atrijit" } ]
null
[]
/** * */ package com.crowd.streetbuzzalgo.datasift; import com.crowd.streetbuzzalgo.constants.SystemConstants; /** * @author Atrijit * */ public class DataSift implements SystemConstants{ /** * */ public DataSift() { // TODO Auto-generated constructor stub } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }
391
0.659847
0.659847
29
12.482759
17.37541
58
false
false
0
0
0
0
0
0
0.551724
false
false
2
42d520b4faea4c7a942f0358a19c0c476e78ec44
22,393,959,526,176
61db66a2208ded488445a5cec7ec16fc3bf1a5fa
/JAVA EE/projetsMaven/udev3-exemple-mvc/udev3-exemple-mvc/src/main/java/io/github/spoonless/mvc/modele/Civilite.java
b424c4be36298d5531fe3d5bb56c8342ae388a71
[]
no_license
Kenjaman/UDEV3
https://github.com/Kenjaman/UDEV3
d3bac1007e2e6ebf2c7c89d1e7f3f2f48771b088
a8c39820a1a14ea1da113abb5a81b57c38d9c01f
refs/heads/master
2022-03-12T15:43:16.849000
2022-02-13T18:30:16
2022-02-13T18:30:16
216,365,891
0
0
null
false
2022-02-13T18:30:16
2019-10-20T13:25:35
2022-02-13T18:24:57
2022-02-13T18:30:16
221,652
0
0
36
HTML
false
false
package io.github.spoonless.mvc.modele; public enum Civilite { Monsieur, Madame, Autre }
UTF-8
Java
96
java
Civilite.java
Java
[]
null
[]
package io.github.spoonless.mvc.modele; public enum Civilite { Monsieur, Madame, Autre }
96
0.729167
0.729167
9
9.666667
12.319813
39
false
false
0
0
0
0
0
0
0.777778
false
false
2
783732bf1aa5ea8c9b9388a5cb6d0ffc77f1f26a
14,233,521,666,952
3647a8c6b291facea592e26dc03ce2c32f1e55e2
/src/application/Event.java
f9e5b2fd2e0cfdcf0aa937d4b9cf6f0a2dc59fe7
[]
no_license
cftan925/CST232-Event-Driven-Simulation
https://github.com/cftan925/CST232-Event-Driven-Simulation
8218d15aeed1750449224082f3a8698453ad61f2
1b830edf8472c5b45f07edf1a27383f4910c4903
refs/heads/master
2023-06-08T02:35:07.620000
2021-06-27T11:49:46
2021-06-27T11:49:46
380,716,851
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package application; import java.io.IOException; import java.net.URL; import java.util.*; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.collections.ObservableList; import javafx.collections.FXCollections; import javafx.event.ActionEvent; public class Event implements Initializable{ public static LinkedList<Node.EventNode> eventList = new LinkedList<Node.EventNode>(); public static LinkedList<Node.MemoryNode> memoryList = new LinkedList<Node.MemoryNode>(); public static Node.EventNode eventPointer; public static int previousTime,timeInterval,totalRunJob; public static float totalProcessTime; @FXML public TableView<Node.Cell> eventTable; @FXML public ListView<Integer> waitingList; @FXML public ListView<String> memoryBlock; @FXML public TableColumn<Node.Cell,Integer> eventTime; @FXML public TableColumn<Node.Cell,Integer> jobNum; @FXML public TableColumn<Node.Cell,String> event; // @FXML public TableColumn<Node.Cell,Integer> jobSize; @FXML public TableColumn<Node.Cell,Integer> processTime; // @FXML public TextField throughput; @FXML public TextField avrQueueLength; @FXML public TextField maxQueLength; @FXML public TextField totalWaitingTime; @FXML public TextField avrWaitingTime; @FXML public TextField minWaitingTime; @FXML public TextField maxWaitingTime; @FXML public TextField totalFrag; @FXML public TextField avrFrag; @FXML public Label currentTime; public static ObservableList<Node.Cell> table = FXCollections.observableArrayList(); public static ObservableList<Integer> waiting = FXCollections.observableArrayList(); public static ObservableList<String> block = FXCollections.observableArrayList(); public Event() { for (Node.JobNode i : ReadFile.jobList) { Node.EventNode newEvent = new Node.EventNode(i, i.arrivalTime, "Running"); //Change the default event to running since most jobs can be run as it arrives if(!eventList.isEmpty()) eventList.getLast().next=newEvent; eventList.add(newEvent); } memoryList = CreateMemoryList(); eventPointer = eventList.getFirst(); } @Override public void initialize(URL arg0, ResourceBundle arg1) { eventTime.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("eventTime")); jobNum.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("jobNum")); event.setCellValueFactory(new PropertyValueFactory<Node.Cell, String>("event")); // jobSize.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("jobSize")); processTime.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("processTime")); // eventTable.setItems(table); waitingList.setItems(waiting); memoryBlock.setItems(block); } public static LinkedList<Node.MemoryNode> CreateMemoryList() { Node.MemoryNode newMemory; if (Main.partitionChoice==1) { for (int i=0; i<Main.memoryBlock; i++) { newMemory = new Node.MemoryNode(ReadFile.memoryList.get(i).memSize, 0); if (!memoryList.isEmpty()) { memoryList.getLast().next=newMemory; } memoryList.add(newMemory); block.add("Empty "+"| Memory Size: "+newMemory.memSize); } } else { newMemory = new Node.MemoryNode(Main.memoryBlock,0); block.add("Empty "+"| Memory Size: "+newMemory.memSize); memoryList.add(newMemory); } return memoryList; } public static void CreateDoneEvent(Node.JobNode doneJob) { int currentEvent; int doneTime=eventPointer.eventTime + doneJob.processTime; currentEvent = eventList.indexOf(eventPointer); Node.EventNode newDoneNode = new Node.EventNode(doneJob,doneTime,"Done"); totalProcessTime += doneJob.processTime; totalRunJob++; while(eventPointer.next != null && doneTime > eventPointer.next.eventTime) { eventPointer = eventPointer.next; } if(eventPointer.next != null){ newDoneNode.next = eventPointer.next; eventPointer.next = newDoneNode; eventList.add(eventList.indexOf(eventPointer)+1, newDoneNode); } else { eventList.getLast().next=newDoneNode; newDoneNode.next = null; eventList.add(newDoneNode); } eventPointer = eventList.get(currentEvent); } public void RunEvent() { /*while(eventPointer!=null) { if(eventPointer.eventTime != previousTime) { timeInterval = eventPointer.eventTime - previousTime; currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; if (!Waiting.waitingList.isEmpty()) { Waiting.UpdateWaitingTime(timeInterval); } Queue.UpdateQueueLength(timeInterval); } if(eventPointer.event=="Running") { if(!Allocation.Allocate(eventPointer.eventJob)) { eventPointer.event="Waiting"; Waiting.AddWaitingJob(eventPointer.eventJob); Queue.queueLength++; } Display(); table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); } else if(eventPointer.event=="Done"){ Deallocation.Deallocate(eventPointer.eventJob); Display(); //Display done job in eventTable table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); if(!Waiting.waitingList.isEmpty() && (eventPointer.next==null || eventPointer.eventTime!=eventPointer.next.eventTime || eventPointer.next.event!="Done")) { eventPointer.event="Dequeue"; Waiting.waitingPointer=Waiting.waitingList.getFirst(); continue; } } else //event is Dequeue { while(Waiting.waitingPointer!=null) { if(Allocation.Allocate(Waiting.waitingPointer)) { Queue.queueLength--; Display(); //Display dequeue job in eventTable table.add(new Node.Cell( eventPointer.eventTime, Waiting.waitingPointer.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); Waiting.DeleteWaitingJob(); continue; } else { //Check the next waiting job Waiting.waitingPointer=Waiting.waitingPointer.next; } } eventPointer=eventPointer.next; continue; } if(previousTime!=eventPointer.eventTime) { currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; } eventPointer=eventPointer.next; }*/ if(eventPointer != null){ if(eventPointer.eventTime != previousTime) { timeInterval = eventPointer.eventTime - previousTime; currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; if (!Waiting.waitingList.isEmpty()) { Waiting.UpdateWaitingTime(timeInterval); } Queue.UpdateQueueLength(timeInterval); } if(eventPointer.event=="Running") { if(!Allocation.Allocate(eventPointer.eventJob)) { eventPointer.event="Waiting"; Waiting.AddWaitingJob(eventPointer.eventJob); Queue.queueLength++; } Display(); table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); } else if(eventPointer.event=="Done"){ Deallocation.Deallocate(eventPointer.eventJob); Display(); //Display done job in eventTable table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); if(!Waiting.waitingList.isEmpty() && (eventPointer.next==null || eventPointer.eventTime!=eventPointer.next.eventTime || eventPointer.next.event!="Done")) { eventPointer.event="Dequeue"; Waiting.waitingPointer=Waiting.waitingList.getFirst(); return; } } else //event is Dequeue { while(Waiting.waitingPointer!=null) { if(Allocation.Allocate(Waiting.waitingPointer)) { Queue.queueLength--; Display(); //Display dequeue job in eventTable table.add(new Node.Cell( eventPointer.eventTime, Waiting.waitingPointer.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); Waiting.DeleteWaitingJob(); return; } else { //Check the next waiting job Waiting.waitingPointer=Waiting.waitingPointer.next; } } eventPointer=eventPointer.next; RunEvent(); return; } if(previousTime!=eventPointer.eventTime) { currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; } eventPointer=eventPointer.next; } else { currentTime.setText("DONE"); } } public void Display() { throughput.setText(Float.toString(totalProcessTime/previousTime)); minWaitingTime.setText(Integer.toString(Waiting.minWaitingTime)); maxWaitingTime.setText(Integer.toString(Waiting.maxWaitingTime)); totalWaitingTime.setText(Float.toString(Waiting.totalWaitingTime)); avrWaitingTime.setText(Float.toString(Waiting.totalWaitingTime/40)); maxQueLength.setText(Integer.toString(Queue.maxQueLength)); avrQueueLength.setText(Float.toString(Queue.AverageQueueLength())); totalFrag.setText(Float.toString(Allocation.totalFrag)); avrFrag.setText(Float.toString(Allocation.totalFrag/totalRunJob)); } public static void Return(ActionEvent event) { //Clear everything then go back to the main menu totalProcessTime=0; totalRunJob=0; previousTime=0; Allocation.totalFrag=0; Waiting.minWaitingTime=0; Waiting.maxWaitingTime=0; Waiting.totalWaitingTime=0; Waiting.waitingList.clear(); Queue.queueLength=0; Queue.maxQueLength=0; Queue.queue.clear(); eventList.clear(); memoryList.clear(); //Main.MainMenu } }
UTF-8
Java
9,998
java
Event.java
Java
[]
null
[]
package application; import java.io.IOException; import java.net.URL; import java.util.*; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.collections.ObservableList; import javafx.collections.FXCollections; import javafx.event.ActionEvent; public class Event implements Initializable{ public static LinkedList<Node.EventNode> eventList = new LinkedList<Node.EventNode>(); public static LinkedList<Node.MemoryNode> memoryList = new LinkedList<Node.MemoryNode>(); public static Node.EventNode eventPointer; public static int previousTime,timeInterval,totalRunJob; public static float totalProcessTime; @FXML public TableView<Node.Cell> eventTable; @FXML public ListView<Integer> waitingList; @FXML public ListView<String> memoryBlock; @FXML public TableColumn<Node.Cell,Integer> eventTime; @FXML public TableColumn<Node.Cell,Integer> jobNum; @FXML public TableColumn<Node.Cell,String> event; // @FXML public TableColumn<Node.Cell,Integer> jobSize; @FXML public TableColumn<Node.Cell,Integer> processTime; // @FXML public TextField throughput; @FXML public TextField avrQueueLength; @FXML public TextField maxQueLength; @FXML public TextField totalWaitingTime; @FXML public TextField avrWaitingTime; @FXML public TextField minWaitingTime; @FXML public TextField maxWaitingTime; @FXML public TextField totalFrag; @FXML public TextField avrFrag; @FXML public Label currentTime; public static ObservableList<Node.Cell> table = FXCollections.observableArrayList(); public static ObservableList<Integer> waiting = FXCollections.observableArrayList(); public static ObservableList<String> block = FXCollections.observableArrayList(); public Event() { for (Node.JobNode i : ReadFile.jobList) { Node.EventNode newEvent = new Node.EventNode(i, i.arrivalTime, "Running"); //Change the default event to running since most jobs can be run as it arrives if(!eventList.isEmpty()) eventList.getLast().next=newEvent; eventList.add(newEvent); } memoryList = CreateMemoryList(); eventPointer = eventList.getFirst(); } @Override public void initialize(URL arg0, ResourceBundle arg1) { eventTime.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("eventTime")); jobNum.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("jobNum")); event.setCellValueFactory(new PropertyValueFactory<Node.Cell, String>("event")); // jobSize.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("jobSize")); processTime.setCellValueFactory(new PropertyValueFactory<Node.Cell, Integer>("processTime")); // eventTable.setItems(table); waitingList.setItems(waiting); memoryBlock.setItems(block); } public static LinkedList<Node.MemoryNode> CreateMemoryList() { Node.MemoryNode newMemory; if (Main.partitionChoice==1) { for (int i=0; i<Main.memoryBlock; i++) { newMemory = new Node.MemoryNode(ReadFile.memoryList.get(i).memSize, 0); if (!memoryList.isEmpty()) { memoryList.getLast().next=newMemory; } memoryList.add(newMemory); block.add("Empty "+"| Memory Size: "+newMemory.memSize); } } else { newMemory = new Node.MemoryNode(Main.memoryBlock,0); block.add("Empty "+"| Memory Size: "+newMemory.memSize); memoryList.add(newMemory); } return memoryList; } public static void CreateDoneEvent(Node.JobNode doneJob) { int currentEvent; int doneTime=eventPointer.eventTime + doneJob.processTime; currentEvent = eventList.indexOf(eventPointer); Node.EventNode newDoneNode = new Node.EventNode(doneJob,doneTime,"Done"); totalProcessTime += doneJob.processTime; totalRunJob++; while(eventPointer.next != null && doneTime > eventPointer.next.eventTime) { eventPointer = eventPointer.next; } if(eventPointer.next != null){ newDoneNode.next = eventPointer.next; eventPointer.next = newDoneNode; eventList.add(eventList.indexOf(eventPointer)+1, newDoneNode); } else { eventList.getLast().next=newDoneNode; newDoneNode.next = null; eventList.add(newDoneNode); } eventPointer = eventList.get(currentEvent); } public void RunEvent() { /*while(eventPointer!=null) { if(eventPointer.eventTime != previousTime) { timeInterval = eventPointer.eventTime - previousTime; currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; if (!Waiting.waitingList.isEmpty()) { Waiting.UpdateWaitingTime(timeInterval); } Queue.UpdateQueueLength(timeInterval); } if(eventPointer.event=="Running") { if(!Allocation.Allocate(eventPointer.eventJob)) { eventPointer.event="Waiting"; Waiting.AddWaitingJob(eventPointer.eventJob); Queue.queueLength++; } Display(); table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); } else if(eventPointer.event=="Done"){ Deallocation.Deallocate(eventPointer.eventJob); Display(); //Display done job in eventTable table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); if(!Waiting.waitingList.isEmpty() && (eventPointer.next==null || eventPointer.eventTime!=eventPointer.next.eventTime || eventPointer.next.event!="Done")) { eventPointer.event="Dequeue"; Waiting.waitingPointer=Waiting.waitingList.getFirst(); continue; } } else //event is Dequeue { while(Waiting.waitingPointer!=null) { if(Allocation.Allocate(Waiting.waitingPointer)) { Queue.queueLength--; Display(); //Display dequeue job in eventTable table.add(new Node.Cell( eventPointer.eventTime, Waiting.waitingPointer.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); Waiting.DeleteWaitingJob(); continue; } else { //Check the next waiting job Waiting.waitingPointer=Waiting.waitingPointer.next; } } eventPointer=eventPointer.next; continue; } if(previousTime!=eventPointer.eventTime) { currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; } eventPointer=eventPointer.next; }*/ if(eventPointer != null){ if(eventPointer.eventTime != previousTime) { timeInterval = eventPointer.eventTime - previousTime; currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; if (!Waiting.waitingList.isEmpty()) { Waiting.UpdateWaitingTime(timeInterval); } Queue.UpdateQueueLength(timeInterval); } if(eventPointer.event=="Running") { if(!Allocation.Allocate(eventPointer.eventJob)) { eventPointer.event="Waiting"; Waiting.AddWaitingJob(eventPointer.eventJob); Queue.queueLength++; } Display(); table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); } else if(eventPointer.event=="Done"){ Deallocation.Deallocate(eventPointer.eventJob); Display(); //Display done job in eventTable table.add(new Node.Cell( eventPointer.eventTime, eventPointer.eventJob.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); if(!Waiting.waitingList.isEmpty() && (eventPointer.next==null || eventPointer.eventTime!=eventPointer.next.eventTime || eventPointer.next.event!="Done")) { eventPointer.event="Dequeue"; Waiting.waitingPointer=Waiting.waitingList.getFirst(); return; } } else //event is Dequeue { while(Waiting.waitingPointer!=null) { if(Allocation.Allocate(Waiting.waitingPointer)) { Queue.queueLength--; Display(); //Display dequeue job in eventTable table.add(new Node.Cell( eventPointer.eventTime, Waiting.waitingPointer.jobNum, eventPointer.event, eventPointer.eventJob.jobSize, eventPointer.eventJob.processTime)); Waiting.DeleteWaitingJob(); return; } else { //Check the next waiting job Waiting.waitingPointer=Waiting.waitingPointer.next; } } eventPointer=eventPointer.next; RunEvent(); return; } if(previousTime!=eventPointer.eventTime) { currentTime.setText("EVENT TIME "+eventPointer.eventTime); previousTime= eventPointer.eventTime; } eventPointer=eventPointer.next; } else { currentTime.setText("DONE"); } } public void Display() { throughput.setText(Float.toString(totalProcessTime/previousTime)); minWaitingTime.setText(Integer.toString(Waiting.minWaitingTime)); maxWaitingTime.setText(Integer.toString(Waiting.maxWaitingTime)); totalWaitingTime.setText(Float.toString(Waiting.totalWaitingTime)); avrWaitingTime.setText(Float.toString(Waiting.totalWaitingTime/40)); maxQueLength.setText(Integer.toString(Queue.maxQueLength)); avrQueueLength.setText(Float.toString(Queue.AverageQueueLength())); totalFrag.setText(Float.toString(Allocation.totalFrag)); avrFrag.setText(Float.toString(Allocation.totalFrag/totalRunJob)); } public static void Return(ActionEvent event) { //Clear everything then go back to the main menu totalProcessTime=0; totalRunJob=0; previousTime=0; Allocation.totalFrag=0; Waiting.minWaitingTime=0; Waiting.maxWaitingTime=0; Waiting.totalWaitingTime=0; Waiting.waitingList.clear(); Queue.queueLength=0; Queue.maxQueLength=0; Queue.queue.clear(); eventList.clear(); memoryList.clear(); //Main.MainMenu } }
9,998
0.724845
0.723045
306
31.67647
24.257805
157
false
false
0
0
0
0
0
0
3.816993
false
false
2
5b3b59e417cc040e26085f1913d6271ca67afefb
12,799,002,593,963
4465bfcb9e75e863158b6b01fe712b108dce0636
/week1/LogicalSequence2.java
fb921b6edb160a9a27bc713326b4e6786679abe2
[]
no_license
moldalieva26/neobis
https://github.com/moldalieva26/neobis
45b9f904ff4fdd8db19fd8a69ce96be9febf213b
9f19857ccc8da5bff1af14df0d9a16f0308cb736
refs/heads/master
2023-02-18T09:09:02.984000
2021-01-17T02:02:03
2021-01-17T02:02:03
296,193,095
0
1
null
false
2020-10-02T01:48:06
2020-09-17T02:03:23
2020-09-30T01:09:59
2020-10-02T01:48:05
55
0
1
0
Java
false
false
package neobistasks.week1; import java.text.ParseException; public class LogicalSequence2 { public static void main(String[] args) throws ParseException { LogicalSequence2.showSequence1ToY(3, 99); } public static void showSequence1ToY(long x, long y) { for (long i=1; i<= y; i++) { for(int n=0; n<x; n++) { System.out.print(i + " "); i++; } i--; System.out.println(); } } }
UTF-8
Java
417
java
LogicalSequence2.java
Java
[]
null
[]
package neobistasks.week1; import java.text.ParseException; public class LogicalSequence2 { public static void main(String[] args) throws ParseException { LogicalSequence2.showSequence1ToY(3, 99); } public static void showSequence1ToY(long x, long y) { for (long i=1; i<= y; i++) { for(int n=0; n<x; n++) { System.out.print(i + " "); i++; } i--; System.out.println(); } } }
417
0.625899
0.601918
23
17.130434
18.695045
64
false
false
0
0
0
0
0
0
2.130435
false
false
2
eb4ed5c127b83e1173fa9831978e0d8863ba6151
24,498,493,521,952
a96d5f1fcf42f9f69d5cbe22caffaed35d854f36
/cliente-web/src/br/com/cliente/servlets/buscaServlet.java
2d9dfff124d02b1f8ee25157372aa2e7ace8ad90
[]
no_license
duarteallan/CursoJavaWebZLN
https://github.com/duarteallan/CursoJavaWebZLN
8660d54f1bc6d9c218659800ef71951e9db4db24
d2b0d2dea9121d9a59d8bff4f91931bf723fba83
refs/heads/master
2021-05-07T02:31:27.060000
2017-11-13T18:30:25
2017-11-13T18:30:25
110,584,502
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.cliente.servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import br.com.cliente.dao.ClienteDao; import br.com.cliente.model.Cliente; public class buscaServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.write("<html><body>"); ClienteDao clienteDao = new ClienteDao(); List<Cliente> clientes = clienteDao.obterTodosClientes(); writer.write("<ul>"); for(int indice= 0; indice < clientes.size();indice++) { writer.write("<li>"); writer.write("Cliente: "+clientes.get(indice)); writer.write("</li>"); } writer.write("</ul>"); writer.write("</body></html>"); } }
UTF-8
Java
1,042
java
buscaServlet.java
Java
[]
null
[]
package br.com.cliente.servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import br.com.cliente.dao.ClienteDao; import br.com.cliente.model.Cliente; public class buscaServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.write("<html><body>"); ClienteDao clienteDao = new ClienteDao(); List<Cliente> clientes = clienteDao.obterTodosClientes(); writer.write("<ul>"); for(int indice= 0; indice < clientes.size();indice++) { writer.write("<li>"); writer.write("Cliente: "+clientes.get(indice)); writer.write("</li>"); } writer.write("</ul>"); writer.write("</body></html>"); } }
1,042
0.729367
0.727447
41
24.414635
24.303946
118
false
false
0
0
0
0
0
0
1.658537
false
false
2
63a14da1fcabc85e51d11d2cf00227501d83433e
13,331,578,555,597
6bf8c8c2e45ef72de548683dce39f934ace3e0ff
/app/src/main/java/com/wohuizhong/client/app/UiBase/PtrStaggerFragment.java
f401b04e33fc8e15c329cbb9635bc82ed6e891a0
[]
no_license
jzyu/WeplantPlayground
https://github.com/jzyu/WeplantPlayground
f7cfd0b72b657695ee9a2e59f1c36c1887cb5b92
65b41d416c9cd901d0d524cfb5dc9bdc55a8b9e4
refs/heads/master
2021-01-11T12:16:49.135000
2017-04-20T02:16:07
2017-04-20T02:16:07
76,512,265
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wohuizhong.client.app.UiBase; import android.support.v7.widget.StaggeredGridLayoutManager; import com.zhy.adapter.recyclerview.CommonAdapter; import com.zhy.adapter.recyclerview.MultiItemTypeAdapter; import com.zhy.adapter.recyclerview.base.ViewHolder; import java.util.List; public abstract class PtrStaggerFragment<T> extends PtrRecyclerViewFragment<T> implements PtrRecyclerViewFragment.RowConvert<T> { final protected ConfigBuilder<T> getBuilder(int rowLayoutId, List<T> items) { MultiItemTypeAdapter<T> adapter = new CommonAdapter<T>(getContext(), rowLayoutId, items) { @Override protected void convert(ViewHolder holder, T item, int position) { onRowConvert(holder, item, position); } }; StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager( 2, StaggeredGridLayoutManager.VERTICAL); layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); return new ConfigBuilder<T>() .items(items) .adapter(adapter) .layoutManager(layoutManager); } }
UTF-8
Java
1,182
java
PtrStaggerFragment.java
Java
[]
null
[]
package com.wohuizhong.client.app.UiBase; import android.support.v7.widget.StaggeredGridLayoutManager; import com.zhy.adapter.recyclerview.CommonAdapter; import com.zhy.adapter.recyclerview.MultiItemTypeAdapter; import com.zhy.adapter.recyclerview.base.ViewHolder; import java.util.List; public abstract class PtrStaggerFragment<T> extends PtrRecyclerViewFragment<T> implements PtrRecyclerViewFragment.RowConvert<T> { final protected ConfigBuilder<T> getBuilder(int rowLayoutId, List<T> items) { MultiItemTypeAdapter<T> adapter = new CommonAdapter<T>(getContext(), rowLayoutId, items) { @Override protected void convert(ViewHolder holder, T item, int position) { onRowConvert(holder, item, position); } }; StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager( 2, StaggeredGridLayoutManager.VERTICAL); layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); return new ConfigBuilder<T>() .items(items) .adapter(adapter) .layoutManager(layoutManager); } }
1,182
0.699662
0.69797
32
35.9375
29.405502
98
false
false
0
0
0
0
0
0
0.59375
false
false
2
d753ba112a30b2ca95159bd98e51fe66e5a531b1
16,630,113,440,042
9c8fd39d805ce63174776505fe16a90db06cc01b
/src/main/java/business_logic/ProductBLL.java
6eadda7654f1a89e240d21203db18a1519464060
[]
no_license
mariaandriesa18/pt-assig3
https://github.com/mariaandriesa18/pt-assig3
169b935a6c7d3333e964f5feb164c900f407d4e2
3f39f0ef81a61a2dfe9afce1e6f64f51d10a3f34
refs/heads/master
2022-12-20T01:29:41.808000
2020-09-08T21:43:49
2020-09-08T21:43:49
293,933,975
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package business_logic; import data_access.ProductDAO; import model.Product; public class ProductBLL { public String[] findByID(Integer id) { ProductDAO product=new ProductDAO(); return product.findById(id); } public int insertProduct(Product product) { ProductDAO ins = new ProductDAO(); /*for (Validator<Product> v : validators) { v.validate(product); }*/ return ins.insert(product).getId(); } public Product editProduct(Product product) { ProductDAO up = new ProductDAO(); //TODO validate edit return up.update(product); } public int deleteProduct(Product product) { ProductDAO del = new ProductDAO(); //TODO validate edit return del.delete(product).getId(); } /* * public List<Product> selectAllProducts(){ ProductDAO sel = new ProductDAO(); * return sel.findAll(); } */ public String[][] selectAll(){ ProductDAO s = new ProductDAO(); return s.selectAll(); } }
UTF-8
Java
922
java
ProductBLL.java
Java
[]
null
[]
package business_logic; import data_access.ProductDAO; import model.Product; public class ProductBLL { public String[] findByID(Integer id) { ProductDAO product=new ProductDAO(); return product.findById(id); } public int insertProduct(Product product) { ProductDAO ins = new ProductDAO(); /*for (Validator<Product> v : validators) { v.validate(product); }*/ return ins.insert(product).getId(); } public Product editProduct(Product product) { ProductDAO up = new ProductDAO(); //TODO validate edit return up.update(product); } public int deleteProduct(Product product) { ProductDAO del = new ProductDAO(); //TODO validate edit return del.delete(product).getId(); } /* * public List<Product> selectAllProducts(){ ProductDAO sel = new ProductDAO(); * return sel.findAll(); } */ public String[][] selectAll(){ ProductDAO s = new ProductDAO(); return s.selectAll(); } }
922
0.698482
0.698482
39
22.641026
18.343569
80
false
false
0
0
0
0
0
0
1.641026
false
false
2
b64e0026c28c798b8b17e78f73f6f6ac4fdcc4d7
893,353,197,827
cecfa89e2fb10969b268649de571712c5061bdc2
/src/main/java/optional/Matching.java
90ad365ef089bdd41a4c7edc5725f4c8b866a73e
[]
no_license
Nenma/ap-lab4
https://github.com/Nenma/ap-lab4
3f1325d62e85cf2a80180017d01292bfb99af33f
49fad18524c1ef11bab4ac626ec35037853736f1
refs/heads/master
2021-03-18T15:04:16.715000
2020-03-19T16:22:42
2020-03-19T16:22:42
247,079,879
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package optional; import java.util.LinkedHashSet; import java.util.Set; /** * Class simulating a set of (resident, hospital) pairs, so a set of Element */ public class Matching { private Set<Element> elements; public Matching() { elements = new LinkedHashSet<>(); } public Matching(Set<Element> pairs) { this.elements = pairs; } public void add(Element element) { elements.add(element); } public Set<Element> getElements() { return elements; } }
UTF-8
Java
522
java
Matching.java
Java
[]
null
[]
package optional; import java.util.LinkedHashSet; import java.util.Set; /** * Class simulating a set of (resident, hospital) pairs, so a set of Element */ public class Matching { private Set<Element> elements; public Matching() { elements = new LinkedHashSet<>(); } public Matching(Set<Element> pairs) { this.elements = pairs; } public void add(Element element) { elements.add(element); } public Set<Element> getElements() { return elements; } }
522
0.632184
0.632184
27
18.333334
18.686497
76
false
false
0
0
0
0
0
0
0.37037
false
false
2
0c5e31c104ead5fb93c646d4bf3f5bb212f61098
23,424,751,660,033
ab57e5ae3de63089ba3e88f06b0413ed8e6abe08
/cloud-infrastructure-model/src/main/java/com/twilio/interview/cloudinfrastructure/model/ResponseHandler.java
2e12784d47a91b87c563796afaa0cbd386ff8341
[]
no_license
harishyarlagaddas/twilio-coding-excercise
https://github.com/harishyarlagaddas/twilio-coding-excercise
43d97dff741839deb72dc5e21fb21e5489c51da3
9f798d34055424f024b1154eb4225b8bf93f19e6
refs/heads/master
2018-12-29T18:35:25.835000
2015-09-21T19:12:25
2015-09-21T19:12:25
42,887,644
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.twilio.interview.cloudinfrastructure.model; /** * * This is the response handler which is used to notify the async response for the api call * * @param <T> The type of object which will be returned to you onResponse method. */ public interface ResponseHandler<T> { /** * This call back function will be used to notify about the response when the * particular api completes its action. * * @param responseObject T object which is defined during its declaration */ public void onResponse(T responseObject); }
UTF-8
Java
542
java
ResponseHandler.java
Java
[]
null
[]
package com.twilio.interview.cloudinfrastructure.model; /** * * This is the response handler which is used to notify the async response for the api call * * @param <T> The type of object which will be returned to you onResponse method. */ public interface ResponseHandler<T> { /** * This call back function will be used to notify about the response when the * particular api completes its action. * * @param responseObject T object which is defined during its declaration */ public void onResponse(T responseObject); }
542
0.738007
0.738007
19
27.526316
32.318104
91
false
false
0
0
0
0
0
0
0.526316
false
false
2
9ac55e8aa4622f6043866abe5f4676d55d05f0e8
11,510,512,395,355
1ed0e7930d6027aa893e1ecd4c5bba79484b7c95
/keiji/source/java/com/vungle/publisher/a.java
06c2b916384c8ddc143650bc8919ee392a7b1cc0
[]
no_license
AnKoushinist/hikaru-bottakuri-slot
https://github.com/AnKoushinist/hikaru-bottakuri-slot
36f1821e355a76865057a81221ce2c6f873f04e5
7ed60c6d53086243002785538076478c82616802
refs/heads/master
2021-01-20T05:47:00.966000
2017-08-26T06:58:25
2017-08-26T06:58:25
101,468,394
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vungle.publisher; import android.content.Context; import android.content.Intent; import android.database.SQLException; import android.os.Bundle; import android.os.Parcelable; import com.tapjoy.TJAdUnitConstants.String; import com.vungle.log.Logger; import dagger.Lazy; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import javax.inject.Provider; import javax.inject.Singleton; import twitter4j.TwitterResponse; @Singleton /* compiled from: vungle */ public final class a extends qe { @Inject py a; @Inject Context b; @Inject pn c; @Inject ql d; @Inject Class e; @Inject Class f; @Inject public bt g; @Inject uq h; @Inject Lazy<b> i; @Inject public Lazy<a> j; @Inject Provider<c> k; @Inject yc l; @Inject pv m; @Inject com.vungle.publisher.hu.a n; @Inject com.vungle.publisher.jp.b o; @Inject q p; @Inject pp q; @Inject com.vungle.publisher.gm.a r; @Inject com.vungle.publisher.cj.b s; @Inject com.vungle.publisher.dx.b t; @Inject aff u; /* compiled from: vungle */ public class AnonymousClass2 implements Runnable { final /* synthetic */ p a; final /* synthetic */ a b; public AnonymousClass2(a aVar, p pVar) { this.b = aVar; this.a = pVar; } public final void run() { Throwable e; cj cjVar = null; Logger.d(Logger.AD_TAG, "AdManager.playAd()"); try { cj h_; Object obj; a aVar = this.b; p pVar = this.a; dn a = aVar.a(false); if (a != null) { h_ = a.h_(); } else { h_ = null; } cj a2 = aVar.a(h_ == null ? null : (String) h_.w(), pVar); if (a2 != null) { h_ = a2; } Logger.i(Logger.AD_TAG, "next ad " + (h_ == null ? null : h_.z())); if (h_ == null) { try { Logger.d(Logger.AD_TAG, "no ad to play"); this.b.d.a(new bl()); obj = null; } catch (Exception e2) { e = e2; cjVar = h_; try { this.b.r.a(Logger.AD_TAG, "error launching ad", e); this.b.d.a(new bp(cjVar, false)); } finally { this.b.l.c(); } } } else { ((b) this.b.i.get()).register(); Intent intent = new Intent(this.b.b, h_ instanceof jk ? this.b.e : this.b.f); intent.addFlags(805306368); Parcelable parcelable = this.a; Bundle bundle = new Bundle(); bundle.putParcelable("adConfig", parcelable); intent.putExtra("adConfig", bundle); intent.putExtra(FullScreenAdActivity.AD_ID_EXTRA_KEY, (String) h_.w()); intent.putExtra(FullScreenAdActivity.AD_TYPE_EXTRA_KEY, h_.f()); this.b.b.startActivity(intent); obj = 1; } if (obj == null) { this.b.l.c(); } } catch (Exception e3) { e = e3; this.b.r.a(Logger.AD_TAG, "error launching ad", e); this.b.d.a(new bp(cjVar, false)); } } } /* compiled from: vungle */ static /* synthetic */ class AnonymousClass4 { static final /* synthetic */ int[] a = new int[com.vungle.publisher.cj.c.values().length]; static { try { a[com.vungle.publisher.cj.c.aware.ordinal()] = 1; } catch (NoSuchFieldError e) { } try { a[com.vungle.publisher.cj.c.ready.ordinal()] = 2; } catch (NoSuchFieldError e2) { } try { a[com.vungle.publisher.cj.c.viewed.ordinal()] = 3; } catch (NoSuchFieldError e3) { } } } @Singleton /* compiled from: vungle */ public static class a extends qe { @Inject a a; @Inject a() { } public final void onEvent(v vVar) { this.a.b(false); } } @Singleton /* compiled from: vungle */ static class b extends qe { final String a = Logger.PREPARE_TAG; @Inject a b; @Inject com.vungle.publisher.gm.a c; @Inject b() { } public final void onEvent(aq<cj> aqVar) { try { aqVar.a().b(com.vungle.publisher.cj.c.viewed); } catch (Throwable e) { this.c.a(Logger.PREPARE_TAG, "error processing start play ad event", e); } } public final void onEvent(ae aeVar) { Logger.d(Logger.PREPARE_TAG, "sent ad report - unregistering play ad listener"); unregister(); } public final void onEvent(bh bhVar) { Logger.d(Logger.PREPARE_TAG, "play ad failure - unregistering play ad listener"); unregister(); } } /* compiled from: vungle */ static class c extends qe { final String a = Logger.PREPARE_TAG; volatile boolean b; volatile hu c; final long d = System.currentTimeMillis(); @Inject com.vungle.publisher.hu.a e; @Inject c() { } final void a() { this.b = true; synchronized (this) { notifyAll(); } } public final void onEvent(af afVar) { unregister(); Logger.d(Logger.PREPARE_TAG, "request streaming ad failure after " + (afVar.e - this.d) + " ms"); a(); } public final void onEvent(ap apVar) { unregister(); long j = apVar.e - this.d; aea com_vungle_publisher_aea = (aea) apVar.a; if (Boolean.TRUE.equals(com_vungle_publisher_aea.k)) { Logger.d(Logger.PREPARE_TAG, "received streaming ad " + com_vungle_publisher_aea.f + " after " + j + " ms"); String str = com_vungle_publisher_aea.f; hu huVar = (hu) this.e.a((Object) str); if (huVar == null) { hu a = this.e.a(com_vungle_publisher_aea); this.c = a; Logger.d(Logger.PREPARE_TAG, "inserting new " + a.z()); try { a.q(); } catch (SQLException e) { Logger.d(Logger.PREPARE_TAG, "did not insert streaming ad - possible duplicate"); } } else { try { this.e.a((jk) huVar, (aed) com_vungle_publisher_aea); } catch (Throwable e2) { Logger.w(Logger.PREPARE_TAG, "error updating ad " + str, e2); } com.vungle.publisher.cj.c g = huVar.g(); switch (AnonymousClass4.a[g.ordinal()]) { case TwitterResponse.READ /*1*/: Logger.w(Logger.PREPARE_TAG, "unexpected ad status " + g + " for " + huVar.z()); break; case TwitterResponse.READ_WRITE /*2*/: case TwitterResponse.READ_WRITE_DIRECTMESSAGES /*3*/: break; default: Logger.w(Logger.PREPARE_TAG, "existing " + huVar.z() + " with status " + g + " - ignoring"); break; } Logger.d(Logger.PREPARE_TAG, "existing " + huVar.z() + " with status " + g); if (g != com.vungle.publisher.cj.c.ready) { huVar.b(com.vungle.publisher.cj.c.ready); } this.c = huVar; } } else { Logger.d(Logger.PREPARE_TAG, "no streaming ad to play after " + j + " ms"); } a(); } } @Inject a() { } public final boolean a() { if (!this.q.d.get() && this.q.a()) { if (this.t.b() != null) { return true; } } return false; } private void a(ahp<dn<?>> com_vungle_publisher_ahp_com_vungle_publisher_dn_) { if (this.a.o.compareAndSet(false, true)) { ahq anonymousClass1 = new ahq<dn<?>>(this) { final /* synthetic */ a a; { this.a = r1; } public final /* synthetic */ void a(Object obj) { Logger.d(Logger.PREPARE_TAG, "ad observable onNext"); this.a.d.a(new ag()); } public final void a() { Logger.d(Logger.PREPARE_TAG, "ad observable onComplete"); this.a.a.a(); this.a.b(false); } public final void a(Throwable th) { Logger.d(Logger.PREPARE_TAG, "ad observable onError"); this.a.a.a(); this.a.b(false); } }; if (anonymousClass1 instanceof ahu) { ahp.a((ahu) anonymousClass1, (ahp) com_vungle_publisher_ahp_com_vungle_publisher_dn_); } else { ahp.a(new ajy(anonymousClass1), (ahp) com_vungle_publisher_ahp_com_vungle_publisher_dn_); } } } final dn<?> a(boolean z) { if (this.c.o()) { dn<?> a; if (z) { a = this.t.a(com.vungle.publisher.cj.c.ready, com.vungle.publisher.cj.c.preparing); } else { a = this.t.b(); } if (a == null) { Logger.d(Logger.PREPARE_TAG, "no local ad available"); aff com_vungle_publisher_aff = this.u; ahp a2 = ahp.a(new aip(new aih<ahp<zq>>(com_vungle_publisher_aff) { final /* synthetic */ aff a; { this.a = r1; } public final /* synthetic */ Object call() { long max = Math.max(0, this.a.k.l.getLong("VgSleepWakeupTime", 0) - System.currentTimeMillis()); Logger.d(Logger.PREPARE_TAG, "request ad after sleep delay: " + max); return akc.a(this.a.b.d()).a(new aja(max, TimeUnit.MILLISECONDS, this.a.a)); } })); ahs c = alw.c(); if (a2 instanceof akc) { a2 = ((akc) a2).a(c); } else { a2 = ahp.a(new ajd(a2, c)); } a(ahp.a(new air(a2.a(com_vungle_publisher_aff.c).a(com_vungle_publisher_aff.e).a(com_vungle_publisher_aff.f).b(com_vungle_publisher_aff.g).a(com_vungle_publisher_aff.h), com_vungle_publisher_aff.i)).a(com_vungle_publisher_aff.j).a(com_vungle_publisher_aff.d).c(com_vungle_publisher_aff.l.a(100, "ad prep chain failure"))); return a; } com.vungle.publisher.cj.c g = a.g(); if (g != com.vungle.publisher.cj.c.preparing) { if (g == com.vungle.publisher.cj.c.ready) { Logger.v(Logger.PREPARE_TAG, "local ad already available for " + a.d()); } return a; } else if (z) { Logger.d(Logger.PREPARE_TAG, "local ad partially prepared, restarting preparation for " + a.d()); a(akc.a((Object) a).a(this.u.d)); return null; } else { Logger.i(Logger.PREPARE_TAG, "local ad partially prepared, but not restarting preparation for " + a.d()); return null; } } Logger.w(Logger.PREPARE_TAG, "unable to fetch local ad - no external storage available"); return null; } final hu a(String str, p pVar) { Throwable th; hu huVar; Throwable th2; hu huVar2; hu huVar3 = null; boolean z = false; try { if (this.m.b) { un a = this.h.a(); z = this.m.c.contains(a); Logger.d(Logger.PREPARE_TAG, "ad streaming " + (z ? String.ENABLED : "disabled") + " for " + a + " connectivity"); } else { Logger.d(Logger.PREPARE_TAG, "ad streaming disabled"); } if (!z) { return null; } Logger.d(Logger.PREPARE_TAG, "requesting streaming ad"); c cVar = (c) this.k.get(); cVar.register(); this.l.a(str, pVar); long j = cVar.d; int i = this.m.d; Logger.d(Logger.CONFIG_TAG, "streaming response timeout config " + i + " ms"); long j2 = ((long) i) + j; synchronized (cVar) { while (!cVar.b) { try { long currentTimeMillis = j2 - System.currentTimeMillis(); if (currentTimeMillis > 0) { try { cVar.wait(currentTimeMillis); } catch (InterruptedException e) { } } } catch (Throwable th3) { th = th3; huVar = null; th2 = th; } } j2 = System.currentTimeMillis() - j; if (cVar.b) { huVar = cVar.c; if (huVar != null) { try { Logger.d(Logger.PREPARE_TAG, "request streaming ad success after " + j2 + " ms " + huVar.z()); huVar3 = huVar; } catch (Throwable th4) { th2 = th4; try { throw th2; } catch (Throwable e2) { th2 = e2; huVar2 = huVar; } } } else { huVar3 = huVar; } } else { Logger.d(Logger.PREPARE_TAG, "request streaming ad timeout after " + j2 + " ms"); cVar.a(); } try { return huVar3; } catch (Throwable th32) { th = th32; huVar = huVar3; th2 = th; throw th2; } } } catch (Throwable e22) { th = e22; huVar2 = null; th2 = th; this.r.a(Logger.PREPARE_TAG, "error getting streaming ad", th2); return huVar2; } } public final void b(boolean z) { a(z); this.g.a(com.vungle.publisher.bt.b.deleteExpiredAds); Long c = this.t.c(); if (c != null) { this.g.a(new Runnable(this) { final /* synthetic */ a a; { this.a = r1; } public final void run() { new com.vungle.publisher.dx.b.a(this.a.t) { final /* synthetic */ b a; { this.a = r2; } final int a(dx<?, ?, ?> dxVar) { return dxVar.a(); } }.a(); } }, com.vungle.publisher.bt.b.deleteExpiredAds, c.longValue() - System.currentTimeMillis()); } } public final void onEvent(qo qoVar) { b(false); } }
UTF-8
Java
16,534
java
a.java
Java
[]
null
[]
package com.vungle.publisher; import android.content.Context; import android.content.Intent; import android.database.SQLException; import android.os.Bundle; import android.os.Parcelable; import com.tapjoy.TJAdUnitConstants.String; import com.vungle.log.Logger; import dagger.Lazy; import java.util.concurrent.TimeUnit; import javax.inject.Inject; import javax.inject.Provider; import javax.inject.Singleton; import twitter4j.TwitterResponse; @Singleton /* compiled from: vungle */ public final class a extends qe { @Inject py a; @Inject Context b; @Inject pn c; @Inject ql d; @Inject Class e; @Inject Class f; @Inject public bt g; @Inject uq h; @Inject Lazy<b> i; @Inject public Lazy<a> j; @Inject Provider<c> k; @Inject yc l; @Inject pv m; @Inject com.vungle.publisher.hu.a n; @Inject com.vungle.publisher.jp.b o; @Inject q p; @Inject pp q; @Inject com.vungle.publisher.gm.a r; @Inject com.vungle.publisher.cj.b s; @Inject com.vungle.publisher.dx.b t; @Inject aff u; /* compiled from: vungle */ public class AnonymousClass2 implements Runnable { final /* synthetic */ p a; final /* synthetic */ a b; public AnonymousClass2(a aVar, p pVar) { this.b = aVar; this.a = pVar; } public final void run() { Throwable e; cj cjVar = null; Logger.d(Logger.AD_TAG, "AdManager.playAd()"); try { cj h_; Object obj; a aVar = this.b; p pVar = this.a; dn a = aVar.a(false); if (a != null) { h_ = a.h_(); } else { h_ = null; } cj a2 = aVar.a(h_ == null ? null : (String) h_.w(), pVar); if (a2 != null) { h_ = a2; } Logger.i(Logger.AD_TAG, "next ad " + (h_ == null ? null : h_.z())); if (h_ == null) { try { Logger.d(Logger.AD_TAG, "no ad to play"); this.b.d.a(new bl()); obj = null; } catch (Exception e2) { e = e2; cjVar = h_; try { this.b.r.a(Logger.AD_TAG, "error launching ad", e); this.b.d.a(new bp(cjVar, false)); } finally { this.b.l.c(); } } } else { ((b) this.b.i.get()).register(); Intent intent = new Intent(this.b.b, h_ instanceof jk ? this.b.e : this.b.f); intent.addFlags(805306368); Parcelable parcelable = this.a; Bundle bundle = new Bundle(); bundle.putParcelable("adConfig", parcelable); intent.putExtra("adConfig", bundle); intent.putExtra(FullScreenAdActivity.AD_ID_EXTRA_KEY, (String) h_.w()); intent.putExtra(FullScreenAdActivity.AD_TYPE_EXTRA_KEY, h_.f()); this.b.b.startActivity(intent); obj = 1; } if (obj == null) { this.b.l.c(); } } catch (Exception e3) { e = e3; this.b.r.a(Logger.AD_TAG, "error launching ad", e); this.b.d.a(new bp(cjVar, false)); } } } /* compiled from: vungle */ static /* synthetic */ class AnonymousClass4 { static final /* synthetic */ int[] a = new int[com.vungle.publisher.cj.c.values().length]; static { try { a[com.vungle.publisher.cj.c.aware.ordinal()] = 1; } catch (NoSuchFieldError e) { } try { a[com.vungle.publisher.cj.c.ready.ordinal()] = 2; } catch (NoSuchFieldError e2) { } try { a[com.vungle.publisher.cj.c.viewed.ordinal()] = 3; } catch (NoSuchFieldError e3) { } } } @Singleton /* compiled from: vungle */ public static class a extends qe { @Inject a a; @Inject a() { } public final void onEvent(v vVar) { this.a.b(false); } } @Singleton /* compiled from: vungle */ static class b extends qe { final String a = Logger.PREPARE_TAG; @Inject a b; @Inject com.vungle.publisher.gm.a c; @Inject b() { } public final void onEvent(aq<cj> aqVar) { try { aqVar.a().b(com.vungle.publisher.cj.c.viewed); } catch (Throwable e) { this.c.a(Logger.PREPARE_TAG, "error processing start play ad event", e); } } public final void onEvent(ae aeVar) { Logger.d(Logger.PREPARE_TAG, "sent ad report - unregistering play ad listener"); unregister(); } public final void onEvent(bh bhVar) { Logger.d(Logger.PREPARE_TAG, "play ad failure - unregistering play ad listener"); unregister(); } } /* compiled from: vungle */ static class c extends qe { final String a = Logger.PREPARE_TAG; volatile boolean b; volatile hu c; final long d = System.currentTimeMillis(); @Inject com.vungle.publisher.hu.a e; @Inject c() { } final void a() { this.b = true; synchronized (this) { notifyAll(); } } public final void onEvent(af afVar) { unregister(); Logger.d(Logger.PREPARE_TAG, "request streaming ad failure after " + (afVar.e - this.d) + " ms"); a(); } public final void onEvent(ap apVar) { unregister(); long j = apVar.e - this.d; aea com_vungle_publisher_aea = (aea) apVar.a; if (Boolean.TRUE.equals(com_vungle_publisher_aea.k)) { Logger.d(Logger.PREPARE_TAG, "received streaming ad " + com_vungle_publisher_aea.f + " after " + j + " ms"); String str = com_vungle_publisher_aea.f; hu huVar = (hu) this.e.a((Object) str); if (huVar == null) { hu a = this.e.a(com_vungle_publisher_aea); this.c = a; Logger.d(Logger.PREPARE_TAG, "inserting new " + a.z()); try { a.q(); } catch (SQLException e) { Logger.d(Logger.PREPARE_TAG, "did not insert streaming ad - possible duplicate"); } } else { try { this.e.a((jk) huVar, (aed) com_vungle_publisher_aea); } catch (Throwable e2) { Logger.w(Logger.PREPARE_TAG, "error updating ad " + str, e2); } com.vungle.publisher.cj.c g = huVar.g(); switch (AnonymousClass4.a[g.ordinal()]) { case TwitterResponse.READ /*1*/: Logger.w(Logger.PREPARE_TAG, "unexpected ad status " + g + " for " + huVar.z()); break; case TwitterResponse.READ_WRITE /*2*/: case TwitterResponse.READ_WRITE_DIRECTMESSAGES /*3*/: break; default: Logger.w(Logger.PREPARE_TAG, "existing " + huVar.z() + " with status " + g + " - ignoring"); break; } Logger.d(Logger.PREPARE_TAG, "existing " + huVar.z() + " with status " + g); if (g != com.vungle.publisher.cj.c.ready) { huVar.b(com.vungle.publisher.cj.c.ready); } this.c = huVar; } } else { Logger.d(Logger.PREPARE_TAG, "no streaming ad to play after " + j + " ms"); } a(); } } @Inject a() { } public final boolean a() { if (!this.q.d.get() && this.q.a()) { if (this.t.b() != null) { return true; } } return false; } private void a(ahp<dn<?>> com_vungle_publisher_ahp_com_vungle_publisher_dn_) { if (this.a.o.compareAndSet(false, true)) { ahq anonymousClass1 = new ahq<dn<?>>(this) { final /* synthetic */ a a; { this.a = r1; } public final /* synthetic */ void a(Object obj) { Logger.d(Logger.PREPARE_TAG, "ad observable onNext"); this.a.d.a(new ag()); } public final void a() { Logger.d(Logger.PREPARE_TAG, "ad observable onComplete"); this.a.a.a(); this.a.b(false); } public final void a(Throwable th) { Logger.d(Logger.PREPARE_TAG, "ad observable onError"); this.a.a.a(); this.a.b(false); } }; if (anonymousClass1 instanceof ahu) { ahp.a((ahu) anonymousClass1, (ahp) com_vungle_publisher_ahp_com_vungle_publisher_dn_); } else { ahp.a(new ajy(anonymousClass1), (ahp) com_vungle_publisher_ahp_com_vungle_publisher_dn_); } } } final dn<?> a(boolean z) { if (this.c.o()) { dn<?> a; if (z) { a = this.t.a(com.vungle.publisher.cj.c.ready, com.vungle.publisher.cj.c.preparing); } else { a = this.t.b(); } if (a == null) { Logger.d(Logger.PREPARE_TAG, "no local ad available"); aff com_vungle_publisher_aff = this.u; ahp a2 = ahp.a(new aip(new aih<ahp<zq>>(com_vungle_publisher_aff) { final /* synthetic */ aff a; { this.a = r1; } public final /* synthetic */ Object call() { long max = Math.max(0, this.a.k.l.getLong("VgSleepWakeupTime", 0) - System.currentTimeMillis()); Logger.d(Logger.PREPARE_TAG, "request ad after sleep delay: " + max); return akc.a(this.a.b.d()).a(new aja(max, TimeUnit.MILLISECONDS, this.a.a)); } })); ahs c = alw.c(); if (a2 instanceof akc) { a2 = ((akc) a2).a(c); } else { a2 = ahp.a(new ajd(a2, c)); } a(ahp.a(new air(a2.a(com_vungle_publisher_aff.c).a(com_vungle_publisher_aff.e).a(com_vungle_publisher_aff.f).b(com_vungle_publisher_aff.g).a(com_vungle_publisher_aff.h), com_vungle_publisher_aff.i)).a(com_vungle_publisher_aff.j).a(com_vungle_publisher_aff.d).c(com_vungle_publisher_aff.l.a(100, "ad prep chain failure"))); return a; } com.vungle.publisher.cj.c g = a.g(); if (g != com.vungle.publisher.cj.c.preparing) { if (g == com.vungle.publisher.cj.c.ready) { Logger.v(Logger.PREPARE_TAG, "local ad already available for " + a.d()); } return a; } else if (z) { Logger.d(Logger.PREPARE_TAG, "local ad partially prepared, restarting preparation for " + a.d()); a(akc.a((Object) a).a(this.u.d)); return null; } else { Logger.i(Logger.PREPARE_TAG, "local ad partially prepared, but not restarting preparation for " + a.d()); return null; } } Logger.w(Logger.PREPARE_TAG, "unable to fetch local ad - no external storage available"); return null; } final hu a(String str, p pVar) { Throwable th; hu huVar; Throwable th2; hu huVar2; hu huVar3 = null; boolean z = false; try { if (this.m.b) { un a = this.h.a(); z = this.m.c.contains(a); Logger.d(Logger.PREPARE_TAG, "ad streaming " + (z ? String.ENABLED : "disabled") + " for " + a + " connectivity"); } else { Logger.d(Logger.PREPARE_TAG, "ad streaming disabled"); } if (!z) { return null; } Logger.d(Logger.PREPARE_TAG, "requesting streaming ad"); c cVar = (c) this.k.get(); cVar.register(); this.l.a(str, pVar); long j = cVar.d; int i = this.m.d; Logger.d(Logger.CONFIG_TAG, "streaming response timeout config " + i + " ms"); long j2 = ((long) i) + j; synchronized (cVar) { while (!cVar.b) { try { long currentTimeMillis = j2 - System.currentTimeMillis(); if (currentTimeMillis > 0) { try { cVar.wait(currentTimeMillis); } catch (InterruptedException e) { } } } catch (Throwable th3) { th = th3; huVar = null; th2 = th; } } j2 = System.currentTimeMillis() - j; if (cVar.b) { huVar = cVar.c; if (huVar != null) { try { Logger.d(Logger.PREPARE_TAG, "request streaming ad success after " + j2 + " ms " + huVar.z()); huVar3 = huVar; } catch (Throwable th4) { th2 = th4; try { throw th2; } catch (Throwable e2) { th2 = e2; huVar2 = huVar; } } } else { huVar3 = huVar; } } else { Logger.d(Logger.PREPARE_TAG, "request streaming ad timeout after " + j2 + " ms"); cVar.a(); } try { return huVar3; } catch (Throwable th32) { th = th32; huVar = huVar3; th2 = th; throw th2; } } } catch (Throwable e22) { th = e22; huVar2 = null; th2 = th; this.r.a(Logger.PREPARE_TAG, "error getting streaming ad", th2); return huVar2; } } public final void b(boolean z) { a(z); this.g.a(com.vungle.publisher.bt.b.deleteExpiredAds); Long c = this.t.c(); if (c != null) { this.g.a(new Runnable(this) { final /* synthetic */ a a; { this.a = r1; } public final void run() { new com.vungle.publisher.dx.b.a(this.a.t) { final /* synthetic */ b a; { this.a = r2; } final int a(dx<?, ?, ?> dxVar) { return dxVar.a(); } }.a(); } }, com.vungle.publisher.bt.b.deleteExpiredAds, c.longValue() - System.currentTimeMillis()); } } public final void onEvent(qo qoVar) { b(false); } }
16,534
0.42718
0.421737
487
32.950718
29.21628
338
false
false
0
0
0
0
0
0
0.591376
false
false
2
6b593c4f909d76b8b32e69b78dad90851732b9e3
9,363,028,758,334
05ffb7ceaa525aac52793249e9fa18eaba936202
/src/main/java/us/ihmc/yoVariables/parameters/xml/Registry.java
fb2d29cab4047ff38a93af6163fc5521111433de
[]
no_license
ihmcrobotics/ihmc-yovariables
https://github.com/ihmcrobotics/ihmc-yovariables
96b94c89137cfd4c4c1c3ccfaddc9a0690d43d4c
4c57886cf239a4a2c3322b9671f66120c79a33b8
refs/heads/master
2023-09-02T02:17:50.354000
2022-09-08T21:42:45
2022-09-08T21:42:45
94,456,307
1
2
null
false
2019-06-18T21:16:04
2017-06-15T16:02:54
2019-04-17T22:40:39
2019-06-18T21:16:03
373
0
0
4
Java
false
false
/* * Copyright 2017 Florida Institute for Human and Machine Cognition (IHMC) * * 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 us.ihmc.yoVariables.parameters.xml; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import us.ihmc.yoVariables.parameters.XmlParameterReader; import us.ihmc.yoVariables.parameters.XmlParameterWriter; import us.ihmc.yoVariables.parameters.YoParameter; /** * This class represents a XML token used together with {@link XmlParameterReader} and * {@link XmlParameterWriter} to export and import {@link YoParameter} with their values to and from * XML files. * <p> * This XML token represents a registry which can have sub-registries and parameters. * </p> */ @XmlAccessorType(XmlAccessType.NONE) public class Registry { /** The name of this registry. */ @XmlAttribute private String name; /** The children of this registry. */ @XmlElement(name = "registry") private List<Registry> registries; /** The parameters in this registry. */ @XmlElement(name = "parameter") private List<Parameter> parameters; /** * Creates a new registry XML token which fields have to be initialized afterwards. */ public Registry() { } /** * Creates and initializes a new parameter XML token. * <p> * The children and parameters are initialized to an empty {@code ArrayList}. * </p> * * @param name the name of this registry. */ public Registry(String name) { this.name = name; registries = new ArrayList<>(); parameters = new ArrayList<>(); } /** * Returns the name of this registry. * * @return the name of this registry. */ public String getName() { return name; } /** * Sets the name of this registry. * * @param name the name of this registry. */ public void setName(String name) { this.name = name; } /** * Returns the children of this registry. * * @return the children. */ public List<Registry> getRegistries() { return registries; } /** * Sets the children of this registry. * * @param registries the children. */ public void setRegistries(List<Registry> registries) { this.registries = registries; } /** * Returns the parameters in this registry. * * @return this registry's parameters. */ public List<Parameter> getParameters() { return parameters; } /** * Sets the parameters in this registry. * * @param parameters this registry's parameters. */ public void setParameters(List<Parameter> parameters) { this.parameters = parameters; } }
UTF-8
Java
3,393
java
Registry.java
Java
[]
null
[]
/* * Copyright 2017 Florida Institute for Human and Machine Cognition (IHMC) * * 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 us.ihmc.yoVariables.parameters.xml; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import us.ihmc.yoVariables.parameters.XmlParameterReader; import us.ihmc.yoVariables.parameters.XmlParameterWriter; import us.ihmc.yoVariables.parameters.YoParameter; /** * This class represents a XML token used together with {@link XmlParameterReader} and * {@link XmlParameterWriter} to export and import {@link YoParameter} with their values to and from * XML files. * <p> * This XML token represents a registry which can have sub-registries and parameters. * </p> */ @XmlAccessorType(XmlAccessType.NONE) public class Registry { /** The name of this registry. */ @XmlAttribute private String name; /** The children of this registry. */ @XmlElement(name = "registry") private List<Registry> registries; /** The parameters in this registry. */ @XmlElement(name = "parameter") private List<Parameter> parameters; /** * Creates a new registry XML token which fields have to be initialized afterwards. */ public Registry() { } /** * Creates and initializes a new parameter XML token. * <p> * The children and parameters are initialized to an empty {@code ArrayList}. * </p> * * @param name the name of this registry. */ public Registry(String name) { this.name = name; registries = new ArrayList<>(); parameters = new ArrayList<>(); } /** * Returns the name of this registry. * * @return the name of this registry. */ public String getName() { return name; } /** * Sets the name of this registry. * * @param name the name of this registry. */ public void setName(String name) { this.name = name; } /** * Returns the children of this registry. * * @return the children. */ public List<Registry> getRegistries() { return registries; } /** * Sets the children of this registry. * * @param registries the children. */ public void setRegistries(List<Registry> registries) { this.registries = registries; } /** * Returns the parameters in this registry. * * @return this registry's parameters. */ public List<Parameter> getParameters() { return parameters; } /** * Sets the parameters in this registry. * * @param parameters this registry's parameters. */ public void setParameters(List<Parameter> parameters) { this.parameters = parameters; } }
3,393
0.67433
0.671972
134
24.320896
24.310369
100
false
false
0
0
0
0
0
0
0.201493
false
false
2
c2d0893b5fa4870695b54ea1b4f82c75d7468bd3
2,534,030,755,109
8fb71a7a0429a2c7cccacd8ecfe52f6399fcbbec
/app/src/main/java/be/appreciate/androidbasetool/database/ClientTable.java
1b5e2dac4f44d08dfb5a4f87940db35c58dd5ae3
[]
no_license
mesutismael/Android-base-project
https://github.com/mesutismael/Android-base-project
e5594892baa0b0ed495091344536829ef4f5298d
b6c661728a526cbe3393569af006aeb08fc64a7f
refs/heads/master
2021-01-12T10:41:35.481000
2017-03-21T12:14:12
2017-03-21T12:14:12
72,617,686
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package be.appreciate.androidbasetool.database; import android.database.sqlite.SQLiteDatabase; import java.util.HashMap; import java.util.Map; /** * Created by thijscoorevits on 5/10/16. */ public class ClientTable { public static final String TABLE_NAME = "client"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_CLIENT_ID = "client_id"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_STREET = "street"; public static final String COLUMN_ZIP_CODE = "zip_code"; public static final String COLUMN_CITY = "city"; public static final String COLUMN_ID_FULL = TABLE_NAME + "." + COLUMN_ID; public static final String COLUMN_CLIENT_ID_FULL = TABLE_NAME + "." + COLUMN_CLIENT_ID; public static final String COLUMN_NAME_FULL = TABLE_NAME + "." + COLUMN_NAME; public static final String COLUMN_STREET_FULL = TABLE_NAME + "." + COLUMN_STREET; public static final String COLUMN_ZIP_CODE_FULL = TABLE_NAME + "." + COLUMN_ZIP_CODE; public static final String COLUMN_CITY_FULL = TABLE_NAME + "." + COLUMN_CITY; public static final String COLUMN_ID_ALIAS = TABLE_NAME + "_" + COLUMN_ID; public static final String COLUMN_CLIENT_ID_ALIAS = TABLE_NAME + "_" + COLUMN_CLIENT_ID; public static final String COLUMN_NAME_ALIAS = TABLE_NAME + "_" + COLUMN_NAME; public static final String COLUMN_STREET_ALIAS = TABLE_NAME + "_" + COLUMN_STREET; public static final String COLUMN_ZIP_CODE_ALIAS = TABLE_NAME + "_" + COLUMN_ZIP_CODE; public static final String COLUMN_CITY_ALIAS = TABLE_NAME + "_" + COLUMN_CITY; public static final Map<String, String> PROJECTION_MAP; static { PROJECTION_MAP = new HashMap<>(); PROJECTION_MAP.put(COLUMN_ID_FULL, COLUMN_ID_FULL + " AS " + COLUMN_ID_ALIAS); PROJECTION_MAP.put(COLUMN_CLIENT_ID_FULL, COLUMN_CLIENT_ID_FULL + " AS " + COLUMN_CLIENT_ID_ALIAS); PROJECTION_MAP.put(COLUMN_NAME_FULL, COLUMN_NAME_FULL + " AS " + COLUMN_NAME_ALIAS); PROJECTION_MAP.put(COLUMN_STREET_FULL, COLUMN_STREET_FULL + " AS " + COLUMN_STREET_ALIAS); PROJECTION_MAP.put(COLUMN_ZIP_CODE_FULL, COLUMN_ZIP_CODE_FULL + " AS " + COLUMN_ZIP_CODE_ALIAS); PROJECTION_MAP.put(COLUMN_CITY_FULL, COLUMN_CITY_FULL + " AS " + COLUMN_CITY_ALIAS); } private static final String CREATE_TABLE = "create table IF NOT EXISTS " + TABLE_NAME + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_CLIENT_ID + " integer, " + COLUMN_NAME + " text, " + COLUMN_STREET + " text, " + COLUMN_ZIP_CODE + " text, " + COLUMN_CITY + " text" + ");"; public static void onCreate(SQLiteDatabase database) { database.execSQL(CREATE_TABLE); } public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { while (oldVersion < newVersion) { switch (oldVersion) { default: database.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(database); break; } oldVersion++; } } }
UTF-8
Java
3,268
java
ClientTable.java
Java
[ { "context": ".HashMap;\nimport java.util.Map;\n\n/**\n * Created by thijscoorevits on 5/10/16.\n */\n\npublic class ClientTable\n{\n p", "end": 178, "score": 0.9995896220207214, "start": 164, "tag": "USERNAME", "value": "thijscoorevits" } ]
null
[]
package be.appreciate.androidbasetool.database; import android.database.sqlite.SQLiteDatabase; import java.util.HashMap; import java.util.Map; /** * Created by thijscoorevits on 5/10/16. */ public class ClientTable { public static final String TABLE_NAME = "client"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_CLIENT_ID = "client_id"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_STREET = "street"; public static final String COLUMN_ZIP_CODE = "zip_code"; public static final String COLUMN_CITY = "city"; public static final String COLUMN_ID_FULL = TABLE_NAME + "." + COLUMN_ID; public static final String COLUMN_CLIENT_ID_FULL = TABLE_NAME + "." + COLUMN_CLIENT_ID; public static final String COLUMN_NAME_FULL = TABLE_NAME + "." + COLUMN_NAME; public static final String COLUMN_STREET_FULL = TABLE_NAME + "." + COLUMN_STREET; public static final String COLUMN_ZIP_CODE_FULL = TABLE_NAME + "." + COLUMN_ZIP_CODE; public static final String COLUMN_CITY_FULL = TABLE_NAME + "." + COLUMN_CITY; public static final String COLUMN_ID_ALIAS = TABLE_NAME + "_" + COLUMN_ID; public static final String COLUMN_CLIENT_ID_ALIAS = TABLE_NAME + "_" + COLUMN_CLIENT_ID; public static final String COLUMN_NAME_ALIAS = TABLE_NAME + "_" + COLUMN_NAME; public static final String COLUMN_STREET_ALIAS = TABLE_NAME + "_" + COLUMN_STREET; public static final String COLUMN_ZIP_CODE_ALIAS = TABLE_NAME + "_" + COLUMN_ZIP_CODE; public static final String COLUMN_CITY_ALIAS = TABLE_NAME + "_" + COLUMN_CITY; public static final Map<String, String> PROJECTION_MAP; static { PROJECTION_MAP = new HashMap<>(); PROJECTION_MAP.put(COLUMN_ID_FULL, COLUMN_ID_FULL + " AS " + COLUMN_ID_ALIAS); PROJECTION_MAP.put(COLUMN_CLIENT_ID_FULL, COLUMN_CLIENT_ID_FULL + " AS " + COLUMN_CLIENT_ID_ALIAS); PROJECTION_MAP.put(COLUMN_NAME_FULL, COLUMN_NAME_FULL + " AS " + COLUMN_NAME_ALIAS); PROJECTION_MAP.put(COLUMN_STREET_FULL, COLUMN_STREET_FULL + " AS " + COLUMN_STREET_ALIAS); PROJECTION_MAP.put(COLUMN_ZIP_CODE_FULL, COLUMN_ZIP_CODE_FULL + " AS " + COLUMN_ZIP_CODE_ALIAS); PROJECTION_MAP.put(COLUMN_CITY_FULL, COLUMN_CITY_FULL + " AS " + COLUMN_CITY_ALIAS); } private static final String CREATE_TABLE = "create table IF NOT EXISTS " + TABLE_NAME + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_CLIENT_ID + " integer, " + COLUMN_NAME + " text, " + COLUMN_STREET + " text, " + COLUMN_ZIP_CODE + " text, " + COLUMN_CITY + " text" + ");"; public static void onCreate(SQLiteDatabase database) { database.execSQL(CREATE_TABLE); } public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) { while (oldVersion < newVersion) { switch (oldVersion) { default: database.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(database); break; } oldVersion++; } } }
3,268
0.631885
0.630355
78
40.910255
34.323566
107
false
false
0
0
0
0
0
0
0.666667
false
false
2